Title: [295155] trunk
Revision
295155
Author
za...@apple.com
Date
2022-06-02 17:08:01 -0700 (Thu, 02 Jun 2022)

Log Message

Regression(r294902) Web Inspector highlight gets stuck when hovering over items.
https://bugs.webkit.org/show_bug.cgi?id=241231

Reviewed by Simon Fraser.

This patch ensures that repaint() goes through for the "about-to-be-destroyed" content.

Staring from r294902, when the RenderLayer says "I am scheduled for a full repaint", any subsequent repaint call on the associated renderer returns early (no repaint) as we are certain that a full repaint is going to be issued still within the current "rendering update" frame as part of the post-layout tasks.
Except this one case when soon after marking the RenderLayer dirty with the "needs full repaint" flag, we destroy both the layer and the associated renderer. In this case the layer has no chance to issue the repaint.

* LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt: Added.
* LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html: Added.
* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::detachFromRenderElement):

Canonical link: https://commits.webkit.org/251243@main

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt (0 => 295155)


--- trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach-expected.txt	2022-06-03 00:08:01 UTC (rev 295155)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html (0 => 295155)


--- trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/repaint-renderer-with-layer-on-detach.html	2022-06-03 00:08:01 UTC (rev 295155)
@@ -0,0 +1,33 @@
+<style>
+#remove_me {
+  transform: translateX(10px);
+  background-color: red;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<!-- PASS if no red -->
+<div id=remove_me></div>
+<pre id=result></pre>
+<script>
+if (window.testRunner) {
+  testRunner.waitUntilDone();
+  testRunner.dumpAsText();
+}
+
+document.body.offsetHeight;
+
+setTimeout(function() {
+  if (window.internals)
+    internals.startTrackingRepaints();
+  
+  remove_me.remove();
+
+  if (window.internals) {
+    result.innerText = internals.repaintRectsAsText().indexOf("18 8 100 100") != -1 ? "PASS" : "FAIL";
+    internals.stopTrackingRepaints();
+  }
+  if (window.testRunner)
+    testRunner.notifyDone();
+}, 1);
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (295154 => 295155)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-06-03 00:05:46 UTC (rev 295154)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-06-03 00:08:01 UTC (rev 295155)
@@ -953,12 +953,11 @@
     // that a positioned child got yanked). We also repaint, so that the area exposed when the child
     // disappears gets repainted properly.
     if (!parent.renderTreeBeingDestroyed() && child.everHadLayout()) {
-        child.setNeedsLayoutAndPrefWidthsRecalc();
-        // We only repaint |child| if we have a RenderLayer as its visual overflow may not be tracked by its parent.
         if (child.isBody())
             parent.view().repaintRootContents();
         else
             child.repaint();
+        child.setNeedsLayoutAndPrefWidthsRecalc();
     }
 
     // If we have a line box wrapper, delete it.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to