From ff3e454565c60c52b4b25d033d638c84e0b847be Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 7 Feb 2024 13:13:32 +0100 Subject: [PATCH] LibWeb: Invalidate paint-only property after relayout Before this change, `set_needs_to_resolve_paint_only_properties()` was only called after style invalidation. However, since relayout can be triggered independently from style invalidation, we need to ensure that paint-only properties are updated in that case too. --- ...-paint-only-properties-after-layout-ref.html | 11 +++++++++++ ...olve-paint-only-properties-after-layout.html | 17 +++++++++++++++++ Userland/Libraries/LibWeb/DOM/Document.cpp | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Ref/reference/resolve-paint-only-properties-after-layout-ref.html create mode 100644 Tests/LibWeb/Ref/resolve-paint-only-properties-after-layout.html diff --git a/Tests/LibWeb/Ref/reference/resolve-paint-only-properties-after-layout-ref.html b/Tests/LibWeb/Ref/reference/resolve-paint-only-properties-after-layout-ref.html new file mode 100644 index 0000000000..c8870ad2e7 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/resolve-paint-only-properties-after-layout-ref.html @@ -0,0 +1,11 @@ + + + +
hello
diff --git a/Tests/LibWeb/Ref/resolve-paint-only-properties-after-layout.html b/Tests/LibWeb/Ref/resolve-paint-only-properties-after-layout.html new file mode 100644 index 0000000000..44938c3fba --- /dev/null +++ b/Tests/LibWeb/Ref/resolve-paint-only-properties-after-layout.html @@ -0,0 +1,17 @@ + + + +
+ diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 72dab3a7ad..1424f38caf 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1060,8 +1060,10 @@ void Document::update_layout() // Broadcast the current viewport rect to any new paintables, so they know whether they're visible or not. inform_all_viewport_clients_about_the_current_viewport_rect(); - if (navigable()) + if (navigable()) { + navigable()->set_needs_to_resolve_paint_only_properties(); navigable()->set_needs_display(); + } if (navigable()->is_traversable()) { page().client().page_did_layout();