<!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>[167928] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167928">167928</a></dd>
<dt>Author</dt> <dd>abucur@adobe.com</dd>
<dt>Date</dt> <dd>2014-04-29 05:38:20 -0700 (Tue, 29 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Store the containing region map inside the flow thread
https://bugs.webkit.org/show_bug.cgi?id=131647

Reviewed by Mihnea Ovidenie.

Source/WebCore:
The patch moves the containing region map inside the flow thread where
it can be better handled in case the region chain changes and the map
needs to be cleared.

As a result of this move we are able to also cleanup the lines region
information of a block flow when it is removed from the tree.

Test: fast/regions/inline-strike-through.html

* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::InlineFlowBox):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::addOverflowFromInlineChildren):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::removeFlowChildInfo):
(WebCore::RenderFlowThread::invalidateRegions):
(WebCore::RenderFlowThread::removeLineRegionInfo):
(WebCore::RenderFlowThread::checkLinesConsistency):
(WebCore::RenderFlowThread::containingRegionMap):
* rendering/RenderFlowThread.h:
* rendering/RootInlineBox.cpp:
(WebCore::containingRegionMap):
(WebCore::RootInlineBox::~RootInlineBox):
(WebCore::RootInlineBox::paint):
(WebCore::RootInlineBox::containingRegion):
(WebCore::RootInlineBox::clearContainingRegion):
(WebCore::RootInlineBox::setContainingRegion):

LayoutTests:
Add a test that verifies the containing region map is properly cleared
when the region chain changes.

