Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/3db455408d1528c00d95702b0cb303d405342932
...commit
http://git.netsurf-browser.org/netsurf.git/commit/3db455408d1528c00d95702b0cb303d405342932
...tree
http://git.netsurf-browser.org/netsurf.git/tree/3db455408d1528c00d95702b0cb303d405342932
The branch, jmb/bm has been updated
via 3db455408d1528c00d95702b0cb303d405342932 (commit)
from fe95004d2a44100c2650694a37e2243d14323eb4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=3db455408d1528c00d95702b0cb303d405342932
commit 3db455408d1528c00d95702b0cb303d405342932
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
HTML: skeletal event processing
diff --git a/content/handlers/html/box/manager.c
b/content/handlers/html/box/manager.c
index 9fe5269d6..abcd5c5d8 100644
--- a/content/handlers/html/box/manager.c
+++ b/content/handlers/html/box/manager.c
@@ -11,6 +11,8 @@ struct box_manager
dom_event_listener *listener;
/* Whether we have been told that stylesheets are available */
+ // XXX: need an API for stylesheet change notifications
+ // On receipt, mark entire tree invalid (synthesise a subtree modified
event? -- not fired at DOM, for obvious reasons, but could be thrown at our
event handler)
bool have_styles;
/* Whether there is an outstanding callback pending */
bool callback_pending;
@@ -21,34 +23,92 @@ struct box_manager
};
static void
-box_manager_process_events(void *pw)
+box_manager_rebuild_boxes_for_children(box_manager *mgr, dom_node *parent)
{
- box_manager *mgr = pw;
-
- mgr->callback_pending = false;
+ (void) mgr;
+ (void) parent;
//XXX: implement
-
- /* Just release references for now */
- while (mgr->pending_queue_idx > 0) {
- mgr->pending_queue_idx--;
- dom_node_unref(mgr->pending_queue[mgr->pending_queue_idx]);
- }
-
- // 1. Eliminate nodes which are no longer in our document, or in a
detached tree (we expect to have received a corresponding event for their
parent)
- // 2. Eliminate duplicate nodes from the list
- // 3. Eliminate nodes which are descendants of other nodes in the list
- // 4. For every remaining node: (re)build the structural box tree
segment rooted at each of node's children
- // 5. For each modified box tree segment:
+ //
+ // 1. (re)build the structural box tree segment rooted at each of
parent's children.
+ // 2. For each modified box tree segment:
// a. find the immediate containing block(s) for the segment
// (there may be more than one if posititioned/out-of-flow
elements are in play)
// b. emit (a) "box tree modified" event(s) referencing the
containing block(s)
//
// The box tree must always be in normal form so it may be necessary to
insert (or remove?) elements between the segment root and its parent box
// Layout calculators will receive the "box tree modified" events and
deal with them
+}
- // XXX: need an API for stylesheet change notifications
- // On receipt, mark entire tree invalid (synthesise a subtree modified
event? -- not fired at DOM, for obvious reasons, but could be thrown at our
event handler)
+static void
+box_manager_process_events(void *pw)
+{
+ box_manager *mgr = pw;
+ dom_exception exc;
+ size_t i, j;
+
+ mgr->callback_pending = false;
+
+ /* 1. Eliminate nodes which are no longer in our document, or in a
+ * detached tree (we expect to have received a corresponding event for
+ * their parent) */
+ for (i = mgr->pending_queue_idx; i > 0; i--) {
+ bool contains = false;
+ exc = dom_node_contains(mgr->doc, mgr->pending_queue[i-1],
+ &contains);
+ if (exc == DOM_NO_ERR && contains == false) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ continue;
+ }
+
+ /* 2. Eliminate duplicate nodes from the list */
+ for (j = mgr->pending_queue_idx; j > i + 1; j--) {
+ if (mgr->pending_queue[i-1] ==
+ mgr->pending_queue[j-1]) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ break;
+ }
+ }
+ }
+
+ /* 3. Eliminate nodes which are descendants of other nodes in the
+ * list */
+ for (i = mgr->pending_queue_idx; i > 0; i--) {
+ if (mgr->pending_queue[i-1] == NULL) {
+ continue;
+ }
+
+ for (j = mgr->pending_queue_idx; j > 0; j--) {
+ bool contains = false;
+ exc = dom_node_contains(mgr->pending_queue[j-1],
+ mgr->pending_queue[i-1], &contains);
+ if (exc == DOM_NO_ERR && contains == true) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ break;
+ }
+ }
+ }
+
+ /* 4. For every remaining node: (re)build the structural box tree
+ * segment rooted at each of node's children. We do this in receive
+ * order, though it should make no difference. */
+ for (i = 0; i < mgr->pending_queue_idx; i++) {
+ if (mgr->pending_queue[i] == NULL) {
+ continue;
+ }
+ box_manager_rebuild_boxes_for_children(mgr,
+ mgr->pending_queue[i]);
+
+ /* We're done with this node */
+ dom_node_unref(mgr->pending_queue[i]);
+ mgr->pending_queue[i] = NULL;
+ }
+
+ /* 5. All events processed. Clean up. */
+ mgr->pending_queue_idx = 0;
}
static void
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/box/manager.c | 96 ++++++++++++++++++++++++++++++-------
1 file changed, 78 insertions(+), 18 deletions(-)
diff --git a/content/handlers/html/box/manager.c
b/content/handlers/html/box/manager.c
index 9fe5269d6..abcd5c5d8 100644
--- a/content/handlers/html/box/manager.c
+++ b/content/handlers/html/box/manager.c
@@ -11,6 +11,8 @@ struct box_manager
dom_event_listener *listener;
/* Whether we have been told that stylesheets are available */
+ // XXX: need an API for stylesheet change notifications
+ // On receipt, mark entire tree invalid (synthesise a subtree modified
event? -- not fired at DOM, for obvious reasons, but could be thrown at our
event handler)
bool have_styles;
/* Whether there is an outstanding callback pending */
bool callback_pending;
@@ -21,34 +23,92 @@ struct box_manager
};
static void
-box_manager_process_events(void *pw)
+box_manager_rebuild_boxes_for_children(box_manager *mgr, dom_node *parent)
{
- box_manager *mgr = pw;
-
- mgr->callback_pending = false;
+ (void) mgr;
+ (void) parent;
//XXX: implement
-
- /* Just release references for now */
- while (mgr->pending_queue_idx > 0) {
- mgr->pending_queue_idx--;
- dom_node_unref(mgr->pending_queue[mgr->pending_queue_idx]);
- }
-
- // 1. Eliminate nodes which are no longer in our document, or in a
detached tree (we expect to have received a corresponding event for their
parent)
- // 2. Eliminate duplicate nodes from the list
- // 3. Eliminate nodes which are descendants of other nodes in the list
- // 4. For every remaining node: (re)build the structural box tree
segment rooted at each of node's children
- // 5. For each modified box tree segment:
+ //
+ // 1. (re)build the structural box tree segment rooted at each of
parent's children.
+ // 2. For each modified box tree segment:
// a. find the immediate containing block(s) for the segment
// (there may be more than one if posititioned/out-of-flow
elements are in play)
// b. emit (a) "box tree modified" event(s) referencing the
containing block(s)
//
// The box tree must always be in normal form so it may be necessary to
insert (or remove?) elements between the segment root and its parent box
// Layout calculators will receive the "box tree modified" events and
deal with them
+}
- // XXX: need an API for stylesheet change notifications
- // On receipt, mark entire tree invalid (synthesise a subtree modified
event? -- not fired at DOM, for obvious reasons, but could be thrown at our
event handler)
+static void
+box_manager_process_events(void *pw)
+{
+ box_manager *mgr = pw;
+ dom_exception exc;
+ size_t i, j;
+
+ mgr->callback_pending = false;
+
+ /* 1. Eliminate nodes which are no longer in our document, or in a
+ * detached tree (we expect to have received a corresponding event for
+ * their parent) */
+ for (i = mgr->pending_queue_idx; i > 0; i--) {
+ bool contains = false;
+ exc = dom_node_contains(mgr->doc, mgr->pending_queue[i-1],
+ &contains);
+ if (exc == DOM_NO_ERR && contains == false) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ continue;
+ }
+
+ /* 2. Eliminate duplicate nodes from the list */
+ for (j = mgr->pending_queue_idx; j > i + 1; j--) {
+ if (mgr->pending_queue[i-1] ==
+ mgr->pending_queue[j-1]) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ break;
+ }
+ }
+ }
+
+ /* 3. Eliminate nodes which are descendants of other nodes in the
+ * list */
+ for (i = mgr->pending_queue_idx; i > 0; i--) {
+ if (mgr->pending_queue[i-1] == NULL) {
+ continue;
+ }
+
+ for (j = mgr->pending_queue_idx; j > 0; j--) {
+ bool contains = false;
+ exc = dom_node_contains(mgr->pending_queue[j-1],
+ mgr->pending_queue[i-1], &contains);
+ if (exc == DOM_NO_ERR && contains == true) {
+ dom_node_unref(mgr->pending_queue[i-1]);
+ mgr->pending_queue[i-1] = NULL;
+ break;
+ }
+ }
+ }
+
+ /* 4. For every remaining node: (re)build the structural box tree
+ * segment rooted at each of node's children. We do this in receive
+ * order, though it should make no difference. */
+ for (i = 0; i < mgr->pending_queue_idx; i++) {
+ if (mgr->pending_queue[i] == NULL) {
+ continue;
+ }
+ box_manager_rebuild_boxes_for_children(mgr,
+ mgr->pending_queue[i]);
+
+ /* We're done with this node */
+ dom_node_unref(mgr->pending_queue[i]);
+ mgr->pending_queue[i] = NULL;
+ }
+
+ /* 5. All events processed. Clean up. */
+ mgr->pending_queue_idx = 0;
}
static void
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]