Title: [265462] branches/safari-610.1.25.10-branch
Revision
265462
Author
[email protected]
Date
2020-08-10 16:47:35 -0700 (Mon, 10 Aug 2020)

Log Message

Cherry-pick r265198. rdar://problem/66644002

    REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases
    https://bugs.webkit.org/show_bug.cgi?id=215079

    Reviewed by Zalan Bujtas.

    Source/WebCore:

    r259585 did some refactoring that broke a special case where text decoration color comes from
    '-webkit-text-fill-color' property.

    Test: fast/text/text-decoration-currentcolor-fill-color.html

    * rendering/TextDecorationPainter.cpp:
    (WebCore::TextDecorationPainter::decorationColor):

    Move resolving currentColor to RenderStyle.

    * rendering/style/RenderStyle.cpp:
    (WebCore::RenderStyle::colorResolvingCurrentColor const):

    Handle CSSPropertyTextDecorationColor as a special case here.

    (WebCore::RenderStyle::visitedDependentColor const):

    LayoutTests:

    * fast/text/text-decoration-currentcolor-fill-color-expected.html: Added.
    * fast/text/text-decoration-currentcolor-fill-color.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265198 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-610.1.25.10-branch/LayoutTests/ChangeLog (265461 => 265462)


--- branches/safari-610.1.25.10-branch/LayoutTests/ChangeLog	2020-08-10 23:47:31 UTC (rev 265461)
+++ branches/safari-610.1.25.10-branch/LayoutTests/ChangeLog	2020-08-10 23:47:35 UTC (rev 265462)
@@ -1,3 +1,49 @@
+2020-08-10  Alan Coon  <[email protected]>
+
+        Cherry-pick r265198. rdar://problem/66644002
+
+    REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases
+    https://bugs.webkit.org/show_bug.cgi?id=215079
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    r259585 did some refactoring that broke a special case where text decoration color comes from
+    '-webkit-text-fill-color' property.
+    
+    Test: fast/text/text-decoration-currentcolor-fill-color.html
+    
+    * rendering/TextDecorationPainter.cpp:
+    (WebCore::TextDecorationPainter::decorationColor):
+    
+    Move resolving currentColor to RenderStyle.
+    
+    * rendering/style/RenderStyle.cpp:
+    (WebCore::RenderStyle::colorResolvingCurrentColor const):
+    
+    Handle CSSPropertyTextDecorationColor as a special case here.
+    
+    (WebCore::RenderStyle::visitedDependentColor const):
+    
+    LayoutTests:
+    
+    * fast/text/text-decoration-currentcolor-fill-color-expected.html: Added.
+    * fast/text/text-decoration-currentcolor-fill-color.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-03  Antti Koivisto  <[email protected]>
+
+            REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases
+            https://bugs.webkit.org/show_bug.cgi?id=215079
+
+            Reviewed by Zalan Bujtas.
+
+            * fast/text/text-decoration-currentcolor-fill-color-expected.html: Added.
+            * fast/text/text-decoration-currentcolor-fill-color.html: Added.
+
 2020-07-31  Alex Christensen  <[email protected]>
 
         Use more inclusive terminology in Tools

Added: branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color-expected.html (0 => 265462)


--- branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color-expected.html	                        (rev 0)
+++ branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color-expected.html	2020-08-10 23:47:35 UTC (rev 265462)
@@ -0,0 +1,11 @@
+<style>
+div {
+  background-color: red;
+  -webkit-background-clip: text;
+  -webkit-text-fill-color: transparent;
+}
+a {
+  text-decoration: none;
+}
+</style>
+<div><a href="" if no underline</a></div>

Added: branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color.html (0 => 265462)


--- branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color.html	                        (rev 0)
+++ branches/safari-610.1.25.10-branch/LayoutTests/fast/text/text-decoration-currentcolor-fill-color.html	2020-08-10 23:47:35 UTC (rev 265462)
@@ -0,0 +1,8 @@
+<style>
+div {
+  background-color: red;
+  -webkit-background-clip: text;
+  -webkit-text-fill-color: transparent;
+}
+</style>
+<div><a href="" if no underline</a></div>

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog (265461 => 265462)


--- branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog	2020-08-10 23:47:31 UTC (rev 265461)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/ChangeLog	2020-08-10 23:47:35 UTC (rev 265462)
@@ -1,5 +1,65 @@
 2020-08-10  Alan Coon  <[email protected]>
 
