Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2017 19:34:48 +0000 (19:34 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2017 19:34:48 +0000 (19:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168044
Source/WebCore:

rdar://problem/30165746

Reviewed by Simon Fraser.

This patch moves these styles out of svg, and sets the properties on video cues.

Tests: fast/css/parsing-paint-order.html
       fast/css/parsing-stroke-linecap.html
       fast/css/parsing-stroke-linejoin.html
       fast/css/parsing-stroke-width.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::paintOrder):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSProperties.json:
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue):
(WebCore::paintOrder): Deleted.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::isValidCueStyleProperty):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
(WebCore::RenderStyle::paintTypesForPaintOrder):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setPaintOrder):
(WebCore::RenderStyle::paintOrder):
(WebCore::RenderStyle::initialPaintOrder):
(WebCore::RenderStyle::setCapStyle):
(WebCore::RenderStyle::capStyle):
(WebCore::RenderStyle::initialCapStyle):
(WebCore::RenderStyle::setJoinStyle):
(WebCore::RenderStyle::joinStyle):
(WebCore::RenderStyle::initialJoinStyle):
(WebCore::RenderStyle::strokeWidth):
(WebCore::RenderStyle::setStrokeWidth):
(WebCore::RenderStyle::hasVisibleStroke):
(WebCore::RenderStyle::setStrokeOpacity):
* rendering/style/SVGRenderStyle.cpp:
(WebCore::SVGRenderStyle::diff):
(WebCore::SVGRenderStyle::paintTypesForPaintOrder): Deleted.
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::initialBufferedRendering):
(WebCore::SVGRenderStyle::initialFillRule):
(WebCore::SVGRenderStyle::initialMaskType):
(WebCore::SVGRenderStyle::setBufferedRendering):
(WebCore::SVGRenderStyle::setFillRule):
(WebCore::SVGRenderStyle::setMaskType):
(WebCore::SVGRenderStyle::bufferedRendering):
(WebCore::SVGRenderStyle::fillRule):
(WebCore::SVGRenderStyle::strokeMiterLimit):
(WebCore::SVGRenderStyle::maskType):
(WebCore::SVGRenderStyle::hasStroke):
(WebCore::SVGRenderStyle::setBitDefaults):
(WebCore::SVGRenderStyle::InheritedFlags::operator==):
(WebCore::SVGRenderStyle::initialCapStyle): Deleted.
(WebCore::SVGRenderStyle::initialJoinStyle): Deleted.
(WebCore::SVGRenderStyle::initialPaintOrder): Deleted.
(WebCore::SVGRenderStyle::setCapStyle): Deleted.
(WebCore::SVGRenderStyle::setJoinStyle): Deleted.
(WebCore::SVGRenderStyle::setPaintOrder): Deleted.
(WebCore::SVGRenderStyle::capStyle): Deleted.
(WebCore::SVGRenderStyle::joinStyle): Deleted.
(WebCore::SVGRenderStyle::strokeWidth): Deleted.
(WebCore::SVGRenderStyle::paintOrder): Deleted.
(WebCore::SVGRenderStyle::hasVisibleStroke): Deleted.
(WebCore::SVGRenderStyle::setStrokeWidth): Deleted.
* rendering/style/SVGRenderStyleDefs.cpp:
(WebCore::StyleStrokeData::StyleStrokeData):
(WebCore::StyleStrokeData::operator==):
* rendering/style/SVGRenderStyleDefs.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:
* rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::strokeShape):
* rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::strokeShape):
(WebCore::RenderSVGPath::shapeDependentStrokeContains):
(WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
(WebCore::RenderSVGPath::zeroLengthLinecapPath):
* rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::strokeShape):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::strokeShape):
(WebCore::RenderSVGShape::fillStrokeMarkers):
(WebCore::RenderSVGShape::strokeWidth):
(WebCore::RenderSVGShape::hasSmoothStroke):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::strokeBoundingBox):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paint):
(WebCore::SVGInlineTextBox::paintDecoration):
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::applyStrokeStyleToContext):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeStyle):

LayoutTests:

Reviewed by Simon Fraser.

* fast/css/parsing-paint-order-expected.txt: Added.
* fast/css/parsing-paint-order.html: Added.
* fast/css/parsing-stroke-linecap-expected.txt: Added.
* fast/css/parsing-stroke-linecap.html: Added.
* fast/css/parsing-stroke-linejoin-expected.txt: Added.
* fast/css/parsing-stroke-linejoin.html: Added.
* fast/css/parsing-stroke-width-expected.txt: Added.
* fast/css/parsing-stroke-width.html: Added.
* media/track/track-css-stroke-cues-expected.txt:
* media/track/track-css-stroke-cues.html:

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

