Title: [219755] trunk
Revision
219755
Author
[email protected]
Date
2017-07-21 17:41:14 -0700 (Fri, 21 Jul 2017)

Log Message

Round-tripping stroke-width styles through getComputedStyle cause the text to gain a stroke.
https://bugs.webkit.org/show_bug.cgi?id=174701
Source/WebCore:

<rdar://problem/32903679>

Reviewed by Simon Fraser.

The initial value of stroke-color should be transparent, see https://www.w3.org/TR/fill-stroke-3/#stroke-color.
Also, there is no need to set the graphics context in text stroke mode, if the stroke color is not visible.

Test: fast/css/round-trip-stroke-width-using-computed-style.html

* rendering/TextPaintStyle.cpp:
(WebCore::updateGraphicsContext):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::initialStrokeWidth):
(WebCore::RenderStyle::initialStrokeColor):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):

LayoutTests:

Reviewed by Simon Fraser.

* fast/css/round-trip-stroke-width-using-computed-style-expected.html: Added.
* fast/css/round-trip-stroke-width-using-computed-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219754 => 219755)


--- trunk/LayoutTests/ChangeLog	2017-07-22 00:15:00 UTC (rev 219754)
+++ trunk/LayoutTests/ChangeLog	2017-07-22 00:41:14 UTC (rev 219755)
@@ -1,3 +1,13 @@
+2017-07-21  Per Arne Vollan  <[email protected]>
+
+        Round-tripping stroke-width styles through getComputedStyle cause the text to gain a stroke.
+        https://bugs.webkit.org/show_bug.cgi?id=174701
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/round-trip-stroke-width-using-computed-style-expected.html: Added.
+        * fast/css/round-trip-stroke-width-using-computed-style.html: Added.
+
 2017-07-21  Nan Wang  <[email protected]>
 
         AX: Expose form validation on iOS as hint

Added: trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html (0 => 219755)


--- trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html	2017-07-22 00:41:14 UTC (rev 219755)
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+
+<html>
+<body>
+<div>This text should not be stroked.</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html (0 => 219755)


--- trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html	2017-07-22 00:41:14 UTC (rev 219755)
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML>
+
+<html>
+<body>
+<div id=t>This text should not be stroked.</div>
+<script>t.style=getComputedStyle(t).cssText</script>
+<body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (219754 => 219755)


--- trunk/Source/WebCore/ChangeLog	2017-07-22 00:15:00 UTC (rev 219754)
+++ trunk/Source/WebCore/ChangeLog	2017-07-22 00:41:14 UTC (rev 219755)
@@ -1,3 +1,24 @@
+2017-07-21  Per Arne Vollan  <[email protected]>
+
+        Round-tripping stroke-width styles through getComputedStyle cause the text to gain a stroke.
+        https://bugs.webkit.org/show_bug.cgi?id=174701
+        <rdar://problem/32903679>
+
+        Reviewed by Simon Fraser.
+
+        The initial value of stroke-color should be transparent, see https://www.w3.org/TR/fill-stroke-3/#stroke-color.
+        Also, there is no need to set the graphics context in text stroke mode, if the stroke color is not visible.
+
+        Test: fast/css/round-trip-stroke-width-using-computed-style.html
+
+        * rendering/TextPaintStyle.cpp:
+        (WebCore::updateGraphicsContext):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::initialStrokeWidth):
+        (WebCore::RenderStyle::initialStrokeColor):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+
 2017-07-21  Timothy Horton  <[email protected]>
 
         Remove an inaccurate comment from RenderTextLineBoxes

Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (219754 => 219755)


--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2017-07-22 00:15:00 UTC (rev 219754)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp	2017-07-22 00:41:14 UTC (rev 219755)
@@ -187,7 +187,7 @@
     else
         newMode &= ~TextModeLetterpress;
 #endif
-    if (paintStyle.strokeWidth > 0)
+    if (paintStyle.strokeWidth > 0 && paintStyle.strokeColor.isVisible())
         newMode |= TextModeStroke;
     if (mode != newMode) {
         context.setTextDrawingMode(newMode);

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (219754 => 219755)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-07-22 00:15:00 UTC (rev 219754)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-07-22 00:41:14 UTC (rev 219755)
@@ -1267,6 +1267,7 @@
     const Length& strokeWidth() const { return m_rareInheritedData->strokeWidth; }
     void setStrokeWidth(Length&& w) { SET_VAR(m_rareInheritedData, strokeWidth, WTFMove(w)); }
     bool hasVisibleStroke() const { return svgStyle().hasStroke() && !strokeWidth().isZero(); }
+    static Length initialStrokeWidth() { return initialOneLength(); }
 
     float computedStrokeWidth(const IntSize& viewportSize) const;
     void setHasExplicitlySetStrokeWidth(bool v) { SET_VAR(m_rareInheritedData, hasSetStrokeWidth, static_cast<unsigned>(v)); }
@@ -1279,6 +1280,7 @@
     const Color& visitedLinkStrokeColor() const { return m_rareInheritedData->visitedLinkStrokeColor; }
     void setHasExplicitlySetStrokeColor(bool v) { SET_VAR(m_rareInheritedData, hasSetStrokeColor, static_cast<unsigned>(v)); }
     bool hasExplicitlySetStrokeColor() const { return m_rareInheritedData->hasSetStrokeColor; };
+    static Color initialStrokeColor() { return Color(Color::transparent); }
     
     float strokeMiterLimit() const { return m_rareInheritedData->miterLimit; }
     void setStrokeMiterLimit(float f) { SET_VAR(m_rareInheritedData, miterLimit, f); }

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (219754 => 219755)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2017-07-22 00:15:00 UTC (rev 219754)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2017-07-22 00:41:14 UTC (rev 219755)
@@ -130,7 +130,8 @@
     , joinStyle(RenderStyle::initialJoinStyle())
     , hasSetStrokeWidth(false)
     , hasSetStrokeColor(false)
-    , strokeWidth(RenderStyle::initialOneLength())
+    , strokeWidth(RenderStyle::initialStrokeWidth())
+    , strokeColor(RenderStyle::initialStrokeColor())
     , miterLimit(RenderStyle::initialStrokeMiterLimit())
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to