The css properties stroke-width/stroke-color and -webkit-text-stroke-width/-webkit...
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Nov 2017 22:13:34 +0000 (22:13 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Nov 2017 22:13:34 +0000 (22:13 +0000)
commit2a0cdb7ca2a28b609f92bcd6dc9d15d297d72781
tree0f8dd69acb0dfd9cd7043aa05e9a9e047123e80d
parent8aebc45bfcb7fe4d3ef989be54729a7e4d9b2568
The css properties stroke-width/stroke-color and -webkit-text-stroke-width/-webkit-text-stroke-color should not be mixed.
https://bugs.webkit.org/show_bug.cgi?id=174737

Reviewed by Antti Koivisto.

Source/WebCore:

Previously, the stroke width and stroke color would independently fall back to the -webkit-text-stroke-width and
-webkit-text-stroke-color values if stroke-width and/or stroke-color were not explicitly specified. This is
problematic, since we might end up mixing the new stroke properties with the legacy Webkit stroke properties.
The new strategy is to use the stroke-width and stroke-color value combination only if stroke-color has been
explicitly specified. This should work well, since there will be no visible stroke when specifying only
stroke-width (because stroke-color by default is transparent). We can then safely fall back to the legacy Webkit
stroke value combination. In the case where only stroke-color is specified, we should use the stroke-width/
stroke-color combination, since stroke-width by default is 1, and we will then have a visible stroke.

No new tests, existing tests have been updated to reflect behavior changes.

* rendering/TextDecorationPainter.cpp:
(WebCore::decorationColor):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
(WebCore::computeTextSelectionPaintStyle):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::computedStrokeWidth const):
(WebCore::RenderStyle::hasPositiveStrokeWidth const):
(WebCore::RenderStyle::computedStrokeColor const):
* rendering/style/RenderStyle.h:

LayoutTests:

* fast/css/stroke-color-expected.html:
* fast/css/stroke-color-fallback-expected.html:
* fast/css/stroke-color-fallback.html:
* fast/css/stroke-color.html:
* fast/css/stroke-width-expected.html:
* fast/css/stroke-width-fallback-expected.html:
* fast/css/stroke-width-fallback.html:
* fast/css/stroke-width.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/stroke-color-expected.html
LayoutTests/fast/css/stroke-color-fallback-expected.html
LayoutTests/fast/css/stroke-color-fallback.html
LayoutTests/fast/css/stroke-color.html
LayoutTests/fast/css/stroke-width-expected.html
LayoutTests/fast/css/stroke-width-fallback-expected.html
LayoutTests/fast/css/stroke-width-fallback.html
LayoutTests/fast/css/stroke-width.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/TextDecorationPainter.cpp
Source/WebCore/rendering/TextPaintStyle.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h