haikuwebkit/LayoutTests/fast/css/stroke-width.html

29 lines
698 B
HTML
Raw Permalink Normal View History

Implement stroke-width CSS property. https://bugs.webkit.org/show_bug.cgi?id=169273 Reviewed by Simon Fraser. Source/WebCore: Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/. Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been set, we fall back to the value of the -webkit-text-stroke-width property. Tests: fast/css/stroke-width-percent.html fast/css/stroke-width.html * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueStrokeWidth): (WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): (WebCore::InlineFlowBox::addTextBoxVisualOverflow): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::computeOverflow): * rendering/TextDecorationPainter.cpp: (WebCore::decorationColor): * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): (WebCore::computeTextSelectionPaintStyle): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::RenderStyle): (WebCore::RenderStyle::computedTextStrokeWidth): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setHasExplicitlySetStrokeWidth): (WebCore::RenderStyle::hasExplicitlySetStrokeWidth): (WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth): (WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth): (WebCore::RenderStyle::InheritedFlags::operator==): LayoutTests: * fast/css/stroke-width-expected.html: Added. * fast/css/stroke-width-percent-expected.html: Added. * fast/css/stroke-width-percent.html: Added. * fast/css/stroke-width.html: Added. Canonical link: https://commits.webkit.org/186391@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-09 09:51:04 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
div {
font-size: 80px;
color: gray;
text-shadow: none;
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: Canonical link: https://commits.webkit.org/195665@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-13 22:13:34 +00:00
stroke-color: blue;
display: inline;
Implement stroke-width CSS property. https://bugs.webkit.org/show_bug.cgi?id=169273 Reviewed by Simon Fraser. Source/WebCore: Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/. Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been set, we fall back to the value of the -webkit-text-stroke-width property. Tests: fast/css/stroke-width-percent.html fast/css/stroke-width.html * css/CSSProperties.json: * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueStrokeWidth): (WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): (WebCore::InlineFlowBox::addTextBoxVisualOverflow): * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::computeOverflow): * rendering/TextDecorationPainter.cpp: (WebCore::decorationColor): * rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle): (WebCore::computeTextSelectionPaintStyle): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::RenderStyle): (WebCore::RenderStyle::computedTextStrokeWidth): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setHasExplicitlySetStrokeWidth): (WebCore::RenderStyle::hasExplicitlySetStrokeWidth): (WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth): (WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth): (WebCore::RenderStyle::InheritedFlags::operator==): LayoutTests: * fast/css/stroke-width-expected.html: Added. * fast/css/stroke-width-percent-expected.html: Added. * fast/css/stroke-width-percent.html: Added. * fast/css/stroke-width.html: Added. Canonical link: https://commits.webkit.org/186391@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-09 09:51:04 +00:00
}
</style>
</head>
<body>
<div style="stroke-width: 25px;">&#x25fc;</div>
<div style="stroke-width: 0.2in;">&#x25fc;</div>
<div style="stroke-width: 2mm;">&#x25fc;</div>
<div style="stroke-width: 0.1cm;">&#x25fc;</div>
<div style="stroke-width: 25px;"><span>&#x25fc;</span></div>
<div style="stroke-width: 0.2in;"><span>&#x25fc;</span></div>
<div style="stroke-width: 2mm;"><span>&#x25fc;</span></div>
<div style="stroke-width: 0.1cm;"><span>&#x25fc;</span></div>
</body>
</html>