#include <stdbool.h>
#include <dom/core/exceptions.h>
#include <dom/core/string.h>
Go to the source code of this file.
◆ dom_document_event_can_dispatch
#define dom_document_event_can_dispatch |
( |
| d, |
|
|
| n, |
|
|
| t, |
|
|
| c ) |
Value:
(bool *) (c))
dom_exception _dom_document_event_can_dispatch(dom_document_event *de, dom_string *namespace, dom_string *type, bool *can)
Definition document_event.c:174
◆ dom_document_event_create_event
#define dom_document_event_create_event |
( |
| d, |
|
|
| t, |
|
|
| e ) |
Value:
dom_exception _dom_document_event_create_event(dom_document_event *de, dom_string *type, struct dom_event **evt)
Definition document_event.c:96
◆ dom_default_action_callback
typedef void(* dom_default_action_callback) (struct dom_event *evt, void *pw) |
The callback function which is used to process the default action of any event.
As dom_default_action_phase defines, we have three points in our implementation where these kinds of callbacks get invoked.
When the implementation start to dispatch certain event, it firstly invoke the following callback, which should process the event before the normal event flow.
Take a MousePressed event on a check box object as example:
- The 'pressed' event is generated by OS and catched by our UI code;
- The UI code dispatch the event to DOM;
- DOM trys to dispatch the event as what the spec said;
- Before the real event flow happens, DOM get the dom_default_action_callback function from the dom_events_default_action_fetcher with param DOM_DEFAULT_ACTION_STARTED, and then call it;
- The callback function invoke some System-denpendent API to make the checkbox checked and then return;
- Normal event flow goes on.
- When the implementation reach the end of the event flow, it check whether the event's default action is prevented, if it is, then go to step 8, else go to step 9.
- The event's default action get prevented, DOM get the dom_default_action_callback function from the dom_events_default_action_fetcher with param DOM_DEFAULT_ACTION_PREVENTED, and then call it.
- The event's default action does not get prevented, DOM get the dom_default_action_callback function from the dom_events_default_action_fetcher with param DOM_DEFAULT_ACTION_END, and then call it.
- Note
- : the point here is that we want the UI related stuff to be done within the default action code. The DOM only take care of the content tree and the event flow itself.
◆ dom_document_event
◆ dom_events_default_action_fetcher
The default action fetcher
- Parameters
-
type | The type of the event |
phase | The phase of the default action callback |
pw | The return private data of the callback function |
- Returns
- a callback function, NULL if there is none.
◆ dom_default_action_phase
The default action phase
- Note
- : we define the following three values to fetch three different types of dom_default_action_callback function and their private data.
Enumerator |
---|
DOM_DEFAULT_ACTION_STARTED | |
DOM_DEFAULT_ACTION_PREVENTED | |
DOM_DEFAULT_ACTION_END | |
DOM_DEFAULT_ACTION_FINISHED | |
◆ _dom_document_event_can_dispatch()
Tests if the implementation can generate events of a specified type
- Parameters
-
de | The DocumentEvent |
namespace | The namespace of the event |
type | The type of the event |
can | True if we can generate such an event, false otherwise |
- Returns
- DOM_NO_ERR on success, appropriate dom_exception on failure.
We don't support this API now, so the return value should always DOM_NO_SUPPORTED_ERR.
◆ _dom_document_event_create_event()
Create an Event object
- Parameters
-
de | The DocumentEvent object |
type | The Event type |
evt | The returned Event object |
- Returns
- DOM_NO_ERR on success, appropriate dom_exception on failure.