<!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>[176490] 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/176490">176490</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-11-21 17:22:41 -0800 (Fri, 21 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Regression(<a href="http://trac.webkit.org/projects/webkit/changeset/176202">r176202</a>): line-height is wrong on marco.org
https://bugs.webkit.org/show_bug.cgi?id=138970

Reviewed by Simon Fraser.

Source/WebCore:

After <a href="http://trac.webkit.org/projects/webkit/changeset/176202">r176202</a>, on iOS with IOS_TEXT_AUTOSIZING enabled, we would
multiply the lineHeight by RenderStyle::textSizeAdjust()::multiplier()
unconditionally. However, we're only supposed to do so if
RenderStyle::textSizeAdjust()::isPercentage() returns true. This
patch reintroduces the textSizeAdjust().isPercentage() check that was
inadvertently dropped when refactoring the code to be shared between
iOS and OS X.

Additionally, the multiplier is only supposed the be applied if the
input CSSPrimitiveValue is a Length or a Number. However, after
<a href="http://trac.webkit.org/projects/webkit/changeset/176202">r176202</a>, we would apply the multiplier if the CSSPrimitiveValue is
a Percentage or a Number. This patch updates the code to match the
behavior prior to <a href="http://trac.webkit.org/projects/webkit/changeset/176202">r176202</a>.

Test: fast/css/line-height-text-autosizing.html

* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderFunctions::convertLineHeight):
(WebCore::StyleBuilderFunctions::applyValueLineHeight):

LayoutTests:

Add layout test to cover line-height CSS property and its interaction
with -webkit-text-size-adjust.