+        Cherry-pick r265198. rdar://problem/66644002
+
+    REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases
+    https://bugs.webkit.org/show_bug.cgi?id=215079
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    r259585 did some refactoring that broke a special case where text decoration color comes from
+    '-webkit-text-fill-color' property.
+    
+    Test: fast/text/text-decoration-currentcolor-fill-color.html
+    
+    * rendering/TextDecorationPainter.cpp:
+    (WebCore::TextDecorationPainter::decorationColor):
+    
+    Move resolving currentColor to RenderStyle.
+    
+    * rendering/style/RenderStyle.cpp:
+    (WebCore::RenderStyle::colorResolvingCurrentColor const):
+    
+    Handle CSSPropertyTextDecorationColor as a special case here.
+    
+    (WebCore::RenderStyle::visitedDependentColor const):
+    
+    LayoutTests:
+    
+    * fast/text/text-decoration-currentcolor-fill-color-expected.html: Added.
+    * fast/text/text-decoration-currentcolor-fill-color.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-03  Antti Koivisto  <[email protected]>
+
+            REGRESSION(r259585) Text decoration color with value currentColor miscomputed in some cases
+            https://bugs.webkit.org/show_bug.cgi?id=215079
+
+            Reviewed by Zalan Bujtas.
+
+            r259585 did some refactoring that broke a special case where text decoration color comes from
+            '-webkit-text-fill-color' property.
+
+            Test: fast/text/text-decoration-currentcolor-fill-color.html
+
+            * rendering/TextDecorationPainter.cpp:
+            (WebCore::TextDecorationPainter::decorationColor):
+
+            Move resolving currentColor to RenderStyle.
+
+            * rendering/style/RenderStyle.cpp:
+            (WebCore::RenderStyle::colorResolvingCurrentColor const):
+
+            Handle CSSPropertyTextDecorationColor as a special case here.
+
+            (WebCore::RenderStyle::visitedDependentColor const):
+
+2020-08-10  Alan Coon  <[email protected]>
+
         Cherry-pick r265188. rdar://problem/66643973
 
     Table data is incorrectly translated in some articles on en.wikipedia.org

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/rendering/TextDecorationPainter.cpp (265461 => 265462)


--- branches/safari-610.1.25.10-branch/Source/WebCore/rendering/TextDecorationPainter.cpp	2020-08-10 23:47:31 UTC (rev 265461)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/rendering/TextDecorationPainter.cpp	2020-08-10 23:47:35 UTC (rev 265462)
@@ -373,18 +373,7 @@
 
 Color TextDecorationPainter::decorationColor(const RenderStyle& style)
 {
-    // Check for text decoration color first.
-    auto result = style.visitedDependentColorWithColorFilter(CSSPropertyTextDecorationColor);
-    if (result.isValid())
-        return result;
-    if (style.hasPositiveStrokeWidth()) {
-        // Prefer stroke color if possible but not if it's fully transparent.
-        result = style.computedStrokeColor();
-        if (result.isVisible())
-            return result;
-    }
-    
-    return style.visitedDependentColorWithColorFilter(CSSPropertyWebkitTextFillColor);
+    return style.visitedDependentColorWithColorFilter(CSSPropertyTextDecorationColor);
 }
 
 OptionSet<TextDecoration> TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style)

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.cpp (265461 => 265462)


--- branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.cpp	2020-08-10 23:47:31 UTC (rev 265461)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.cpp	2020-08-10 23:47:35 UTC (rev 265462)
@@ -2024,6 +2024,17 @@
     auto result = unresolvedColorForProperty(colorProperty, visitedLink);
 
     if (isCurrentColor(result)) {
+        if (colorProperty == CSSPropertyTextDecorationColor) {
+            if (hasPositiveStrokeWidth()) {
+                // Prefer stroke color if possible but not if it's fully transparent.
+                auto strokeColor = colorResolvingCurrentColor(effectiveStrokeColorProperty(), visitedLink);
+                if (strokeColor.isVisible())
+                    return strokeColor;
+            }
+
+            return colorResolvingCurrentColor(CSSPropertyWebkitTextFillColor, visitedLink);
+        }
+
         auto borderStyle = computeBorderStyle();
         if (!visitedLink && (borderStyle == BorderStyle::Inset || borderStyle == BorderStyle::Outset || borderStyle == BorderStyle::Ridge || borderStyle == BorderStyle::Groove))
             return SRGBA<uint8_t> { 238, 238, 238 };
@@ -2050,10 +2061,6 @@
 
     Color visitedColor = colorResolvingCurrentColor(colorProperty, true);
 
-    // Text decoration color validity is preserved (checked in RenderObject::decorationColor).
-    if (colorProperty == CSSPropertyTextDecorationColor)
-        return visitedColor;
-
     // FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
     // assume that if the background color is transparent that it wasn't set. Note that it's weird that
     // we're returning unvisited info for a visited link, but given our restriction that the alpha values
@@ -2560,10 +2567,7 @@
 
 Color RenderStyle::computedStrokeColor() const
 {
-    CSSPropertyID propertyID = CSSPropertyStrokeColor;
-    if (!hasExplicitlySetStrokeColor())
-        propertyID = CSSPropertyWebkitTextStrokeColor;
-    return visitedDependentColor(propertyID);
+    return visitedDependentColor(effectiveStrokeColorProperty());
 }
 
 } // namespace WebCore

Modified: branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.h (265461 => 265462)


--- branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.h	2020-08-10 23:47:31 UTC (rev 265461)
+++ branches/safari-610.1.25.10-branch/Source/WebCore/rendering/style/RenderStyle.h	2020-08-10 23:47:35 UTC (rev 265462)
@@ -1322,6 +1322,7 @@
     bool hasExplicitlySetStrokeColor() const { return m_rareInheritedData->hasSetStrokeColor; };
     static Color initialStrokeColor() { return Color::transparentBlack; }
     Color computedStrokeColor() const;
+    CSSPropertyID effectiveStrokeColorProperty() const { return hasExplicitlySetStrokeColor() ? CSSPropertyStrokeColor : CSSPropertyWebkitTextStrokeColor; }
 
     float strokeMiterLimit() const { return m_rareInheritedData->miterLimit; }
     void setStrokeMiterLimit(float f) { SET_VAR(m_rareInheritedData, miterLimit, f); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to