Diff
Modified: branches/safari-604-branch/LayoutTests/ChangeLog (219924 => 219925)
--- branches/safari-604-branch/LayoutTests/ChangeLog 2017-07-26 09:51:50 UTC (rev 219924)
+++ branches/safari-604-branch/LayoutTests/ChangeLog 2017-07-26 09:51:53 UTC (rev 219925)
@@ -1,5 +1,19 @@
2017-07-26 Jason Marcell <[email protected]>
+ Cherry-pick r219755. rdar://problem/33523843
+
+ 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-26 Jason Marcell <[email protected]>
+
Cherry-pick r219751. rdar://problem/33523861
2017-07-21 Nan Wang <[email protected]>
Added: branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html (0 => 219925)
--- branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style-expected.html 2017-07-26 09:51:53 UTC (rev 219925)
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+
+<html>
+<body>
+<div>This text should not be stroked.</div>
+</body>
+</html>
Added: branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html (0 => 219925)
--- branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/css/round-trip-stroke-width-using-computed-style.html 2017-07-26 09:51:53 UTC (rev 219925)
@@ -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: branches/safari-604-branch/Source/WebCore/ChangeLog (219924 => 219925)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-07-26 09:51:50 UTC (rev 219924)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-07-26 09:51:53 UTC (rev 219925)
@@ -1,5 +1,30 @@
2017-07-26 Jason Marcell <[email protected]>
+ Cherry-pick r219755. rdar://problem/33523843
+
+ 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-26 Jason Marcell <[email protected]>
+
Cherry-pick r219752. rdar://problem/33524766
2017-07-21 Timothy Horton <[email protected]>
Modified: branches/safari-604-branch/Source/WebCore/rendering/TextPaintStyle.cpp (219924 => 219925)
--- branches/safari-604-branch/Source/WebCore/rendering/TextPaintStyle.cpp 2017-07-26 09:51:50 UTC (rev 219924)
+++ branches/safari-604-branch/Source/WebCore/rendering/TextPaintStyle.cpp 2017-07-26 09:51:53 UTC (rev 219925)
@@ -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: branches/safari-604-branch/Source/WebCore/rendering/style/RenderStyle.h (219924 => 219925)
--- branches/safari-604-branch/Source/WebCore/rendering/style/RenderStyle.h 2017-07-26 09:51:50 UTC (rev 219924)
+++ branches/safari-604-branch/Source/WebCore/rendering/style/RenderStyle.h 2017-07-26 09:51:53 UTC (rev 219925)
@@ -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: branches/safari-604-branch/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (219924 => 219925)
--- branches/safari-604-branch/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2017-07-26 09:51:50 UTC (rev 219924)
+++ branches/safari-604-branch/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2017-07-26 09:51:53 UTC (rev 219925)
@@ -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)