<!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>[179029] branches/safari-600.5-branch</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/179029">179029</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2015-01-23 15:04:58 -0800 (Fri, 23 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/174489">r174489</a>. &lt;rdar://problem/19452129&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6005branchLayoutTestsChangeLog">branches/safari-600.5-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreChangeLog">branches/safari-600.5-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsFonth">branches/safari-600.5-branch/Source/WebCore/platform/graphics/Font.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingInlineBoxh">branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingInlineTextBoxh">branches/safari-600.5-branch/Source/WebCore/rendering/InlineTextBox.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderBlockLineLayoutcpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderBoxcpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyBasecpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyRunh">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyjustificationexpectedhtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-expected.html</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyjustificationhittestexpectedtxt">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest-expected.txt</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyjustificationhittesthtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest.html</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyjustificationhtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6005branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/LayoutTests/ChangeLog (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/ChangeLog        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/LayoutTests/ChangeLog        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-01-23  Dana Burkart  &lt;dburkart@apple.com&gt;
+
+        Merged r174489. &lt;rdar://problem/19452129&gt;
+
+    2014-10-08  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+            Inline ruby does not get justified correctly
+            https://bugs.webkit.org/show_bug.cgi?id=137421
+
+            Reviewed by Dave Hyatt.
+
+            Test that ruby gets spaces inside the ruby base, and that hit testing the
+            ruby base gives us correct answers.
+
+            * fast/ruby/ruby-justification-expected.html: Added.
+            * fast/ruby/ruby-justification-hittest-expected.txt: Added.
+            * fast/ruby/ruby-justification-hittest.html: Added.
+            * fast/ruby/ruby-justification.html: Added.
+            * platform/mac/fast/ruby/bopomofo-rl-expected.txt: Ruby text gets the CSS
+            property text-align: justify, which worked prior to this patch. However, this
+            patch now justifies ruby bases, so now if there is text that is both a ruby
+            base and ruby text (such as ruby in ruby) it correctly gets justified. This
+            test does such, and therefore needs to be rebaselined.
+
</ins><span class="cx"> 2015-01-22  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r175264. rdar://problem/19451378
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyjustificationexpectedhtmlfromrev174489trunkLayoutTestsfastrubyrubyjustificationexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-expected.html (from rev 174489, trunk/LayoutTests/fast/ruby/ruby-justification-expected.html) (0 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-expected.html                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-expected.html        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+This test makes sure that ruby inside text-align: justify has its contents justified.
+&lt;div style=&quot;text-align: justify; font-size: 16px;&quot;&gt;
+&lt;div&gt;
+abcdefg abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div&gt;
+abcdefg abcdefg abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div&gt;
+abcdefg &lt;ruby&gt;abcdefg&lt;rt&gt;&lt;span style=&quot;color: transparent;&quot;&gt;a&lt;/span&gt;&lt;/ruby&gt; abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-family: Ahem; font-size: 16px;&quot;&gt;
+&lt;ruby&gt;abcdefg&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;abcdefg&lt;rt&gt;a&lt;/ruby&gt; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div style=&quot;text-align: right;&quot;&gt;
+a
+&lt;/div&gt;
+&lt;div style=&quot;text-align: justify;&quot;&gt;
+abcdefg abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
</ins></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyjustificationhittestexpectedtxtfromrev174489trunkLayoutTestsfastrubyrubyjustificationhittestexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest-expected.txt (from rev 174489, trunk/LayoutTests/fast/ruby/ruby-justification-hittest-expected.txt) (0 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest-expected.txt                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest-expected.txt        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+This test makes sure that hit testing works with ruby inside text-align: justify.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS right is 792
+PASS document.elementFromPoint(right - 1, bottom - 1).id is &quot;ruby&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+abcdefg abcdefga mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
</ins></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyjustificationhittesthtmlfromrev174489trunkLayoutTestsfastrubyrubyjustificationhittesthtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest.html (from rev 174489, trunk/LayoutTests/fast/ruby/ruby-justification-hittest.html) (0 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest.html                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification-hittest.html        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -0,0 +1,21 @@
</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;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;text-align: justify; font-family: Ahem;&quot;&gt;
+&lt;ruby id=&quot;ruby&quot;&gt;abcdefg abcdefg&lt;rt&gt;a&lt;/ruby&gt; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;script&gt;
+description(&quot;This test makes sure that hit testing works with ruby inside text-align: justify.&quot;);
+var ruby = document.getElementById(&quot;ruby&quot;);
+var boundingRect = ruby.getBoundingClientRect();
+var right = boundingRect.right;
+var bottom = boundingRect.bottom;
+shouldBe(&quot;right&quot;, &quot;792&quot;);
+shouldBeEqualToString(&quot;document.elementFromPoint(right - 1, bottom - 1).id&quot;, &quot;ruby&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="branchessafari6005branchLayoutTestsfastrubyrubyjustificationhtmlfromrev174489trunkLayoutTestsfastrubyrubyjustificationhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification.html (from rev 174489, trunk/LayoutTests/fast/ruby/ruby-justification.html) (0 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification.html                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-justification.html        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+This test makes sure that ruby inside text-align: justify has its contents justified.
+&lt;div style=&quot;text-align: justify; font-size: 16px;&quot;&gt;
+&lt;div&gt;
+&lt;ruby&gt;abcdefg abcdefg&lt;rt&gt; &lt;/ruby&gt; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div&gt;
+&lt;ruby&gt;abcdefg abcdefg&lt;rt&gt; &lt;/ruby&gt; abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div&gt;
+&lt;ruby&gt;abcdefg abcdefg&lt;rt&gt;&lt;span style=&quot;color: transparent;&quot;&gt;a&lt;/span&gt;&lt;/ruby&gt; abcdefg mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div style=&quot;font-family: Ahem;&quot;&gt;
+&lt;ruby&gt;abcdefg abcdefg&lt;rt&gt;a&lt;/ruby&gt; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;div&gt;
+&lt;ruby&gt;abcdefg abcdefg&lt;rt style=&quot;text-align: right; font-size: 16px;&quot;&gt;a&lt;/ruby&gt; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
+&lt;/div&gt;
+&lt;/div&gt;
</ins></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/ChangeLog (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-01-23  Dana Burkart  &lt;dburkart@apple.com&gt;
+
+        Merged r174489. &lt;rdar://problem/19452129&gt;
+
+    2014-10-08  Myles C. Maxfield  &lt;litherum@gmail.com&gt;
+
+            Inline ruby does not get justified correctly
+            https://bugs.webkit.org/show_bug.cgi?id=137421
+
+            Reviewed by Dave Hyatt.
+
+            We justify text in two passes: one counts expansion opportunities within a line,
+            and the other doles out widths and expansion amounts to constituent inline boxes.
+            This patch simply modifies both passes to descend into ruby bases. Once it has
+            done so, we then re-layout the ruby run with the newly found width.
+
+            Tests: fast/ruby/ruby-justification-hittest.html
+                   fast/ruby/ruby-justification.html
+
+            * rendering/InlineBox.h:
+            (WebCore::InlineBox::setExpansion): updateRubyForJustifiedText() has to set the
+            expansion for an inline box, so make setExpansion() public.
+            * rendering/RenderBlockLineLayout.cpp:
+            (WebCore::updateRubyForJustifiedText): Given values that have already been
+            computed in computeInlineDirectionPositionsForSegment(), adjust the widths and
+            expansion values for all the various pieces of ruby.
+            (WebCore::computeExpansionForJustifiedText): Call updateRubyForJustifiedText() if
+            necessary.
+            (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): When
+            counting expansion opportunities in a line, include ruby bases.
+            * rendering/RenderRubyRun.h: Fix grammar in comment.
+            * rendering/RenderText.cpp:
+            (WebCore::RenderText::stringView): Give default arguments to function.
+            * rendering/RenderText.h: Ditto.
+
</ins><span class="cx"> 2015-01-22  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merged r178967. &lt;rdar://problem/19572776&gt;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsFonth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/Font.h (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/Font.h        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/Font.h        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -201,6 +201,9 @@
</span><span class="cx">     static bool isCJKIdeograph(UChar32);
</span><span class="cx">     static bool isCJKIdeographOrSymbol(UChar32);
</span><span class="cx"> 
</span><ins>+    // BEWARE: If isAfterExpansion is true after this function call, then the returned value includes a trailing opportunity
+    // which may or may not actually be present. RenderBlockFlow::computeInlineDirectionPositionsForSegment() compensates
+    // for this by decrementing the returned value if isAfterExpansion is true at the end of a line.
</ins><span class="cx">     static unsigned expansionOpportunityCount(const LChar*, size_t length, TextDirection, bool&amp; isAfterExpansion);
</span><span class="cx">     static unsigned expansionOpportunityCount(const UChar*, size_t length, TextDirection, bool&amp; isAfterExpansion);
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingInlineBoxh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -271,6 +271,13 @@
</span><span class="cx">     bool dirOverride() const { return m_bitfields.dirOverride(); }
</span><span class="cx">     void setDirOverride(bool dirOverride) { m_bitfields.setDirOverride(dirOverride); }
</span><span class="cx"> 
</span><ins>+    void setExpansion(float newExpansion)
+    {
+        m_logicalWidth -= m_bitfields.expansion();
+        m_bitfields.setExpansion(newExpansion);
+        m_logicalWidth += m_bitfields.expansion();
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     InlineBox* m_next; // The next element on the same line as us.
</span><span class="cx">     InlineBox* m_prev; // The previous element on the same line as us.
</span><span class="lines">@@ -408,7 +415,6 @@
</span><span class="cx">     bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeadingExpansion(); }
</span><span class="cx">     void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); }
</span><span class="cx">     int expansion() { return m_bitfields.expansion(); }
</span><del>-    void setExpansion(int expansion) { m_bitfields.setExpansion(expansion); }
</del><span class="cx">     
</span><span class="cx">     // For InlineFlowBox and InlineTextBox
</span><span class="cx">     bool extracted() const { return m_bitfields.extracted(); }
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/InlineTextBox.h (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/InlineTextBox.h        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/InlineTextBox.h        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -133,13 +133,6 @@
</span><span class="cx"> public:
</span><span class="cx">     virtual bool isLineBreak() const override final;
</span><span class="cx"> 
</span><del>-    void setExpansion(int newExpansion)
-    {
-        m_logicalWidth -= expansion();
-        InlineBox::setExpansion(newExpansion);
-        m_logicalWidth += newExpansion;
-    }
-
</del><span class="cx"> private:
</span><span class="cx">     virtual bool isInlineTextBox() const override final { return true; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> #include &quot;RenderFlowThread.h&quot;
</span><span class="cx"> #include &quot;RenderLineBreak.h&quot;
</span><span class="cx"> #include &quot;RenderRegion.h&quot;
</span><ins>+#include &quot;RenderRubyBase.h&quot;
+#include &quot;RenderRubyText.h&quot;
</ins><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;SVGRootInlineBox.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -538,8 +540,42 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, Vector&lt;unsigned, 16&gt;&amp; expansionOpportunities, unsigned expansionOpportunityCount, float&amp; totalLogicalWidth, float availableLogicalWidth)
</del><ins>+static inline void updateRubyForJustifiedText(RenderRubyRun&amp; rubyRun, BidiRun&amp; r, const Vector&lt;unsigned, 16&gt;&amp; expansionOpportunities, unsigned&amp; expansionOpportunityCount, float&amp; totalLogicalWidth, float availableLogicalWidth, size_t&amp; i)
</ins><span class="cx"> {
</span><ins>+    if (!rubyRun.rubyBase() || !rubyRun.rubyBase()-&gt;firstRootBox() || rubyRun.rubyBase()-&gt;firstRootBox()-&gt;nextRootBox() || !r.renderer().style().collapseWhiteSpace())
+        return;
+
+    auto&amp; rubyBase = *rubyRun.rubyBase();
+    auto&amp; rootBox = *rubyBase.firstRootBox();
+
+    float totalExpansion = 0;
+    unsigned totalOpportunitiesInRun = 0;
+    for (auto* leafChild = rootBox.firstLeafChild(); leafChild; leafChild = leafChild-&gt;nextLeafChild()) {
+        if (!leafChild-&gt;isInlineTextBox())
+            continue;
+
+        unsigned opportunitiesInRun = expansionOpportunities[i++];
+        ASSERT(opportunitiesInRun &lt;= expansionOpportunityCount);
+        auto expansion = (availableLogicalWidth - totalLogicalWidth) * opportunitiesInRun / expansionOpportunityCount;
+        totalExpansion += expansion;
+        totalOpportunitiesInRun += opportunitiesInRun;
+    }
+
+    if (totalOpportunitiesInRun) {
+        ASSERT(!rubyRun.hasOverrideWidth());
+        rubyRun.setOverrideLogicalContentWidth(rubyRun.logicalWidth() + totalExpansion);
+        rubyRun.setNeedsLayout(MarkOnlyThis);
+        rubyRun.layoutBlock(true);
+        rubyRun.clearOverrideLogicalContentWidth();
+        r.box()-&gt;setExpansion(totalExpansion);
+
+        totalLogicalWidth += totalExpansion;
+        expansionOpportunityCount -= totalOpportunitiesInRun;
+    }
+}
+
+static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector&lt;unsigned, 16&gt;&amp; expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth)
+{
</ins><span class="cx">     if (!expansionOpportunityCount || availableLogicalWidth &lt;= totalLogicalWidth)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -561,9 +597,11 @@
</span><span class="cx">                 totalLogicalWidth += expansion;
</span><span class="cx">             }
</span><span class="cx">             expansionOpportunityCount -= opportunitiesInRun;
</span><del>-            if (!expansionOpportunityCount)
-                break;
-        }
</del><ins>+        } else if (r-&gt;renderer().isRubyRun())
+            updateRubyForJustifiedText(toRenderRubyRun(r-&gt;renderer()), *r, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, i);
+
+        if (!expansionOpportunityCount)
+            break;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -693,7 +731,33 @@
</span><span class="cx"> 
</span><span class="cx">             setLogicalWidthForTextRun(lineBox, r, &amp;rt, totalLogicalWidth, lineInfo, textBoxDataMap, verticalPositionCache, wordMeasurements);
</span><span class="cx">         } else {
</span><del>-            isAfterExpansion = false;
</del><ins>+            bool encounteredJustifiedRuby = false;
+            if (r-&gt;renderer().isRubyRun() &amp;&amp; textAlign == JUSTIFY &amp;&amp; r != trailingSpaceRun &amp;&amp; toRenderRubyRun(r-&gt;renderer()).rubyBase()) {
+                auto* rubyBase = toRenderRubyRun(r-&gt;renderer()).rubyBase();
+                if (rubyBase-&gt;firstRootBox() &amp;&amp; !rubyBase-&gt;firstRootBox()-&gt;nextRootBox() &amp;&amp; r-&gt;renderer().style().collapseWhiteSpace()) {
+                    for (auto* leafChild = rubyBase-&gt;firstRootBox()-&gt;firstLeafChild(); leafChild; leafChild = leafChild-&gt;nextLeafChild()) {
+                        if (!leafChild-&gt;isInlineTextBox())
+                            continue;
+                        if (!isAfterExpansion)
+                            toInlineTextBox(leafChild)-&gt;setCanHaveLeadingExpansion(true);
+                        encounteredJustifiedRuby = true;
+                        RenderText&amp; renderText = toRenderText(leafChild-&gt;renderer());
+
+                        unsigned opportunitiesInRun;
+                        if (renderText.is8Bit())
+                            opportunitiesInRun = Font::expansionOpportunityCount(renderText.characters8() + r-&gt;m_start, r-&gt;m_stop - r-&gt;m_start, r-&gt;box()-&gt;direction(), isAfterExpansion);
+                        else
+                            opportunitiesInRun = Font::expansionOpportunityCount(renderText.characters16() + r-&gt;m_start, r-&gt;m_stop - r-&gt;m_start, r-&gt;box()-&gt;direction(), isAfterExpansion);
+
+                        expansionOpportunities.append(opportunitiesInRun);
+                        expansionOpportunityCount += opportunitiesInRun;
+                    }
+                }
+            }
+
+            if (!encounteredJustifiedRuby)
+                isAfterExpansion = false;
+
</ins><span class="cx">             if (!r-&gt;renderer().isRenderInline()) {
</span><span class="cx">                 RenderBox&amp; renderBox = toRenderBox(r-&gt;renderer());
</span><span class="cx">                 if (renderBox.isRubyRun())
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderBox.cpp (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderBox.cpp        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderBox.cpp        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -2283,7 +2283,7 @@
</span><span class="cx">     // width.  Use the width from the style context.
</span><span class="cx">     // FIXME: Account for block-flow in flexible boxes.
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=46418
</span><del>-    if (hasOverrideWidth() &amp;&amp; (style().borderFit() == BorderFitLines || parent()-&gt;isFlexibleBoxIncludingDeprecated())) {
</del><ins>+    if (hasOverrideWidth() &amp;&amp; (isRubyRun() || style().borderFit() == BorderFitLines || parent()-&gt;isFlexibleBoxIncludingDeprecated())) {
</ins><span class="cx">         computedValues.m_extent = overrideLogicalContentWidth() + borderAndPaddingLogicalWidth();
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyBasecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderRubyBase::adjustInlineDirectionLineBounds(int expansionOpportunityCount, float&amp; logicalLeft, float&amp; logicalWidth) const
</span><span class="cx"> {
</span><del>-    int maxPreferredLogicalWidth = this-&gt;maxPreferredLogicalWidth();
</del><ins>+    LayoutUnit maxPreferredLogicalWidth = rubyRun() &amp;&amp; rubyRun()-&gt;hasOverrideWidth() ? rubyRun()-&gt;overrideLogicalContentWidth() : this-&gt;maxPreferredLogicalWidth();
</ins><span class="cx">     if (maxPreferredLogicalWidth &gt;= logicalWidth)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyRunh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h (179028 => 179029)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h        2015-01-23 23:03:28 UTC (rev 179028)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h        2015-01-23 23:04:58 UTC (rev 179029)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> class RenderRubyBase;
</span><span class="cx"> class RenderRubyText;
</span><span class="cx"> 
</span><del>-// RenderRubyRun are 'inline-block/table' like objects,and wrap a single pairing of a ruby base with its ruby text(s).
</del><ins>+// RenderRubyRuns are 'inline-block/table' like objects, and wrap a single pairing of a ruby base with its ruby text(s).
</ins><span class="cx"> // See RenderRuby.h for further comments on the structure
</span><span class="cx"> 
</span><span class="cx"> class RenderRubyRun final : public RenderBlockFlow {
</span></span></pre>
</div>
</div>

</body>
</html>