<!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>[199149] trunk/Source/WebCore</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/199149">199149</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-04-06 21:59:55 -0700 (Wed, 06 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename MidpointState to WhitespaceCollapsingState
https://bugs.webkit.org/show_bug.cgi?id=156304

Reviewed by David Hyatt.

MidpointState has nothing to do with midpoints.

An individual midpoint is now known as a &quot;whitespace collapsing transition.&quot;

No new tests because there is no behavior change.

* platform/text/BidiResolver.h:
(WebCore::WhitespaceCollapsingState::reset): (See addMidpoint() below.)
Previously, we were using operator= to destroy old Iterators when their
storage inside the Vector was reused. Now that we are elliminating
m_numMidpoints, we can push destruction earlier to this reset() function.
Because the same amount of destruction happens in both cases, this doesn't
add additional work. (Vector can destroy its contents without shrinking
its storage overcommitment.)
(WebCore::WhitespaceCollapsingState::startIgnoringSpaces):
(WebCore::WhitespaceCollapsingState::stopIgnoringSpaces):
(WebCore::WhitespaceCollapsingState::ensureLineBoxInsideIgnoredSpaces):
(WebCore::WhitespaceCollapsingState::decrementTransitionAt):
(WebCore::WhitespaceCollapsingState::thresholds): Make the return value
const. The only clients of this function which needed mutation were
migrated to using decrementTransitionAt().
(WebCore::WhitespaceCollapsingState::numTransitions):
(WebCore::WhitespaceCollapsingState::currentTransition):
(WebCore::WhitespaceCollapsingState::setCurrentTransition):
(WebCore::WhitespaceCollapsingState::incrementCurrentTransition):
(WebCore::WhitespaceCollapsingState::decrementNumTransitions):
(WebCore::WhitespaceCollapsingState::betweenTransitions):
(WebCore::BidiResolverBase::whitespaceCollapsingState):
(WebCore::Subclass&gt;::setWhitespaceCollapsingTransitionForIsolatedRun):
(WebCore::Subclass&gt;::whitespaceCollapsingTransitionForIsolatedRun):
(WebCore::MidpointState::MidpointState): Deleted.
(WebCore::MidpointState::reset): Deleted.
(WebCore::MidpointState::startIgnoringSpaces): Deleted.
(WebCore::MidpointState::stopIgnoringSpaces): Deleted.
(WebCore::MidpointState::ensureLineBoxInsideIgnoredSpaces): Deleted.
(WebCore::MidpointState::midpoints): Deleted.
(WebCore::MidpointState::numMidpoints): Deleted.
(WebCore::MidpointState::currentMidpoint): Deleted.
(WebCore::MidpointState::setCurrentMidpoint): Deleted.
(WebCore::MidpointState::incrementCurrentMidpoint): Deleted.
(WebCore::MidpointState::decrementNumMidpoints): Deleted.
(WebCore::MidpointState::betweenMidpoints): Deleted.
(WebCore::MidpointState::addMidpoint): Deleted. This code has been around for 13
years (since <a href="http://trac.webkit.org/projects/webkit/changeset/3672">r3672</a>) where it was using QMemArray. That class doesn't have an
append() class, so it was implemented inside this function. Luckily, Vector
already overcommits its allocation, so we can elliminate m_numMidpoints entirely.
(WebCore::BidiResolverBase::midpointState): Deleted.
(WebCore::Subclass&gt;::setMidpointForIsolatedRun): Deleted.
(WebCore::Subclass&gt;::midpointForIsolatedRun): Deleted.
* rendering/InlineIterator.h:
(WebCore::addPlaceholderRunForIsolatedInline):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::appendRunsForObject):
(WebCore::setUpResolverToResumeInIsolate):
(WebCore::constructBidiRunsForSegment):
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::BreakingContext):
(WebCore::BreakingContext::handleBR):
(WebCore::BreakingContext::handleOutOfFlowPositioned):
(WebCore::shouldSkipWhitespaceAfterStartObject):
(WebCore::BreakingContext::handleEmptyInline):
(WebCore::BreakingContext::handleReplaced):
(WebCore::ensureCharacterGetsLineBox):
(WebCore::BreakingContext::handleText):
(WebCore::checkWhitespaceCollapsingTransitions):
(WebCore::BreakingContext::handleEndOfLine):
(WebCore::checkMidpoints): Deleted.
* rendering/line/TrailingObjects.cpp:
(WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes):
(WebCore::TrailingObjects::updateMidpointsForTrailingBoxes): Deleted.
* rendering/line/TrailingObjects.h:
(WebCore::TrailingObjects::appendBoxIfNeeded):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformtextBidiResolverh">trunk/Source/WebCore/platform/text/BidiResolver.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineIteratorh">trunk/Source/WebCore/rendering/InlineIterator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContexth">trunk/Source/WebCore/rendering/line/BreakingContext.h</a></li>
<li><a href="#trunkSourceWebCorerenderinglineTrailingObjectscpp">trunk/Source/WebCore/rendering/line/TrailingObjects.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderinglineTrailingObjectsh">trunk/Source/WebCore/rendering/line/TrailingObjects.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/ChangeLog        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -1,3 +1,84 @@
</span><ins>+2016-04-06  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Rename MidpointState to WhitespaceCollapsingState
+        https://bugs.webkit.org/show_bug.cgi?id=156304
+
+        Reviewed by David Hyatt.
+
+        MidpointState has nothing to do with midpoints.
+
+        An individual midpoint is now known as a &quot;whitespace collapsing transition.&quot;
+
+        No new tests because there is no behavior change.
+
+        * platform/text/BidiResolver.h:
+        (WebCore::WhitespaceCollapsingState::reset): (See addMidpoint() below.)
+        Previously, we were using operator= to destroy old Iterators when their
+        storage inside the Vector was reused. Now that we are elliminating
+        m_numMidpoints, we can push destruction earlier to this reset() function.
+        Because the same amount of destruction happens in both cases, this doesn't
+        add additional work. (Vector can destroy its contents without shrinking
+        its storage overcommitment.)
+        (WebCore::WhitespaceCollapsingState::startIgnoringSpaces):
+        (WebCore::WhitespaceCollapsingState::stopIgnoringSpaces):
+        (WebCore::WhitespaceCollapsingState::ensureLineBoxInsideIgnoredSpaces):
+        (WebCore::WhitespaceCollapsingState::decrementTransitionAt):
+        (WebCore::WhitespaceCollapsingState::thresholds): Make the return value
+        const. The only clients of this function which needed mutation were
+        migrated to using decrementTransitionAt().
+        (WebCore::WhitespaceCollapsingState::numTransitions):
+        (WebCore::WhitespaceCollapsingState::currentTransition):
+        (WebCore::WhitespaceCollapsingState::setCurrentTransition):
+        (WebCore::WhitespaceCollapsingState::incrementCurrentTransition):
+        (WebCore::WhitespaceCollapsingState::decrementNumTransitions):
+        (WebCore::WhitespaceCollapsingState::betweenTransitions):
+        (WebCore::BidiResolverBase::whitespaceCollapsingState):
+        (WebCore::Subclass&gt;::setWhitespaceCollapsingTransitionForIsolatedRun):
+        (WebCore::Subclass&gt;::whitespaceCollapsingTransitionForIsolatedRun):
+        (WebCore::MidpointState::MidpointState): Deleted.
+        (WebCore::MidpointState::reset): Deleted.
+        (WebCore::MidpointState::startIgnoringSpaces): Deleted.
+        (WebCore::MidpointState::stopIgnoringSpaces): Deleted.
+        (WebCore::MidpointState::ensureLineBoxInsideIgnoredSpaces): Deleted.
+        (WebCore::MidpointState::midpoints): Deleted.
+        (WebCore::MidpointState::numMidpoints): Deleted.
+        (WebCore::MidpointState::currentMidpoint): Deleted.
+        (WebCore::MidpointState::setCurrentMidpoint): Deleted.
+        (WebCore::MidpointState::incrementCurrentMidpoint): Deleted.
+        (WebCore::MidpointState::decrementNumMidpoints): Deleted.
+        (WebCore::MidpointState::betweenMidpoints): Deleted.
+        (WebCore::MidpointState::addMidpoint): Deleted. This code has been around for 13
+        years (since r3672) where it was using QMemArray. That class doesn't have an
+        append() class, so it was implemented inside this function. Luckily, Vector
+        already overcommits its allocation, so we can elliminate m_numMidpoints entirely.
+        (WebCore::BidiResolverBase::midpointState): Deleted.
+        (WebCore::Subclass&gt;::setMidpointForIsolatedRun): Deleted.
+        (WebCore::Subclass&gt;::midpointForIsolatedRun): Deleted.
+        * rendering/InlineIterator.h:
+        (WebCore::addPlaceholderRunForIsolatedInline):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::appendRunsForObject):
+        (WebCore::setUpResolverToResumeInIsolate):
+        (WebCore::constructBidiRunsForSegment):
+        (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+        * rendering/line/BreakingContext.h:
+        (WebCore::BreakingContext::BreakingContext):
+        (WebCore::BreakingContext::handleBR):
+        (WebCore::BreakingContext::handleOutOfFlowPositioned):
+        (WebCore::shouldSkipWhitespaceAfterStartObject):
+        (WebCore::BreakingContext::handleEmptyInline):
+        (WebCore::BreakingContext::handleReplaced):
+        (WebCore::ensureCharacterGetsLineBox):
+        (WebCore::BreakingContext::handleText):
+        (WebCore::checkWhitespaceCollapsingTransitions):
+        (WebCore::BreakingContext::handleEndOfLine):
+        (WebCore::checkMidpoints): Deleted.
+        * rendering/line/TrailingObjects.cpp:
+        (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes):
+        (WebCore::TrailingObjects::updateMidpointsForTrailingBoxes): Deleted.
+        * rendering/line/TrailingObjects.h:
+        (WebCore::TrailingObjects::appendBoxIfNeeded):
+
</ins><span class="cx"> 2016-04-06  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove duplicated parsePortFromStringPosition()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextBidiResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/BidiResolver.h (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/BidiResolver.h        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/platform/text/BidiResolver.h        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
</span><del>- * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc.  All right reserved.
</del><ins>+ * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2016 Apple Inc.  All right reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -34,63 +34,50 @@
</span><span class="cx"> 
</span><span class="cx"> class RenderObject;
</span><span class="cx"> 
</span><del>-template &lt;class Iterator&gt; class MidpointState {
</del><ins>+template &lt;class Iterator&gt; class WhitespaceCollapsingState {
</ins><span class="cx"> public:
</span><del>-    MidpointState()
-    {
-        reset();
-    }
-    
</del><span class="cx">     void reset()
</span><span class="cx">     {
</span><del>-        m_numMidpoints = 0;
-        m_currentMidpoint = 0;
</del><ins>+        m_transitions.clear();
+        m_currentTransition = 0;
</ins><span class="cx">     }
</span><span class="cx">     
</span><del>-    void startIgnoringSpaces(const Iterator&amp; midpoint)
</del><ins>+    void startIgnoringSpaces(const Iterator&amp; transition)
</ins><span class="cx">     {
</span><del>-        ASSERT(!(m_numMidpoints % 2));
-        addMidpoint(midpoint);
</del><ins>+        ASSERT(!(m_transitions.size() % 2));
+        m_transitions.append(transition);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void stopIgnoringSpaces(const Iterator&amp; midpoint)
</del><ins>+    void stopIgnoringSpaces(const Iterator&amp; transition)
</ins><span class="cx">     {
</span><del>-        ASSERT(m_numMidpoints % 2);
-        addMidpoint(midpoint);
</del><ins>+        ASSERT(m_transitions.size() % 2);
+        m_transitions.append(transition);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // When ignoring spaces, this needs to be called for objects that need line boxes such as RenderInlines or
</span><span class="cx">     // hard line breaks to ensure that they're not ignored.
</span><del>-    void ensureLineBoxInsideIgnoredSpaces(RenderObject* renderer)
</del><ins>+    void ensureLineBoxInsideIgnoredSpaces(RenderObject&amp; renderer)
</ins><span class="cx">     {
</span><del>-        Iterator midpoint(0, renderer, 0);
-        stopIgnoringSpaces(midpoint);
-        startIgnoringSpaces(midpoint);
</del><ins>+        Iterator transition(0, &amp;renderer, 0);
+        stopIgnoringSpaces(transition);
+        startIgnoringSpaces(transition);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Vector&lt;Iterator&gt;&amp; midpoints() { return m_midpoints; }
-    unsigned numMidpoints() const { return m_numMidpoints; }
-    unsigned currentMidpoint() const { return m_currentMidpoint; }
-    void setCurrentMidpoint(unsigned currentMidpoint) { m_currentMidpoint = currentMidpoint; }
-    void incrementCurrentMidpoint() { ++m_currentMidpoint; }
-    void decrementNumMidpoints() { --m_numMidpoints; }
-    bool betweenMidpoints() const { return m_currentMidpoint % 2; }
-private:
-    // The goal is to reuse the line state across multiple
-    // lines so we just keep an array around for midpoints and never clear it across multiple
-    // lines. We track the number of items and position using the two other variables.
-    Vector&lt;Iterator&gt; m_midpoints;
-    unsigned m_numMidpoints;
-    unsigned m_currentMidpoint;
-
-    void addMidpoint(const Iterator&amp; midpoint)
</del><ins>+    void decrementTransitionAt(size_t index)
</ins><span class="cx">     {
</span><del>-        if (m_midpoints.size() &lt;= m_numMidpoints)
-            m_midpoints.grow(m_numMidpoints + 10);
-
-        Iterator* midpointsIterator = m_midpoints.data();
-        midpointsIterator[m_numMidpoints++] = midpoint;
</del><ins>+        m_transitions[index].fastDecrement();
</ins><span class="cx">     }
</span><ins>+
+    const Vector&lt;Iterator&gt;&amp; transitions() { return m_transitions; }
+    size_t numTransitions() const { return m_transitions.size(); }
+    size_t currentTransition() const { return m_currentTransition; }
+    void setCurrentTransition(size_t currentTransition) { m_currentTransition = currentTransition; }
+    void incrementCurrentTransition() { ++m_currentTransition; }
+    void decrementNumTransitions() { m_transitions.shrink(m_transitions.size() - 1); }
+    bool betweenTransitions() const { return m_currentTransition % 2; }
+private:
+    Vector&lt;Iterator&gt; m_transitions;
+    size_t m_currentTransition { 0 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // The BidiStatus at a given position (typically the end of a line) can
</span><span class="lines">@@ -247,7 +234,7 @@
</span><span class="cx">     const BidiStatus&amp; status() const { return m_status; }
</span><span class="cx">     void setStatus(const BidiStatus s) { m_status = s; }
</span><span class="cx"> 
</span><del>-    MidpointState&lt;Iterator&gt;&amp; midpointState() { return m_midpointState; }
</del><ins>+    WhitespaceCollapsingState&lt;Iterator&gt;&amp; whitespaceCollapsingState() { return m_whitespaceCollapsingState; }
</ins><span class="cx"> 
</span><span class="cx">     // The current algorithm handles nested isolates one layer of nesting at a time.
</span><span class="cx">     // But when we layout each isolated span, we will walk into (and ignore) all
</span><span class="lines">@@ -267,8 +254,8 @@
</span><span class="cx">     // It's unclear if this is still needed.
</span><span class="cx">     void markCurrentRunEmpty() { m_emptyRun = true; }
</span><span class="cx"> 
</span><del>-    void setMidpointForIsolatedRun(Run&amp;, unsigned);
-    unsigned midpointForIsolatedRun(Run&amp;);
</del><ins>+    void setWhitespaceCollapsingTransitionForIsolatedRun(Run&amp;, size_t);
+    unsigned whitespaceCollapsingTransitionForIsolatedRun(Run&amp;);
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     // FIXME: Instead of InlineBidiResolvers subclassing this method, we should
</span><span class="lines">@@ -292,10 +279,10 @@
</span><span class="cx">     // into createBidiRunsForLine by the caller.
</span><span class="cx">     BidiRunList&lt;Run&gt; m_runs;
</span><span class="cx"> 
</span><del>-    MidpointState&lt;Iterator&gt; m_midpointState;
</del><ins>+    WhitespaceCollapsingState&lt;Iterator&gt; m_whitespaceCollapsingState;
</ins><span class="cx"> 
</span><span class="cx">     unsigned m_nestedIsolateCount;
</span><del>-    HashMap&lt;Run*, unsigned&gt; m_midpointForIsolatedRun;
</del><ins>+    HashMap&lt;Run*, unsigned&gt; m_whitespaceCollapsingTransitionForIsolatedRun;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void raiseExplicitEmbeddingLevel(UCharDirection from, UCharDirection to);
</span><span class="lines">@@ -982,16 +969,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;class Iterator, class Run, class Subclass&gt;
</span><del>-void BidiResolverBase&lt;Iterator, Run, Subclass&gt;::setMidpointForIsolatedRun(Run&amp; run, unsigned midpoint)
</del><ins>+void BidiResolverBase&lt;Iterator, Run, Subclass&gt;::setWhitespaceCollapsingTransitionForIsolatedRun(Run&amp; run, size_t transition)
</ins><span class="cx"> {
</span><del>-    ASSERT(!m_midpointForIsolatedRun.contains(&amp;run));
-    m_midpointForIsolatedRun.add(&amp;run, midpoint);
</del><ins>+    ASSERT(!m_whitespaceCollapsingTransitionForIsolatedRun.contains(&amp;run));
+    m_whitespaceCollapsingTransitionForIsolatedRun.add(&amp;run, transition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;class Iterator, class Run, class Subclass&gt;
</span><del>-unsigned BidiResolverBase&lt;Iterator, Run, Subclass&gt;::midpointForIsolatedRun(Run&amp; run)
</del><ins>+unsigned BidiResolverBase&lt;Iterator, Run, Subclass&gt;::whitespaceCollapsingTransitionForIsolatedRun(Run&amp; run)
</ins><span class="cx"> {
</span><del>-    return m_midpointForIsolatedRun.take(&amp;run);
</del><ins>+    return m_whitespaceCollapsingTransitionForIsolatedRun.take(&amp;run);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineIterator.h (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineIterator.h        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/rendering/InlineIterator.h        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx">     std::unique_ptr&lt;BidiRun&gt; isolatedRun = std::make_unique&lt;BidiRun&gt;(pos, 0, obj, resolver.context(), resolver.dir());
</span><span class="cx">     // FIXME: isolatedRuns() could be a hash of object-&gt;run and then we could cheaply
</span><span class="cx">     // ASSERT here that we didn't create multiple objects for the same inline.
</span><del>-    resolver.setMidpointForIsolatedRun(*isolatedRun, resolver.midpointState().currentMidpoint());
</del><ins>+    resolver.setWhitespaceCollapsingTransitionForIsolatedRun(*isolatedRun, resolver.whitespaceCollapsingState().currentTransition());
</ins><span class="cx">     resolver.isolatedRuns().append(BidiIsolatedRun(obj, pos, root, *isolatedRun));
</span><span class="cx">     resolver.runs().appendRun(WTFMove(isolatedRun));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -81,38 +81,38 @@
</span><span class="cx">     if (start &gt; end || shouldSkipCreatingRunsForObject(obj))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    LineMidpointState&amp; lineMidpointState = resolver.midpointState();
-    bool haveNextMidpoint = (lineMidpointState.currentMidpoint() &lt; lineMidpointState.numMidpoints());
-    InlineIterator nextMidpoint;
-    if (haveNextMidpoint)
-        nextMidpoint = lineMidpointState.midpoints()[lineMidpointState.currentMidpoint()];
-    if (lineMidpointState.betweenMidpoints()) {
-        if (!haveNextMidpoint || (&amp;obj != nextMidpoint.renderer()))
</del><ins>+    LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState = resolver.whitespaceCollapsingState();
+    bool haveNextTransition = (lineWhitespaceCollapsingState.currentTransition() &lt; lineWhitespaceCollapsingState.numTransitions());
+    InlineIterator nextTransition;
+    if (haveNextTransition)
+        nextTransition = lineWhitespaceCollapsingState.transitions()[lineWhitespaceCollapsingState.currentTransition()];
+    if (lineWhitespaceCollapsingState.betweenTransitions()) {
+        if (!haveNextTransition || (&amp;obj != nextTransition.renderer()))
</ins><span class="cx">             return;
</span><span class="cx">         // This is a new start point. Stop ignoring objects and
</span><span class="cx">         // adjust our start.
</span><del>-        start = nextMidpoint.offset();
-        lineMidpointState.incrementCurrentMidpoint();
</del><ins>+        start = nextTransition.offset();
+        lineWhitespaceCollapsingState.incrementCurrentTransition();
</ins><span class="cx">         if (start &lt; end) {
</span><span class="cx">             appendRunsForObject(runs, start, end, obj, resolver);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><del>-        if (!haveNextMidpoint || (&amp;obj != nextMidpoint.renderer())) {
</del><ins>+        if (!haveNextTransition || (&amp;obj != nextTransition.renderer())) {
</ins><span class="cx">             if (runs)
</span><span class="cx">                 runs-&gt;appendRun(createRun(start, end, obj, resolver));
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // An end midpoint has been encountered within our object. We need to append a run with our endpoint.
-        if (static_cast&lt;int&gt;(nextMidpoint.offset() + 1) &lt;= end) {
-            lineMidpointState.incrementCurrentMidpoint();
</del><ins>+        // An end transition has been encountered within our object. We need to append a run with our endpoint.
+        if (static_cast&lt;int&gt;(nextTransition.offset() + 1) &lt;= end) {
+            lineWhitespaceCollapsingState.incrementCurrentTransition();
</ins><span class="cx">             // The end of the line is before the object we're inspecting. Skip everything and return
</span><del>-            if (nextMidpoint.refersToEndOfPreviousNode())
</del><ins>+            if (nextTransition.refersToEndOfPreviousNode())
</ins><span class="cx">                 return;
</span><del>-            if (static_cast&lt;int&gt;(nextMidpoint.offset() + 1) &gt; start &amp;&amp; runs)
-                runs-&gt;appendRun(createRun(start, nextMidpoint.offset() + 1, obj, resolver));
-            appendRunsForObject(runs, nextMidpoint.offset() + 1, end, obj, resolver);
</del><ins>+            if (static_cast&lt;int&gt;(nextTransition.offset() + 1) &gt; start &amp;&amp; runs)
+                runs-&gt;appendRun(createRun(start, nextTransition.offset() + 1, obj, resolver));
+            appendRunsForObject(runs, nextTransition.offset() + 1, end, obj, resolver);
</ins><span class="cx">         } else if (runs)
</span><span class="cx">             runs-&gt;appendRun(createRun(start, end, obj, resolver));
</span><span class="cx">     }
</span><span class="lines">@@ -1076,9 +1076,9 @@
</span><span class="cx"> 
</span><span class="cx"> static inline void setUpResolverToResumeInIsolate(InlineBidiResolver&amp; resolver, InlineBidiResolver&amp; topResolver, BidiRun&amp; isolatedRun, RenderObject* root, RenderObject* startObject)
</span><span class="cx"> {
</span><del>-    // Set up m_midpointState
-    resolver.midpointState() = topResolver.midpointState();
-    resolver.midpointState().setCurrentMidpoint(topResolver.midpointForIsolatedRun(isolatedRun));
</del><ins>+    // Set up m_whitespaceCollapsingState
+    resolver.whitespaceCollapsingState() = topResolver.whitespaceCollapsingState();
+    resolver.whitespaceCollapsingState().setCurrentTransition(topResolver.whitespaceCollapsingTransitionForIsolatedRun(isolatedRun));
</ins><span class="cx"> 
</span><span class="cx">     // Set up m_nestedIsolateCount
</span><span class="cx">     notifyResolverToResumeInIsolate(resolver, root, startObject);
</span><span class="lines">@@ -1145,7 +1145,7 @@
</span><span class="cx">         while (!isolatedResolver.isolatedRuns().isEmpty()) {
</span><span class="cx">             auto runWithContext = WTFMove(isolatedResolver.isolatedRuns().last());
</span><span class="cx">             isolatedResolver.isolatedRuns().removeLast();
</span><del>-            topResolver.setMidpointForIsolatedRun(runWithContext.runToReplace, isolatedResolver.midpointForIsolatedRun(runWithContext.runToReplace));
</del><ins>+            topResolver.setWhitespaceCollapsingTransitionForIsolatedRun(runWithContext.runToReplace, isolatedResolver.whitespaceCollapsingTransitionForIsolatedRun(runWithContext.runToReplace));
</ins><span class="cx">             topResolver.isolatedRuns().append(WTFMove(runWithContext));
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1286,7 +1286,7 @@
</span><span class="cx"> {
</span><span class="cx">     const RenderStyle&amp; styleToUse = style();
</span><span class="cx">     bool paginated = view().layoutState() &amp;&amp; view().layoutState()-&gt;isPaginated();
</span><del>-    LineMidpointState&amp; lineMidpointState = resolver.midpointState();
</del><ins>+    LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState = resolver.whitespaceCollapsingState();
</ins><span class="cx">     InlineIterator end = resolver.position();
</span><span class="cx">     bool checkForEndLineMatch = layoutState.endLine();
</span><span class="cx">     RenderTextInfo renderTextInfo;
</span><span class="lines">@@ -1305,7 +1305,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        lineMidpointState.reset();
</del><ins>+        lineWhitespaceCollapsingState.reset();
</ins><span class="cx"> 
</span><span class="cx">         layoutState.lineInfo().setEmpty(true);
</span><span class="cx">         layoutState.lineInfo().resetRunsFromLeadingWhitespace();
</span><span class="lines">@@ -1455,7 +1455,7 @@
</span><span class="cx">             layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last().get() : nullptr);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        lineMidpointState.reset();
</del><ins>+        lineWhitespaceCollapsingState.reset();
</ins><span class="cx">         resolver.setPosition(end, numberOfIsolateAncestors(end));
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">         , m_allowImagesToBreak(!block.document().inQuirksMode() || !block.isTableCell() || !m_blockStyle.logicalWidth().isIntrinsicOrAuto())
</span><span class="cx">         , m_atEnd(false)
</span><span class="cx">         , m_hadUncommittedWidthBeforeCurrent(false)
</span><del>-        , m_lineMidpointState(resolver.midpointState())
</del><ins>+        , m_lineWhitespaceCollapsingState(resolver.whitespaceCollapsingState())
</ins><span class="cx">     {
</span><span class="cx">         m_lineInfo.setPreviousLineBrokeCleanly(false);
</span><span class="cx">     }
</span><span class="lines">@@ -292,7 +292,7 @@
</span><span class="cx">     
</span><span class="cx">     bool m_hangsAtEnd { false };
</span><span class="cx"> 
</span><del>-    LineMidpointState&amp; m_lineMidpointState;
</del><ins>+    LineWhitespaceCollapsingState&amp; m_lineWhitespaceCollapsingState;
</ins><span class="cx"> 
</span><span class="cx">     TrailingObjects m_trailingObjects;
</span><span class="cx"> };
</span><span class="lines">@@ -334,9 +334,9 @@
</span><span class="cx"> inline void BreakingContext::handleBR(EClear&amp; clear)
</span><span class="cx"> {
</span><span class="cx">     if (fitsOnLineOrHangsAtEnd()) {
</span><del>-        RenderObject* br = m_current.renderer();
</del><ins>+        RenderObject&amp; br = *m_current.renderer();
</ins><span class="cx">         m_lineBreakHistory.push([&amp;](InlineIterator&amp; modifyMe) {
</span><del>-            modifyMe.moveToStartOf(br);
</del><ins>+            modifyMe.moveToStartOf(&amp;br);
</ins><span class="cx">             modifyMe.increment();
</span><span class="cx">         });
</span><span class="cx"> 
</span><span class="lines">@@ -354,12 +354,12 @@
</span><span class="cx">         // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
</span><span class="cx">         // run for this object.
</span><span class="cx">         if (m_ignoringSpaces &amp;&amp; m_currentStyle-&gt;clear() != CNONE)
</span><del>-            m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(br);
</del><ins>+            m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(br);
</ins><span class="cx">         // If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets
</span><span class="cx">         // collapsed away so that it doesn't push the text out from the container's right-hand edge.
</span><span class="cx">         // FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results.
</span><span class="cx">         else if (m_ignoringSpaces &amp;&amp; (m_blockStyle.textAlign() == RIGHT || m_blockStyle.textAlign() == WEBKIT_RIGHT))
</span><del>-            m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset()));
</del><ins>+            m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset()));
</ins><span class="cx"> 
</span><span class="cx">         if (!m_lineInfo.isEmpty())
</span><span class="cx">             clear = m_currentStyle-&gt;clear();
</span><span class="lines">@@ -438,8 +438,8 @@
</span><span class="cx">     // then start ignoring spaces again.
</span><span class="cx">     if (isInlineType || box.container()-&gt;isRenderInline()) {
</span><span class="cx">         if (m_ignoringSpaces)
</span><del>-            m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(&amp;box);
-        m_trailingObjects.appendBoxIfNeeded(&amp;box);
</del><ins>+            m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(box);
+        m_trailingObjects.appendBoxIfNeeded(box);
</ins><span class="cx">     } else
</span><span class="cx">         positionedObjects.append(&amp;box);
</span><span class="cx"> 
</span><span class="lines">@@ -469,7 +469,7 @@
</span><span class="cx"> 
</span><span class="cx"> // This is currently just used for list markers and inline flows that have line boxes. Neither should
</span><span class="cx"> // have an effect on whitespace at the start of the line.
</span><del>-inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow&amp; block, RenderObject* o, LineMidpointState&amp; lineMidpointState)
</del><ins>+inline bool shouldSkipWhitespaceAfterStartObject(RenderBlockFlow&amp; block, RenderObject* o, LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState)
</ins><span class="cx"> {
</span><span class="cx">     RenderObject* next = bidiNextSkippingEmptyInlines(block, o);
</span><span class="cx">     while (next &amp;&amp; next-&gt;isFloatingOrOutOfFlowPositioned())
</span><span class="lines">@@ -479,7 +479,7 @@
</span><span class="cx">         RenderText&amp; nextText = downcast&lt;RenderText&gt;(*next);
</span><span class="cx">         UChar nextChar = nextText.characterAt(0);
</span><span class="cx">         if (nextText.style().isCollapsibleWhiteSpace(nextChar)) {
</span><del>-            lineMidpointState.startIgnoringSpaces(InlineIterator(nullptr, o, 0));
</del><ins>+            lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(nullptr, o, 0));
</ins><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -506,16 +506,16 @@
</span><span class="cx">             m_lineInfo.setEmpty(false, &amp;m_block, &amp;m_width);
</span><span class="cx">         if (m_ignoringSpaces) {
</span><span class="cx">             m_trailingObjects.clear();
</span><del>-            m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.renderer());
</del><ins>+            m_lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(*m_current.renderer());
</ins><span class="cx">         } else if (m_blockStyle.collapseWhiteSpace() &amp;&amp; m_resolver.position().renderer() == m_current.renderer()
</span><del>-            &amp;&amp; shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineMidpointState)) {
</del><ins>+            &amp;&amp; shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineWhitespaceCollapsingState)) {
</ins><span class="cx">             // Like with list markers, we start ignoring spaces to make sure that any
</span><span class="cx">             // additional spaces we see will be discarded.
</span><span class="cx">             m_currentCharacterIsSpace = true;
</span><span class="cx">             m_currentCharacterIsWS = true;
</span><span class="cx">             m_ignoringSpaces = true;
</span><span class="cx">         } else
</span><del>-            m_trailingObjects.appendBoxIfNeeded(&amp;flowBox);
</del><ins>+            m_trailingObjects.appendBoxIfNeeded(flowBox);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     float inlineWidth = inlineLogicalWidth(m_current.renderer()) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox);
</span><span class="lines">@@ -549,7 +549,7 @@
</span><span class="cx">             m_lineLayoutState.prevFloatBottomFromAnonymousInlineBlock(), m_lineLayoutState.maxFloatBottomFromAnonymousInlineBlock());
</span><span class="cx"> 
</span><span class="cx">     if (m_ignoringSpaces)
</span><del>-        m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0));
</del><ins>+        m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0));
</ins><span class="cx"> 
</span><span class="cx">     m_lineInfo.setEmpty(false, &amp;m_block, &amp;m_width);
</span><span class="cx">     m_ignoringSpaces = false;
</span><span class="lines">@@ -561,7 +561,7 @@
</span><span class="cx">     // item, then this is all moot.
</span><span class="cx">     LayoutUnit replacedLogicalWidth = m_block.logicalWidthForChild(replacedBox) + m_block.marginStartForChild(replacedBox) + m_block.marginEndForChild(replacedBox) + inlineLogicalWidth(m_current.renderer());
</span><span class="cx">     if (is&lt;RenderListMarker&gt;(*m_current.renderer())) {
</span><del>-        if (m_blockStyle.collapseWhiteSpace() &amp;&amp; shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineMidpointState)) {
</del><ins>+        if (m_blockStyle.collapseWhiteSpace() &amp;&amp; shouldSkipWhitespaceAfterStartObject(m_block, m_current.renderer(), m_lineWhitespaceCollapsingState)) {
</ins><span class="cx">             // Like with inline flows, we start ignoring spaces to make sure that any
</span><span class="cx">             // additional spaces we see will be discarded.
</span><span class="cx">             m_currentCharacterIsSpace = true;
</span><span class="lines">@@ -642,12 +642,12 @@
</span><span class="cx">     return font.width(run, &amp;fallbackFonts, &amp;glyphOverflow);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Adding a pair of midpoints before a character will split it out into a new line box.
-inline void ensureCharacterGetsLineBox(LineMidpointState&amp; lineMidpointState, InlineIterator&amp; textParagraphSeparator)
</del><ins>+// Adding a pair of whitespace collapsing transitions before a character will split it out into a new line box.
+inline void ensureCharacterGetsLineBox(LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState, InlineIterator&amp; textParagraphSeparator)
</ins><span class="cx"> {
</span><del>-    InlineIterator midpoint(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset());
-    lineMidpointState.startIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1));
-    lineMidpointState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
</del><ins>+    InlineIterator transition(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset());
+    lineWhitespaceCollapsingState.startIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset() - 1));
+    lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void tryHyphenating(RenderText&amp; text, const FontCascade&amp; font, const AtomicString&amp; localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator&amp; lineBreak, int nextBreakable, bool&amp; hyphenated)
</span><span class="lines">@@ -887,7 +887,7 @@
</span><span class="cx">                     m_ignoringSpaces = false;
</span><span class="cx">                     wordSpacingForWordMeasurement = 0;
</span><span class="cx">                     lastSpace = m_current.offset(); // e.g., &quot;Foo    goo&quot;, don't add in any of the ignored spaces.
</span><del>-                    m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset()));
</del><ins>+                    m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), m_current.offset()));
</ins><span class="cx">                     stoppedIgnoringSpaces = true;
</span><span class="cx">                 } else {
</span><span class="cx">                     // Just keep ignoring these spaces.
</span><span class="lines">@@ -948,7 +948,7 @@
</span><span class="cx">                     }
</span><span class="cx">                     if (m_lineBreakHistory.atTextParagraphSeparator()) {
</span><span class="cx">                         if (!stoppedIgnoringSpaces &amp;&amp; m_current.offset() &gt; 0)
</span><del>-                            ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
</del><ins>+                            ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current);
</ins><span class="cx">                         m_lineBreakHistory.increment();
</span><span class="cx">                         m_lineInfo.setPreviousLineBrokeCleanly(true);
</span><span class="cx">                         wordMeasurement.endOffset = m_lineBreakHistory.offset();
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx"> 
</span><span class="cx">             if (c == '\n' &amp;&amp; m_preservesNewline) {
</span><span class="cx">                 if (!stoppedIgnoringSpaces &amp;&amp; m_current.offset())
</span><del>-                    ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
</del><ins>+                    ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current);
</ins><span class="cx">                 commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition());
</span><span class="cx">                 m_lineBreakHistory.increment();
</span><span class="cx">                 m_lineInfo.setPreviousLineBrokeCleanly(true);
</span><span class="lines">@@ -1039,10 +1039,10 @@
</span><span class="cx">                     m_ignoringSpaces = true;
</span><span class="cx"> 
</span><span class="cx">                     // We just entered a mode where we are ignoring
</span><del>-                    // spaces. Create a midpoint to terminate the run
</del><ins>+                    // spaces. Create a transition to terminate the run
</ins><span class="cx">                     // before the second space.
</span><del>-                    m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces);
-                    m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
</del><ins>+                    m_lineWhitespaceCollapsingState.startIgnoringSpaces(m_startOfIgnoredSpaces);
+                    m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><span class="lines">@@ -1052,7 +1052,7 @@
</span><span class="cx">                 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
</span><span class="cx">                 wordSpacingForWordMeasurement = (applyWordSpacing &amp;&amp; wordMeasurements.last().width) ? wordSpacing : 0;
</span><span class="cx">                 lastSpace = m_current.offset(); // e.g., &quot;Foo    goo&quot;, don't add in any of the ignored spaces.
</span><del>-                m_lineMidpointState.stopIgnoringSpaces(InlineIterator(nullptr, m_current.renderer(), m_current.offset()));
</del><ins>+                m_lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(nullptr, m_current.renderer(), m_current.offset()));
</ins><span class="cx">             }
</span><span class="cx">             if (m_hangsAtEnd &amp;&amp; !renderText.isHangableStopOrComma(c))
</span><span class="cx">                 m_hangsAtEnd = false;
</span><span class="lines">@@ -1061,7 +1061,7 @@
</span><span class="cx">         if (isSVGText &amp;&amp; m_current.offset()) {
</span><span class="cx">             // Force creation of new InlineBoxes for each absolute positioned character (those that start new text chunks).
</span><span class="cx">             if (downcast&lt;RenderSVGInlineText&gt;(renderText).characterStartsNewTextChunk(m_current.offset()))
</span><del>-                ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
</del><ins>+                ensureCharacterGetsLineBox(m_lineWhitespaceCollapsingState, m_current);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (m_currentCharacterIsSpace &amp;&amp; !previousCharacterIsSpace) {
</span><span class="lines">@@ -1074,7 +1074,7 @@
</span><span class="cx">                 m_startOfIgnoredSpaces.setOffset(m_startOfIgnoredSpaces.offset() - 1);
</span><span class="cx">                 // If there's just a single trailing space start ignoring it now so it collapses away.
</span><span class="cx">                 if (m_current.offset() == renderText.textLength() - 1)
</span><del>-                    m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces);
</del><ins>+                    m_lineWhitespaceCollapsingState.startIgnoringSpaces(m_startOfIgnoredSpaces);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1220,23 +1220,23 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline TrailingObjects::CollapseFirstSpaceOrNot checkMidpoints(LineMidpointState&amp; lineMidpointState, const InlineIterator&amp; lBreak)
</del><ins>+inline TrailingObjects::CollapseFirstSpaceOrNot checkWhitespaceCollapsingTransitions(LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState, const InlineIterator&amp; lBreak)
</ins><span class="cx"> {
</span><del>-    // Check to see if our last midpoint is a start point beyond the line break. If so,
</del><ins>+    // Check to see if our last transition is a start point beyond the line break. If so,
</ins><span class="cx">     // shave it off the list, and shave off a trailing space if the previous end point doesn't
</span><span class="cx">     // preserve whitespace.
</span><del>-    if (lBreak.renderer() &amp;&amp; lineMidpointState.numMidpoints() &amp;&amp; !(lineMidpointState.numMidpoints() % 2)) {
-        InlineIterator* midpoints = lineMidpointState.midpoints().data();
-        InlineIterator&amp; endpoint = midpoints[lineMidpointState.numMidpoints() - 2];
-        const InlineIterator&amp; startpoint = midpoints[lineMidpointState.numMidpoints() - 1];
</del><ins>+    if (lBreak.renderer() &amp;&amp; lineWhitespaceCollapsingState.numTransitions() &amp;&amp; !(lineWhitespaceCollapsingState.numTransitions() % 2)) {
+        const InlineIterator* transitions = lineWhitespaceCollapsingState.transitions().data();
+        const InlineIterator&amp; endpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 2];
+        const InlineIterator&amp; startpoint = transitions[lineWhitespaceCollapsingState.numTransitions() - 1];
</ins><span class="cx">         InlineIterator currpoint = endpoint;
</span><span class="cx">         while (!currpoint.atEnd() &amp;&amp; currpoint != startpoint &amp;&amp; currpoint != lBreak)
</span><span class="cx">             currpoint.increment();
</span><span class="cx">         if (currpoint == lBreak) {
</span><span class="cx">             // We hit the line break before the start point. Shave off the start point.
</span><del>-            lineMidpointState.decrementNumMidpoints();
</del><ins>+            lineWhitespaceCollapsingState.decrementNumTransitions();
</ins><span class="cx">             if (endpoint.renderer()-&gt;style().collapseWhiteSpace() &amp;&amp; endpoint.renderer()-&gt;isText()) {
</span><del>-                endpoint.fastDecrement();
</del><ins>+                lineWhitespaceCollapsingState.decrementTransitionAt(lineWhitespaceCollapsingState.numTransitions() - 1);
</ins><span class="cx">                 return TrailingObjects::DoNotCollapseFirstSpace;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -1269,10 +1269,10 @@
</span><span class="cx">         m_lineBreakHistory.increment();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Sanity check our midpoints.
-    TrailingObjects::CollapseFirstSpaceOrNot collapsed = checkMidpoints(m_lineMidpointState, m_lineBreakHistory.current());
</del><ins>+    // Sanity check our whitespace collapsing transitions.
+    TrailingObjects::CollapseFirstSpaceOrNot collapsed = checkWhitespaceCollapsingTransitions(m_lineWhitespaceCollapsingState, m_lineBreakHistory.current());
</ins><span class="cx"> 
</span><del>-    m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, m_lineBreakHistory.current(), collapsed);
</del><ins>+    m_trailingObjects.updateWhitespaceCollapsingTransitionsForTrailingBoxes(m_lineWhitespaceCollapsingState, m_lineBreakHistory.current(), collapsed);
</ins><span class="cx"> 
</span><span class="cx">     // We might have made lineBreak an iterator that points past the end
</span><span class="cx">     // of the object. Do this adjustment to make it point to the start
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineTrailingObjectscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/TrailingObjects.cpp (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/TrailingObjects.cpp        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/rendering/line/TrailingObjects.cpp        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -29,44 +29,44 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void TrailingObjects::updateMidpointsForTrailingBoxes(LineMidpointState&amp; lineMidpointState, const InlineIterator&amp; lBreak, CollapseFirstSpaceOrNot collapseFirstSpace)
</del><ins>+void TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState&amp; lineWhitespaceCollapsingState, const InlineIterator&amp; lBreak, CollapseFirstSpaceOrNot collapseFirstSpace)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_whitespace)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // This object is either going to be part of the last midpoint, or it is going to be the actual endpoint.
</del><ins>+    // This object is either going to be part of the last transition, or it is going to be the actual endpoint.
</ins><span class="cx">     // In both cases we just decrease our pos by 1 level to exclude the space, allowing it to - in effect - collapse into the newline.
</span><del>-    if (lineMidpointState.numMidpoints() % 2) {
-        // Find the trailing space object's midpoint.
-        int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1;
-        for ( ; trailingSpaceMidpoint &gt; 0 &amp;&amp; lineMidpointState.midpoints()[trailingSpaceMidpoint].renderer() != m_whitespace; --trailingSpaceMidpoint) { }
-        ASSERT(trailingSpaceMidpoint &gt;= 0);
</del><ins>+    if (lineWhitespaceCollapsingState.numTransitions() % 2) {
+        // Find the trailing space object's transition.
+        int trailingSpaceTransition = lineWhitespaceCollapsingState.numTransitions() - 1;
+        for ( ; trailingSpaceTransition &gt; 0 &amp;&amp; lineWhitespaceCollapsingState.transitions()[trailingSpaceTransition].renderer() != m_whitespace; --trailingSpaceTransition) { }
+        ASSERT(trailingSpaceTransition &gt;= 0);
</ins><span class="cx">         if (collapseFirstSpace == CollapseFirstSpace)
</span><del>-            lineMidpointState.midpoints()[trailingSpaceMidpoint].fastDecrement();
</del><ins>+            lineWhitespaceCollapsingState.decrementTransitionAt(trailingSpaceTransition);
</ins><span class="cx"> 
</span><del>-        // Now make sure every single trailingPositionedBox following the trailingSpaceMidpoint properly stops and starts
</del><ins>+        // Now make sure every single trailingPositionedBox following the trailingSpaceTransition properly stops and starts
</ins><span class="cx">         // ignoring spaces.
</span><del>-        size_t currentMidpoint = trailingSpaceMidpoint + 1;
</del><ins>+        size_t currentTransition = trailingSpaceTransition + 1;
</ins><span class="cx">         for (size_t i = 0; i &lt; m_boxes.size(); ++i) {
</span><del>-            if (currentMidpoint &gt;= lineMidpointState.numMidpoints()) {
-                // We don't have a midpoint for this box yet.
-                lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
</del><ins>+            if (currentTransition &gt;= lineWhitespaceCollapsingState.numTransitions()) {
+                // We don't have a transition for this box yet.
+                lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
</ins><span class="cx">             } else {
</span><del>-                ASSERT(lineMidpointState.midpoints()[currentMidpoint].renderer() == m_boxes[i]);
-                ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1].renderer() == m_boxes[i]);
</del><ins>+                ASSERT(lineWhitespaceCollapsingState.transitions()[currentTransition].renderer() == &amp;(m_boxes[i].get()));
+                ASSERT(lineWhitespaceCollapsingState.transitions()[currentTransition + 1].renderer() == &amp;(m_boxes[i].get()));
</ins><span class="cx">             }
</span><del>-            currentMidpoint += 2;
</del><ins>+            currentTransition += 2;
</ins><span class="cx">         }
</span><span class="cx">     } else if (!lBreak.renderer()) {
</span><span class="cx">         ASSERT(m_whitespace-&gt;isText());
</span><span class="cx">         ASSERT(collapseFirstSpace == CollapseFirstSpace);
</span><del>-        // Add a new end midpoint that stops right at the very end.
</del><ins>+        // Add a new end transition that stops right at the very end.
</ins><span class="cx">         unsigned length = m_whitespace-&gt;textLength();
</span><span class="cx">         unsigned pos = length &gt;= 2 ? length - 2 : UINT_MAX;
</span><span class="cx">         InlineIterator endMid(0, m_whitespace, pos);
</span><del>-        lineMidpointState.startIgnoringSpaces(endMid);
</del><ins>+        lineWhitespaceCollapsingState.startIgnoringSpaces(endMid);
</ins><span class="cx">         for (size_t i = 0; i &lt; m_boxes.size(); ++i)
</span><del>-            lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
</del><ins>+            lineWhitespaceCollapsingState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineTrailingObjectsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/TrailingObjects.h (199148 => 199149)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/TrailingObjects.h        2016-04-07 04:33:32 UTC (rev 199148)
+++ trunk/Source/WebCore/rendering/line/TrailingObjects.h        2016-04-07 04:59:55 UTC (rev 199149)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
</span><del>- * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All right reserved.
</del><ins>+ * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2016 Apple Inc. All right reserved.
</ins><span class="cx">  * Copyright (C) 2010 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 ChangSeok Oh &lt;shivamidow@gmail.com&gt;
</span><span class="cx">  * Copyright (C) 2013 Adobe Systems Inc. All right reserved.
</span><span class="lines">@@ -38,9 +38,9 @@
</span><span class="cx"> 
</span><span class="cx"> template &lt;class Iterator, class Run&gt; class BidiResolver;
</span><span class="cx"> template &lt;class Iterator, class Run, class IsolateRun&gt; class BidiResolverWithIsolate;
</span><del>-template &lt;class Iterator&gt; class MidpointState;
</del><ins>+template &lt;class Iterator&gt; class WhitespaceCollapsingState;
</ins><span class="cx"> typedef BidiResolverWithIsolate&lt;InlineIterator, BidiRun, BidiIsolatedRun&gt; InlineBidiResolver;
</span><del>-typedef MidpointState&lt;InlineIterator&gt; LineMidpointState;
</del><ins>+typedef WhitespaceCollapsingState&lt;InlineIterator&gt; LineWhitespaceCollapsingState;
</ins><span class="cx"> 
</span><span class="cx"> class TrailingObjects {
</span><span class="cx"> public:
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">         m_boxes.shrink(0); // Use shrink(0) instead of clear() to retain our capacity.
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void appendBoxIfNeeded(RenderBoxModelObject* box)
</del><ins>+    void appendBoxIfNeeded(RenderBoxModelObject&amp; box)
</ins><span class="cx">     {
</span><span class="cx">         if (m_whitespace)
</span><span class="cx">             m_boxes.append(box);
</span><span class="lines">@@ -68,11 +68,11 @@
</span><span class="cx"> 
</span><span class="cx">     enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace };
</span><span class="cx"> 
</span><del>-    void updateMidpointsForTrailingBoxes(LineMidpointState&amp;, const InlineIterator&amp; lBreak, CollapseFirstSpaceOrNot);
</del><ins>+    void updateWhitespaceCollapsingTransitionsForTrailingBoxes(LineWhitespaceCollapsingState&amp;, const InlineIterator&amp; lBreak, CollapseFirstSpaceOrNot);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     RenderText* m_whitespace;
</span><del>-    Vector&lt;RenderBoxModelObject*, 4&gt; m_boxes;
</del><ins>+    Vector&lt;std::reference_wrapper&lt;RenderBoxModelObject&gt;, 4&gt; m_boxes;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>