33 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/parsing-paint-order-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/parsing-paint-order.html [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-linecap-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-linecap.html [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-linejoin-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-linejoin.html [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/parsing-stroke-width.html [new file with mode: 0644]
LayoutTests/media/track/track-css-stroke-cues-expected.txt
LayoutTests/media/track/track-css-stroke-cues.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSProperties.json
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyle.cpp
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp
Source/WebCore/rendering/style/SVGRenderStyleDefs.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
Source/WebCore/rendering/svg/RenderSVGPath.cpp
Source/WebCore/rendering/svg/RenderSVGRect.cpp
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

index f2947f1..ac5b739 100644 (file)
@@ -1,3 +1,21 @@
+2017-02-17  Per Arne Vollan  <pvollan@apple.com>
+
+        Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
+        https://bugs.webkit.org/show_bug.cgi?id=168044
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/parsing-paint-order-expected.txt: Added.
+        * fast/css/parsing-paint-order.html: Added.
+        * fast/css/parsing-stroke-linecap-expected.txt: Added.
+        * fast/css/parsing-stroke-linecap.html: Added.
+        * fast/css/parsing-stroke-linejoin-expected.txt: Added.
+        * fast/css/parsing-stroke-linejoin.html: Added.
+        * fast/css/parsing-stroke-width-expected.txt: Added.
+        * fast/css/parsing-stroke-width.html: Added.
+        * media/track/track-css-stroke-cues-expected.txt:
+        * media/track/track-css-stroke-cues.html:
+
 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
 
         Fixed elements bounce when rubber-banding at the bottom of the page
diff --git a/LayoutTests/fast/css/parsing-paint-order-expected.txt b/LayoutTests/fast/css/parsing-paint-order-expected.txt
new file mode 100644 (file)
index 0000000..566e643
--- /dev/null
@@ -0,0 +1,32 @@
+This tests checks that all of the input values for paint-order parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testComputedStyleInherited("paint-order: fill;") is "fill"
+PASS testComputedStyleInherited("paint-order: stroke;") is "stroke"
+PASS testComputedStyleInherited("paint-order: markers;") is "markers"
+PASS testComputedStyle(";") is "normal"
+PASS test("paint-order: fill;") is "fill"
+PASS test("paint-order: fill stroke;") is "fill"
+PASS test("paint-order: fill markers;") is "fill markers"
+PASS test("paint-order: fill stroke markers;") is "fill"
+PASS test("paint-order: fill markers stroke;") is "fill markers"
+PASS test("paint-order: stroke;") is "stroke"
+PASS test("paint-order: stroke fill;") is "stroke"
+PASS test("paint-order: stroke markers;") is "stroke markers"
+PASS test("paint-order: stroke fill markers;") is "stroke"
+PASS test("paint-order: stroke markers fill;") is "stroke markers"
+PASS test("paint-order: markers;") is "markers"
+PASS test("paint-order: markers fill;") is "markers"
+PASS test("paint-order: markers stroke;") is "markers stroke"
+PASS test("paint-order: markers fill stroke;") is "markers"
+PASS test("paint-order: markers stroke fill;") is "markers stroke"
+PASS test("paint-order: fil;") is ""
+PASS test("paint-order: fill markrs;") is ""
+PASS test("paint-order: 10px;") is ""
+PASS test("paint-order: 10%;") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/parsing-paint-order.html b/LayoutTests/fast/css/parsing-paint-order.html
new file mode 100644 (file)
index 0000000..7b1472a
--- /dev/null
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+        <script>
+            description("This tests checks that all of the input values for paint-order parse correctly.");
+
+            function test(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = div.style.getPropertyValue("paint-order");
+                
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyle(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+    
+                var result = window.getComputedStyle(div).paintOrder;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyleInherited(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+
+                var div2 = document.createElement("div");
+                div.appendChild(div2);
+                
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div2).paintOrder;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            shouldBe('testComputedStyleInherited("paint-order: fill;")', '"fill"');
+            shouldBe('testComputedStyleInherited("paint-order: stroke;")', '"stroke"');
+            shouldBe('testComputedStyleInherited("paint-order: markers;")', '"markers"');
+
+            shouldBe('testComputedStyle(";")', '"normal"');
+            shouldBe('test("paint-order: fill;")', '"fill"');
+            shouldBe('test("paint-order: fill stroke;")', '"fill"');
+            shouldBe('test("paint-order: fill markers;")', '"fill markers"');
+            shouldBe('test("paint-order: fill stroke markers;")', '"fill"');
+            shouldBe('test("paint-order: fill markers stroke;")', '"fill markers"');
+            
+            shouldBe('test("paint-order: stroke;")', '"stroke"');
+            shouldBe('test("paint-order: stroke fill;")', '"stroke"');
+            shouldBe('test("paint-order: stroke markers;")', '"stroke markers"');
+            shouldBe('test("paint-order: stroke fill markers;")', '"stroke"');
+            shouldBe('test("paint-order: stroke markers fill;")', '"stroke markers"');
+            
+            shouldBe('test("paint-order: markers;")', '"markers"');
+            shouldBe('test("paint-order: markers fill;")', '"markers"');
+            shouldBe('test("paint-order: markers stroke;")', '"markers stroke"');
+            shouldBe('test("paint-order: markers fill stroke;")', '"markers"');
+            shouldBe('test("paint-order: markers stroke fill;")', '"markers stroke"');
+
+            shouldBeEqualToString('test("paint-order: fil;")', '');
+            shouldBeEqualToString('test("paint-order: fill markrs;")', '');
+            shouldBeEqualToString('test("paint-order: 10px;")', '');
+            shouldBeEqualToString('test("paint-order: 10%;")', '');
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/css/parsing-stroke-linecap-expected.txt b/LayoutTests/fast/css/parsing-stroke-linecap-expected.txt
new file mode 100644 (file)
index 0000000..c38fe3f
--- /dev/null
@@ -0,0 +1,20 @@
+This tests checks that all of the input values for stroke-linecap parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testComputedStyleInherited("stroke-linecap: butt;") is "butt"
+PASS testComputedStyleInherited("stroke-linecap: round;") is "round"
+PASS testComputedStyleInherited("stroke-linecap: square;") is "square"
+PASS testComputedStyle(";") is "butt"
+PASS test("stroke-linecap: butt;") is "butt"
+PASS test("stroke-linecap: round;") is "round"
+PASS test("stroke-linecap: square;") is "square"
+PASS test("stroke-linecap: rnd;") is ""
+PASS test("stroke-linecap: but;") is ""
+PASS test("stroke-linecap: 10px;") is ""
+PASS test("stroke-linecap: 10%;") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/parsing-stroke-linecap.html b/LayoutTests/fast/css/parsing-stroke-linecap.html
new file mode 100644 (file)
index 0000000..e44cd97
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+        <script>
+            description("This tests checks that all of the input values for stroke-linecap parse correctly.");
+
+            function test(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = div.style.getPropertyValue("stroke-linecap");
+                
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyle(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div).strokeLinecap;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyleInherited(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+
+                var div2 = document.createElement("div");
+                div.appendChild(div2);
+                
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div2).strokeLinecap;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            shouldBe('testComputedStyleInherited("stroke-linecap: butt;")', '"butt"');
+            shouldBe('testComputedStyleInherited("stroke-linecap: round;")', '"round"');
+            shouldBe('testComputedStyleInherited("stroke-linecap: square;")', '"square"');
+
+            shouldBe('testComputedStyle(";")', '"butt"');
+            shouldBe('test("stroke-linecap: butt;")', '"butt"');
+            shouldBe('test("stroke-linecap: round;")', '"round"');
+            shouldBe('test("stroke-linecap: square;")', '"square"');
+
+            shouldBeEqualToString('test("stroke-linecap: rnd;")', '');
+            shouldBeEqualToString('test("stroke-linecap: but;")', '');
+            shouldBeEqualToString('test("stroke-linecap: 10px;")', '');
+            shouldBeEqualToString('test("stroke-linecap: 10%;")', '');
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/css/parsing-stroke-linejoin-expected.txt b/LayoutTests/fast/css/parsing-stroke-linejoin-expected.txt
new file mode 100644 (file)
index 0000000..74ab266
--- /dev/null
@@ -0,0 +1,20 @@
+This tests checks that all of the input values for stroke-linejoin parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testComputedStyleInherited("stroke-linejoin: miter;") is "miter"
+PASS testComputedStyleInherited("stroke-linejoin: round;") is "round"
+PASS testComputedStyleInherited("stroke-linejoin: bevel;") is "bevel"
+PASS testComputedStyle(";") is "miter"
+PASS test("stroke-linejoin: miter;") is "miter"
+PASS test("stroke-linejoin: round;") is "round"
+PASS test("stroke-linejoin: bevel;") is "bevel"
+PASS test("stroke-linejoin: mitr;") is ""
+PASS test("stroke-linejoin: bevl;") is ""
+PASS test("stroke-linejoin: 10px;") is ""
+PASS test("stroke-linejoin: 10%;") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/parsing-stroke-linejoin.html b/LayoutTests/fast/css/parsing-stroke-linejoin.html
new file mode 100644 (file)
index 0000000..5fdcbae
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+        <script>
+            description("This tests checks that all of the input values for stroke-linejoin parse correctly.");
+
+            function test(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = div.style.getPropertyValue("stroke-linejoin");
+                
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyle(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div).strokeLinejoin;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyleInherited(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+
+                var div2 = document.createElement("div");
+                div.appendChild(div2);
+                
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div2).strokeLinejoin;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            shouldBe('testComputedStyleInherited("stroke-linejoin: miter;")', '"miter"');
+            shouldBe('testComputedStyleInherited("stroke-linejoin: round;")', '"round"');
+            shouldBe('testComputedStyleInherited("stroke-linejoin: bevel;")', '"bevel"');
+
+            shouldBe('testComputedStyle(";")', '"miter"');
+            shouldBe('test("stroke-linejoin: miter;")', '"miter"');
+            shouldBe('test("stroke-linejoin: round;")', '"round"');
+            shouldBe('test("stroke-linejoin: bevel;")', '"bevel"');
+
+            shouldBeEqualToString('test("stroke-linejoin: mitr;")', '');
+            shouldBeEqualToString('test("stroke-linejoin: bevl;")', '');
+            shouldBeEqualToString('test("stroke-linejoin: 10px;")', '');
+            shouldBeEqualToString('test("stroke-linejoin: 10%;")', '');
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/css/parsing-stroke-width-expected.txt b/LayoutTests/fast/css/parsing-stroke-width-expected.txt
new file mode 100644 (file)
index 0000000..a58e3a9
--- /dev/null
@@ -0,0 +1,19 @@
+This tests checks that all of the input values for stroke-width parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testComputedStyleInherited("stroke-width: 4px;") is "4px"
+FAIL testComputedStyleInherited("stroke-width: 0.01em;") should be 0.01em. Was 0.1599999964237213px.
+PASS testComputedStyleInherited("stroke-width: 10%;") is "10%"
+PASS testComputedStyle(";") is "1px"
+PASS test("stroke-width: 4px;") is "4px"
+PASS test("stroke-width: 0.01em;") is "0.01em"
+PASS test("stroke-width: 10%;") is "10%"
+PASS test("stroke-width: 4;") is "4px"
+PASS test("stroke-width: em;") is ""
+PASS test("stroke-width: %;") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/parsing-stroke-width.html b/LayoutTests/fast/css/parsing-stroke-width.html
new file mode 100644 (file)
index 0000000..76ce1ed
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+        <script>
+            description("This tests checks that all of the input values for stroke-width parse correctly.");
+
+            function test(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = div.style.getPropertyValue("stroke-width");
+                
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyle(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div).strokeWidth;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            function testComputedStyleInherited(value)
+            {
+                var div = document.createElement("div");
+                div.setAttribute("style", value);
+
+                var div2 = document.createElement("div");
+                div.appendChild(div2);
+                
+                document.body.appendChild(div);
+
+                var result = window.getComputedStyle(div2).strokeWidth;
+                document.body.removeChild(div);
+                return result;
+            }
+
+            shouldBe('testComputedStyleInherited("stroke-width: 4px;")', '"4px"');
+            shouldBe('testComputedStyleInherited("stroke-width: 0.01em;")', '"0.01em"');
+            shouldBe('testComputedStyleInherited("stroke-width: 10%;")', '"10%"');
+
+            shouldBe('testComputedStyle(";")', '"1px"');
+            shouldBe('test("stroke-width: 4px;")', '"4px"');
+            shouldBe('test("stroke-width: 0.01em;")', '"0.01em"');
+            shouldBe('test("stroke-width: 10%;")', '"10%"');
+            
+            shouldBeEqualToString('test("stroke-width: 4;")', '4px');
+            shouldBeEqualToString('test("stroke-width: em;")', '');
+            shouldBeEqualToString('test("stroke-width: %;")', '');
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
index c91bf06..b170e83 100644 (file)
@@ -4,5 +4,8 @@ EVENT(canplaythrough)
 EVENT(seeked)
 EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).webkitTextStrokeWidth == '4px') OK
 EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).webkitTextStrokeColor == 'rgb(0, 0, 0)') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).paintOrder == 'stroke') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).strokeLinejoin == 'round') OK
+EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).strokeLinecap == 'round') OK
 END OF TEST
 
index ee37bd8..618d064 100644 (file)
@@ -9,7 +9,7 @@
 
         <style>
 
-        video::cue { -webkit-text-stroke: 4px black; }
+        video::cue { -webkit-text-stroke: 4px black; paint-order: stroke; stroke-linecap: round; stroke-linejoin: round;}
 
         </style>
 
@@ -19,6 +19,9 @@
         {
             testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).webkitTextStrokeWidth", "4px");
             testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).webkitTextStrokeColor", "rgb(0, 0, 0)");
+            testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).paintOrder", "stroke");
+            testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).strokeLinejoin", "round");
+            testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).strokeLinecap", "round");
             endTest();
         }
 
index 2c5acf2..5f13541 100644 (file)
@@ -1,3 +1,107 @@
+2017-02-17  Per Arne Vollan  <pvollan@apple.com>
+
+        Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
+        https://bugs.webkit.org/show_bug.cgi?id=168044
+        rdar://problem/30165746
+
+        Reviewed by Simon Fraser.
+
+        This patch moves these styles out of svg, and sets the properties on video cues.
+
+        Tests: fast/css/parsing-paint-order.html
+               fast/css/parsing-stroke-linecap.html
+               fast/css/parsing-stroke-linejoin.html
+               fast/css/parsing-stroke-width.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::paintOrder):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSProperties.json:
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::svgPropertyValue):
+        (WebCore::paintOrder): Deleted.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::isValidCueStyleProperty):
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        (WebCore::RenderStyle::paintTypesForPaintOrder):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setPaintOrder):
+        (WebCore::RenderStyle::paintOrder):
+        (WebCore::RenderStyle::initialPaintOrder):
+        (WebCore::RenderStyle::setCapStyle):
+        (WebCore::RenderStyle::capStyle):
+        (WebCore::RenderStyle::initialCapStyle):
+        (WebCore::RenderStyle::setJoinStyle):
+        (WebCore::RenderStyle::joinStyle):
+        (WebCore::RenderStyle::initialJoinStyle):
+        (WebCore::RenderStyle::strokeWidth):
+        (WebCore::RenderStyle::setStrokeWidth):
+        (WebCore::RenderStyle::hasVisibleStroke):
+        (WebCore::RenderStyle::setStrokeOpacity):
+        * rendering/style/SVGRenderStyle.cpp:
+        (WebCore::SVGRenderStyle::diff):
+        (WebCore::SVGRenderStyle::paintTypesForPaintOrder): Deleted.
+        * rendering/style/SVGRenderStyle.h:
+        (WebCore::SVGRenderStyle::initialBufferedRendering):
+        (WebCore::SVGRenderStyle::initialFillRule):
+        (WebCore::SVGRenderStyle::initialMaskType):
+        (WebCore::SVGRenderStyle::setBufferedRendering):
+        (WebCore::SVGRenderStyle::setFillRule):
+        (WebCore::SVGRenderStyle::setMaskType):
+        (WebCore::SVGRenderStyle::bufferedRendering):
+        (WebCore::SVGRenderStyle::fillRule):
+        (WebCore::SVGRenderStyle::strokeMiterLimit):
+        (WebCore::SVGRenderStyle::maskType):
+        (WebCore::SVGRenderStyle::hasStroke):
+        (WebCore::SVGRenderStyle::setBitDefaults):
+        (WebCore::SVGRenderStyle::InheritedFlags::operator==):
+        (WebCore::SVGRenderStyle::initialCapStyle): Deleted.
+        (WebCore::SVGRenderStyle::initialJoinStyle): Deleted.
+        (WebCore::SVGRenderStyle::initialPaintOrder): Deleted.
+        (WebCore::SVGRenderStyle::setCapStyle): Deleted.
+        (WebCore::SVGRenderStyle::setJoinStyle): Deleted.
+        (WebCore::SVGRenderStyle::setPaintOrder): Deleted.
+        (WebCore::SVGRenderStyle::capStyle): Deleted.
+        (WebCore::SVGRenderStyle::joinStyle): Deleted.
+        (WebCore::SVGRenderStyle::strokeWidth): Deleted.
+        (WebCore::SVGRenderStyle::paintOrder): Deleted.
+        (WebCore::SVGRenderStyle::hasVisibleStroke): Deleted.
+        (WebCore::SVGRenderStyle::setStrokeWidth): Deleted.
+        * rendering/style/SVGRenderStyleDefs.cpp:
+        (WebCore::StyleStrokeData::StyleStrokeData):
+        (WebCore::StyleStrokeData::operator==):
+        * rendering/style/SVGRenderStyleDefs.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        * rendering/style/StyleRareInheritedData.h:
+        * rendering/svg/RenderSVGEllipse.cpp:
+        (WebCore::RenderSVGEllipse::strokeShape):
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::RenderSVGPath::strokeShape):
+        (WebCore::RenderSVGPath::shapeDependentStrokeContains):
+        (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
+        (WebCore::RenderSVGPath::zeroLengthLinecapPath):
+        * rendering/svg/RenderSVGRect.cpp:
+        (WebCore::RenderSVGRect::strokeShape):
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::strokeShape):
+        (WebCore::RenderSVGShape::fillStrokeMarkers):
+        (WebCore::RenderSVGShape::strokeWidth):
+        (WebCore::RenderSVGShape::hasSmoothStroke):
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::strokeBoundingBox):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::paint):
+        (WebCore::SVGInlineTextBox::paintDecoration):
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writeStyle):
+
 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [SOUP] Handle Settings::allowsAnySSLCertificate() in SSL sockets
index e38b54f..625961e 100644 (file)
@@ -2479,6 +2479,41 @@ static Ref<CSSValueList> valueForContentPositionAndDistributionWithOverflowAlign
     return result;
 }
 
+static Ref<CSSValue> paintOrder(PaintOrder paintOrder)
+{
+    if (paintOrder == PaintOrderNormal)
+        return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
+    
+    auto paintOrderList = CSSValueList::createSpaceSeparated();
+    switch (paintOrder) {
+    case PaintOrderNormal:
+        ASSERT_NOT_REACHED();
+        break;
+    case PaintOrderFill:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+        break;
+    case PaintOrderFillMarkers:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+        break;
+    case PaintOrderStroke:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+        break;
+    case PaintOrderStrokeMarkers:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+        break;
+    case PaintOrderMarkers:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+        break;
+    case PaintOrderMarkersStroke:
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+        break;
+    }
+    return WTFMove(paintOrderList);
+}
+
 inline static bool isFlexOrGrid(ContainerNode* element)
 {
     return element && element->computedStyle() && element->computedStyle()->isDisplayFlexibleOrGridBox();
@@ -3806,8 +3841,6 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             return zoomAdjustedPixelValueForLength(style->svgStyle().rx(), *style);
         case CSSPropertyRy:
             return zoomAdjustedPixelValueForLength(style->svgStyle().ry(), *style);
-        case CSSPropertyStrokeWidth:
-            return zoomAdjustedPixelValueForLength(style->svgStyle().strokeWidth(), *style);
         case CSSPropertyStrokeDashoffset:
             return zoomAdjustedPixelValueForLength(style->svgStyle().strokeDashOffset(), *style);
         case CSSPropertyX:
@@ -3817,6 +3850,15 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyWebkitTextZoom:
             return cssValuePool.createValue(style->textZoom());
 
+        case CSSPropertyPaintOrder:
+            return paintOrder(style->paintOrder());
+        case CSSPropertyStrokeLinecap:
+            return CSSPrimitiveValue::create(style->capStyle());
+        case CSSPropertyStrokeLinejoin:
+            return CSSPrimitiveValue::create(style->joinStyle());
+        case CSSPropertyStrokeWidth:
+            return zoomAdjustedPixelValueForLength(style->strokeWidth(), *style);
+
         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
         case CSSPropertyAll:
         case CSSPropertyAnimation:
@@ -3930,12 +3972,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyMarkerMid:
         case CSSPropertyMarkerStart:
         case CSSPropertyMaskType:
-        case CSSPropertyPaintOrder:
         case CSSPropertyShapeRendering:
         case CSSPropertyStroke:
         case CSSPropertyStrokeDasharray:
-        case CSSPropertyStrokeLinecap:
-        case CSSPropertyStrokeLinejoin:
         case CSSPropertyStrokeMiterlimit:
         case CSSPropertyStrokeOpacity:
         case CSSPropertyAlignmentBaseline:
index 3ce5848..50920af 100644 (file)
         },
         "paint-order": {
             "codegen-properties": {
-                "converter": "PaintOrder",
-                "svg": true
+                "converter": "PaintOrder"
             }
         },
         "pointer-events": {
                 "square"
             ],
             "codegen-properties": {
-                "name-for-methods": "CapStyle",
-                "svg": true
+                "name-for-methods": "CapStyle"
             }
         },
         "stroke-linejoin": {
                 "bevel"
             ],
             "codegen-properties": {
-                "name-for-methods": "JoinStyle",
-                "svg": true
+                "name-for-methods": "JoinStyle"
             }
         },
         "stroke-miterlimit": {
index d769a5a..8217efb 100644 (file)
 
 namespace WebCore {
 
-static Ref<CSSValue> paintOrder(PaintOrder paintOrder)
-{
-    if (paintOrder == PaintOrderNormal)
-        return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
-
-    auto paintOrderList = CSSValueList::createSpaceSeparated();
-    switch (paintOrder) {
-    case PaintOrderNormal:
-        ASSERT_NOT_REACHED();
-        break;
-    case PaintOrderFill:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
-        break;
-    case PaintOrderFillMarkers:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
-        break;
-    case PaintOrderStroke:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
-        break;
-    case PaintOrderStrokeMarkers:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
-        break;
-    case PaintOrderMarkers:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
-        break;
-    case PaintOrderMarkersStroke:
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
-        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
-        break;
-    }
-    return WTFMove(paintOrderList);
-}
-
 static RefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphOrientation orientation)
 {
     switch (orientation) {
@@ -148,10 +113,6 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
             return CSSPrimitiveValue::create(svgStyle.colorRendering());
         case CSSPropertyShapeRendering:
             return CSSPrimitiveValue::create(svgStyle.shapeRendering());
-        case CSSPropertyStrokeLinecap:
-            return CSSPrimitiveValue::create(svgStyle.capStyle());
-        case CSSPropertyStrokeLinejoin:
-            return CSSPrimitiveValue::create(svgStyle.joinStyle());
         case CSSPropertyStrokeMiterlimit:
             return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER);
         case CSSPropertyStrokeOpacity:
@@ -229,8 +190,6 @@ RefPtr<CSSValue> ComputedStyleExtractor::svgPropertyValue(CSSPropertyID property
             return CSSPrimitiveValue::create(svgStyle.vectorEffect());
         case CSSPropertyMaskType:
             return CSSPrimitiveValue::create(svgStyle.maskType());
-        case CSSPropertyPaintOrder:
-            return paintOrder(svgStyle.paintOrder());
         case CSSPropertyMarker:
         case CSSPropertyEnableBackground:
         case CSSPropertyColorProfile:
index d17e298..25d9039 100644 (file)
@@ -1499,6 +1499,9 @@ inline bool StyleResolver::isValidCueStyleProperty(CSSPropertyID id)
     case CSSPropertyTextDecoration:
     case CSSPropertyTextShadow:
     case CSSPropertyBorderStyle:
+    case CSSPropertyPaintOrder:
+    case CSSPropertyStrokeLinejoin:
+    case CSSPropertyStrokeLinecap:
     case CSSPropertyWebkitTextStrokeColor:
     case CSSPropertyWebkitTextStrokeWidth:
         return true;
index 50cf0e5..117143b 100644 (file)
@@ -368,6 +368,11 @@ String CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor(CSSPropertyID
     if (important)
         builder.appendLiteral(" !important");
     builder.append(';');
+    if (id == CSSPropertyWebkitTextStroke) {
+        builder.append(" paint-order: stroke;");
+        builder.append(" stroke-linejoin: round;");
+        builder.append(" stroke-linecap: round;");
+    }
     
     return builder.toString();
 }
index 8fe82e1..53ea334 100644 (file)
@@ -914,6 +914,12 @@ StyleDifference RenderStyle::diff(const RenderStyle& other, unsigned& changedCon
             return svgChange;
     }
 
+    // These properties affect the cached stroke bounding box rects.
+    if (m_rareInheritedData->capStyle != other.m_rareInheritedData->capStyle
+        || m_rareInheritedData->joinStyle != other.m_rareInheritedData->joinStyle
+        || m_rareInheritedData->strokeWidth != other.m_rareInheritedData->strokeWidth)
+        return StyleDifferenceLayout;
+
     if (changeRequiresLayout(other, changedContextSensitiveProperties))
         return StyleDifferenceLayout;
 
@@ -2217,4 +2223,45 @@ void RenderStyle::setDashboardRegion(int type, const String& label, Length&& top
 
 #endif
 
+Vector<PaintType, 3> RenderStyle::paintTypesForPaintOrder() const
+{
+    Vector<PaintType, 3> paintOrder;
+    switch (this->paintOrder()) {
+    case PaintOrderNormal:
+        FALLTHROUGH;
+    case PaintOrderFill:
+        paintOrder.append(PaintTypeFill);
+        paintOrder.append(PaintTypeStroke);
+        paintOrder.append(PaintTypeMarkers);
+        break;
+    case PaintOrderFillMarkers:
+        paintOrder.append(PaintTypeFill);
+        paintOrder.append(PaintTypeMarkers);
+        paintOrder.append(PaintTypeStroke);
+        break;
+    case PaintOrderStroke:
+        paintOrder.append(PaintTypeStroke);
+        paintOrder.append(PaintTypeFill);
+        paintOrder.append(PaintTypeMarkers);
+        break;
+    case PaintOrderStrokeMarkers:
+        paintOrder.append(PaintTypeStroke);
+        paintOrder.append(PaintTypeMarkers);
+        paintOrder.append(PaintTypeFill);
+        break;
+    case PaintOrderMarkers:
+        paintOrder.append(PaintTypeMarkers);
+        paintOrder.append(PaintTypeFill);
+        paintOrder.append(PaintTypeStroke);
+        break;
+    case PaintOrderMarkersStroke:
+        paintOrder.append(PaintTypeMarkers);
+        paintOrder.append(PaintTypeStroke);
+        paintOrder.append(PaintTypeFill);
+        break;
+    };
+    return paintOrder;
+}
+
+
 } // namespace WebCore
index 99c1547..c643593 100644 (file)
@@ -1242,6 +1242,25 @@ public:
     void setApplePayButtonType(ApplePayButtonType type) { SET_VAR(m_rareNonInheritedData, applePayButtonType, static_cast<unsigned>(type)); }
 #endif
 
+    // Support for paint-order, stroke-linecap, and stroke-linejoin from https://drafts.fxtf.org/paint/.
+    void setPaintOrder(PaintOrder order) { SET_VAR(m_rareInheritedData, paintOrder, order); }
+    PaintOrder paintOrder() const { return static_cast<PaintOrder>(m_rareInheritedData->paintOrder); }
+    static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
+    Vector<PaintType, 3> paintTypesForPaintOrder() const;
+    
+    void setCapStyle(LineCap val) { SET_VAR(m_rareInheritedData, capStyle, val); }
+    LineCap capStyle() const { return static_cast<LineCap>(m_rareInheritedData->capStyle); }
+    static LineCap initialCapStyle() { return ButtCap; }
+    
+    void setJoinStyle(LineJoin val) { SET_VAR(m_rareInheritedData, joinStyle, val); }
+    LineJoin joinStyle() const { return static_cast<LineJoin>(m_rareInheritedData->joinStyle); }
+    static LineJoin initialJoinStyle() { return MiterJoin; }
+    
+    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(); }
+
+    
     const SVGRenderStyle& svgStyle() const { return m_svgStyle; }
     SVGRenderStyle& accessSVGStyle() { return m_svgStyle.access(); }
 
@@ -1256,8 +1275,6 @@ public:
     void setStrokePaintColor(const Color& color) { accessSVGStyle().setStrokePaint(SVG_PAINTTYPE_RGBCOLOR, color, emptyString()); }
     float strokeOpacity() const { return svgStyle().strokeOpacity(); }
     void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
-    const Length& strokeWidth() const { return svgStyle().strokeWidth(); }
-    void setStrokeWidth(Length&& w) { accessSVGStyle().setStrokeWidth(WTFMove(w)); }
     Vector<SVGLengthValue> strokeDashArray() const { return svgStyle().strokeDashArray(); }
     void setStrokeDashArray(Vector<SVGLengthValue> array) { accessSVGStyle().setStrokeDashArray(array); }
     const Length& strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
index e468f89..c8e55b4 100644 (file)
@@ -145,46 +145,6 @@ void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle& other)
     m_nonInheritedResourceData = other.m_nonInheritedResourceData;
 }
 
-Vector<PaintType, 3> SVGRenderStyle::paintTypesForPaintOrder() const
-{
-    Vector<PaintType, 3> paintOrder;
-    switch (this->paintOrder()) {
-    case PaintOrderNormal:
-        FALLTHROUGH;
-    case PaintOrderFill:
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeMarkers);
-        break;
-    case PaintOrderFillMarkers:
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeStroke);
-        break;
-    case PaintOrderStroke:
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeMarkers);
-        break;
-    case PaintOrderStrokeMarkers:
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeFill);
-        break;
-    case PaintOrderMarkers:
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeFill);
-        paintOrder.append(PaintTypeStroke);
-        break;
-    case PaintOrderMarkersStroke:
-        paintOrder.append(PaintTypeMarkers);
-        paintOrder.append(PaintTypeStroke);
-        paintOrder.append(PaintTypeFill);
-        break;
-    };
-    return paintOrder;
-}
-
 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle& other) const
 {
     // NOTE: All comparisions that may return StyleDifferenceLayout have to go before those who return StyleDifferenceRepaint
@@ -215,11 +175,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle& other) const
     if (miscNotEqual && m_miscData->baselineShiftValue != other.m_miscData->baselineShiftValue)
         return StyleDifferenceLayout;
 
-    // These properties affect the cached stroke bounding box rects.
-    if (m_inheritedFlags.capStyle != other.m_inheritedFlags.capStyle
-        || m_inheritedFlags.joinStyle != other.m_inheritedFlags.joinStyle)
-        return StyleDifferenceLayout;
-
     // Shadow changes require relayouts, as they affect the repaint rects.
     if (m_shadowData != other.m_shadowData)
         return StyleDifferenceLayout;
