Title: [267528] trunk
- Revision
- 267528
- Author
- [email protected]
- Date
- 2020-09-24 06:21:13 -0700 (Thu, 24 Sep 2020)
Log Message
currentColor isn't recalculated when a text node doesn't exist
https://bugs.webkit.org/show_bug.cgi?id=216780
<rdar://problem/69320933>
Reviewed by Antoine Quint.
Source/WebCore:
We fail to repaint with the new background color when 'background-color' property has value 'currentColor' and the current color changes.
Test case by Cory LaViska.
Test: fast/css/currentColor-background-paint.html
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresRepaint const):
* rendering/style/StyleBackgroundData.cpp:
(WebCore::StyleBackgroundData::isEquivalentForPainting const):
* rendering/style/StyleBackgroundData.h:
LayoutTests:
* fast/css/currentColor-background-paint-expected.html: Added.
* fast/css/currentColor-background-paint.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (267527 => 267528)
--- trunk/LayoutTests/ChangeLog 2020-09-24 12:52:35 UTC (rev 267527)
+++ trunk/LayoutTests/ChangeLog 2020-09-24 13:21:13 UTC (rev 267528)
@@ -1,3 +1,14 @@
+2020-09-24 Antti Koivisto <[email protected]>
+
+ currentColor isn't recalculated when a text node doesn't exist
+ https://bugs.webkit.org/show_bug.cgi?id=216780
+ <rdar://problem/69320933>
+
+ Reviewed by Antoine Quint.
+
+ * fast/css/currentColor-background-paint-expected.html: Added.
+ * fast/css/currentColor-background-paint.html: Added.
+
2020-09-24 Commit Queue <[email protected]>
Unreviewed, reverting r267495 and r267512.
Added: trunk/LayoutTests/fast/css/currentColor-background-paint-expected.html (0 => 267528)
--- trunk/LayoutTests/fast/css/currentColor-background-paint-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-background-paint-expected.html 2020-09-24 13:21:13 UTC (rev 267528)
@@ -0,0 +1,15 @@
+Both divs should have green background.
+
+<div></div>
+<div>Works with text</div>
+
+<style>
+div {
+ width: 200px;
+ height: 50px;
+ color: green;
+ background-color: green;
+ text-shadow: 1px 1px 0 white;
+ margin: 1rem 0;
+}
+</style>
Added: trunk/LayoutTests/fast/css/currentColor-background-paint.html (0 => 267528)
--- trunk/LayoutTests/fast/css/currentColor-background-paint.html (rev 0)
+++ trunk/LayoutTests/fast/css/currentColor-background-paint.html 2020-09-24 13:21:13 UTC (rev 267528)
@@ -0,0 +1,29 @@
+Both divs should have green background.
+
+<div></div>
+<div>Works with text</div>
+
+<style>
+div {
+ width: 200px;
+ height: 50px;
+ background-color: currentColor;
+ text-shadow: 1px 1px 0 white;
+ margin: 1rem 0;
+}
+</style>
+
+<script>
+window._onload_ = async function() {
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+ document.body.offsetLeft;
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ await new Promise(requestAnimationFrame);
+ [...document.querySelectorAll('div')].map(div => div.style.color = "green");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
Modified: trunk/Source/WebCore/ChangeLog (267527 => 267528)
--- trunk/Source/WebCore/ChangeLog 2020-09-24 12:52:35 UTC (rev 267527)
+++ trunk/Source/WebCore/ChangeLog 2020-09-24 13:21:13 UTC (rev 267528)
@@ -1,3 +1,23 @@
+2020-09-24 Antti Koivisto <[email protected]>
+
+ currentColor isn't recalculated when a text node doesn't exist
+ https://bugs.webkit.org/show_bug.cgi?id=216780
+ <rdar://problem/69320933>
+
+ Reviewed by Antoine Quint.
+
+ We fail to repaint with the new background color when 'background-color' property has value 'currentColor' and the current color changes.
+
+ Test case by Cory LaViska.
+
+ Test: fast/css/currentColor-background-paint.html
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::changeRequiresRepaint const):
+ * rendering/style/StyleBackgroundData.cpp:
+ (WebCore::StyleBackgroundData::isEquivalentForPainting const):
+ * rendering/style/StyleBackgroundData.h:
+
2020-09-24 Cathie Chen <[email protected]>
Root node with stateless wheel event isn't always scrollable
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (267527 => 267528)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-09-24 12:52:35 UTC (rev 267527)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-09-24 13:21:13 UTC (rev 267528)
@@ -1115,12 +1115,14 @@
if (!requiresPainting(*this) && !requiresPainting(other))
return false;
+ bool currentColorDiffers = m_inheritedData->color != other.m_inheritedData->color;
+
if (m_inheritedFlags.visibility != other.m_inheritedFlags.visibility
|| m_inheritedFlags.printColorAdjust != other.m_inheritedFlags.printColorAdjust
|| m_inheritedFlags.insideLink != other.m_inheritedFlags.insideLink
|| m_inheritedFlags.insideDefaultButton != other.m_inheritedFlags.insideDefaultButton
|| m_surroundData->border != other.m_surroundData->border
- || !m_backgroundData->isEquivalentForPainting(*other.m_backgroundData))
+ || !m_backgroundData->isEquivalentForPainting(*other.m_backgroundData, currentColorDiffers))
return true;
if (m_rareNonInheritedData.ptr() != other.m_rareNonInheritedData.ptr()
Modified: trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp (267527 => 267528)
--- trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp 2020-09-24 12:52:35 UTC (rev 267527)
+++ trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp 2020-09-24 13:21:13 UTC (rev 267528)
@@ -51,12 +51,16 @@
return background == other.background && color == other.color && outline == other.outline;
}
-bool StyleBackgroundData::isEquivalentForPainting(const StyleBackgroundData& other) const
+bool StyleBackgroundData::isEquivalentForPainting(const StyleBackgroundData& other, bool currentColorDiffers) const
{
if (background != other.background || color != other.color)
return false;
+ if (currentColorDiffers && color == RenderStyle::currentColor())
+ return false;
if (!outline.isVisible() && !other.outline.isVisible())
return true;
+ if (currentColorDiffers && outline.color() == RenderStyle::currentColor())
+ return false;
return outline == other.outline;
}
Modified: trunk/Source/WebCore/rendering/style/StyleBackgroundData.h (267527 => 267528)
--- trunk/Source/WebCore/rendering/style/StyleBackgroundData.h 2020-09-24 12:52:35 UTC (rev 267527)
+++ trunk/Source/WebCore/rendering/style/StyleBackgroundData.h 2020-09-24 13:21:13 UTC (rev 267528)
@@ -41,7 +41,7 @@
bool operator==(const StyleBackgroundData&) const;
bool operator!=(const StyleBackgroundData& other) const { return !(*this == other); }
- bool isEquivalentForPainting(const StyleBackgroundData&) const;
+ bool isEquivalentForPainting(const StyleBackgroundData&, bool currentColorDiffers) const;
DataRef<FillLayer> background;
Color color;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes