Truly independent web browser
LibWeb: Name display list dump nodes in the order the dump prints them
Aliaksandr Kalenikae7d24437ae8
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cppindex 16ad5aa1d8f..74dcc42e22e 100644--- a/Libraries/LibWeb/DOM/Document.cpp+++ b/Libraries/LibWeb/DOM/Document.cpp@@ -11750,7 +11750,7 @@ ElementByIdMap& Document::element_by_id() constreturn *m_element_by_id;}-Utf16String Document::dump_display_list()+Utf16String Document::dump_display_list(Painting::DisplayListDumpOptions const& options){Layout::ForcedReadScope read { *this };update_layout(UpdateLayoutReason::DumpDisplayList);@@ -11764,7 +11764,7 @@ Utf16String Document::dump_display_list()if (!record_display_list(read, HTML::PaintConfig { .records_whole_document = true }, Painting::PaintCommandCacheMode::ReadOnly))return "No display list"_utf16;- return Painting::serialize_painting_dump(read, *this);+ return Painting::serialize_painting_dump(read, *this, options);}Utf16String Document::dump_stacking_context_tree()diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.hindex 1b36e9b7558..27ecd9af068 100644--- a/Libraries/LibWeb/DOM/Document.h+++ b/Libraries/LibWeb/DOM/Document.h@@ -112,6 +112,12 @@ class ImageStyleValueResource;}+namespace Web::Painting {++struct DisplayListDumpOptions;++}+namespace Web::DOM {struct MutationObserverOptions;@@ -1821,7 +1827,7 @@ public:auto const& script_blocking_style_sheet_set() const { return m_script_blocking_style_sheet_set; }void remove_from_script_blocking_style_sheet_set(Element&);- Utf16String dump_display_list();+ Utf16String dump_display_list(Painting::DisplayListDumpOptions const&);Utf16String dump_stacking_context_tree();// https://www.w3.org/TR/css-properties-values-api-1/#dom-window-registeredpropertyset-slotdiff --git a/Libraries/LibWeb/Internals/Internals.cpp b/Libraries/LibWeb/Internals/Internals.cppindex 82275c61720..d978c49f526 100644--- a/Libraries/LibWeb/Internals/Internals.cpp+++ b/Libraries/LibWeb/Internals/Internals.cpp@@ -1919,9 +1919,11 @@ static Utf16String dump_string_to_utf16(String const& string)return Utf16String::from_utf8_without_validation(string.bytes_as_string_view());}-Utf16String Internals::dump_display_list()+Utf16String Internals::dump_display_list(Bindings::DisplayListDumpOptions const& options){- return window().associated_document().dump_display_list();+ return window().associated_document().dump_display_list({+ .raw_node_indices = options.raw_node_indices,+ });}Utf16String Internals::dump_accessibility_tree()diff --git a/Libraries/LibWeb/Internals/Internals.h b/Libraries/LibWeb/Internals/Internals.hindex f4748974dcd..3dbab12ddce 100644--- a/Libraries/LibWeb/Internals/Internals.h+++ b/Libraries/LibWeb/Internals/Internals.h@@ -228,7 +228,7 @@ public:bool needs_display_list_record();bool has_animation_frame_callbacks();- Utf16String dump_display_list();+ Utf16String dump_display_list(Bindings::DisplayListDumpOptions const&);Utf16String dump_accessibility_tree();String accessibility_character_offsets(GC::Ref<DOM::Node>);String dump_accessibility_node_data(GC::Ref<DOM::Node>);diff --git a/Libraries/LibWeb/Internals/Internals.idl b/Libraries/LibWeb/Internals/Internals.idlindex e4b1b6ff94e..7a8f38d9ec6 100644--- a/Libraries/LibWeb/Internals/Internals.idl+++ b/Libraries/LibWeb/Internals/Internals.idl@@ -249,7 +249,7 @@ interface Internals {readonly attribute boolean needsDisplayListRecord;readonly attribute boolean hasAnimationFrameCallbacks;- DOMString dumpDisplayList();+ DOMString dumpDisplayList(optional DisplayListDumpOptions options = {});DOMString dumpAccessibilityTree();// The per-character offsets that the accessibility tree reports for a text node, as space-separated "x,y" pairs.DOMString accessibilityCharacterOffsets(Node node);@@ -543,6 +543,10 @@ dictionary StyleRecordsDumpOptions {boolean groups = false;};+dictionary DisplayListDumpOptions {+ boolean rawNodeIndices = false;+};+dictionary LayoutTraceOptions {boolean treeBuilds = false;};diff --git a/Libraries/LibWeb/Painting/DisplayListDumpOptions.h b/Libraries/LibWeb/Painting/DisplayListDumpOptions.hnew file mode 100644index 00000000000..612eb0f95eb--- /dev/null+++ b/Libraries/LibWeb/Painting/DisplayListDumpOptions.h@@ -0,0 +1,15 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++namespace Web::Painting {++struct DisplayListDumpOptions {+ bool raw_node_indices { false };+};++}diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp b/Libraries/LibWeb/Painting/PaintingRustBridge.cppindex c51ae820464..40f36cb3036 100644--- a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp@@ -244,7 +244,7 @@ static void push_debug_description(DOM::Document const& document, Compositing::RLayout::RustFFI::layout_arena_paint_push_bytes(description_sink, bytes.data(), bytes.size());}-Utf16String serialize_painting_dump(Layout::BegunRead const& read, DOM::Document const& document)+Utf16String serialize_painting_dump(Layout::BegunRead const& read, DOM::Document const& document, DisplayListDumpOptions const& options){struct DumpContext {GC::Ref<DOM::Document const> document;@@ -257,7 +257,10 @@ Utf16String serialize_painting_dump(Layout::BegunRead const& read, DOM::Document.append_text = [](void* context_pointer, u8 const* bytes, size_t byte_count) { static_cast<DumpContext*>(context_pointer)->dump = Utf16String::from_utf8_without_validation(StringView { bytes, byte_count }); },};Gfx::IntRect device_viewport_rect { {}, document.page().css_to_device_rect(document.viewport_rect()).size().to_type<int>() };- Layout::RustFFI::painting_dump(document_host(document), &read, viewport_row_slot(read, document), device_viewport_rect, callbacks);+ Layout::RustFFI::FfiDisplayListDumpOptions ffi_options {+ .raw_node_indices = options.raw_node_indices,+ };+ Layout::RustFFI::painting_dump(document_host(document), &read, viewport_row_slot(read, document), device_viewport_rect, ffi_options, callbacks);return move(context.dump);}diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.h b/Libraries/LibWeb/Painting/PaintingRustBridge.hindex 19ebd0681ef..40978c7e6c1 100644--- a/Libraries/LibWeb/Painting/PaintingRustBridge.h+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.h@@ -13,6 +13,7 @@#include <LibWeb/Forward.h>#include <LibWeb/HTML/PaintConfig.h>#include <LibWeb/Layout/LayoutRustFFI.h>+#include <LibWeb/Painting/DisplayListDumpOptions.h>#include <LibWeb/Painting/DisplayListRecording.h>#include <LibWeb/Painting/DocumentPaintState.h>#include <LibWeb/Painting/FlexboxInspectorOverlay.h>@@ -72,7 +73,7 @@ WEB_API void publish_rust_display_list_recording(Layout::BegunRead const&, DOM::// Hands the document the trace the recording it took in last left, if it left one.WEB_API void take_recording_trace_if_pending(Layout::BegunRead const&, DOM::Document&);// Dumps the display list the document recorded last.-WEB_API Utf16String serialize_painting_dump(Layout::BegunRead const&, DOM::Document const&);+WEB_API Utf16String serialize_painting_dump(Layout::BegunRead const&, DOM::Document const&, DisplayListDumpOptions const&);WEB_API Layout::RustFFI::FfiVectorImageKey vector_image_key_to_ffi(VectorImageKey const&);// Has the compositor rasterize `paint` into `target` as `request` asks, which must be a shareable BGRA8888 bitmap withdiff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rsindex b74fdf113e9..d77080e65a4 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs@@ -33,6 +33,14 @@ use std::fmt::Write;crate::stage::main_thread_ffi_entries!();+/// What the display list dump prints besides what it always does.+#[derive(Clone, Copy)]+#[repr(C)]+pub struct FfiDisplayListDumpOptions {+ /// Names visual context nodes by their indices in the tree rather than by the order the dump first prints them in.+ pub raw_node_indices: bool,+}+/// What a display list dump asks the document. The fields are private: the callbacks are reached/// only through the methods below, which take the main thread token.///@@ -179,6 +187,7 @@ pub unsafe extern "C" fn painting_dump(read: &crate::render_state::BegunRead,viewport: NodeSlotId,device_viewport_rect: IntRect,+ options: FfiDisplayListDumpOptions,callbacks: FfiPaintingDumpCallbacks,) {// SAFETY: Guaranteed by the entry point's contract.@@ -211,7 +220,11 @@ pub unsafe extern "C" fn painting_dump(owners})};- let mut names = DumpNames::default();+ let mut names = if options.raw_node_indices {+ DumpNames::default()+ } else {+ DumpNames::numbering_nodes_in_print_order()+ };let mut output = visual_context_tree.dump_nodes_reachable_from_runs(command_runs, &mut names, |kind, index| {let owner = owners.owner(kind, index)?;Some(callbacks.debug_description(&main_thread, owner))diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump_format.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump_format.rsindex af6eb6faa87..2765e6cd4c7 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump_format.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump_format.rs@@ -26,12 +26,21 @@ use libgfx_rust::{use std::collections::HashMap;use std::fmt::Write;-/// Names the resources of a dump by the order it first prints them in, since their ids count up across the process.+/// Names the resources of a dump by the order it first prints them in, since their ids count up across the process,+/// and its visual context nodes either the same way, per kind, or by their indices in the tree.#[derive(Default)]pub(crate) struct DumpNames {resources: HashMap<(ResourceKind, u64), u32>,resource_counts: HashMap<ResourceKind, u32>,times_of_this_process: HashMap<i64, u32>,+ numbered_nodes: Option<[HashMap<u32, u32>; 3]>,+}++#[derive(Clone, Copy)]+enum NodeKind {+ Spatial,+ Clip,+ Effect,}fn resource_kind_name(kind: ResourceKind) -> &'static str {@@ -46,6 +55,22 @@ fn resource_kind_name(kind: ResourceKind) -> &'static str {}impl DumpNames {+ pub(crate) fn numbering_nodes_in_print_order() -> Self {+ Self {+ numbered_nodes: Some(Default::default()),+ ..Self::default()+ }+ }++ fn node_number(&mut self, kind: NodeKind, index: u32) -> u32 {+ let Some(numbered_nodes) = &mut self.numbered_nodes else {+ return index;+ };+ let numbers = &mut numbered_nodes[kind as usize];+ let next_number = numbers.len() as u32;+ *numbers.entry(index).or_insert(next_number)+ }+pub(crate) fn resource(&mut self, kind: ResourceKind, raw: u64) -> String {let count = self.resource_counts.entry(kind).or_default();let number = *self.resources.entry((kind, raw)).or_insert_with(|| {@@ -62,15 +87,15 @@ impl DumpNames {}pub(crate) fn spatial(&mut self, index: SpatialNodeIndex) -> String {- format!("s{}", index.0)+ format!("s{}", self.node_number(NodeKind::Spatial, index.0))}pub(crate) fn clip(&mut self, index: ClipNodeIndex) -> String {- format!("c{}", index.0)+ format!("c{}", self.node_number(NodeKind::Clip, index.0))}pub(crate) fn effect(&mut self, index: EffectNodeIndex) -> String {- format!("e{}", index.0)+ format!("e{}", self.node_number(NodeKind::Effect, index.0))}}diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/dump.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/dump.rsindex eb52d4347e7..9e48db23135 100644--- a/Libraries/LibWeb/Rust/src/painting/visual_context/dump.rs+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/dump.rs@@ -754,6 +754,7 @@ mod section_dump_tests {use super::{SlotKind, VisualContextTreeDump};use crate::layout::node_data::NodeSlotId;use crate::painting::display_list::commands::{ContextRef, DisplayListCommandRun, SpatialNodeIndex};+ use crate::painting::display_list::dump_format::DumpNames;use crate::painting::visual_context::{ClipData, ClipMode, ClipNodeData, ClipNodeIndex, EffectNodeData, EffectNodeIndex, EffectsData, ScrollData,SpatialData, TransformData, TransformDataRole, VISUAL_VIEWPORT_NODE_INDEX, VisualContextTree,@@ -844,7 +845,7 @@ mod section_dump_tests {run(scroll_node, escaping_context),run(VISUAL_VIEWPORT_NODE_INDEX, ContextRef::default()),];- let mut names = crate::painting::display_list::dump_format::DumpNames::default();+ let mut names = DumpNames::default();let text = tree.dump_nodes_reachable_from_runs(&runs, &mut names, |kind, index| match (kind, index) {(SlotKind::Spatial, 1) => Some("BlockContainer<DIV>#scroller".to_string()),(SlotKind::Clip, 0) => Some("BlockContainer<DIV>#scroller".to_string()),@@ -856,4 +857,55 @@ mod section_dump_tests {"AccumulatedVisualContext Tree:\n spatial:\n [s0] transform=[1,0,0,1,0,0] origin=(0,0)\n [s1] scroll (BlockContainer<DIV>#scroller)\n clips:\n [c0 in s1] clip=[1,2 3x4] (BlockContainer<DIV>#scroller)\n [c1 in s1] clip=[5,6 7x8]\n effects:\n [e0 in s1 out=c0] effects=[opacity=0.5] (BlockContainer<DIV>#faded)\n");}++ #[test]+ fn nodes_are_numbered_in_the_order_the_dump_first_prints_them() {+ let mut tree = VisualContextTree::create(TransformData {+ matrix: FloatMatrix4x4::identity(),+ origin: FloatPoint::default(),+ sorting_context_root_index: None,+ flattens_inherited_transform: false,+ role: TransformDataRole::CssTransform,+ synthetic_plane: false,+ establishes_sorting_context: false,+ bounds: FloatRect::default(),+ });+ let scroll_node = |tree: &mut VisualContextTree| {+ tree.append_spatial(+ SpatialData::Scroll(ScrollData {+ state_slot: NO_SCROLL_STATE_SLOT,+ owner_paintable: NodeSlotId::INVALID,+ }),+ VISUAL_VIEWPORT_NODE_INDEX,+ )+ };+ let _unreachable_scroll_node = scroll_node(&mut tree);+ let scroller = scroll_node(&mut tree);+ let _unreachable_clip = tree.append_clip(+ ClipNodeData::rect_clip(FloatRect::new(9.0, 9.0, 9.0, 9.0)),+ ClipNodeIndex::NONE,+ scroller,+ );+ let clip = tree.append_clip(+ ClipNodeData::rect_clip(FloatRect::new(1.0, 2.0, 3.0, 4.0)),+ ClipNodeIndex::NONE,+ scroller,+ );+ let runs = [run(+ scroller,+ ContextRef {+ clip,+ ..ContextRef::default()+ },+ )];+ let dump = |names: &mut DumpNames| tree.dump_nodes_reachable_from_runs(&runs, names, |_, _| None);+ assert_eq!(+ dump(&mut DumpNames::numbering_nodes_in_print_order()),+ "AccumulatedVisualContext Tree:\n spatial:\n [s0] transform=[1,0,0,1,0,0] origin=(0,0)\n [s1] scroll\n clips:\n [c0 in s1] clip=[1,2 3x4]\n"+ );+ assert_eq!(+ dump(&mut DumpNames::default()),+ "AccumulatedVisualContext Tree:\n spatial:\n [s0] transform=[1,0,0,1,0,0] origin=(0,0)\n [s2] scroll\n clips:\n [c1 in s2] clip=[1,2 3x4]\n"+ );+ }}diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cppindex 5ed892073a0..43bde67858a 100644--- a/Services/WebContent/ConnectionFromClient.cpp+++ b/Services/WebContent/ConnectionFromClient.cpp@@ -1250,7 +1250,7 @@ void ConnectionFromClient::debug_request(Web::PageId page_id, ByteString requestif (request == "dump-display-list") {if (auto doc = page->page().local_traversable()->active_document()) {- auto display_list_dump = doc->dump_display_list();+ auto display_list_dump = doc->dump_display_list({});dbgln("{}", display_list_dump.to_utf8());}return;@@ -2852,7 +2852,7 @@ static void append_display_list(Web::Page& page, StringBuilder& builder)return;}- builder.append(document->dump_display_list().to_utf8());+ builder.append(document->dump_display_list({}).to_utf8());}static void append_gc_graph(StringBuilder& builder)diff --git a/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt b/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txtindex b74da4323ee..5a9f11ba272 100644--- a/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt+++ b/Tests/LibWeb/Text/expected/display_list/clip-positioned-descendants.txt@@ -4,11 +4,11 @@ AccumulatedVisualContext Tree:[s1] scroll (Viewport<#document>)clips:[c0 in s1] clip_path=[bounds: 50,50 100x100, path: M50 50L150 50L150 150L50 150L50 50Z] (BlockContainer<DIV>.clip-path-ancestor)- [c3 in s0] clip=[220,0 100x100] (BlockContainer<DIV>.clip-ancestor)+ [c1 in s0] clip=[220,0 100x100] (BlockContainer<DIV>.clip-ancestor)effects:[e0 in s0] effects=[]DisplayList:FillRect@s1/c0/e0 rect=[0,0 200x200] color=rgb(255, 0, 0)-FillRect@s0/c3/e0 rect=[220,0 200x200] color=rgb(0, 128, 0)+FillRect@s0/c1/e0 rect=[220,0 200x200] color=rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt b/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txtindex 12973864505..279dcdc6312 100644--- a/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt+++ b/Tests/LibWeb/Text/expected/display_list/mixed-sibling-contexts.txt@@ -2,20 +2,20 @@ AccumulatedVisualContext Tree:spatial:[s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)[s1] scroll (Viewport<#document>)- [s3] scroll (BlockContainer<DIV>.clipped)- [s2] transform=[1,0,0,1,5,5] origin=(58,58) bounds=[8,8 100x100] (BlockContainer<DIV>.transformed)+ [s2] scroll (BlockContainer<DIV>.clipped)+ [s3] transform=[1,0,0,1,5,5] origin=(58,58) bounds=[8,8 100x100] (BlockContainer<DIV>.transformed)clips:[c0 in s1] clip=[119,9 100x100] (BlockContainer<DIV>.clipped)effects:[e0 in s0] effects=[]ScrollNodes:-ScrollNode scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[119,9 100x100] min_scroll_offset=[0,0] max_scroll_offset=[50,50] is_viewport=false+ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[119,9 100x100] min_scroll_offset=[0,0] max_scroll_offset=[50,50] is_viewport=falseDisplayList:FillRoundedRectRing@s1/e0 rect=[118,8 102x102] top_width=1 right_width=1 bottom_width=1 left_width=1 color=rgb(0, 0, 255)-FillRect@s3/c0/e0 rect=[119,9 150x150] color=rgb(173, 216, 230)-DrawGlyphRun@s3/c0/e0 font_id=font1 glyphs=7 rect=[119,9 55x16] glyph_bounding_rect=[119,10 60x15] translation=[119,22] color=rgb(0, 0, 0)-FillRect@s2/e0 rect=[8,8 100x100] color=rgb(255, 127, 80)-DrawGlyphRun@s2/e0 font_id=font1 glyphs=9 rect=[8,8 88x16] glyph_bounding_rect=[8,8 88x15] translation=[8,21] color=rgb(0, 0, 0)+FillRect@s2/c0/e0 rect=[119,9 150x150] color=rgb(173, 216, 230)+DrawGlyphRun@s2/c0/e0 font_id=font1 glyphs=7 rect=[119,9 55x16] glyph_bounding_rect=[119,10 60x15] translation=[119,22] color=rgb(0, 0, 0)+FillRect@s3/e0 rect=[8,8 100x100] color=rgb(255, 127, 80)+DrawGlyphRun@s3/e0 font_id=font1 glyphs=9 rect=[8,8 88x16] glyph_bounding_rect=[8,8 88x15] translation=[8,21] color=rgb(0, 0, 0)diff --git a/Tests/LibWeb/Text/expected/display_list/node-names-follow-print-order.txt b/Tests/LibWeb/Text/expected/display_list/node-names-follow-print-order.txtnew file mode 100644index 00000000000..e8d50247cbb--- /dev/null+++ b/Tests/LibWeb/Text/expected/display_list/node-names-follow-print-order.txt@@ -0,0 +1,10 @@+Named in print order:+ [s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)+ [s2] transform=[1,0,0,1,3,0] origin=(33,133) bounds=[8,108 50x50] (BlockContainer<DIV>)+ [c0 in s2] clip=[8,108 50x50] (BlockContainer<DIV>)+FillRect@s2/c0/e0 rect=[8,108 50x50] color=rgb(0, 128, 0)+Named by index:+ [s0] transform=[1,0,0,1,0,0] origin=(0,0) (Viewport<#document>)+ [s4] transform=[1,0,0,1,3,0] origin=(33,133) bounds=[8,108 50x50] (BlockContainer<DIV>)+ [c1 in s4] clip=[8,108 50x50] (BlockContainer<DIV>)+FillRect@s4/c1/e0 rect=[8,108 50x50] color=rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/input/async-scrolling/sticky-areas.html b/Tests/LibWeb/Text/input/async-scrolling/sticky-areas.htmlindex 18fe03b0d96..b620063b036 100644--- a/Tests/LibWeb/Text/input/async-scrolling/sticky-areas.html+++ b/Tests/LibWeb/Text/input/async-scrolling/sticky-areas.html@@ -28,7 +28,7 @@internals.recordDisplayListForTesting();const state = internals.recordedAsyncScrollingState();const viewportNode = state.scrollNodes.find(node => node.isViewport);- const displayList = internals.dumpDisplayList();+ const displayList = internals.dumpDisplayList({ rawNodeIndices: true });const stickyNodes = [...displayList.matchAll(/\[s(\d+)\] sticky scroller=s(\d+)(?: parent_sticky=s(\d+))?.*? insets=\[([^\]]*)\]/g)].map(match => ({index: Number(match[1]),diff --git a/Tests/LibWeb/Text/input/display_list/node-names-follow-print-order.html b/Tests/LibWeb/Text/input/display_list/node-names-follow-print-order.htmlnew file mode 100644index 00000000000..91d989be4c4--- /dev/null+++ b/Tests/LibWeb/Text/input/display_list/node-names-follow-print-order.html@@ -0,0 +1,23 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ div {+ width: 50px;+ height: 50px;+ }+ .painted {+ background: green;+ }+</style>+<div style="transform: translateX(1px)"></div>+<div style="transform: translateX(2px); overflow: hidden"><div></div></div>+<div style="transform: translateX(3px); overflow: hidden"><div class="painted"></div></div>+<script>+ test(() => {+ const nodeLines = dump => dump.split("\n").filter(line => line.includes("translate") || line.includes("transform=") || line.includes("clip=") || line.startsWith("FillRect"));+ println("Named in print order:");+ println(nodeLines(internals.dumpDisplayList()).join("\n"));+ println("Named by index:");+ println(nodeLines(internals.dumpDisplayList({ rawNodeIndices: true })).join("\n"));+ });+</script>