@@ -230,8 +185,7 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle& other) const
 
     // Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated.
     if (m_strokeData != other.m_strokeData) {
-        if (m_strokeData->width != other.m_strokeData->width
-            || m_strokeData->paintType != other.m_strokeData->paintType
+        if (m_strokeData->paintType != other.m_strokeData->paintType
             || m_strokeData->paintColor != other.m_strokeData->paintColor
             || m_strokeData->paintUri != other.m_strokeData->paintUri
             || m_strokeData->miterLimit != other.m_strokeData->miterLimit
index 669a2c0..24b5e6f 100644 (file)
@@ -53,13 +53,11 @@ public:
     static EBaselineShift initialBaselineShift() { return BS_BASELINE; }
     static EVectorEffect initialVectorEffect() { return VE_NONE; }
     static EBufferedRendering initialBufferedRendering() { return BR_AUTO; }
-    static LineCap initialCapStyle() { return ButtCap; }
     static WindRule initialClipRule() { return RULE_NONZERO; }
     static EColorInterpolation initialColorInterpolation() { return CI_SRGB; }
     static EColorInterpolation initialColorInterpolationFilters() { return CI_LINEARRGB; }
     static EColorRendering initialColorRendering() { return CR_AUTO; }
     static WindRule initialFillRule() { return RULE_NONZERO; }
-    static LineJoin initialJoinStyle() { return MiterJoin; }
     static EShapeRendering initialShapeRendering() { return SR_AUTO; }
     static ETextAnchor initialTextAnchor() { return TA_START; }
     static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DEG; }
@@ -86,7 +84,6 @@ public:
     static String initialMarkerMidResource() { return String(); }
     static String initialMarkerEndResource() { return String(); }
     static EMaskType initialMaskType() { return MT_LUMINANCE; }
-    static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
     static SVGLengthValue initialBaselineShiftValue();
     static SVGLengthValue initialKerning();
 
@@ -96,19 +93,16 @@ public:
     void setBaselineShift(EBaselineShift val) { m_nonInheritedFlags.flagBits.baselineShift = val; }
     void setVectorEffect(EVectorEffect val) { m_nonInheritedFlags.flagBits.vectorEffect = val; }
     void setBufferedRendering(EBufferedRendering val) { m_nonInheritedFlags.flagBits.bufferedRendering = val; }
-    void setCapStyle(LineCap val) { m_inheritedFlags.capStyle = val; }
     void setClipRule(WindRule val) { m_inheritedFlags.clipRule = val; }
     void setColorInterpolation(EColorInterpolation val) { m_inheritedFlags.colorInterpolation = val; }
     void setColorInterpolationFilters(EColorInterpolation val) { m_inheritedFlags.colorInterpolationFilters = val; }
     void setColorRendering(EColorRendering val) { m_inheritedFlags.colorRendering = val; }
     void setFillRule(WindRule val) { m_inheritedFlags.fillRule = val; }
-    void setJoinStyle(LineJoin val) { m_inheritedFlags.joinStyle = val; }
     void setShapeRendering(EShapeRendering val) { m_inheritedFlags.shapeRendering = val; }
     void setTextAnchor(ETextAnchor val) { m_inheritedFlags.textAnchor = val; }
     void setGlyphOrientationHorizontal(EGlyphOrientation val) { m_inheritedFlags.glyphOrientationHorizontal = val; }
     void setGlyphOrientationVertical(EGlyphOrientation val) { m_inheritedFlags.glyphOrientationVertical = val; }
     void setMaskType(EMaskType val) { m_nonInheritedFlags.flagBits.maskType = val; }
-    void setPaintOrder(PaintOrder val) { m_inheritedFlags.paintOrder = val; }
     void setCx(const Length&);
     void setCy(const Length&);
     void setR(const Length&);
@@ -123,7 +117,6 @@ public:
 
     void setStrokeDashArray(const Vector<SVGLengthValue>&);
     void setStrokeMiterLimit(float);
-    void setStrokeWidth(const Length&);
     void setStrokeDashOffset(const Length&);
     void setKerning(const SVGLengthValue&);
     void setStopOpacity(float);
@@ -150,13 +143,11 @@ public:
     EBaselineShift baselineShift() const { return (EBaselineShift) m_nonInheritedFlags.flagBits.baselineShift; }
     EVectorEffect vectorEffect() const { return (EVectorEffect) m_nonInheritedFlags.flagBits.vectorEffect; }
     EBufferedRendering bufferedRendering() const { return (EBufferedRendering) m_nonInheritedFlags.flagBits.bufferedRendering; }
-    LineCap capStyle() const { return (LineCap) m_inheritedFlags.capStyle; }
     WindRule clipRule() const { return (WindRule) m_inheritedFlags.clipRule; }
     EColorInterpolation colorInterpolation() const { return (EColorInterpolation) m_inheritedFlags.colorInterpolation; }
     EColorInterpolation colorInterpolationFilters() const { return (EColorInterpolation) m_inheritedFlags.colorInterpolationFilters; }
     EColorRendering colorRendering() const { return (EColorRendering) m_inheritedFlags.colorRendering; }
     WindRule fillRule() const { return (WindRule) m_inheritedFlags.fillRule; }
-    LineJoin joinStyle() const { return (LineJoin) m_inheritedFlags.joinStyle; }
     EShapeRendering shapeRendering() const { return (EShapeRendering) m_inheritedFlags.shapeRendering; }
     ETextAnchor textAnchor() const { return (ETextAnchor) m_inheritedFlags.textAnchor; }
     EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrientation) m_inheritedFlags.glyphOrientationHorizontal; }
@@ -171,7 +162,6 @@ public:
     const String& strokePaintUri() const { return m_strokeData->paintUri; }
     Vector<SVGLengthValue> strokeDashArray() const { return m_strokeData->dashArray; }
     float strokeMiterLimit() const { return m_strokeData->miterLimit; }
-    const Length& strokeWidth() const { return m_strokeData->width; }
     const Length& strokeDashOffset() const { return m_strokeData->dashOffset; }
     SVGLengthValue kerning() const { return m_textData->kerning; }
     float stopOpacity() const { return m_stopData->opacity; }
@@ -194,8 +184,6 @@ public:
     const String& markerMidResource() const { return m_inheritedResourceData->markerMid; }
     const String& markerEndResource() const { return m_inheritedResourceData->markerEnd; }
     EMaskType maskType() const { return (EMaskType) m_nonInheritedFlags.flagBits.maskType; }
-    PaintOrder paintOrder() const { return (PaintOrder) m_inheritedFlags.paintOrder; }
-    Vector<PaintType, 3> paintTypesForPaintOrder() const;
 
     const SVGPaintType& visitedLinkFillPaintType() const { return m_fillData->visitedLinkPaintType; }
     const Color& visitedLinkFillPaintColor() const { return m_fillData->visitedLinkPaintColor; }
@@ -209,7 +197,6 @@ public:
     bool hasMasker() const { return !maskerResource().isEmpty(); }
     bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); }
     bool hasStroke() const { return strokePaintType() != SVG_PAINTTYPE_NONE; }
-    bool hasVisibleStroke() const { return hasStroke() && !strokeWidth().isZero(); }
     bool hasFill() const { return fillPaintType() != SVG_PAINTTYPE_NONE; }
     bool isolatesBlending() const { return hasMasker() || shadow(); }
 
@@ -230,14 +217,11 @@ private:
         unsigned shapeRendering : 2; // EShapeRendering
         unsigned clipRule : 1; // WindRule
         unsigned fillRule : 1; // WindRule
-        unsigned capStyle : 2; // LineCap
-        unsigned joinStyle : 2; // LineJoin
         unsigned textAnchor : 2; // ETextAnchor
         unsigned colorInterpolation : 2; // EColorInterpolation
         unsigned colorInterpolationFilters : 2; // EColorInterpolation
         unsigned glyphOrientationHorizontal : 3; // EGlyphOrientation
         unsigned glyphOrientationVertical : 3; // EGlyphOrientation
-        unsigned paintOrder : 3; // PaintOrder
     };
 
     struct NonInheritedFlags {
@@ -396,12 +380,6 @@ inline void SVGRenderStyle::setStrokeMiterLimit(float limit)
         m_strokeData.access().miterLimit = limit;
 }
 
