<!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>[179906] 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/179906">179906</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2015-02-10 17:33:24 -0800 (Tue, 10 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/179722">r179722</a>.  rdar://problem/19670548</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6005branchLayoutTestsChangeLog">branches/safari-600.5-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyblockstylenotupdatedwithbeforeaftercontentexpectedtxt">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyblockstylenotupdatedwithbeforeaftercontenthtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyinlinestylenotupdatedwithbeforeaftercontentexpectedtxt">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubyinlinestylenotupdatedwithbeforeaftercontenthtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreChangeLog">branches/safari-600.5-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingInlineBoxh">branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderBlockFlowh">branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockFlow.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderBlockLineLayoutcpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyBasecpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyBaseh">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyRuncpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyRunh">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyTextcpp">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderingRenderRubyTexth">branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCorerenderinglineBreakingContextInlineHeadersh">branches/safari-600.5-branch/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubypunctuationavoidbreakingexpectedhtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html</a></li>
<li><a href="#branchessafari6005branchLayoutTestsfastrubyrubypunctuationavoidbreakinghtml">branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.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 (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/ChangeLog        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/LayoutTests/ChangeLog        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-02-05  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r179366
+
+    2015-01-20  David Hyatt  &lt;hyatt@apple.com&gt;
+
+            Japanese line breaking rules need to be respected before and after Ruby.
+            https://bugs.webkit.org/show_bug.cgi?id=91588
+            &lt;rdar://problem/17306535&gt;
+
+            Reviewed by Dean Jackson.
+
+            * fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
+            * fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
+            * fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
+            * fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
+            * fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
+            * fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
+
</ins><span class="cx"> 2015-01-24  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r176262.
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyblockstylenotupdatedwithbeforeaftercontentexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -4,9 +4,9 @@
</span><span class="cx">   RenderBlock {HTML} at (0,0) size 800x600
</span><span class="cx">     RenderBody {BODY} at (8,8) size 784x584
</span><span class="cx">       RenderRuby (block) {RUBY} at (0,0) size 784x384 [color=#0000FF]
</span><del>-        RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]
-          RenderText at (0,0) size 512x128
-            text run at (0,0) width 512: &quot;1234&quot;
</del><ins>+        RenderInline (generated) at (0,0) size 640x128 [color=#FFA500]
+          RenderText at (0,0) size 640x128
+            text run at (0,0) width 640: &quot;1234 &quot;
</ins><span class="cx">         RenderRubyRun (anonymous) at (0,128) size 512x128
</span><span class="cx">           RenderRubyBase (anonymous) at (0,0) size 512x128
</span><span class="cx">             RenderText {#text} at (0,0) size 512x128
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyblockstylenotupdatedwithbeforeaftercontenthtml"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -4,12 +4,12 @@
</span><span class="cx"> &lt;style&gt;
</span><span class="cx"> #test::before
</span><span class="cx"> {
</span><del>-    content: &quot;1234&quot;;
</del><ins>+    content: &quot;1234 &quot;;
</ins><span class="cx">     color: orange;
</span><span class="cx"> }
</span><span class="cx"> #test::after
</span><span class="cx"> {
</span><del>-    content: &quot;4578&quot;;
</del><ins>+    content: &quot; 4578&quot;;
</ins><span class="cx">     color: yellow;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyinlinestylenotupdatedwithbeforeaftercontentexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx">   RenderBlock {HTML} at (0,0) size 800x600
</span><span class="cx">     RenderBody {BODY} at (8,8) size 784x584
</span><span class="cx">       RenderBlock (anonymous) at (0,0) size 784x384
</span><del>-        RenderRuby (inline) {RUBY} at (0,0) size 512x384 [color=#0000FF]
-          RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]
-            RenderText at (0,0) size 512x128
-              text run at (0,0) width 512: &quot;1234&quot;
</del><ins>+        RenderRuby (inline) {RUBY} at (0,0) size 640x384 [color=#0000FF]
+          RenderInline (generated) at (0,0) size 640x128 [color=#FFA500]
+            RenderText at (0,0) size 640x128
+              text run at (0,0) width 640: &quot;1234 &quot;
</ins><span class="cx">           RenderRubyRun (anonymous) at (0,128) size 512x128
</span><span class="cx">             RenderRubyBase (anonymous) at (0,0) size 512x128
</span><span class="cx">               RenderText {#text} at (0,0) size 512x128
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubyinlinestylenotupdatedwithbeforeaftercontenthtml"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -4,12 +4,12 @@
</span><span class="cx"> &lt;style&gt;
</span><span class="cx"> #test::before
</span><span class="cx"> {
</span><del>-    content: &quot;1234&quot;;
</del><ins>+    content: &quot;1234 &quot;;
</ins><span class="cx">     color: orange;
</span><span class="cx"> }
</span><span class="cx"> #test::after
</span><span class="cx"> {
</span><del>-    content: &quot;4578&quot;;
</del><ins>+    content: &quot; 4578&quot;;
</ins><span class="cx">     color: yellow;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubypunctuationavoidbreakingexpectedhtmlfromrev179722branchessafari6001415branchLayoutTestsfastrubyrubypunctuationavoidbreakingexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html (from rev 179722, branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html) (0 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;html lang=&quot;ja&quot;&gt;
+&lt;head&gt;
+&lt;meta http-equiv =&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div&gt;
+&lt;p&gt;Japanese Line breaking rule &quot;Kinsoku&quot; Test Case. We should not break before or after the Ruby.
+&lt;div style=&quot;position: absolute; top: 50px; left: 3%; width: 100px;&quot;&gt;
+「&lt;ruby&gt;直帰&lt;rt&gt;ちょっき&lt;/rt&gt;&lt;/ruby&gt;」
+&lt;/div&gt;
+&lt;div&gt;
+&lt;div style=&quot;position: absolute; top: 50px; left: 200px;-webkit-writing-mode: vertical-rl; height: 100px;&quot;&gt;
+「&lt;ruby&gt;直帰&lt;rt&gt;ちょっき&lt;/rt&gt;&lt;/ruby&gt;」
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari6005branchLayoutTestsfastrubyrubypunctuationavoidbreakinghtmlfromrev179722branchessafari6001415branchLayoutTestsfastrubyrubypunctuationavoidbreakinghtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html (from rev 179722, branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html) (0 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html                                (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;html lang=&quot;ja&quot;&gt;
+&lt;head&gt;
+&lt;meta http-equiv =&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div&gt;
+&lt;p&gt;Japanese Line breaking rule &quot;Kinsoku&quot; Test Case. We should not break before or after the Ruby.
+&lt;div style=&quot;position: absolute; top: 50px; left: 3%; width: 40px;&quot;&gt;
+「&lt;ruby&gt;直帰&lt;rt&gt;ちょっき&lt;/rt&gt;&lt;/ruby&gt;」
+&lt;/div&gt;
+&lt;div&gt;
+&lt;div style=&quot;position: absolute; top: 50px; left: 200px;-webkit-writing-mode: vertical-rl; height: 40px;&quot;&gt;
+「&lt;ruby&gt;直帰&lt;rt&gt;ちょっき&lt;/rt&gt;&lt;/ruby&gt;」
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/ChangeLog (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2015-02-05  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r179366
+
+    2015-01-20  David Hyatt  &lt;hyatt@apple.com&gt;
+
+            Japanese line breaking rules need to be respected before and after Ruby.
+            https://bugs.webkit.org/show_bug.cgi?id=91588
+            &lt;rdar://problem/17306535&gt;
+
+            Reviewed by Dean Jackson.
+
+            Added fast/ruby/ruby-punctuation-avoid-breaking.html.
+
+            This patch has to add support for following line breaking rules at both
+            sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
+            just hard-code the rules (and apply this hard-coding only to Ruby and not
+            to other inline replaced elements).
+
+            For breaking after a Ruby we do better. The Ruby run caches its prior characters
+            and line layout is able to obtain them and use them when deciding whether or not
+            to break. This means for the &quot;after&quot; side of a Ruby, we're able to behave the same
+            as if no Ruby was used.
+
+            * rendering/RenderBlockFlow.h:
+            (WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
+            * rendering/RenderBlockLineLayout.cpp:
+            (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+            * rendering/RenderRubyBase.cpp:
+            (WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
+            * rendering/RenderRubyBase.h:
+            * rendering/RenderRubyRun.cpp:
+            (WebCore::RenderRubyRun::RenderRubyRun):
+            (WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
+            (WebCore::RenderRubyRun::canBreakBefore):
+            * rendering/RenderRubyRun.h:
+            * rendering/RenderRubyText.cpp:
+            (WebCore::RenderRubyText::canBreakBefore):
+            * rendering/RenderRubyText.h:
+            * rendering/line/BreakingContextInlineHeaders.h:
+            (WebCore::BreakingContext::handleReplaced):
+            (WebCore::BreakingContext::canBreakAtThisPosition):
+            (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
+
</ins><span class="cx"> 2015-02-10  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r177849
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingInlineBoxh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/InlineBox.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -22,8 +22,10 @@
</span><span class="cx"> #define InlineBox_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;RenderBoxModelObject.h&quot;
</span><ins>+#include &quot;TextBreakIterator.h&quot;
</ins><span class="cx"> #include &quot;TextDirection.h&quot;
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class HitTestRequest;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockFlow.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockFlow.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockFlow.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -462,7 +462,9 @@
</span><span class="cx">     
</span><span class="cx">     virtual void computeColumnCountAndWidth();
</span><span class="cx">     virtual bool requiresColumns(int) const;
</span><del>-
</del><ins>+    
+    virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&amp;) {};
+    
</ins><span class="cx"> private:
</span><span class="cx">     bool recomputeLogicalWidthAndColumnWidth();
</span><span class="cx">     LayoutUnit columnGap() const;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -1143,6 +1143,7 @@
</span><span class="cx"> 
</span><span class="cx">         WordMeasurements wordMeasurements;
</span><span class="cx">         end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
</span><ins>+        cachePriorCharactersIfNeeded(renderTextInfo.m_lineBreakIterator);
</ins><span class="cx">         renderTextInfo.m_lineBreakIterator.resetPriorContext();
</span><span class="cx">         if (resolver.position().atEnd()) {
</span><span class="cx">             // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with!
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyBasecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.cpp        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -154,4 +154,11 @@
</span><span class="cx">     logicalWidth -= inset;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderRubyBase::cachePriorCharactersIfNeeded(const LazyLineBreakIterator&amp; lineBreakIterator)
+{
+    auto* run = rubyRun();
+    if (run)
+        run-&gt;setCachedPriorCharacters(lineBreakIterator.lastCharacter(), lineBreakIterator.secondToLastCharacter());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyBaseh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyBase.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -48,6 +48,8 @@
</span><span class="cx"> 
</span><span class="cx">     RenderRubyRun* rubyRun() const;
</span><span class="cx"> 
</span><ins>+    virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&amp;) override;
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const;
</span><span class="cx">     virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyRuncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.cpp (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.cpp        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.cpp        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -43,6 +43,8 @@
</span><span class="cx"> 
</span><span class="cx"> RenderRubyRun::RenderRubyRun(Document&amp; document, PassRef&lt;RenderStyle&gt; style)
</span><span class="cx">     : RenderBlockFlow(document, WTF::move(style))
</span><ins>+    , m_lastCharacter(0)
+    , m_secondToLastCharacter(0)
</ins><span class="cx"> {
</span><span class="cx">     setReplaced(true);
</span><span class="cx">     setInline(true);
</span><span class="lines">@@ -327,4 +329,17 @@
</span><span class="cx">         endOverhang = std::min&lt;int&gt;(endOverhang, std::min&lt;int&gt;(toRenderText(endRenderer)-&gt;minLogicalWidth(), halfWidthOfFontSize));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderRubyRun::updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator&amp; iterator) const
+{
+    iterator.setPriorContext(m_lastCharacter, m_secondToLastCharacter);
+}
+
+bool RenderRubyRun::canBreakBefore(const LazyLineBreakIterator&amp; iterator) const
+{
+    RenderRubyText* rubyText = this-&gt;rubyText();
+    if (!rubyText)
+        return true;
+    return rubyText-&gt;canBreakBefore(iterator);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyRunh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyRun.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -67,6 +67,14 @@
</span><span class="cx"> 
</span><span class="cx">     static RenderRubyRun* staticCreateRubyRun(const RenderObject* parentRuby);
</span><span class="cx"> 
</span><ins>+    void updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator&amp;) const;
+    void setCachedPriorCharacters(UChar last, UChar secondToLast)
+    {
+        m_lastCharacter = last;
+        m_secondToLastCharacter = secondToLast;
+    }
+    bool canBreakBefore(const LazyLineBreakIterator&amp;) const;
+    
</ins><span class="cx"> protected:
</span><span class="cx">     RenderRubyBase* createRubyBase() const;
</span><span class="cx"> 
</span><span class="lines">@@ -75,6 +83,10 @@
</span><span class="cx">     virtual const char* renderName() const { return &quot;RenderRubyRun (anonymous)&quot;; }
</span><span class="cx">     virtual bool createsAnonymousWrapper() const { return true; }
</span><span class="cx">     virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
</span><ins>+
+private:
+    UChar m_lastCharacter;
+    UChar m_secondToLastCharacter;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> RENDER_OBJECT_TYPE_CASTS(RenderRubyRun, isRubyRun())
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyTextcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.cpp (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.cpp        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.cpp        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -93,4 +93,45 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderRubyText::canBreakBefore(const LazyLineBreakIterator&amp; iterator) const
+{
+    // FIXME: It would be nice to improve this so that it isn't just hard-coded, but lookahead in this
+    // case is particularly problematic.
+
+    if (!iterator.priorContextLength())
+        return true;
+    UChar ch = iterator.lastCharacter();
+    ULineBreak lineBreak = (ULineBreak)u_getIntPropertyValue(ch, UCHAR_LINE_BREAK);
+    // UNICODE LINE BREAKING ALGORITHM
+    // http://www.unicode.org/reports/tr14/
+    // And Requirements for Japanese Text Layout, 3.1.7 Characters Not Starting a Line
+    // http://www.w3.org/TR/2012/NOTE-jlreq-20120403/#characters_not_starting_a_line
+    switch (lineBreak) {
+    case U_LB_NONSTARTER:
+    case U_LB_CLOSE_PARENTHESIS:
+    case U_LB_CLOSE_PUNCTUATION:
+    case U_LB_EXCLAMATION:
+    case U_LB_BREAK_SYMBOLS:
+    case U_LB_INFIX_NUMERIC:
+    case U_LB_ZWSPACE:
+    case U_LB_WORD_JOINER:
+        return false;
+    default:
+        break;
+    }
+    // Special care for Requirements for Japanese Text Layout
+    switch (ch) {
+    case 0x2019: // RIGHT SINGLE QUOTATION MARK
+    case 0x201D: // RIGHT DOUBLE QUOTATION MARK
+    case 0x00BB: // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+    case 0x2010: // HYPHEN
+    case 0x2013: // EN DASH
+    case 0x300C: // LEFT CORNER BRACKET
+        return false;
+    default:
+        break;
+    }
+    return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderingRenderRubyTexth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/RenderRubyText.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -45,7 +45,9 @@
</span><span class="cx">     virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override;
</span><span class="cx">     
</span><span class="cx">     RenderRubyRun* rubyRun() const;
</span><del>-
</del><ins>+    
+    bool canBreakBefore(const LazyLineBreakIterator&amp;) const;
+   
</ins><span class="cx"> private:
</span><span class="cx">     virtual const char* renderName() const override { return &quot;RenderRubyText&quot;; }
</span><span class="cx">     virtual bool isRubyText() const override { return true; }
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (179905 => 179906)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-02-11 01:06:01 UTC (rev 179905)
+++ branches/safari-600.5-branch/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-02-11 01:33:24 UTC (rev 179906)
</span><span class="lines">@@ -413,7 +413,8 @@
</span><span class="cx">         m_width.updateAvailableWidth(replacedBox.logicalHeight());
</span><span class="cx"> 
</span><span class="cx">     // Break on replaced elements if either has normal white-space.
</span><del>-    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) &amp;&amp; (!m_current.renderer()-&gt;isImage() || m_allowImagesToBreak)) {
</del><ins>+    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) &amp;&amp; (!m_current.renderer()-&gt;isImage() || m_allowImagesToBreak)
+        &amp;&amp; (!m_current.renderer()-&gt;isRubyRun() || toRenderRubyRun(m_current.renderer())-&gt;canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) {
</ins><span class="cx">         m_width.commit();
</span><span class="cx">         m_lineBreak.moveToStartOf(m_current.renderer());
</span><span class="cx">     }
</span><span class="lines">@@ -442,10 +443,13 @@
</span><span class="cx">             m_width.addUncommittedWidth(replacedLogicalWidth);
</span><span class="cx">     } else
</span><span class="cx">         m_width.addUncommittedWidth(replacedLogicalWidth);
</span><del>-    if (m_current.renderer()-&gt;isRubyRun())
</del><ins>+    if (m_current.renderer()-&gt;isRubyRun()) {
</ins><span class="cx">         m_width.applyOverhang(toRenderRubyRun(m_current.renderer()), m_lastObject, m_nextObject);
</span><del>-    // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
-    m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
</del><ins>+        toRenderRubyRun(m_current.renderer())-&gt;updatePriorContextFromCachedBreakIterator(m_renderTextInfo.m_lineBreakIterator);
+    } else {
+        // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
+        m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline float firstPositiveWidth(const WordMeasurements&amp; wordMeasurements)
</span><span class="lines">@@ -951,7 +955,7 @@
</span><span class="cx">         return m_autoWrap;
</span><span class="cx">     bool currentIsTextOrEmptyInline = m_current.renderer()-&gt;isText() || (m_current.renderer()-&gt;isRenderInline() &amp;&amp; isEmptyInline(toRenderInline(*m_current.renderer())));
</span><span class="cx">     if (!currentIsTextOrEmptyInline)
</span><del>-        return m_autoWrap;
</del><ins>+        return m_autoWrap &amp;&amp; !m_current.renderer()-&gt;isRubyRun();
</ins><span class="cx"> 
</span><span class="cx">     bool canBreakHere = !m_currentCharacterIsSpace &amp;&amp; textBeginsWithBreakablePosition(m_nextObject);
</span><span class="cx"> 
</span><span class="lines">@@ -998,7 +1002,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!m_current.renderer()-&gt;isFloatingOrOutOfFlowPositioned()) {
</span><span class="cx">         m_lastObject = m_current.renderer();
</span><del>-        if (m_lastObject-&gt;isReplaced() &amp;&amp; m_autoWrap &amp;&amp; (!m_lastObject-&gt;isImage() || m_allowImagesToBreak) &amp;&amp; (!m_lastObject-&gt;isListMarker() || toRenderListMarker(*m_lastObject).isInside())) {
</del><ins>+        if (m_lastObject-&gt;isReplaced() &amp;&amp; m_autoWrap &amp;&amp; !m_lastObject-&gt;isRubyRun() &amp;&amp; (!m_lastObject-&gt;isImage() || m_allowImagesToBreak) &amp;&amp; (!m_lastObject-&gt;isListMarker() || toRenderListMarker(*m_lastObject).isInside())) {
</ins><span class="cx">             m_width.commit();
</span><span class="cx">             m_lineBreak.moveToStartOf(m_nextObject);
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>