<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213634] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213634">213634</a></dd>
<dt>Author</dt> <dd>pvollan@apple.com</dd>
<dt>Date</dt> <dd>2017-03-09 01:51:04 -0800 (Thu, 09 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSPropertiesjson">trunk/Source/WebCore/css/CSSProperties.json</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderCustomh">trunk/Source/WebCore/css/StyleBuilderCustom.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxcpp">trunk/Source/WebCore/rendering/InlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutFunctionscpp">trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextDecorationPaintercpp">trunk/Source/WebCore/rendering/TextDecorationPainter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintStylecpp">trunk/Source/WebCore/rendering/TextPaintStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareInheritedDatacpp">trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareInheritedDatah">trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssstrokewidthexpectedhtml">trunk/LayoutTests/fast/css/stroke-width-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcssstrokewidthpercentexpectedhtml">trunk/LayoutTests/fast/css/stroke-width-percent-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcssstrokewidthpercenthtml">trunk/LayoutTests/fast/css/stroke-width-percent.html</a></li>
<li><a href="#trunkLayoutTestsfastcssstrokewidthhtml">trunk/LayoutTests/fast/css/stroke-width.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/LayoutTests/ChangeLog        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-08 Per Arne Vollan <pvollan@apple.com>
+
+ Implement stroke-width CSS property.
+ https://bugs.webkit.org/show_bug.cgi?id=169273
+
+ Reviewed by Simon Fraser.
+
+ * 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.
+
</ins><span class="cx"> 2017-03-09 Antti Koivisto <antti@apple.com>
</span><span class="cx">
</span><span class="cx"> Loading in-body stylesheets should not block rendering of elements before them
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssstrokewidthexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stroke-width-expected.html (0 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stroke-width-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css/stroke-width-expected.html        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ div {
+ font-size: 80px;
+ color: gray;
+ text-shadow: none;
+ -webkit-text-stroke-color: blue;
+ }
+ </style>
+</head>
+<body>
+
+<div style="-webkit-text-stroke-width: 25px;">&#x25fc;</div>
+<div style="-webkit-text-stroke-width: 0.2in;">&#x25fc;</div>
+<div style="-webkit-text-stroke-width: 2mm;">&#x25fc;</div>
+<div style="-webkit-text-stroke-width: 0.1cm;">&#x25fc;</div>
+
+<div style="-webkit-text-stroke-width: 25px;"><span>&#x25fc;</span></div>
+<div style="-webkit-text-stroke-width: 0.2in;"><span>&#x25fc;</span></div>
+<div style="-webkit-text-stroke-width: 2mm;"><span>&#x25fc;</span></div>
+<div style="-webkit-text-stroke-width: 0.1cm;"><span>&#x25fc;</span></div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssstrokewidthpercentexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stroke-width-percent-expected.html (0 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stroke-width-percent-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css/stroke-width-percent-expected.html        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ div {
+ font-size: 200px;
+ color: gray;
+ text-shadow: none;
+ -webkit-text-stroke-color: blue;
+ }
+ </style>
+</head>
+<body>
+
+<div style="stroke-width: 0px;">&#x25fc;</div>
+<div style="stroke-width: 7px;">&#x25fc;</div>
+<div style="stroke-width: 14px;">&#x25fc;</div>
+<div style="stroke-width: 35px;">&#x25fc;</div>
+<div style="stroke-width: 70px;">&#x25fc;</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssstrokewidthpercenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stroke-width-percent.html (0 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stroke-width-percent.html         (rev 0)
+++ trunk/LayoutTests/fast/css/stroke-width-percent.html        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ div {
+ font-size: 200px;
+ color: gray;
+ text-shadow: none;
+ -webkit-text-stroke-color: blue;
+ }
+ </style>
+</head>
+<body>
+
+<div style="stroke-width: 0%;">&#x25fc;</div>
+<div style="stroke-width: 1%;">&#x25fc;</div>
+<div style="stroke-width: 2%;">&#x25fc;</div>
+<div style="stroke-width: 5%;">&#x25fc;</div>
+<div style="stroke-width: 10%;">&#x25fc;</div>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssstrokewidthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/stroke-width.html (0 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/stroke-width.html         (rev 0)
+++ trunk/LayoutTests/fast/css/stroke-width.html        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ div {
+ font-size: 80px;
+ color: gray;
+ text-shadow: none;
+ -webkit-text-stroke-color: blue;
+ }
+ </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>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/ChangeLog        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2017-03-08 Per Arne Vollan <pvollan@apple.com>
+
+ Implement stroke-width CSS property.
+ https://bugs.webkit.org/show_bug.cgi?id=169273
+
+ Reviewed by Simon Fraser.
+
+ 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==):
+
</ins><span class="cx"> 2017-03-09 Antti Koivisto <antti@apple.com>
</span><span class="cx">
</span><span class="cx"> Allow the page to render before <link> stylesheet tags in body
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPropertiesjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSProperties.json (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSProperties.json        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/css/CSSProperties.json        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -3028,6 +3028,7 @@
</span><span class="cx"> "stroke-width": {
</span><span class="cx"> "inherited": true,
</span><span class="cx"> "codegen-properties": {
</span><ins>+ "custom": "Value",
</ins><span class="cx"> "initial": "initialOneLength",
</span><span class="cx"> "converter": "Length"
</span><span class="cx"> },
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -139,6 +139,8 @@
</span><span class="cx"> static void applyValueAlt(StyleResolver&, CSSValue&);
</span><span class="cx"> static void applyValueWillChange(StyleResolver&, CSSValue&);
</span><span class="cx">
</span><ins>+ static void applyValueStrokeWidth(StyleResolver&, CSSValue&);
+
</ins><span class="cx"> private:
</span><span class="cx"> static void resetEffectiveZoom(StyleResolver&);
</span><span class="cx">
</span><span class="lines">@@ -1780,4 +1782,10 @@
</span><span class="cx"> styleResolver.style()->setWillChange(WTFMove(willChange));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline void StyleBuilderCustom::applyValueStrokeWidth(StyleResolver& styleResolver, CSSValue& value)
+{
+ styleResolver.style()->setStrokeWidth(StyleBuilderConverter::convertLength(styleResolver, value));
+ styleResolver.style()->setHasExplicitlySetStrokeWidth(true);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> const RenderStyle& childStyle = child->lineStyle();
</span><span class="cx"> if (child->behavesLikeText()) {
</span><span class="cx"> const RenderStyle* childStyle = &child->lineStyle();
</span><del>- if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth())
</del><ins>+ if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->hasPositiveStrokeWidth())
</ins><span class="cx"> child->clearKnownToHaveNoOverflow();
</span><span class="cx"> } else if (child->renderer().isReplaced()) {
</span><span class="cx"> const RenderBox& box = downcast<RenderBox>(child->renderer());
</span><span class="lines">@@ -904,7 +904,8 @@
</span><span class="cx"> int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0;
</span><span class="cx"> int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0;
</span><span class="cx">
</span><del>- int strokeOverflow = static_cast<int>(ceilf(lineStyle.textStrokeWidth() / 2.0f));
</del><ins>+ auto viewportSize = textBox.renderer().frame().view() ? textBox.renderer().frame().view()->size() : IntSize();
+ int strokeOverflow = std::ceil(lineStyle.computedStrokeWidth(viewportSize) / 2.0f);
</ins><span class="cx"> int topGlyphOverflow = -strokeOverflow - topGlyphEdge;
</span><span class="cx"> int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge;
</span><span class="cx"> int leftGlyphOverflow = -strokeOverflow - leftGlyphEdge;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -68,7 +68,8 @@
</span><span class="cx"> static FloatRect computeOverflow(const RenderBlockFlow& flow, const FloatRect& layoutRect)
</span><span class="cx"> {
</span><span class="cx"> auto overflowRect = layoutRect;
</span><del>- auto strokeOverflow = std::ceil(flow.style().textStrokeWidth());
</del><ins>+ auto viewportSize = flow.frame().view() ? flow.frame().view()->size() : IntSize();
+ auto strokeOverflow = std::ceil(flow.style().computedStrokeWidth(viewportSize));
</ins><span class="cx"> overflowRect.inflate(strokeOverflow);
</span><span class="cx">
</span><span class="cx"> auto letterSpacing = flow.style().fontCascade().letterSpacing();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextDecorationPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -357,7 +357,7 @@
</span><span class="cx"> Color result = style.visitedDependentColor(CSSPropertyWebkitTextDecorationColor);
</span><span class="cx"> if (result.isValid())
</span><span class="cx"> return result;
</span><del>- if (style.textStrokeWidth() > 0) {
</del><ins>+ if (style.hasPositiveStrokeWidth()) {
</ins><span class="cx"> // Prefer stroke color if possible but not if it's fully transparent.
</span><span class="cx"> result = style.visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
</span><span class="cx"> if (result.isVisible())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -67,7 +67,8 @@
</span><span class="cx"> #if ENABLE(LETTERPRESS)
</span><span class="cx"> paintStyle.useLetterpressEffect = lineStyle.textDecorationsInEffect() & TextDecorationLetterpress;
</span><span class="cx"> #endif
</span><del>- paintStyle.strokeWidth = lineStyle.textStrokeWidth();
</del><ins>+ auto viewportSize = frame.view() ? frame.view()->size() : IntSize();
+ paintStyle.strokeWidth = lineStyle.computedStrokeWidth(viewportSize);
</ins><span class="cx"> paintStyle.paintOrder = lineStyle.paintOrder();
</span><span class="cx"> paintStyle.lineJoin = lineStyle.joinStyle();
</span><span class="cx"> paintStyle.lineCap = lineStyle.capStyle();
</span><span class="lines">@@ -148,7 +149,8 @@
</span><span class="cx"> selectionShadow = shadow;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- float strokeWidth = pseudoStyle->textStrokeWidth();
</del><ins>+ auto viewportSize = renderer.frame().view() ? renderer.frame().view()->size() : IntSize();
+ float strokeWidth = pseudoStyle->computedStrokeWidth(viewportSize);
</ins><span class="cx"> if (strokeWidth != selectionPaintStyle.strokeWidth) {
</span><span class="cx"> if (!paintSelectedTextOnly)
</span><span class="cx"> paintSelectedTextSeparately = true;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -2259,5 +2259,34 @@
</span><span class="cx"> return paintOrder;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+float RenderStyle::computedStrokeWidth(const IntSize& viewportSize) const
+{
+ if (!hasExplicitlySetStrokeWidth())
+ return textStrokeWidth();
+
+ const Length& length = strokeWidth();
</ins><span class="cx">
</span><ins>+ if (length.isPercent()) {
+ // According to the spec, https://drafts.fxtf.org/paint/#stroke-width, the percentage is relative to the scaled viewport size.
+ // The scaled viewport size is the geometric mean of the viewport width and height.
+ ExceptionOr<float> result = length.value() * (viewportSize.width() + viewportSize.height()) / 200.0f;
+ if (result.hasException())
+ return 0;
+ return result.releaseReturnValue();
+ }
+
+ if (length.isAuto() || !length.isSpecified())
+ return 0;
+
+ return floatValueForLength(length, viewportSize.width());
+}
+
+bool RenderStyle::hasPositiveStrokeWidth() const
+{
+ if (!hasExplicitlySetStrokeWidth())
+ return textStrokeWidth() > 0;
+
+ return strokeWidth().isPositive();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -1257,7 +1257,12 @@
</span><span class="cx"> void setStrokeWidth(Length&& w) { SET_VAR(m_rareInheritedData, strokeWidth, WTFMove(w)); }
</span><span class="cx"> bool hasVisibleStroke() const { return svgStyle().hasStroke() && !strokeWidth().isZero(); }
</span><span class="cx">
</span><ins>+ float computedStrokeWidth(const IntSize& viewportSize) const;
+ void setHasExplicitlySetStrokeWidth(bool v) { SET_VAR(m_rareInheritedData, hasSetStrokeWidth, static_cast<unsigned>(v)); }
+ bool hasExplicitlySetStrokeWidth() const { return m_rareInheritedData->hasSetStrokeWidth; };
+ bool hasPositiveStrokeWidth() const;
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> const SVGRenderStyle& svgStyle() const { return m_svgStyle; }
</span><span class="cx"> SVGRenderStyle& accessSVGStyle() { return m_svgStyle.access(); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareInheritedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -128,6 +128,7 @@
</span><span class="cx"> , paintOrder(static_cast<unsigned>(RenderStyle::initialPaintOrder()))
</span><span class="cx"> , capStyle(RenderStyle::initialCapStyle())
</span><span class="cx"> , joinStyle(RenderStyle::initialJoinStyle())
</span><ins>+ , hasSetStrokeWidth(false)
</ins><span class="cx"> , strokeWidth(RenderStyle::initialOneLength())
</span><span class="cx"> , hyphenationLimitBefore(-1)
</span><span class="cx"> , hyphenationLimitAfter(-1)
</span><span class="lines">@@ -214,6 +215,7 @@
</span><span class="cx"> , paintOrder(o.paintOrder)
</span><span class="cx"> , capStyle(o.capStyle)
</span><span class="cx"> , joinStyle(o.joinStyle)
</span><ins>+ , hasSetStrokeWidth(o.hasSetStrokeWidth)
</ins><span class="cx"> , strokeWidth(o.strokeWidth)
</span><span class="cx"> , hyphenationString(o.hyphenationString)
</span><span class="cx"> , hyphenationLimitBefore(o.hyphenationLimitBefore)
</span><span class="lines">@@ -324,6 +326,7 @@
</span><span class="cx"> && paintOrder == o.paintOrder
</span><span class="cx"> && capStyle == o.capStyle
</span><span class="cx"> && joinStyle == o.joinStyle
</span><ins>+ && hasSetStrokeWidth == o.hasSetStrokeWidth
</ins><span class="cx"> && strokeWidth == o.strokeWidth
</span><span class="cx"> && customProperties == o.customProperties
</span><span class="cx"> && arePointingToEqualData(listStyleImage, o.listStyleImage);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareInheritedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (213633 => 213634)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h        2017-03-09 09:07:08 UTC (rev 213633)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h        2017-03-09 09:51:04 UTC (rev 213634)
</span><span class="lines">@@ -139,8 +139,9 @@
</span><span class="cx"> unsigned paintOrder : 3; // PaintOrder
</span><span class="cx"> unsigned capStyle : 2; // LineCap
</span><span class="cx"> unsigned joinStyle : 2; // LineJoin
</span><del>- Length strokeWidth;
-
</del><ins>+ unsigned hasSetStrokeWidth : 1;
+ Length strokeWidth;
+
</ins><span class="cx"> AtomicString hyphenationString;
</span><span class="cx"> short hyphenationLimitBefore;
</span><span class="cx"> short hyphenationLimitAfter;
</span></span></pre>
</div>
</div>
</body>
</html>