-inline void SVGRenderStyle::setStrokeWidth(const Length& width)
-{
-    if (!(m_strokeData->width == width))
-        m_strokeData.access().width = width;
-}
-
 inline void SVGRenderStyle::setStrokeDashOffset(const Length& offset)
 {
     if (!(m_strokeData->dashOffset == offset))
@@ -487,13 +465,10 @@ inline void SVGRenderStyle::setBitDefaults()
     m_inheritedFlags.fillRule = initialFillRule();
     m_inheritedFlags.shapeRendering = initialShapeRendering();
     m_inheritedFlags.textAnchor = initialTextAnchor();
-    m_inheritedFlags.capStyle = initialCapStyle();
-    m_inheritedFlags.joinStyle = initialJoinStyle();
     m_inheritedFlags.colorInterpolation = initialColorInterpolation();
     m_inheritedFlags.colorInterpolationFilters = initialColorInterpolationFilters();
     m_inheritedFlags.glyphOrientationHorizontal = initialGlyphOrientationHorizontal();
     m_inheritedFlags.glyphOrientationVertical = initialGlyphOrientationVertical();
-    m_inheritedFlags.paintOrder = initialPaintOrder();
 
     m_nonInheritedFlags.flags = 0;
     m_nonInheritedFlags.flagBits.alignmentBaseline = initialAlignmentBaseline();
@@ -510,14 +485,11 @@ inline bool SVGRenderStyle::InheritedFlags::operator==(const InheritedFlags& oth
         && shapeRendering == other.shapeRendering
         && clipRule == other.clipRule
         && fillRule == other.fillRule
-        && capStyle == other.capStyle
-        && joinStyle == other.joinStyle
         && textAnchor == other.textAnchor
         && colorInterpolation == other.colorInterpolation
         && colorInterpolationFilters == other.colorInterpolationFilters
         && glyphOrientationHorizontal == other.glyphOrientationHorizontal
-        && glyphOrientationVertical == other.glyphOrientationVertical
-        && paintOrder == other.paintOrder;
+        && glyphOrientationVertical == other.glyphOrientationVertical;
 }
 
 } // namespace WebCore
index 20ded8b..9f023e5 100644 (file)
@@ -77,7 +77,6 @@ bool StyleFillData::operator==(const StyleFillData& other) const
 StyleStrokeData::StyleStrokeData()
     : opacity(SVGRenderStyle::initialStrokeOpacity())
     , miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
-    , width(RenderStyle::initialOneLength())
     , dashOffset(RenderStyle::initialZeroLength())
     , dashArray(SVGRenderStyle::initialStrokeDashArray())
     , paintType(SVGRenderStyle::initialStrokePaintType())
@@ -93,7 +92,6 @@ inline StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
     : RefCounted<StyleStrokeData>()
     , opacity(other.opacity)
     , miterLimit(other.miterLimit)
-    , width(other.width)
     , dashOffset(other.dashOffset)
     , dashArray(other.dashArray)
     , paintType(other.paintType)
@@ -112,8 +110,7 @@ Ref<StyleStrokeData> StyleStrokeData::copy() const
 
 bool StyleStrokeData::operator==(const StyleStrokeData& other) const
 {
-    return width == other.width
-        && opacity == other.opacity
+    return opacity == other.opacity
         && miterLimit == other.miterLimit
         && dashOffset == other.dashOffset
         && dashArray == other.dashArray
index 3adbd26..7d39228 100644 (file)
@@ -156,7 +156,6 @@ namespace WebCore {
         float opacity;
         float miterLimit;
 
-        Length width;
         Length dashOffset;
         Vector<SVGLengthValue> dashArray;
 
index fc605d4..7eb5c3c 100644 (file)
@@ -125,6 +125,10 @@ StyleRareInheritedData::StyleRareInheritedData()
     , trailingWord(static_cast<unsigned>(RenderStyle::initialTrailingWord()))
 #endif
     , hangingPunctuation(RenderStyle::initialHangingPunctuation())
+    , paintOrder(RenderStyle::initialPaintOrder())
+    , capStyle(RenderStyle::initialCapStyle())
+    , joinStyle(RenderStyle::initialJoinStyle())
+    , strokeWidth(RenderStyle::initialOneLength())
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
     , hyphenationLimitLines(-1)
@@ -207,6 +211,10 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
     , trailingWord(o.trailingWord)
 #endif
     , hangingPunctuation(o.hangingPunctuation)
+    , paintOrder(o.paintOrder)
+    , capStyle(o.capStyle)
+    , joinStyle(o.joinStyle)
+    , strokeWidth(o.strokeWidth)
     , hyphenationString(o.hyphenationString)
     , hyphenationLimitBefore(o.hyphenationLimitBefore)
     , hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -313,6 +321,10 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && trailingWord == o.trailingWord
 #endif
         && hangingPunctuation == o.hangingPunctuation
+        && paintOrder == o.paintOrder
+        && capStyle == o.capStyle
+        && joinStyle == o.joinStyle
+        && strokeWidth == o.strokeWidth
         && customProperties == o.customProperties
         && arePointingToEqualData(listStyleImage, o.listStyleImage);
 }
index 2ff27c9..963c367 100644 (file)
@@ -136,6 +136,11 @@ public:
 
     unsigned hangingPunctuation : 4;
 
+    unsigned paintOrder : 3; // PaintOrder
+    unsigned capStyle : 2; // LineCap
+    unsigned joinStyle : 2; // LineJoin
+    Length strokeWidth;
+    
     AtomicString hyphenationString;
     short hyphenationLimitBefore;
     short hyphenationLimitAfter;
index b14e513..4b6dd45 100644 (file)
@@ -103,7 +103,7 @@ void RenderSVGEllipse::fillShape(GraphicsContext& context) const
 
 void RenderSVGEllipse::strokeShape(GraphicsContext& context) const
 {
-    if (!style().svgStyle().hasVisibleStroke())
+    if (!style().hasVisibleStroke())
         return;
     if (m_usePathFallback) {
         RenderSVGShape::strokeShape(context);
index 7b4e095..208f11f 100644 (file)
@@ -76,7 +76,7 @@ static void useStrokeStyleToFill(GraphicsContext& context)
 
 void RenderSVGPath::strokeShape(GraphicsContext& context) const
 {
-    if (!style().svgStyle().hasVisibleStroke())
+    if (!style().hasVisibleStroke())
         return;
 
     RenderSVGShape::strokeShape(context);
@@ -105,15 +105,14 @@ bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point)
     if (RenderSVGShape::shapeDependentStrokeContains(point))
         return true;
 
-    const SVGRenderStyle& svgStyle = style().svgStyle();
     for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
-        ASSERT(svgStyle.hasStroke());
+        ASSERT(style().svgStyle().hasStroke());
         float strokeWidth = this->strokeWidth();
-        if (svgStyle.capStyle() == SquareCap) {
+        if (style().capStyle() == SquareCap) {
             if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point))
                 return true;
         } else {
-            ASSERT(svgStyle.capStyle() == RoundCap);
+            ASSERT(style().capStyle() == RoundCap);
             FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() -  m_zeroLengthLinecapLocations[i].y());
             if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
                 return true;
@@ -126,7 +125,7 @@ bool RenderSVGPath::shouldStrokeZeroLengthSubpath() const
 {
     // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
     // but shall be stroked if the "stroke-linecap" property has a value of round or square
-    return style().svgStyle().hasStroke() && style().svgStyle().capStyle() != ButtCap;
+    return style().svgStyle().hasStroke() && style().capStyle() != ButtCap;
 }
 
 Path* RenderSVGPath::zeroLengthLinecapPath(const FloatPoint& linecapPosition) const
@@ -134,7 +133,7 @@ Path* RenderSVGPath::zeroLengthLinecapPath(const FloatPoint& linecapPosition) co
     static NeverDestroyed<Path> tempPath;
 
     tempPath.get().clear();
-    if (style().svgStyle().capStyle() == SquareCap)
+    if (style().capStyle() == SquareCap)
         tempPath.get().addRect(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));
     else
         tempPath.get().addEllipse(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));
