<!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>[161579] tags/Safari-538.10.2</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/161579">161579</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-01-09 13:26:54 -0800 (Thu, 09 Jan 2014)</dd>
</dl>

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari538102LayoutTestsChangeLog">tags/Safari-538.10.2/LayoutTests/ChangeLog</a></li>
<li><a href="#tagsSafari538102LayoutTestsplatformmaceditingselectionafterlinewrapexpectedtxt">tags/Safari-538.10.2/LayoutTests/platform/mac/editing/selection/after-line-wrap-expected.txt</a></li>
<li><a href="#tagsSafari538102SourceWebCoreChangeLog">tags/Safari-538.10.2/Source/WebCore/ChangeLog</a></li>
<li><a href="#tagsSafari538102SourceWebCorerenderinglineBreakingContextInlineHeadersh">tags/Safari-538.10.2/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#tagsSafari538102LayoutTestseditinginsertinginsertingtrailingspaceandletterexpectedhtml">tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter-expected.html</a></li>
<li><a href="#tagsSafari538102LayoutTestseditinginsertinginsertingtrailingspaceandletterhtml">tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari538102LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.10.2/LayoutTests/ChangeLog (161578 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/LayoutTests/ChangeLog        2014-01-09 21:23:30 UTC (rev 161578)
+++ tags/Safari-538.10.2/LayoutTests/ChangeLog        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-01-09  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r161404
+
+    2014-01-06  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+            REGRESSION(r157851): trailing space inside an editable region could be erroneously collapsed
+            https://bugs.webkit.org/show_bug.cgi?id=126549
+
+            Reviewed by Sam Weinig.
+
+            Added a regression test and reverted the erroneous rebaseline in r157851.
+
+            * editing/inserting/inserting-trailing-space-and-letter-expected.html: Added.
+            * editing/inserting/inserting-trailing-space-and-letter.html: Added.
+            * platform/mac/editing/selection/after-line-wrap-expected.txt:
+
</ins><span class="cx"> 2013-12-19  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DOM bindings should use thisValue for attributes
</span></span></pre></div>
<a id="tagsSafari538102LayoutTestseditinginsertinginsertingtrailingspaceandletterexpectedhtmlfromrev161404trunkLayoutTestseditinginsertinginsertingtrailingspaceandletterexpectedhtml"></a>
<div class="copfile"><h4>Copied: tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter-expected.html (from rev 161404, trunk/LayoutTests/editing/inserting/inserting-trailing-space-and-letter-expected.html) (0 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter-expected.html                                (rev 0)
+++ tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter-expected.html        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+#editor {
+    width: 160px;
+    height: 100px;
+    font-family: Ahem;
+    font-size: 50px;
+    border: 1px solid black;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This tests inserting a character after the collapsed space at the end of a line.&lt;br&gt;
+There should be a space between the last two boxes below, and there should be two boxes on the first line and exactly one box on the second line.&lt;/p&gt;
+&lt;div id=&quot;editor&quot; contenteditable&gt;a b c&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="tagsSafari538102LayoutTestseditinginsertinginsertingtrailingspaceandletterhtmlfromrev161404trunkLayoutTestseditinginsertinginsertingtrailingspaceandletterhtml"></a>
<div class="copfile"><h4>Copied: tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter.html (from rev 161404, trunk/LayoutTests/editing/inserting/inserting-trailing-space-and-letter.html) (0 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter.html                                (rev 0)
+++ tags/Safari-538.10.2/LayoutTests/editing/inserting/inserting-trailing-space-and-letter.html        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+#editor {
+    width: 160px;
+    height: 100px;
+    font-family: Ahem;
+    font-size: 50px;
+    border: 1px solid black;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This tests inserting a character after the collapsed space at the end of a line.&lt;br&gt;
+There should be a space between the last two boxes below, and there should be two boxes on the first line and exactly one box on the second line.&lt;/p&gt;
+&lt;div id=&quot;editor&quot; contenteditable&gt;a b&lt;/div&gt;
+&lt;script&gt;
+
+var editor = document.getElementById('editor');
+editor.focus();
+getSelection().collapse(editor.firstChild, 3);
+
+document.execCommand('insertText', false, ' ');
+document.execCommand('insertText', false, 'c');
+
+editor.blur();
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="tagsSafari538102LayoutTestsplatformmaceditingselectionafterlinewrapexpectedtxt"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.10.2/LayoutTests/platform/mac/editing/selection/after-line-wrap-expected.txt (161578 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/LayoutTests/platform/mac/editing/selection/after-line-wrap-expected.txt        2014-01-09 21:23:30 UTC (rev 161578)
+++ tags/Safari-538.10.2/LayoutTests/platform/mac/editing/selection/after-line-wrap-expected.txt        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx">           text run at (0,18) width 285: &quot;after a line wrap can be selected successfully.&quot;
</span><span class="cx">       RenderBlock {P} at (0,104) size 784x0
</span><span class="cx">       RenderBlock {DIV} at (16,104) size 752x38 [border: (1px solid #000000)]
</span><del>-        RenderText {#text} at (1,1) size 749x18
</del><ins>+        RenderText {#text} at (1,1) size 750x18
</ins><span class="cx">           text run at (1,1) width 93: &quot;don't select me&quot;
</span><del>-          text run at (94,1) width 656: &quot;                                                                                                                                                                    &quot;
</del><ins>+          text run at (94,1) width 657: &quot;                                                                                                                                                                                                                                                                                                                                                             &quot;
</ins><span class="cx">         RenderInline {I} at (0,0) size 150x18
</span><span class="cx">           RenderText {#text} at (1,19) size 150x18
</span><span class="cx">             text run at (1,19) width 150: &quot;try to select just this text&quot;
</span></span></pre></div>
<a id="tagsSafari538102SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.10.2/Source/WebCore/ChangeLog (161578 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/Source/WebCore/ChangeLog        2014-01-09 21:23:30 UTC (rev 161578)
+++ tags/Safari-538.10.2/Source/WebCore/ChangeLog        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-01-09  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r161404
+
+    2014-01-06  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+            REGRESSION(r157851): trailing space inside an editable region could be erroneously collapsed
+            https://bugs.webkit.org/show_bug.cgi?id=126549
+
+            Reviewed by Sam Weinig.
+
+            The regression was caused by erroneous use of m_currentCharacterIsSpace in place of m_currentCharacterIsWS.
+
+            See the following two lines before the refactoring:
+            http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp?rev=157850#L3074
+            http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp?rev=157850#L3198
+
+            I've also cross-checked other places where m_currentCharacterIsSpace and m_currentCharacterIsWS are used.
+
+            Test: editing/inserting/inserting-trailing-space-and-letter.html
+
+            * rendering/line/BreakingContextInlineHeaders.h:
+            (WebCore::BreakingContext::handleText):
+
</ins><span class="cx"> 2013-12-19  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Begin stubbing out the KeyedDecoder class
</span></span></pre></div>
<a id="tagsSafari538102SourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.10.2/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (161578 => 161579)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.10.2/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-09 21:23:30 UTC (rev 161578)
+++ tags/Safari-538.10.2/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-09 21:26:54 UTC (rev 161579)
</span><span class="lines">@@ -799,7 +799,7 @@
</span><span class="cx">                 // If we break only after white-space, consider the current character
</span><span class="cx">                 // as candidate width for this line.
</span><span class="cx">                 bool lineWasTooWide = false;
</span><del>-                if (m_width.fitsOnLine() &amp;&amp; m_currentCharacterIsSpace &amp;&amp; m_currentStyle-&gt;breakOnlyAfterWhiteSpace() &amp;&amp; !midWordBreak) {
</del><ins>+                if (m_width.fitsOnLine() &amp;&amp; m_currentCharacterIsWS &amp;&amp; m_currentStyle-&gt;breakOnlyAfterWhiteSpace() &amp;&amp; !midWordBreak) {
</ins><span class="cx">                     float charWidth = textWidth(renderText, m_current.m_pos, 1, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
</span><span class="cx">                     // Check if line is too big even without the extra space
</span><span class="cx">                     // at the end of the line. If it is not, do nothing.
</span><span class="lines">@@ -927,7 +927,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (!m_currentCharacterIsSpace &amp;&amp; previousCharacterIsWS) {
</del><ins>+        if (!m_currentCharacterIsWS &amp;&amp; previousCharacterIsWS) {
</ins><span class="cx">             if (m_autoWrap &amp;&amp; m_currentStyle-&gt;breakOnlyAfterWhiteSpace())
</span><span class="cx">                 m_lineBreak.moveTo(m_current.renderer(), m_current.m_pos, m_current.nextBreakablePosition());
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>