* fast/regions/inline-strike-through-expected.txt: Added.
* fast/regions/inline-strike-through.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxh">trunk/Source/WebCore/rendering/InlineFlowBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlowThreadcpp">trunk/Source/WebCore/rendering/RenderFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlowThreadh">trunk/Source/WebCore/rendering/RenderFlowThread.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxcpp">trunk/Source/WebCore/rendering/RootInlineBox.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastregionsinlinestrikethroughexpectedtxt">trunk/LayoutTests/fast/regions/inline-strike-through-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastregionsinlinestrikethroughhtml">trunk/LayoutTests/fast/regions/inline-strike-through.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/LayoutTests/ChangeLog        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-04-29  Andrei Bucur  &lt;abucur@adobe.com&gt;
+
+        Store the containing region map inside the flow thread
+        https://bugs.webkit.org/show_bug.cgi?id=131647
+
+        Reviewed by Mihnea Ovidenie.
+
+        Add a test that verifies the containing region map is properly cleared
+        when the region chain changes.
+
+        * fast/regions/inline-strike-through-expected.txt: Added.
+        * fast/regions/inline-strike-through.html: Added.
+
</ins><span class="cx"> 2014-04-29  Ryuan Choi  &lt;ryuan.choi@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed EFL gardening.
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsinlinestrikethroughexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/inline-strike-through-expected.txt (0 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/inline-strike-through-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/regions/inline-strike-through-expected.txt        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+131647 - The test passes if it doesn't crash and if it displays the PASS below this line.
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastregionsinlinestrikethroughhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/inline-strike-through.html (0 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/inline-strike-through.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/inline-strike-through.html        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+    #article {
+        -webkit-flow-into: article;
+    }
+    #region {
+        -webkit-flow-from: article;
+        display: inline-block;
+        height: 200px;
+        width: 300px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;article&quot;&gt;&lt;/div&gt;
+    &lt;div id=&quot;region&quot;&gt;&lt;/div&gt;
+    &lt;div&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=131647&quot;&gt;131647&lt;/a&gt; - The test passes if it doesn't crash and if it displays the PASS below this line.&lt;/div&gt;
+    &lt;div&gt;PASS&lt;/div&gt;
+    &lt;script&gt;
+    if (window.testRunner)
+        window.testRunner.dumpAsText();
+    var elem = document.getElementById(&quot;article&quot;);
+    var new_elem = document.createElement(&quot;table&quot;);
+    elem.appendChild(new_elem); elem = new_elem;
+    new_elem = document.createElement(&quot;video&quot;);
+    elem.appendChild(new_elem); elem = new_elem;
+    new_elem = document.createElement(&quot;div&quot;);
+    elem.appendChild(new_elem); 
+    document.designMode = &quot;on&quot;;
+    document.execCommand(&quot;SelectAll&quot;);
+    document.execCommand(&quot;StrikeThrough&quot;);
+    document.body.offsetTop;
+    if (window.testRunner)
+        document.getElementById(&quot;region&quot;).style.visibility = &quot;hidden&quot;;
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/ChangeLog        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-04-29  Andrei Bucur  &lt;abucur@adobe.com&gt;
+
+        Store the containing region map inside the flow thread
+        https://bugs.webkit.org/show_bug.cgi?id=131647
+
+        Reviewed by Mihnea Ovidenie.
+
+        The patch moves the containing region map inside the flow thread where
+        it can be better handled in case the region chain changes and the map
+        needs to be cleared.
+
+        As a result of this move we are able to also cleanup the lines region
+        information of a block flow when it is removed from the tree.
+
+        Test: fast/regions/inline-strike-through.html
+
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::InlineFlowBox):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::addOverflowFromInlineChildren):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::removeFlowChildInfo):
+        (WebCore::RenderFlowThread::invalidateRegions):
+        (WebCore::RenderFlowThread::removeLineRegionInfo):
+        (WebCore::RenderFlowThread::checkLinesConsistency):
+        (WebCore::RenderFlowThread::containingRegionMap):
+        * rendering/RenderFlowThread.h:
+        * rendering/RootInlineBox.cpp:
+        (WebCore::containingRegionMap):
+        (WebCore::RootInlineBox::~RootInlineBox):
+        (WebCore::RootInlineBox::paint):
+        (WebCore::RootInlineBox::containingRegion):
+        (WebCore::RootInlineBox::clearContainingRegion):
+        (WebCore::RootInlineBox::setContainingRegion):
+
</ins><span class="cx"> 2014-04-28  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         SelectorCodeGenerator::generateElementIsNthChild() leaks the parent register :nth-child() is non-filtering
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -53,7 +53,6 @@
</span><span class="cx">         , m_hasAnnotationsBefore(false)
</span><span class="cx">         , m_hasAnnotationsAfter(false)
</span><span class="cx">         , m_isFirstAfterPageBreak(false)
</span><del>-        , m_hasContainingRegion(false)
</del><span class="cx"> #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
</span><span class="cx">         , m_hasBadChildList(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -339,8 +338,6 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned m_isFirstAfterPageBreak : 1;
</span><span class="cx"> 
</span><del>-    unsigned m_hasContainingRegion : 1;
-
</del><span class="cx">     // End of RootInlineBox-specific members.
</span><span class="cx"> 
</span><span class="cx"> #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -1752,7 +1752,7 @@
</span><span class="cx">         endPadding = 1;
</span><span class="cx">     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr-&gt;nextRootBox()) {
</span><span class="cx">         addLayoutOverflow(curr-&gt;paddedLayoutOverflowRect(endPadding));
</span><del>-        RenderRegion* region = curr-&gt;containingRegion();
</del><ins>+        RenderRegion* region = flowThreadContainingBlock() ? curr-&gt;containingRegion() : nullptr;
</ins><span class="cx">         if (region)
</span><span class="cx">             region-&gt;addLayoutOverflowForBox(this, curr-&gt;paddedLayoutOverflowRect(endPadding));
</span><span class="cx">         if (!hasOverflowClip()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderFlowThread::removeFlowChildInfo(RenderObject* child)
</span><span class="cx"> {
</span><ins>+    if (child-&gt;isRenderBlockFlow())
+        removeLineRegionInfo(toRenderBlockFlow(child));
</ins><span class="cx">     if (child-&gt;isBox())
</span><span class="cx">         removeRenderBoxRegionInfo(toRenderBox(child));
</span><span class="cx"> }
</span><span class="lines">@@ -117,6 +119,8 @@
</span><span class="cx">         m_layerToRegionMap-&gt;clear();
</span><span class="cx">     if (m_regionToLayerListMap)
</span><span class="cx">         m_regionToLayerListMap-&gt;clear();
</span><ins>+    if (m_lineToRegionMap)
+        m_lineToRegionMap-&gt;clear();
</ins><span class="cx">     m_layersToRegionMappingsDirty = true;
</span><span class="cx">     setNeedsLayout();
</span><span class="cx"> 
</span><span class="lines">@@ -588,6 +592,19 @@
</span><span class="cx">     m_regionRangeMap.remove(box);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderFlowThread::removeLineRegionInfo(const RenderBlockFlow* blockFlow)
+{
+    if (!m_lineToRegionMap || blockFlow-&gt;m_lineLayoutPath == SimpleLinesPath)
+        return;
+
+    for (RootInlineBox* curr = blockFlow-&gt;firstRootBox(); curr; curr = curr-&gt;nextRootBox()) {
+        if (m_lineToRegionMap-&gt;contains(curr))
+            m_lineToRegionMap-&gt;remove(curr);
+    }
+
+    ASSERT_WITH_SECURITY_IMPLICATION(checkLinesConsistency(blockFlow));
+}
+
</ins><span class="cx"> void RenderFlowThread::logicalWidthChangedInRegionsForBlock(const RenderBlock* block, bool&amp; relayoutChildren)
</span><span class="cx"> {
</span><span class="cx">     if (!hasValidRegionInfo()) {
</span><span class="lines">@@ -889,6 +906,27 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
+bool RenderFlowThread::checkLinesConsistency(const RenderBlockFlow* removedBlock) const
+{
+    if (!m_lineToRegionMap)
+        return true;
+
+    for (auto&amp; linePair : *m_lineToRegionMap.get()) {
+        const RootInlineBox* line = linePair.key;
+        RenderRegion* region = linePair.value;
+        if (&amp;line-&gt;blockFlow() == removedBlock)
+            return false;
+        if (line-&gt;blockFlow().flowThreadState() == NotInsideFlowThread)
+            return false;
+        if (!m_regionList.contains(region))
+            return false;
+    }
+
+    return true;
+}
+#endif
+
</ins><span class="cx"> // During the measure content layout phase of the named flow the regions are initialized with a height equal to their max-height.
</span><span class="cx"> // This way unforced breaks are automatically placed when a region is full and the content height/position correctly estimated.
</span><span class="cx"> // Also, the region where a forced break falls is exactly the region found at the forced break offset inside the flow content.
</span><span class="lines">@@ -1405,6 +1443,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ContainingRegionMap&amp; RenderFlowThread::containingRegionMap()
+{
+    if (!m_lineToRegionMap)
+        m_lineToRegionMap = std::make_unique&lt;ContainingRegionMap&gt;();
+
+    return *m_lineToRegionMap.get();
+}
+
</ins><span class="cx"> CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread)
</span><span class="cx">     : m_renderFlowThread(renderFlowThread)
</span><span class="cx">     , m_previousRenderFlowThread(0)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlowThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlowThread.h        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -44,11 +44,13 @@
</span><span class="cx"> class RenderNamedFlowFragment;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class RenderRegion;
</span><ins>+class RootInlineBox;
</ins><span class="cx"> 
</span><span class="cx"> typedef ListHashSet&lt;RenderRegion*&gt; RenderRegionList;
</span><span class="cx"> typedef Vector&lt;RenderLayer*&gt; RenderLayerList;
</span><span class="cx"> typedef HashMap&lt;RenderNamedFlowFragment*, RenderLayerList&gt; RegionToLayerListMap;
</span><span class="cx"> typedef HashMap&lt;RenderLayer*, RenderNamedFlowFragment*&gt; LayerToRegionMap;
</span><ins>+typedef HashMap&lt;const RootInlineBox*, RenderRegion*&gt; ContainingRegionMap;
</ins><span class="cx"> 
</span><span class="cx"> // RenderFlowThread is used to collect all the render objects that participate in a
</span><span class="cx"> // flow thread. It will also help in doing the layout. However, it will not render
</span><span class="lines">@@ -65,6 +67,10 @@
</span><span class="cx">     bool hasChildInfo(RenderObject* child) const { return child &amp;&amp; child-&gt;isBox() &amp;&amp; m_regionRangeMap.contains(toRenderBox(child)); }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
+    bool checkLinesConsistency(const RenderBlockFlow*) const;
+#endif
+
</ins><span class="cx">     virtual void addRegionToThread(RenderRegion*) = 0;
</span><span class="cx">     virtual void removeRegionFromThread(RenderRegion*);
</span><span class="cx">     const RenderRegionList&amp; renderRegionList() const { return m_regionList; }
</span><span class="lines">@@ -120,7 +126,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RenderRegion* mapFromFlowToRegion(TransformState&amp;) const;
</span><span class="cx"> 
</span><del>-    void removeRenderBoxRegionInfo(RenderBox*);
</del><span class="cx">     void logicalWidthChangedInRegionsForBlock(const RenderBlock*, bool&amp;);
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit contentLogicalWidthOfFirstRegion() const;
</span><span class="lines">@@ -220,6 +225,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void layout() override;
</span><span class="cx"> 
</span><ins>+    ContainingRegionMap&amp; containingRegionMap();
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual bool isRenderFlowThread() const override final { return true; }
</span><span class="cx"> 
</span><span class="lines">@@ -260,6 +267,9 @@
</span><span class="cx"> 
</span><span class="cx">     bool getRegionRangeForBoxFromCachedInfo(const RenderBox*, RenderRegion*&amp; startRegion, RenderRegion*&amp; endRegion) const;
</span><span class="cx"> 
</span><ins>+    void removeRenderBoxRegionInfo(RenderBox*);
+    void removeLineRegionInfo(const RenderBlockFlow*);
+
</ins><span class="cx">     RenderRegionList m_regionList;
</span><span class="cx">     unsigned short m_previousRegionCount;
</span><span class="cx"> 
</span><span class="lines">@@ -321,6 +331,9 @@
</span><span class="cx">     // Map a region to the list of layers that paint in that region.
</span><span class="cx">     std::unique_ptr&lt;RegionToLayerListMap&gt; m_regionToLayerListMap;
</span><span class="cx"> 
</span><ins>+    // Map a line to its containing region.
+    std::unique_ptr&lt;ContainingRegionMap&gt; m_lineToRegionMap;
+
</ins><span class="cx">     // Map a box to the list of regions in which the box is rendered.
</span><span class="cx">     typedef HashMap&lt;const RenderBox*, RenderRegionRange&gt; RenderRegionRangeMap;
</span><span class="cx">     RenderRegionRangeMap m_regionRangeMap;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (167927 => 167928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-04-29 11:42:41 UTC (rev 167927)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-04-29 12:38:20 UTC (rev 167928)
</span><span class="lines">@@ -53,11 +53,10 @@
</span><span class="cx"> typedef WTF::HashMap&lt;const RootInlineBox*, std::unique_ptr&lt;EllipsisBox&gt;&gt; EllipsisBoxMap;
</span><span class="cx"> static EllipsisBoxMap* gEllipsisBoxMap = 0;
</span><span class="cx"> 
</span><del>-typedef HashMap&lt;const RootInlineBox*, RenderRegion*&gt; ContainingRegionMap;
-static ContainingRegionMap&amp; containingRegionMap()
</del><ins>+static ContainingRegionMap&amp; containingRegionMap(RenderBlockFlow&amp; block)
</ins><span class="cx"> {
</span><del>-    static NeverDestroyed&lt;ContainingRegionMap&gt; map;
-    return map;
</del><ins>+    ASSERT(block.flowThreadContainingBlock());
+    return block.flowThreadContainingBlock()-&gt;containingRegionMap();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RootInlineBox::RootInlineBox(RenderBlockFlow&amp; block)
</span><span class="lines">@@ -72,8 +71,8 @@
</span><span class="cx"> {
</span><span class="cx">     detachEllipsisBox();
</span><span class="cx"> 
</span><del>-    if (m_hasContainingRegion)
-        containingRegionMap().remove(this);
</del><ins>+    if (blockFlow().flowThreadContainingBlock())
+        containingRegionMap(blockFlow()).remove(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RootInlineBox::detachEllipsisBox()
</span><span class="lines">@@ -175,8 +174,11 @@
</span><span class="cx"> void RootInlineBox::paint(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
</span><span class="cx"> {
</span><span class="cx">     // Check if we are in the correct region.
</span><del>-    if (paintInfo.renderNamedFlowFragment &amp;&amp; m_hasContainingRegion &amp;&amp; containingRegion() != reinterpret_cast&lt;RenderRegion*&gt;(paintInfo.renderNamedFlowFragment))
-        return;
</del><ins>+    if (paintInfo.renderNamedFlowFragment) {
+        RenderRegion* region = containingRegion();
+        if (region &amp;&amp; region != reinterpret_cast&lt;RenderRegion*&gt;(paintInfo.renderNamedFlowFragment))
+            return;
+    }
</ins><span class="cx">     
</span><span class="cx">     InlineFlowBox::paint(paintInfo, paintOffset, lineTop, lineBottom);
</span><span class="cx">     paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom);
</span><span class="lines">@@ -218,10 +220,12 @@
</span><span class="cx"> 
</span><span class="cx"> RenderRegion* RootInlineBox::containingRegion() const
</span><span class="cx"> {
</span><del>-    RenderRegion* region = m_hasContainingRegion ? containingRegionMap().get(this) : nullptr;
</del><ins>+    ContainingRegionMap&amp; regionMap = containingRegionMap(blockFlow());
+    bool hasContainingRegion = regionMap.contains(this);
+    RenderRegion* region = hasContainingRegion ? regionMap.get(this) : nullptr;
</ins><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><del>-    if (m_hasContainingRegion) {
</del><ins>+    if (hasContainingRegion) {
</ins><span class="cx">         RenderFlowThread* flowThread = blockFlow().flowThreadContainingBlock();
</span><span class="cx">         const RenderRegionList&amp; regionList = flowThread-&gt;renderRegionList();
</span><span class="cx">         ASSERT_WITH_SECURITY_IMPLICATION(regionList.contains(region));
</span><span class="lines">@@ -234,22 +238,18 @@
</span><span class="cx"> void RootInlineBox::clearContainingRegion()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isDirty());
</span><del>-    ASSERT(blockFlow().flowThreadContainingBlock());
</del><span class="cx"> 
</span><del>-    if (!m_hasContainingRegion)
</del><ins>+    if (!containingRegionMap(blockFlow()).contains(this))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    containingRegionMap().remove(this);
-    m_hasContainingRegion = false;
</del><ins>+    containingRegionMap(blockFlow()).remove(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RootInlineBox::setContainingRegion(RenderRegion&amp; region)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isDirty());
</span><del>-    ASSERT(blockFlow().flowThreadContainingBlock());
</del><span class="cx"> 
</span><del>-    containingRegionMap().set(this, &amp;region);
-    m_hasContainingRegion = true;
</del><ins>+    containingRegionMap(blockFlow()).set(this, &amp;region);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&amp; textBoxDataMap, VerticalPositionCache&amp; verticalPositionCache)
</span></span></pre>
</div>
</div>

</body>
</html>