Title: [294618] trunk
Revision
294618
Author
za...@apple.com
Date
2022-05-21 19:34:32 -0700 (Sat, 21 May 2022)

Log Message

Invisible border should not trigger Repaint diff when currentColor changes
https://bugs.webkit.org/show_bug.cgi?id=240763

Reviewed by Simon Fraser.

Let's check if the border is visible to decide if the currentColor should trigger Repaint diff.

Test: fast/repaint/currentColorChange-with-non-visible-border.html
* Source/WebCore/rendering/style/BorderData.cpp:
(WebCore::BorderData::isEquivalentForPainting const):
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt: Added.
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html: Added.

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

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt (0 => 294618)


--- trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt	2022-05-22 02:34:32 UTC (rev 294618)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html (0 => 294618)


--- trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html	2022-05-22 02:34:32 UTC (rev 294618)
@@ -0,0 +1,26 @@
+<style>
+#color_change {
+  border-style: none;
+  border-width: 10px;
+  background-color: green;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<!-- current-color change should not trigger repaint unless the container has text content -->
+<div id=color_change><div>
+<pre id=result></pre>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+document.body.offsetHeight;
+if (window.internals)
+  internals.startTrackingRepaints();
+color_change.style.color = "red";
+document.body.offsetHeight;
+
+if (window.internals) {
+  result.innerText = internals.repaintRectsAsText();
+  internals.stopTrackingRepaints();
+}
+</script>

Modified: trunk/Source/WebCore/rendering/style/BorderData.cpp (294617 => 294618)


--- trunk/Source/WebCore/rendering/style/BorderData.cpp	2022-05-21 23:40:13 UTC (rev 294617)
+++ trunk/Source/WebCore/rendering/style/BorderData.cpp	2022-05-22 02:34:32 UTC (rev 294618)
@@ -40,8 +40,11 @@
     if (!currentColorDiffers)
         return true;
 
-    auto borderHasCurrentColor = RenderStyle::isCurrentColor(m_top.color()) || RenderStyle::isCurrentColor(m_right.color()) || RenderStyle::isCurrentColor(m_bottom.color()) || RenderStyle::isCurrentColor(m_left.color());
-    return !borderHasCurrentColor;
+    auto visibleBorderHasCurrentColor = (m_top.isVisible() && RenderStyle::isCurrentColor(m_top.color()))
+        || (m_right.isVisible() && RenderStyle::isCurrentColor(m_right.color()))
+        || (m_bottom.isVisible() && RenderStyle::isCurrentColor(m_bottom.color()))
+        || (m_left.isVisible() && RenderStyle::isCurrentColor(m_left.color()));
+    return !visibleBorderHasCurrentColor;
 }
 
 TextStream& operator<<(TextStream& ts, const BorderValue& borderValue)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to