Layout: Add Debug Print for The Scroll Tree (#37522)

Add debug option `dump-scroll-tree` to print the scroll tree that had
been stored after each reflow, or log that the scoll tree is not
initialized yet..

To reduce the coupling, the debug print operation will process the
scroll tree node list that have been constructed in the stacking context
tree. It will generate a adjacency list and do preorder traversal. The
order of the tree then will depends on the order of the node in the node
list that has been constructed. Which, in turn, correspond to the
declaration order of the nodes.

This would help with the analysis and development of post composite
queries and its caching.

cc: @xiaochengh

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
This commit is contained in:
Steven Novaryo 2025-06-20 15:16:30 +08:00 committed by GitHub
parent d70f6ace24
commit b622157c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 119 additions and 0 deletions

View file

@ -110,6 +110,9 @@ pub struct DebugOptions {
/// Print the stacking context tree after each layout.
pub dump_stacking_context_tree: bool,
/// Print the scroll tree after each layout.
pub dump_scroll_tree: bool,
/// Print the display list after each layout.
pub dump_display_list: bool,
@ -156,6 +159,7 @@ impl DebugOptions {
"dump-flow-tree" => self.dump_flow_tree = true,
"dump-rule-tree" => self.dump_rule_tree = true,
"dump-style-tree" => self.dump_style_tree = true,
"dump-scroll-tree" => self.dump_scroll_tree = true,
"gc-profile" => self.gc_profile = true,
"profile-script-events" => self.profile_script_events = true,
"relayout-event" => self.relayout_event = true,