summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-11-19 18:06:39 (GMT)
committer Daniel Silverstone <dsilvers@digital-scurf.org>2016-11-19 18:06:39 (GMT)
commite59d7422cc1ce3f4446bb520995017f1ebad19e4 (patch)
tree99d995bd2cd39e76dabe1acb07d541080461e34e
parent46d9b9509a2a5f8863189d880a6722bc3ec74344 (diff)
downloadlibdom-e59d7422cc1ce3f4446bb520995017f1ebad19e4.tar.gz
libdom-e59d7422cc1ce3f4446bb520995017f1ebad19e4.tar.bz2
Add getter/setter for event_target's is_trusted
-rw-r--r--include/dom/events/event.h8
-rw-r--r--src/events/event.c29
-rw-r--r--src/events/event.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
index 5bb0814..aba9655 100644
--- a/include/dom/events/event.h
+++ b/include/dom/events/event.h
@@ -105,4 +105,12 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result);
#define dom_event_is_initialised(e,r) _dom_event_is_initialised( \
(dom_event *) (e), (bool *) (r))
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result);
+#define dom_event_get_is_trusted(e,r) _dom_event_get_is_trusted( \
+ (dom_event *) (e), (bool *) (r))
+
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted);
+#define dom_event_set_is_trusted(e,t) _dom_event_set_is_trusted( \
+ (dom_event *) (e), (bool) (t))
+
#endif
diff --git a/src/events/event.c b/src/events/event.c
index 8a73a0d..028c2e1 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -57,6 +57,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
evt->is_initialised = false;
+ evt->is_trusted = false;
return DOM_NO_ERR;
}
@@ -367,3 +368,31 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
return DOM_NO_ERR;
}
+
+/**
+ * Return whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result)
+{
+ *result = evt->is_trusted;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param trusted Whether or not the event is to be trusted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted)
+{
+ evt->is_trusted = trusted;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 8d8cc0f..857f20a 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -49,6 +49,7 @@ struct dom_event {
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
bool is_initialised; /**< Whether this event is initialised */
+ bool is_trusted; /**< Whether this event is trusted */
};
/* Destructor */