index 63698cd..2ceba5d 100644 (file)
@@ -120,7 +120,7 @@ void RenderSVGRect::fillShape(GraphicsContext& context) const
 
 void RenderSVGRect::strokeShape(GraphicsContext& context) const
 {
-    if (!style().svgStyle().hasVisibleStroke())
+    if (!style().hasVisibleStroke())
         return;
 
     if (m_usePathFallback) {
index 43ab7d8..d467340 100644 (file)
@@ -263,7 +263,7 @@ void RenderSVGShape::strokeShape(const RenderStyle& style, GraphicsContext& orig
 
 void RenderSVGShape::strokeShape(GraphicsContext& context)
 {
-    if (!style().svgStyle().hasVisibleStroke())
+    if (!style().hasVisibleStroke())
         return;
 
     GraphicsContextStateSaver stateSaver(context, false);
@@ -277,7 +277,7 @@ void RenderSVGShape::strokeShape(GraphicsContext& context)
 
 void RenderSVGShape::fillStrokeMarkers(PaintInfo& childPaintInfo)
 {
-    auto paintOrder = style().svgStyle().paintTypesForPaintOrder();
+    auto paintOrder = style().paintTypesForPaintOrder();
     for (unsigned i = 0; i < paintOrder.size(); ++i) {
         switch (paintOrder.at(i)) {
         case PaintTypeFill:
@@ -438,7 +438,7 @@ void RenderSVGShape::updateRepaintBoundingBox()
 float RenderSVGShape::strokeWidth() const
 {
     SVGLengthContext lengthContext(&graphicsElement());
-    return lengthContext.valueForLength(style().svgStyle().strokeWidth());
+    return lengthContext.valueForLength(style().strokeWidth());
 }
 
 bool RenderSVGShape::hasSmoothStroke() const
@@ -446,8 +446,8 @@ bool RenderSVGShape::hasSmoothStroke() const
     const SVGRenderStyle& svgStyle = style().svgStyle();
     return svgStyle.strokeDashArray().isEmpty()
         && svgStyle.strokeMiterLimit() == svgStyle.initialStrokeMiterLimit()
-        && svgStyle.joinStyle() == svgStyle.initialJoinStyle()
-        && svgStyle.capStyle() == svgStyle.initialCapStyle();
+        && style().joinStyle() == style().initialJoinStyle()
+        && style().capStyle() == style().initialCapStyle();
 }
 
 void RenderSVGShape::drawMarkers(PaintInfo& paintInfo)
index d3bb30d..a82c8d2 100644 (file)
@@ -502,7 +502,7 @@ FloatRect RenderSVGText::strokeBoundingBox() const
         return strokeBoundaries;
 
     SVGLengthContext lengthContext(&textElement());
-    strokeBoundaries.inflate(lengthContext.valueForLength(svgStyle.strokeWidth()));
+    strokeBoundaries.inflate(lengthContext.valueForLength(style().strokeWidth()));
     return strokeBoundaries;
 }
 
index b3fd415..e70f090 100644 (file)
@@ -260,7 +260,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
     const SVGRenderStyle& svgStyle = style.svgStyle();
 
     bool hasFill = svgStyle.hasFill();
-    bool hasVisibleStroke = svgStyle.hasVisibleStroke();
+    bool hasVisibleStroke = style.hasVisibleStroke();
 
     const RenderStyle* selectionStyle = &style;
     if (hasSelection && shouldPaintSelectionHighlight) {
@@ -271,7 +271,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
             if (!hasFill)
                 hasFill = svgSelectionStyle.hasFill();
             if (!hasVisibleStroke)
-                hasVisibleStroke = svgSelectionStyle.hasVisibleStroke();
+                hasVisibleStroke = selectionStyle->hasVisibleStroke();
         } else
             selectionStyle = &style;
     }
@@ -299,7 +299,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
         if (decorations & TextDecorationOverline)
             paintDecoration(paintInfo.context(), TextDecorationOverline, fragment);
 
-        auto paintOrder = style.svgStyle().paintTypesForPaintOrder();
+        auto paintOrder = style.paintTypesForPaintOrder();
         for (unsigned i = 0; i < paintOrder.size(); ++i) {
             switch (paintOrder.at(i)) {
             case PaintTypeFill:
@@ -489,7 +489,7 @@ void SVGInlineTextBox::paintDecoration(GraphicsContext& context, TextDecoration
     const SVGRenderStyle& svgDecorationStyle = decorationStyle.svgStyle();
 
     bool hasDecorationFill = svgDecorationStyle.hasFill();
-    bool hasVisibleDecorationStroke = svgDecorationStyle.hasVisibleStroke();
+    bool hasVisibleDecorationStroke = decorationStyle.hasVisibleStroke();
 
     if (hasDecorationFill) {
         m_paintingResourceMode = ApplyToFillMode;
index b782940..0113c70 100644 (file)
@@ -427,10 +427,10 @@ void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const
     const SVGRenderStyle& svgStyle = style.svgStyle();
 
     SVGLengthContext lengthContext(downcast<SVGElement>(renderer.element()));
-    context->setStrokeThickness(lengthContext.valueForLength(svgStyle.strokeWidth()));
-    context->setLineCap(svgStyle.capStyle());
-    context->setLineJoin(svgStyle.joinStyle());
-    if (svgStyle.joinStyle() == MiterJoin)
+    context->setStrokeThickness(lengthContext.valueForLength(style.strokeWidth()));
+    context->setLineCap(style.capStyle());
+    context->setLineJoin(style.joinStyle());
+    if (style.joinStyle() == MiterJoin)
         context->setMiterLimit(svgStyle.strokeMiterLimit());
 
     const Vector<SVGLengthValue>& dashes = svgStyle.strokeDashArray();
index 1619abc..8823bc6 100644 (file)
@@ -187,7 +187,7 @@ static void writeStyle(TextStream& ts, const RenderElement& renderer)
 
             SVGLengthContext lengthContext(&shape.graphicsElement());
             double dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset());
-            double strokeWidth = lengthContext.valueForLength(svgStyle.strokeWidth());
+            double strokeWidth = lengthContext.valueForLength(style.strokeWidth());
             const auto& dashes = svgStyle.strokeDashArray();
 
             DashArray dashArray;
@@ -197,8 +197,8 @@ static void writeStyle(TextStream& ts, const RenderElement& renderer)
             writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
             writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
             writeIfNotDefault(ts, "miter limit", svgStyle.strokeMiterLimit(), 4.0f);
-            writeIfNotDefault(ts, "line cap", svgStyle.capStyle(), ButtCap);
-            writeIfNotDefault(ts, "line join", svgStyle.joinStyle(), MiterJoin);
+            writeIfNotDefault(ts, "line cap", style.capStyle(), ButtCap);
+            writeIfNotDefault(ts, "line join", style.joinStyle(), MiterJoin);
             writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
             if (!dashArray.isEmpty())
                 writeNameValuePair(ts, "dash array", dashArray);