* fast/css/line-height-text-autosizing-expected.txt: Added.
* fast/css/line-height-text-autosizing.html: Added.
* platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderCustomh">trunk/Source/WebCore/css/StyleBuilderCustom.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcsslineheighttextautosizingexpectedtxt">trunk/LayoutTests/fast/css/line-height-text-autosizing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsslineheighttextautosizinghtml">trunk/LayoutTests/fast/css/line-height-text-autosizing.html</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorfastcsslineheighttextautosizingexpectedtxt">trunk/LayoutTests/platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176489 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-22 01:09:21 UTC (rev 176489)
+++ trunk/LayoutTests/ChangeLog        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-11-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Regression(r176202): line-height is wrong on marco.org
+        https://bugs.webkit.org/show_bug.cgi?id=138970
+
+        Reviewed by Simon Fraser.
+
+        Add layout test to cover line-height CSS property and its interaction
+        with -webkit-text-size-adjust.
+
+        * fast/css/line-height-text-autosizing-expected.txt: Added.
+        * fast/css/line-height-text-autosizing.html: Added.
+        * platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt: Added.
+
</ins><span class="cx"> 2014-11-21  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Unclear that user and password are autofilled, no VoiceOver version of the yellow outline.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsslineheighttextautosizingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/line-height-text-autosizing-expected.txt (0 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/line-height-text-autosizing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/line-height-text-autosizing-expected.txt        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Test the 'line-height' property interaction with '-webkit-text-size-adjust'.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Case without text size adjust.
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;normal&quot;
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('font-size') is &quot;20px&quot;
+testDivNoAdjust.style['line-height'] = '1.6'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;32px&quot;
+testDivNoAdjust.style['line-height'] = '80%'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;16px&quot;
+testDivNoAdjust.style['line-height'] = '12px'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;12px&quot;
+Case with text size adjust.
+Platform does not support  -webkit-text-size-adjust
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test
+Test
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsslineheighttextautosizinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/line-height-text-autosizing.html (0 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/line-height-text-autosizing.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/line-height-text-autosizing.html        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+#testDivAdjust {
+  -webkit-text-size-adjust: 150%;
+  font-size: 20px;
+}
+#testDivNoAdjust {
+  font-size: 20px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;boby&gt;
+&lt;div id=&quot;testDivNoAdjust&quot;&gt;Test&lt;/div&gt;
+&lt;div id=&quot;testDivAdjust&quot;&gt;Test&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Test the 'line-height' property interaction with '-webkit-text-size-adjust'.&quot;);
+
+debug(&quot;Case without text size adjust.&quot;);
+var testDivNoAdjust = document.getElementById(&quot;testDivNoAdjust&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')&quot;, &quot;normal&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDivNoAdjust).getPropertyValue('font-size')&quot;, &quot;20px&quot;);
+evalAndLog(&quot;testDivNoAdjust.style['line-height'] = '1.6'&quot;);
+// font-size * line-height == 20px * 1.6 == 32px
+shouldBeEqualToString(&quot;window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')&quot;, &quot;32px&quot;);
+evalAndLog(&quot;testDivNoAdjust.style['line-height'] = '80%'&quot;);
+// font-size * line-height == 20px * 80% == 16px
+shouldBeEqualToString(&quot;window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')&quot;, &quot;16px&quot;);
+evalAndLog(&quot;testDivNoAdjust.style['line-height'] = '12px'&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')&quot;, &quot;12px&quot;);
+
+debug(&quot;Case with text size adjust.&quot;);
+var testDivAdjust = document.getElementById(&quot;testDivAdjust&quot;);
+if (window.getComputedStyle(testDivAdjust).getPropertyValue('-webkit-text-size-adjust') == null) {
+  debug(&quot;Platform does not support  -webkit-text-size-adjust&quot;);
+} else {
+  debug(&quot;Platform supports -webkit-text-size-adjust&quot;);
+  shouldBeEqualToString(&quot;window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')&quot;, &quot;normal&quot;);
+  // font-size * -webkit-text-size-adjust == 20px * 150% == 30px
+  shouldBeEqualToString(&quot;window.getComputedStyle(testDivAdjust).getPropertyValue('font-size')&quot;, &quot;30px&quot;);
+  evalAndLog(&quot;testDivAdjust.style['line-height'] = '1.6'&quot;);
+  // font-size * line-height == 30px * 1.6 == 48px
+  shouldBeEqualToString(&quot;window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')&quot;, &quot;48px&quot;);
+
+  evalAndLog(&quot;testDivAdjust.style['line-height'] = '80%'&quot;);
+  // font-size * line-height == 30px * 80% == 24px
+  shouldBeEqualToString(&quot;window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')&quot;, &quot;24px&quot;);
+
+  evalAndLog(&quot;testDivAdjust.style['line-height'] = '12px'&quot;);
+  // line-height * -webkit-text-size-adjust == 12px * 150% == 18px
+  shouldBeEqualToString(&quot;window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')&quot;, &quot;18px&quot;);
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (176489 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2014-11-22 01:09:21 UTC (rev 176489)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -151,3 +151,8 @@
</span><span class="cx"> traversal
</span><span class="cx"> userscripts
</span><span class="cx"> webarchive
</span><ins>+
+###
+# Mark as passing specific tests in folders that were skipped temporarily above.
+##
+webkit.org/b/138970 fast/css/line-height-text-autosizing.html [ Pass ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfastcsslineheighttextautosizingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt (0 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/css/line-height-text-autosizing-expected.txt        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+Test the 'line-height' property interaction with '-webkit-text-size-adjust'.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Case without text size adjust.
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;normal&quot;
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('font-size') is &quot;20px&quot;
+testDivNoAdjust.style['line-height'] = '1.6'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;32px&quot;
+testDivNoAdjust.style['line-height'] = '80%'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;16px&quot;
+testDivNoAdjust.style['line-height'] = '12px'
+PASS window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height') is &quot;12px&quot;
+Case with text size adjust.
+Platform supports -webkit-text-size-adjust
+PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is &quot;normal&quot;
+PASS window.getComputedStyle(testDivAdjust).getPropertyValue('font-size') is &quot;30px&quot;
+testDivAdjust.style['line-height'] = '1.6'
+PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is &quot;48px&quot;
+testDivAdjust.style['line-height'] = '80%'
+PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is &quot;24px&quot;
+testDivAdjust.style['line-height'] = '12px'
+PASS window.getComputedStyle(testDivAdjust).getPropertyValue('line-height') is &quot;18px&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test
+Test
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176489 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-22 01:09:21 UTC (rev 176489)
+++ trunk/Source/WebCore/ChangeLog        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-11-21  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Regression(r176202): line-height is wrong on marco.org
+        https://bugs.webkit.org/show_bug.cgi?id=138970
+
+        Reviewed by Simon Fraser.
+
+        After r176202, on iOS with IOS_TEXT_AUTOSIZING enabled, we would
+        multiply the lineHeight by RenderStyle::textSizeAdjust()::multiplier()
+        unconditionally. However, we're only supposed to do so if
+        RenderStyle::textSizeAdjust()::isPercentage() returns true. This
+        patch reintroduces the textSizeAdjust().isPercentage() check that was
+        inadvertently dropped when refactoring the code to be shared between
+        iOS and OS X.
+
+        Additionally, the multiplier is only supposed the be applied if the
+        input CSSPrimitiveValue is a Length or a Number. However, after
+        r176202, we would apply the multiplier if the CSSPrimitiveValue is
+        a Percentage or a Number. This patch updates the code to match the
+        behavior prior to r176202.
+
+        Test: fast/css/line-height-text-autosizing.html
+
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderFunctions::convertLineHeight):
+        (WebCore::StyleBuilderFunctions::applyValueLineHeight):
+
</ins><span class="cx"> 2014-11-21  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: com.apple.WebKit.WebContent crashed at WebCore: WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176489 => 176490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2014-11-22 01:09:21 UTC (rev 176489)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2014-11-22 01:22:41 UTC (rev 176490)
</span><span class="lines">@@ -521,11 +521,13 @@
</span><span class="cx">     }
</span><span class="cx">     if (primitiveValue.isLength()) {
</span><span class="cx">         length = primitiveValue.computeLength&lt;Length&gt;(csstoLengthConversionDataWithTextZoomFactor(styleResolver));
</span><ins>+        if (multiplier != 1.f)
+            length = Length(length.value() * multiplier, Fixed);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx">     if (primitiveValue.isPercentage()) {
</span><span class="cx">         // FIXME: percentage should not be restricted to an integer here.
</span><del>-        length = Length((styleResolver.style()-&gt;computedFontSize() * primitiveValue.getIntValue()) * multiplier / 100, Fixed);
</del><ins>+        length = Length((styleResolver.style()-&gt;computedFontSize() * primitiveValue.getIntValue()) / 100, Fixed);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx">     if (primitiveValue.isNumber()) {
</span><span class="lines">@@ -571,7 +573,8 @@
</span><span class="cx"> inline void applyValueLineHeight(StyleResolver&amp; styleResolver, CSSValue&amp; value)
</span><span class="cx"> {
</span><span class="cx">     Length lineHeight;
</span><del>-    if (!convertLineHeight(styleResolver, value, lineHeight, styleResolver.style()-&gt;textSizeAdjust().multiplier()))
</del><ins>+    float multiplier = styleResolver.style()-&gt;textSizeAdjust().isPercentage() ? styleResolver.style()-&gt;textSizeAdjust().multiplier() : 1.f;
+    if (!convertLineHeight(styleResolver, value, lineHeight, multiplier))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     styleResolver.style()-&gt;setLineHeight(lineHeight);
</span></span></pre>
</div>
</div>

</body>
</html>