summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2024-01-07 17:42:38 +0000
committerJohn-Mark Bell <jmb@netsurf-browser.org>2024-01-07 17:42:38 +0000
commitca56cc948b8d9e5b51e129a0a60425d9c46cda1e (patch)
treec422c0ab0f1162c4a7f9837520b97d4d06d13732
parent824ad8857031685ab30b78fbc63a5a6eea0dc597 (diff)
downloadnetsurf-ca56cc948b8d9e5b51e129a0a60425d9c46cda1e.tar.gz
netsurf-ca56cc948b8d9e5b51e129a0a60425d9c46cda1e.tar.bz2
HTML: add event filtering diagnostic
-rw-r--r--content/handlers/html/box/manager.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/content/handlers/html/box/manager.c b/content/handlers/html/box/manager.c
index 6c3049329..2878ef8ee 100644
--- a/content/handlers/html/box/manager.c
+++ b/content/handlers/html/box/manager.c
@@ -4,6 +4,7 @@
#include "html/box/manager.h"
#include "netsurf/misc.h"
#include "utils/corestrings.h"
+#include "utils/log.h"
struct box_manager
{
@@ -46,6 +47,8 @@ box_manager_process_events(void *pw)
box_manager *mgr = pw;
dom_exception exc;
size_t i, j;
+ size_t orphaned_nodes = 0, duplicate_nodes = 0;
+ size_t descendant_nodes = 0, processed_events = 0;
mgr->callback_pending = false;
@@ -64,6 +67,7 @@ box_manager_process_events(void *pw)
if (exc == DOM_NO_ERR && contains == false) {
dom_node_unref(mgr->pending_queue[i-1]);
mgr->pending_queue[i-1] = NULL;
+ orphaned_nodes++;
continue;
}
@@ -77,6 +81,7 @@ box_manager_process_events(void *pw)
mgr->pending_queue[j-1]) {
dom_node_unref(mgr->pending_queue[i-1]);
mgr->pending_queue[i-1] = NULL;
+ duplicate_nodes++;
break;
}
}
@@ -101,6 +106,7 @@ box_manager_process_events(void *pw)
if (exc == DOM_NO_ERR && contains == true) {
dom_node_unref(mgr->pending_queue[i-1]);
mgr->pending_queue[i-1] = NULL;
+ descendant_nodes++;
break;
}
}
@@ -119,8 +125,17 @@ box_manager_process_events(void *pw)
/* We're done with this node */
dom_node_unref(mgr->pending_queue[i]);
mgr->pending_queue[i] = NULL;
+
+ processed_events++;
}
+ NSLOG(layout, DBG, "bm: received %zu raw events (%zu orphaned, "
+ "%zu duplicate, %zu descendant) => "
+ "processed %zu events",
+ mgr->pending_queue_idx, orphaned_nodes,
+ duplicate_nodes, descendant_nodes,
+ processed_events);
+
/* 5. All events processed. Clean up. */
mgr->pending_queue_idx = 0;
}