<!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>[161696] 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/161696">161696</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2014-01-10 16:31:19 -0800 (Fri, 10 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>CSS word-spacing property does not obey percentages
https://bugs.webkit.org/show_bug.cgi?id=126674
Reviewed by Simon Fraser.
Source/WebCore:
One change between CSS2.1 and CSS3 is that the word-spacing CSS property can
take percentages (of the width of the space character) in CSS3. In order to
implement this, the datatype must be changed from a float to a Length, which
can hold percentage values. Then, during layout, we can query the width of
the space character and update the Font's word-spacing value appropriately.
However, the RenderStyle still holds on to the Length (as a rare inherited
value).
Tests: fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html
fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html
fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): Use Font's computed value instead
of style's Length value.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): word-spacing and letter-spacing no longer are
parsed the same way.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyWordSpacing::applyValue): Construct a length from a given
CSSValue and set the style's word spacing with it.
(WebCore::ApplyPropertyWordSpacing::createHandler):
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Use ApplyPropertyWordSpacing.
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun): Use Font's computed value instead
of style's Length value.
* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths): Ditto.
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor): Opt-out of the SimpleLineLayout
if either the percentage or the length is nonzero.
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleText): Use Font's computed value instead
of style's Length value.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::wordSpacing):
(WebCore::RenderStyle::setWordSpacing): Consult the Font's space with to compute
percentage values, but hold on to the original Length.
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareInheritedData.cpp:
* rendering/style/StyleRareInheritedData.h: Hold on to the specified Length
LayoutTests:
See per-file description
* fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html: Added.
* fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html: Added.
Make sure that if Javascript changes the font after initial layout, that the word-spacing
value gets appropriately updated.
* fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html: Added.
* fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt: Added.
* fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html: Added.
Make sure that the CSSOM yields the correct percentage values when queried.
* fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html: Added.
Try some specific values of percentages (-100%, 0%, and 100%).
* css1/text_properties/word_spacing.html: Updated to not disregard percentages
* css2.1/20110323/c541-word-sp-001-expected.html:
* css2.1/20110323/c541-word-sp-001.htm: Ditto
* platform/mac/css1/text_properties/word_spacing-expected.png:
* platform/mac/css1/text_properties/word_spacing-expected.txt: Ditto</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss1text_propertiesword_spacinghtml">trunk/LayoutTests/css1/text_properties/word_spacing.html</a></li>
<li><a href="#trunkLayoutTestscss2120110323c541wordsp001expectedhtml">trunk/LayoutTests/css2.1/20110323/c541-word-sp-001-expected.html</a></li>
<li><a href="#trunkLayoutTestscss2120110323c541wordsp001htm">trunk/LayoutTests/css2.1/20110323/c541-word-sp-001.htm</a></li>
<li><a href="#trunkLayoutTestsplatformmaccss1text_propertiesword_spacingexpectedpng">trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmaccss1text_propertiesword_spacingexpectedtxt">trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationCSSPropertyAnimationcpp">trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextcpp">trunk/Source/WebCore/rendering/RenderText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutcpp">trunk/Source/WebCore/rendering/SimpleLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh">trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h</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>trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/</li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingchangefontexpectedhtml">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingchangefonthtml">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageexpectedhtml">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageparseexpectedtxt">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageparsehtml">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html</a></li>
<li><a href="#trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentagehtml">trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/LayoutTests/ChangeLog        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-01-10 Myles C. Maxfield <mmaxfield@apple.com>
+
+ CSS word-spacing property does not obey percentages
+ https://bugs.webkit.org/show_bug.cgi?id=126674
+
+ Reviewed by Simon Fraser.
+
+ See per-file description
+
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html: Added.
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html: Added.
+ Make sure that if Javascript changes the font after initial layout, that the word-spacing
+ value gets appropriately updated.
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html: Added.
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt: Added.
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html: Added.
+ Make sure that the CSSOM yields the correct percentage values when queried.
+ * fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html: Added.
+ Try some specific values of percentages (-100%, 0%, and 100%).
+ * css1/text_properties/word_spacing.html: Updated to not disregard percentages
+ * css2.1/20110323/c541-word-sp-001-expected.html:
+ * css2.1/20110323/c541-word-sp-001.htm: Ditto
+ * platform/mac/css1/text_properties/word_spacing-expected.png:
+ * platform/mac/css1/text_properties/word_spacing-expected.txt: Ditto
+
</ins><span class="cx"> 2014-01-10 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Implement OES texture half float linear
</span></span></pre></div>
<a id="trunkLayoutTestscss1text_propertiesword_spacinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css1/text_properties/word_spacing.html (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css1/text_properties/word_spacing.html        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/LayoutTests/css1/text_properties/word_spacing.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -16,8 +16,7 @@
</span><span class="cx"> .seven {word-spacing: 1ex;}
</span><span class="cx"> .eight {word-spacing: 5px;}
</span><span class="cx"> .nine {word-spacing: normal;}
</span><del>-.ten {word-spacing: 300%;}
-.eleven {word-spacing: -0.2em;}
</del><ins>+.ten {word-spacing: -0.2em;}
</ins><span class="cx"> </STYLE>
</span><span class="cx">
</span><span class="cx"> </HEAD>
</span><span class="lines">@@ -32,8 +31,7 @@
</span><span class="cx"> .seven {word-spacing: 1ex;}
</span><span class="cx"> .eight {word-spacing: 5px;}
</span><span class="cx"> .nine {word-spacing: normal;}
</span><del>-.ten {word-spacing: 300%;}
-.eleven {word-spacing: -0.2em;}
</del><ins>+.ten {word-spacing: -0.2em;}
</ins><span class="cx">
</span><span class="cx"> </PRE>
</span><span class="cx"> <HR>
</span><span class="lines">@@ -62,9 +60,6 @@
</span><span class="cx"> This words in this sentence should have extra space between them, but the last few words in the sentence <SPAN class="nine">should have normal spacing</SPAN>.
</span><span class="cx"> </P>
</span><span class="cx"> <P class="ten">
</span><del>-This sentence should have normal word-spacing, since percentage values are not allowed on this property.
-</P>
-<P class="eleven">
</del><span class="cx"> This words in this sentence should have reduced space between them, since negative values are allowed on this property.
</span><span class="cx"> </P>
</span><span class="cx">
</span><span class="lines">@@ -100,9 +95,6 @@
</span><span class="cx"> This words in this sentence should have extra space between them, but the last few words in the sentence <SPAN class="nine">should have normal spacing</SPAN>.
</span><span class="cx"> </P>
</span><span class="cx"> <P class="ten">
</span><del>-This sentence should have normal word-spacing, since percentage values are not allowed on this property.
-</P>
-<P class="eleven">
</del><span class="cx"> This words in this sentence should have reduced space between them, since negative values are allowed on this property.
</span><span class="cx"> </P>
</span><span class="cx"> </TD></TR></TABLE></BODY>
</span></span></pre></div>
<a id="trunkLayoutTestscss2120110323c541wordsp001expectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css2.1/20110323/c541-word-sp-001-expected.html (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css2.1/20110323/c541-word-sp-001-expected.html        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/LayoutTests/css2.1/20110323/c541-word-sp-001-expected.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx">
</span><span class="cx"> <p>There should be a stripy pattern of yellow and aqua below (each vertical stripe should be straight and unbroken).</p>
</span><span class="cx">
</span><del>- <div><img src="support/swatch-yellow.png" width="50" height="150" alt="Image download support must be enabled" class="left-and-right-sides"><img src="support/swatch-yellow.png" width="50" height="150" alt="Image download support must be enabled" class="central"><img src="support/swatch-yellow.png" width="25" height="150" alt="Image download support must be enabled" class="central"><img src="support/swatch-yellow.png" width="25" height="150" alt="Image download support must be enabled" class="left-and-right-sides"></div>
</del><ins>+ <div><img src="support/swatch-yellow.png" width="50" height="125" alt="Image download support must be enabled" class="left-and-right-sides"><img src="support/swatch-yellow.png" width="50" height="125" alt="Image download support must be enabled" class="central"><img src="support/swatch-yellow.png" width="25" height="125" alt="Image download support must be enabled" class="central"><img src="support/swatch-yellow.png" width="25" height="125" alt="Image download support must be enabled" class="left-and-right-sides"></div>
</ins><span class="cx">
</span><span class="cx"> </body>
</span><del>-</html>
</del><span class="cx">\ No newline at end of file
</span><ins>+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscss2120110323c541wordsp001htm"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css2.1/20110323/c541-word-sp-001.htm (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css2.1/20110323/c541-word-sp-001.htm        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/LayoutTests/css2.1/20110323/c541-word-sp-001.htm        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -12,8 +12,7 @@
</span><span class="cx"> div { font: 25px/1 Ahem; width: 12em; background: yellow; color: aqua; margin: 0 0 0 2em; }
</span><span class="cx"> .eight {word-spacing: 25px;}
</span><span class="cx"> .nine {word-spacing: normal;}
</span><del>- .ten {word-spacing: 300%;}
- .eleven {word-spacing: -1em;}
</del><ins>+ .ten {word-spacing: -1em;}
</ins><span class="cx"> .fill { color: yellow; }
</span><span class="cx"> </style>
</span><span class="cx"> <link rel="help" href="http://www.w3.org/TR/CSS21/text.html#spacing-props" title="16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties">
</span><span class="lines">@@ -24,7 +23,6 @@
</span><span class="cx"> <div class="test">x&nbsp;&nbsp;x&nbsp;&nbsp;xx&nbsp;xx</div>
</span><span class="cx"> <div class="test">x&nbsp;&nbsp;x&nbsp;&nbsp;xx&nbsp;xx</div>
</span><span class="cx"> <div class="eight"> x x <span class="nine">xx xx</span> </div>
</span><del>- <div class="ten"> x&nbsp; x &nbsp;xx xx </div>
- <div class="eleven"> x&nbsp; &nbsp;<span class="nine"> &nbsp;</span>x&nbsp;&nbsp;<span class="fill">xx</span> xx&nbsp; <span class="fill">x</span>xx </div>
</del><ins>+ <div class="ten"> x&nbsp; &nbsp;<span class="nine"> &nbsp;</span>x&nbsp;&nbsp;<span class="fill">xx</span> xx&nbsp; <span class="fill">x</span>xx </div>
</ins><span class="cx"> </body>
</span><del>-</html>
</del><span class="cx">\ No newline at end of file
</span><ins>+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingchangefontexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font-expected.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div id="cont" style="font-family: Courier New;">
+<div style="word-spacing: -100%;">word1 word2</div>
+<div style="word-spacing: 0px;">word1 word2</div>
+<div style="word-spacing: 100%;">word1 word2</div>
+</div>
+</script>
+</body>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingchangefonthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div id="cont">
+<div style="word-spacing: -100%;">word1 word2</div>
+<div style="word-spacing: 0px;">word1 word2</div>
+<div style="word-spacing: 100%;">word1 word2</div>
+</div>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+window.setTimeout(function() {
+ var cont = document.getElementById("cont");
+ cont.setAttribute("style", "font-family: Courier New;");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}, 0);
+</script>
+</body>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-expected.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div>word1word2</div>
+<div>word1&nbsp;word2</div>
+<div>word1&nbsp;&nbsp;word2</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageparseexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse-expected.txt        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('word-spacing') is "100%"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('word-spacing') is "100.5%"
+PASS cssRule.type is cssRule.STYLE_RULE
+PASS declaration.length is 0
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentageparsehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script type="text/javascript">
+ function testPercentageIsValid(stylesheet, percentage) {
+ cssRule = stylesheet.cssRules.item(0);
+ shouldBe("cssRule.type", "cssRule.STYLE_RULE");
+ declaration = cssRule.style;
+ shouldBe("declaration.length", "1");
+ shouldBe("declaration.getPropertyValue('word-spacing')", '"' + percentage.toString() + '%' + '"');
+ stylesheet.deleteRule(0);
+ }
+
+ function testInvalidRule(stylesheet) {
+ cssRule = stylesheet.cssRules.item(0);
+ shouldBe("cssRule.type", "cssRule.STYLE_RULE");
+ declaration = cssRule.style;
+ shouldBe("declaration.length", "0");
+ stylesheet.deleteRule(0);
+ }
+
+ var styleElement = document.createElement("style");
+ document.head.appendChild(styleElement);
+ stylesheet = styleElement.sheet;
+
+ stylesheet.insertRule(".p { word-spacing: 100%; }", 0);
+ testPercentageIsValid(stylesheet, 100);
+
+ stylesheet.insertRule(".p { word-spacing: 100.5%; }", 0);
+ testPercentageIsValid(stylesheet, 100.5);
+
+ stylesheet.insertRule(".p { word-spacing: garbage%; }", 0);
+ testInvalidRule(stylesheet);
+ </script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcss3textcss3wordspacingpercentagewordspacingpercentagehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html (0 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html         (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="word-spacing: -100%">word1 word2</div>
+<div style="word-spacing: 0%">word1 word2</div>
+<div style="word-spacing: 100%">word1 word2</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaccss1text_propertiesword_spacingexpectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmaccss1text_propertiesword_spacingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.txt (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.txt        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/LayoutTests/platform/mac/css1/text_properties/word_spacing-expected.txt        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1,13 +1,13 @@
</span><del>-layer at (0,0) size 785x997
</del><ins>+layer at (0,0) size 785x914
</ins><span class="cx"> RenderView at (0,0) size 785x600
</span><del>-layer at (0,0) size 785x997
- RenderBlock {HTML} at (0,0) size 785x997
- RenderBody {BODY} at (8,8) size 769x981 [bgcolor=#CCCCCC]
</del><ins>+layer at (0,0) size 785x914
+ RenderBlock {HTML} at (0,0) size 785x914
+ RenderBody {BODY} at (8,8) size 769x898 [bgcolor=#CCCCCC]
</ins><span class="cx"> RenderBlock {P} at (0,0) size 769x18
</span><span class="cx"> RenderText {#text} at (0,0) size 355x18
</span><span class="cx"> text run at (0,0) width 355: "The style declarations which apply to the text below are:"
</span><del>- RenderBlock {PRE} at (0,34) size 769x180
- RenderText {#text} at (0,0) size 248x180
</del><ins>+ RenderBlock {PRE} at (0,34) size 769x165
+ RenderText {#text} at (0,0) size 232x165
</ins><span class="cx"> text run at (0,0) width 216: ".one {word-spacing: 0.3in;}"
</span><span class="cx"> text run at (216,0) width 0: " "
</span><span class="cx"> text run at (0,15) width 216: ".two {word-spacing: 0.5cm;}"
</span><span class="lines">@@ -26,34 +26,32 @@
</span><span class="cx"> text run at (216,105) width 0: " "
</span><span class="cx"> text run at (0,120) width 232: ".nine {word-spacing: normal;}"
</span><span class="cx"> text run at (232,120) width 0: " "
</span><del>- text run at (0,135) width 208: ".ten {word-spacing: 300%;}"
- text run at (208,135) width 0: " "
- text run at (0,150) width 248: ".eleven {word-spacing: -0.2em;}"
- text run at (248,150) width 0: " "
- text run at (0,165) width 0: " "
- RenderBlock {HR} at (0,227) size 769x2 [border: (1px inset #000000)]
- RenderBlock {P} at (0,245) size 769x18
</del><ins>+ text run at (0,135) width 224: ".ten {word-spacing: -0.2em;}"
+ text run at (224,135) width 0: " "
+ text run at (0,150) width 0: " "
+ RenderBlock {HR} at (0,212) size 769x2 [border: (1px inset #000000)]
+ RenderBlock {P} at (0,230) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 709x18
</span><span class="cx"> text run at (0,0) width 709: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,279) size 769x18
</del><ins>+ RenderBlock {P} at (0,264) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 610x18
</span><span class="cx"> text run at (0,0) width 610: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,313) size 769x18
</del><ins>+ RenderBlock {P} at (0,298) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 610x18
</span><span class="cx"> text run at (0,0) width 610: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,347) size 769x18
</del><ins>+ RenderBlock {P} at (0,332) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 461x18
</span><span class="cx"> text run at (0,0) width 461: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,381) size 769x18
</del><ins>+ RenderBlock {P} at (0,366) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 461x18
</span><span class="cx"> text run at (0,0) width 461: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,415) size 769x18
</del><ins>+ RenderBlock {P} at (0,400) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 581x18
</span><span class="cx"> text run at (0,0) width 581: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,449) size 769x18
</del><ins>+ RenderBlock {P} at (0,434) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 493x18
</span><span class="cx"> text run at (0,0) width 493: "This words in this sentence should have extra space between them."
</span><del>- RenderBlock {P} at (0,483) size 769x36
</del><ins>+ RenderBlock {P} at (0,468) size 769x36
</ins><span class="cx"> RenderText {#text} at (0,0) size 751x18
</span><span class="cx"> text run at (0,0) width 751: "This words in this sentence should have extra space between them, but the last few words in the sentence"
</span><span class="cx"> RenderInline {SPAN} at (0,0) size 176x18
</span><span class="lines">@@ -61,24 +59,21 @@
</span><span class="cx"> text run at (0,18) width 176: "should have normal spacing"
</span><span class="cx"> RenderText {#text} at (176,18) size 4x18
</span><span class="cx"> text run at (176,18) width 4: "."
</span><del>- RenderBlock {P} at (0,535) size 769x18
- RenderText {#text} at (0,0) size 668x18
- text run at (0,0) width 668: "This sentence should have normal word-spacing, since percentage values are not allowed on this property."
- RenderBlock {P} at (0,569) size 769x18
</del><ins>+ RenderBlock {P} at (0,520) size 769x18
</ins><span class="cx"> RenderText {#text} at (0,0) size 704x18
</span><span class="cx"> text run at (0,0) width 704: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
</span><del>- RenderTable {TABLE} at (0,603) size 769x378 [border: (1px outset #808080)]
- RenderTableSection {TBODY} at (1,1) size 767x376
</del><ins>+ RenderTable {TABLE} at (0,554) size 769x344 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 767x342
</ins><span class="cx"> RenderTableRow {TR} at (0,0) size 767x26
</span><span class="cx"> RenderTableCell {TD} at (0,0) size 767x26 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
</span><span class="cx"> RenderInline {STRONG} at (0,0) size 163x18
</span><span class="cx"> RenderText {#text} at (4,4) size 163x18
</span><span class="cx"> text run at (4,4) width 163: "TABLE Testing Section"
</span><del>- RenderTableRow {TR} at (0,26) size 767x350
- RenderTableCell {TD} at (0,188) size 12x26 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
</del><ins>+ RenderTableRow {TR} at (0,26) size 767x316
+ RenderTableCell {TD} at (0,171) size 12x26 [bgcolor=#C0C0C0] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
</ins><span class="cx"> RenderText {#text} at (4,4) size 4x18
</span><span class="cx"> text run at (4,4) width 4: " "
</span><del>- RenderTableCell {TD} at (12,26) size 755x350 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
</del><ins>+ RenderTableCell {TD} at (12,26) size 755x316 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
</ins><span class="cx"> RenderBlock {P} at (4,4) size 747x18
</span><span class="cx"> RenderText {#text} at (0,0) size 709x18
</span><span class="cx"> text run at (0,0) width 709: "This words in this sentence should have extra space between them."
</span><span class="lines">@@ -110,8 +105,5 @@
</span><span class="cx"> RenderText {#text} at (239,18) size 4x18
</span><span class="cx"> text run at (239,18) width 4: "."
</span><span class="cx"> RenderBlock {P} at (4,294) size 747x18
</span><del>- RenderText {#text} at (0,0) size 668x18
- text run at (0,0) width 668: "This sentence should have normal word-spacing, since percentage values are not allowed on this property."
- RenderBlock {P} at (4,328) size 747x18
</del><span class="cx"> RenderText {#text} at (0,0) size 704x18
</span><span class="cx"> text run at (0,0) width 704: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/ChangeLog        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2014-01-10 Myles C. Maxfield <mmaxfield@apple.com>
+
+ CSS word-spacing property does not obey percentages
+ https://bugs.webkit.org/show_bug.cgi?id=126674
+
+ Reviewed by Simon Fraser.
+
+ One change between CSS2.1 and CSS3 is that the word-spacing CSS property can
+ take percentages (of the width of the space character) in CSS3. In order to
+ implement this, the datatype must be changed from a float to a Length, which
+ can hold percentage values. Then, during layout, we can query the width of
+ the space character and update the Font's word-spacing value appropriately.
+ However, the RenderStyle still holds on to the Length (as a rare inherited
+ value).
+
+ Tests: fast/css3-text/css3-word-spacing-percentage/word-spacing-change-font.html
+ fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage-parse.html
+ fast/css3-text/css3-word-spacing-percentage/word-spacing-percentage.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::propertyValue): Use Font's computed value instead
+ of style's Length value.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue): word-spacing and letter-spacing no longer are
+ parsed the same way.
+ * css/DeprecatedStyleBuilder.cpp:
+ (WebCore::ApplyPropertyWordSpacing::applyValue): Construct a length from a given
+ CSSValue and set the style's word spacing with it.
+ (WebCore::ApplyPropertyWordSpacing::createHandler):
+ (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Use ApplyPropertyWordSpacing.
+ * page/animation/CSSPropertyAnimation.cpp:
+ (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::setLogicalWidthForTextRun): Use Font's computed value instead
+ of style's Length value.
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computePreferredLogicalWidths): Ditto.
+ * rendering/SimpleLineLayout.cpp:
+ (WebCore::SimpleLineLayout::canUseFor): Opt-out of the SimpleLineLayout
+ if either the percentage or the length is nonzero.
+ * rendering/line/BreakingContextInlineHeaders.h:
+ (WebCore::BreakingContext::handleText): Use Font's computed value instead
+ of style's Length value.
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::wordSpacing):
+ (WebCore::RenderStyle::setWordSpacing): Consult the Font's space with to compute
+ percentage values, but hold on to the original Length.
+ * rendering/style/RenderStyle.h:
+ * rendering/style/StyleRareInheritedData.cpp:
+ * rendering/style/StyleRareInheritedData.h: Hold on to the specified Length
+
</ins><span class="cx"> 2014-01-10 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix the iOS build.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -2512,7 +2512,7 @@
</span><span class="cx"> case CSSPropertyWordBreak:
</span><span class="cx"> return cssValuePool().createValue(style->wordBreak());
</span><span class="cx"> case CSSPropertyWordSpacing:
</span><del>- return zoomAdjustedPixelValue(style->wordSpacing(), style.get());
</del><ins>+ return zoomAdjustedPixelValue(style->font().wordSpacing(), style.get());
</ins><span class="cx"> case CSSPropertyWordWrap:
</span><span class="cx"> return cssValuePool().createValue(style->overflowWrap());
</span><span class="cx"> case CSSPropertyWebkitLineBreak:
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -2142,13 +2142,19 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CSSPropertyLetterSpacing: // normal | <length> | inherit
</span><del>- case CSSPropertyWordSpacing: // normal | <length> | inherit
</del><span class="cx"> if (id == CSSValueNormal)
</span><span class="cx"> validPrimitive = true;
</span><span class="cx"> else
</span><span class="cx"> validPrimitive = validUnit(value, FLength);
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case CSSPropertyWordSpacing: // normal | <length> | <percentage> | inherit
+ if (id == CSSValueNormal)
+ validPrimitive = true;
+ else
+ validPrimitive = validUnit(value, FLength | FPercent);
+ break;
+
</ins><span class="cx"> case CSSPropertyTextIndent:
</span><span class="cx"> parsedValue = parseTextIndent();
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1535,6 +1535,40 @@
</span><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+class ApplyPropertyWordSpacing {
+public:
+ static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
+ {
+ if (!value->isPrimitiveValue())
+ return;
+
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ Length wordSpacing;
+
+ if (primitiveValue->getValueID() == CSSValueNormal)
+ wordSpacing = RenderStyle::initialWordSpacing();
+ else if (primitiveValue->isLength()) {
+ double multiplier = styleResolver->style()->effectiveZoom();
+ if (Frame* frame = styleResolver->document().frame())
+ multiplier *= frame->textZoomFactor();
+ wordSpacing = primitiveValue->computeLength<Length>(styleResolver->style(), styleResolver->rootElementStyle(), multiplier);
+ } else if (primitiveValue->isPercentage())
+ wordSpacing = Length(primitiveValue->getDoubleValue(), Percent);
+ else if (primitiveValue->isNumber())
+ wordSpacing = Length(primitiveValue->getDoubleValue(), Fixed);
+ else if (primitiveValue->isViewportPercentageLength())
+ wordSpacing = Length(styleResolver->viewportPercentageValue(*primitiveValue, primitiveValue->getDoubleValue()), Fixed);
+ else
+ return;
+ styleResolver->style()->setWordSpacing(wordSpacing);
+ }
+ static PropertyHandler createHandler()
+ {
+ PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, &RenderStyle::wordSpacing, Length, &RenderStyle::setWordSpacing, Length, &RenderStyle::initialWordSpacing>::createHandler();
+ return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
+ }
+};
+
</ins><span class="cx"> class ApplyPropertyPageSize {
</span><span class="cx"> private:
</span><span class="cx"> static Length mmLength(double mm)
</span><span class="lines">@@ -2529,7 +2563,7 @@
</span><span class="cx"> setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
</span><span class="cx"> setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
</span><span class="cx"> setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
</span><del>- setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<float, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
</del><ins>+ setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyWordSpacing::createHandler());
</ins><span class="cx">
</span><span class="cx"> // UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
</span><span class="cx"> setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCSSPropertyAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1213,7 +1213,7 @@
</span><span class="cx"> new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset),
</span><span class="cx"> new PropertyWrapper<unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth),
</span><span class="cx"> new PropertyWrapper<float>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing),
</span><del>- new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing),
</del><ins>+ new LengthPropertyWrapper<Length>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing),
</ins><span class="cx"> new LengthPropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent),
</span><span class="cx">
</span><span class="cx"> new PropertyWrapper<float>(CSSPropertyWebkitPerspective, &RenderStyle::perspective, &RenderStyle::setPerspective),
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -479,7 +479,7 @@
</span><span class="cx"> &wordMeasurement.fallbackFonts, &overflow);
</span><span class="cx"> UChar c = renderer->characterAt(wordMeasurement.startOffset);
</span><span class="cx"> if (i > 0 && wordLength == 1 && (c == ' ' || c == '\t'))
</span><del>- measuredWidth += renderer->style().wordSpacing();
</del><ins>+ measuredWidth += renderer->style().font().wordSpacing();
</ins><span class="cx"> } else
</span><span class="cx"> measuredWidth += wordMeasurement.width;
</span><span class="cx"> if (!wordMeasurement.fallbackFonts.isEmpty()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/RenderText.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -682,8 +682,8 @@
</span><span class="cx"> m_hasEndWS = false;
</span><span class="cx">
</span><span class="cx"> const RenderStyle& style = this->style();
</span><del>- const Font& f = style.font(); // FIXME: This ignores first-line.
- float wordSpacing = style.wordSpacing();
</del><ins>+ const Font& font = style.font(); // FIXME: This ignores first-line.
+ float wordSpacing = font.wordSpacing();
</ins><span class="cx"> int len = textLength();
</span><span class="cx"> LazyLineBreakIterator breakIterator(m_text, style.locale());
</span><span class="cx"> bool needsWordSpacing = false;
</span><span class="lines">@@ -696,7 +696,7 @@
</span><span class="cx">
</span><span class="cx"> // Non-zero only when kerning is enabled, in which case we measure words with their trailing
</span><span class="cx"> // space, then subtract its width.
</span><del>- float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style), &fallbackFonts) + wordSpacing : 0;
</del><ins>+ float wordTrailingSpaceWidth = font.typesettingFeatures() & Kerning ? font.width(RenderBlock::constructTextRun(this, font, &space, 1, style), &fallbackFonts) + wordSpacing : 0;
</ins><span class="cx">
</span><span class="cx"> // If automatic hyphenation is allowed, we keep track of the width of the widest word (or word
</span><span class="cx"> // fragment) encountered so far, and only try hyphenating words that are wider.
</span><span class="lines">@@ -760,7 +760,7 @@
</span><span class="cx"> lastWordBoundary++;
</span><span class="cx"> continue;
</span><span class="cx"> } else if (c == softHyphen && style.hyphens() != HyphensNone) {
</span><del>- currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</del><ins>+ currMaxWidth += widthFromCache(font, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</ins><span class="cx"> if (firstGlyphLeftOverflow < 0)
</span><span class="cx"> firstGlyphLeftOverflow = glyphOverflow.left;
</span><span class="cx"> lastWordBoundary = i + 1;
</span><span class="lines">@@ -788,23 +788,23 @@
</span><span class="cx"> bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style);
</span><span class="cx"> float w;
</span><span class="cx"> if (wordTrailingSpaceWidth && isSpace)
</span><del>- w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style) - wordTrailingSpaceWidth;
</del><ins>+ w = widthFromCache(font, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style) - wordTrailingSpaceWidth;
</ins><span class="cx"> else {
</span><del>- w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</del><ins>+ w = widthFromCache(font, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</ins><span class="cx"> if (c == softHyphen && style.hyphens() != HyphensNone)
</span><del>- currMinWidth += hyphenWidth(this, f);
</del><ins>+ currMinWidth += hyphenWidth(this, font);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (w > maxWordWidth) {
</span><span class="cx"> int suffixStart;
</span><del>- float maxFragmentWidth = maxWordFragmentWidth(this, style, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow);
</del><ins>+ float maxFragmentWidth = maxWordFragmentWidth(this, style, font, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow);
</ins><span class="cx">
</span><span class="cx"> if (suffixStart) {
</span><span class="cx"> float suffixWidth;
</span><span class="cx"> if (wordTrailingSpaceWidth && isSpace)
</span><del>- suffixWidth = widthFromCache(f, i + suffixStart, wordLen - suffixStart + 1, leadWidth + currMaxWidth, 0, 0, style) - wordTrailingSpaceWidth;
</del><ins>+ suffixWidth = widthFromCache(font, i + suffixStart, wordLen - suffixStart + 1, leadWidth + currMaxWidth, 0, 0, style) - wordTrailingSpaceWidth;
</ins><span class="cx"> else
</span><del>- suffixWidth = widthFromCache(f, i + suffixStart, wordLen - suffixStart, leadWidth + currMaxWidth, 0, 0, style);
</del><ins>+ suffixWidth = widthFromCache(font, i + suffixStart, wordLen - suffixStart, leadWidth + currMaxWidth, 0, 0, style);
</ins><span class="cx">
</span><span class="cx"> maxFragmentWidth = std::max(maxFragmentWidth, suffixWidth);
</span><span class="cx">
</span><span class="lines">@@ -821,7 +821,7 @@
</span><span class="cx"> if (lastWordBoundary == i)
</span><span class="cx"> currMaxWidth += w;
</span><span class="cx"> else
</span><del>- currMaxWidth += widthFromCache(f, lastWordBoundary, j - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</del><ins>+ currMaxWidth += widthFromCache(font, lastWordBoundary, j - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow, style);
</ins><span class="cx"> lastWordBoundary = j;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -872,13 +872,13 @@
</span><span class="cx"> m_maxWidth = currMaxWidth;
</span><span class="cx"> currMaxWidth = 0;
</span><span class="cx"> } else {
</span><del>- TextRun run = RenderBlock::constructTextRun(this, f, this, i, 1, style);
</del><ins>+ TextRun run = RenderBlock::constructTextRun(this, font, this, i, 1, style);
</ins><span class="cx"> run.setCharactersLength(len - i);
</span><span class="cx"> ASSERT(run.charactersLength() >= run.length());
</span><span class="cx"> run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
</span><span class="cx"> run.setXPos(leadWidth + currMaxWidth);
</span><span class="cx">
</span><del>- currMaxWidth += f.width(run, &fallbackFonts);
</del><ins>+ currMaxWidth += font.width(run, &fallbackFonts);
</ins><span class="cx"> glyphOverflow.right = 0;
</span><span class="cx"> needsWordSpacing = isSpace && !previousCharacterIsSpace && i == len - 1;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> if (!style.textIndent().isZero())
</span><span class="cx"> return false;
</span><del>- if (style.wordSpacing() || style.letterSpacing())
</del><ins>+ if (!style.wordSpacing().isZero() || style.letterSpacing())
</ins><span class="cx"> return false;
</span><span class="cx"> if (style.textTransform() != TTNONE)
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -668,7 +668,7 @@
</span><span class="cx"> bool canHyphenate = style.hyphens() == HyphensAuto && WebCore::canHyphenate(style.locale());
</span><span class="cx">
</span><span class="cx"> unsigned lastSpace = m_current.offset();
</span><del>- float wordSpacing = m_currentStyle->wordSpacing();
</del><ins>+ float wordSpacing = m_currentStyle->font().wordSpacing();
</ins><span class="cx"> float lastSpaceWordSpacing = 0;
</span><span class="cx"> float wordSpacingForWordMeasurement = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -1399,7 +1399,7 @@
</span><span class="cx"> float RenderStyle::computedFontSize() const { return fontDescription().computedSize(); }
</span><span class="cx"> int RenderStyle::fontSize() const { return inherited->font.pixelSize(); }
</span><span class="cx">
</span><del>-float RenderStyle::wordSpacing() const { return inherited->font.wordSpacing(); }
</del><ins>+const Length& RenderStyle::wordSpacing() const { return rareInheritedData->wordSpacing; }
</ins><span class="cx"> float RenderStyle::letterSpacing() const { return inherited->font.letterSpacing(); }
</span><span class="cx">
</span><span class="cx"> bool RenderStyle::setFontDescription(const FontDescription& v)
</span><span class="lines">@@ -1451,7 +1451,19 @@
</span><span class="cx"> return lh.value();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderStyle::setWordSpacing(float v) { inherited.access()->font.setWordSpacing(v); }
</del><ins>+void RenderStyle::setWordSpacing(Length v)
+{
+ float fontWordSpacing;
+ if (v.isPercent())
+ fontWordSpacing = v.getFloatValue() * font().spaceWidth() / 100;
+ else {
+ ASSERT(v.isFixed());
+ fontWordSpacing = v.getFloatValue();
+ }
+ inherited.access()->font.setWordSpacing(fontWordSpacing);
+ rareInheritedData.access()->wordSpacing = std::move(v);
+}
+
</ins><span class="cx"> void RenderStyle::setLetterSpacing(float v) { inherited.access()->font.setLetterSpacing(v); }
</span><span class="cx">
</span><span class="cx"> void RenderStyle::setFontSize(float size)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -580,7 +580,7 @@
</span><span class="cx"> #else
</span><span class="cx"> TextDecorationStyle textDecorationStyle() const { return TextDecorationStyleSolid; }
</span><span class="cx"> #endif
</span><del>- float wordSpacing() const;
</del><ins>+ const Length& wordSpacing() const;
</ins><span class="cx"> float letterSpacing() const;
</span><span class="cx">
</span><span class="cx"> float zoom() const { return visual->m_zoom; }
</span><span class="lines">@@ -1189,7 +1189,7 @@
</span><span class="cx">
</span><span class="cx"> void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
</span><span class="cx">
</span><del>- void setWordSpacing(float);
</del><ins>+ void setWordSpacing(Length);
</ins><span class="cx"> void setLetterSpacing(float);
</span><span class="cx">
</span><span class="cx"> void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
</span><span class="lines">@@ -1664,7 +1664,7 @@
</span><span class="cx"> static unsigned short initialColumnRuleWidth() { return 3; }
</span><span class="cx"> static unsigned short initialOutlineWidth() { return 3; }
</span><span class="cx"> static float initialLetterSpacing() { return 0; }
</span><del>- static float initialWordSpacing() { return 0; }
</del><ins>+ static Length initialWordSpacing() { return Length(Fixed); }
</ins><span class="cx"> static Length initialSize() { return Length(); }
</span><span class="cx"> static Length initialMinSize() { return Length(Fixed); }
</span><span class="cx"> static Length initialMaxSize() { return Length(Undefined); }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareInheritedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> void* ownPtrs[1];
</span><span class="cx"> AtomicString atomicStrings[5];
</span><span class="cx"> void* refPtrs[2];
</span><del>- Length lengths[1];
</del><ins>+ Length lengths[2];
</ins><span class="cx"> float secondFloat;
</span><span class="cx"> unsigned m_bitfields[2];
</span><span class="cx"> #if ENABLE(CSS3_TEXT_DECORATION) && ENABLE(CSS_IMAGE_ORIENTATION)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareInheritedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (161695 => 161696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h        2014-01-11 00:29:37 UTC (rev 161695)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h        2014-01-11 00:31:19 UTC (rev 161696)
</span><span class="lines">@@ -75,6 +75,8 @@
</span><span class="cx"> RefPtr<CursorList> cursorData;
</span><span class="cx"> Length indent;
</span><span class="cx"> float m_effectiveZoom;
</span><ins>+
+ Length wordSpacing;
</ins><span class="cx">
</span><span class="cx"> // Paged media properties.
</span><span class="cx"> short widows;
</span></span></pre>
</div>
</div>
</body>
</html>