<!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>[168967] 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/168967">168967</a></dd>
<dt>Author</dt> <dd>abucur@adobe.com</dd>
<dt>Date</dt> <dd>2014-05-16 06:22:00 -0700 (Fri, 16 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Regions] Reduce the RenderRegion invasiveness in rendering code
https://bugs.webkit.org/show_bug.cgi?id=132121

Reviewed by Antti Koivisto.

Remove the RenderRegion / RenderNamedFlowFragment parameters and fields from
the painting / hit testing data structures and use a stateful approach to
correctly handle regions.

When painting or hit testing, the current flow thread is saved along the current
region. They are accessed through the |currentRenderNamedFlowFragment| helper
method on RenderObject or RenderLayer.

The patch also changes a bunch of 0s to nullptrs.

Tests: No new tests, no functional change.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* rendering/HitTestLocation.cpp:
(WebCore::HitTestLocation::HitTestLocation):
(WebCore::HitTestLocation::operator=):
* rendering/HitTestLocation.h:
(WebCore::HitTestLocation::region): Deleted.
* rendering/HitTestResult.h:
* rendering/PaintInfo.h:
(WebCore::PaintInfo::PaintInfo):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):
(WebCore::RenderBlock::selectionGaps):
(WebCore::RenderBlock::nodeAtPoint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::nodeAtPoint):
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::pushContentsClip):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderBoxModelObject.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paint):
(WebCore::RenderLayer::paintLayer):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintLayerByApplyingTransform):
(WebCore::RenderLayer::collectFragments):
(WebCore::RenderLayer::updatePaintingInfoForFragments):
(WebCore::RenderLayer::paintTransformedLayerIntoFragments):
(WebCore::RenderLayer::paintBackgroundForFragments):
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
(WebCore::RenderLayer::paintOutlineForFragments):
(WebCore::RenderLayer::paintMaskForFragments):
(WebCore::RenderLayer::hitTest):
(WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestTransformedLayerInFragments):
(WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateCompositedBounds):
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::addToOverlapMap):
(WebCore::RenderLayerCompositor::clippedByAncestor):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::currentRenderNamedFlowFragment):
* rendering/RenderObject.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderReplica.cpp:
(WebCore::RenderReplica::paint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::nodeAtPoint):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeLayers):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::paint):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paintReplaced):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestLocationcpp">trunk/Source/WebCore/rendering/HitTestLocation.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestLocationh">trunk/Source/WebCore/rendering/HitTestLocation.h</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResulth">trunk/Source/WebCore/rendering/HitTestResult.h</a></li>
<li><a href="#trunkSourceWebCorerenderingPaintInfoh">trunk/Source/WebCore/rendering/PaintInfo.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjectcpp">trunk/Source/WebCore/rendering/RenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplicacpp">trunk/Source/WebCore/rendering/RenderReplica.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableSectioncpp">trunk/Source/WebCore/rendering/RenderTableSection.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/RenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxcpp">trunk/Source/WebCore/rendering/RootInlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGRootcpp">trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/ChangeLog        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -1,3 +1,88 @@
</span><ins>+2014-05-16  Andrei Bucur  &lt;abucur@adobe.com&gt;
+
+        [CSS Regions] Reduce the RenderRegion invasiveness in rendering code
+        https://bugs.webkit.org/show_bug.cgi?id=132121
+
+        Reviewed by Antti Koivisto.
+
+        Remove the RenderRegion / RenderNamedFlowFragment parameters and fields from
+        the painting / hit testing data structures and use a stateful approach to
+        correctly handle regions.
+
+        When painting or hit testing, the current flow thread is saved along the current
+        region. They are accessed through the |currentRenderNamedFlowFragment| helper
+        method on RenderObject or RenderLayer.
+
+        The patch also changes a bunch of 0s to nullptrs.
+
+        Tests: No new tests, no functional change.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
+        * rendering/HitTestLocation.cpp:
+        (WebCore::HitTestLocation::HitTestLocation):
+        (WebCore::HitTestLocation::operator=):
+        * rendering/HitTestLocation.h:
+        (WebCore::HitTestLocation::region): Deleted.
+        * rendering/HitTestResult.h:
+        * rendering/PaintInfo.h:
+        (WebCore::PaintInfo::PaintInfo):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paint):
+        (WebCore::RenderBlock::paintObject):
+        (WebCore::RenderBlock::selectionGaps):
+        (WebCore::RenderBlock::nodeAtPoint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::nodeAtPoint):
+        (WebCore::RenderBox::paintBoxDecorations):
+        (WebCore::RenderBox::pushContentsClip):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paint):
+        (WebCore::RenderLayer::paintLayer):
+        (WebCore::RenderLayer::paintLayerContents):
+        (WebCore::RenderLayer::paintLayerByApplyingTransform):
+        (WebCore::RenderLayer::collectFragments):
+        (WebCore::RenderLayer::updatePaintingInfoForFragments):
+        (WebCore::RenderLayer::paintTransformedLayerIntoFragments):
+        (WebCore::RenderLayer::paintBackgroundForFragments):
+        (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
+        (WebCore::RenderLayer::paintOutlineForFragments):
+        (WebCore::RenderLayer::paintMaskForFragments):
+        (WebCore::RenderLayer::hitTest):
+        (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
+        (WebCore::RenderLayer::hitTestLayer):
+        (WebCore::RenderLayer::hitTestTransformedLayerInFragments):
+        (WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateCompositedBounds):
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::addToOverlapMap):
+        (WebCore::RenderLayerCompositor::clippedByAncestor):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::currentRenderNamedFlowFragment):
+        * rendering/RenderObject.h:
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldPaint):
+        * rendering/RenderReplica.cpp:
+        (WebCore::RenderReplica::paint):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::nodeAtPoint):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::nodeAtPoint):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::writeLayers):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::paint):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::paintReplaced):
+
</ins><span class="cx"> 2014-05-16  Kiran  &lt;kiran.guduru@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         RTCDtmfSender default values need to be updated.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -1479,7 +1479,7 @@
</span><span class="cx">     if (!buffer)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    layer-&gt;paint(buffer-&gt;context(), paintingRect, PaintBehaviorFlattenCompositingLayers, nullptr, nullptr, RenderLayer::PaintLayerPaintingCompositingAllPhases);
</del><ins>+    layer-&gt;paint(buffer-&gt;context(), paintingRect, PaintBehaviorFlattenCompositingLayers, nullptr, RenderLayer::PaintLayerPaintingCompositingAllPhases);
</ins><span class="cx"> 
</span><span class="cx">     return buffer-&gt;copyImage();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestLocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestLocation.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestLocation.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/HitTestLocation.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -47,8 +47,7 @@
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><span class="cx"> HitTestLocation::HitTestLocation()
</span><del>-    : m_region(0)
-    , m_isRectBased(false)
</del><ins>+    : m_isRectBased(false)
</ins><span class="cx">     , m_isRectilinear(true)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -58,7 +57,6 @@
</span><span class="cx">     , m_boundingBox(rectForPoint(point, 0, 0, 0, 0))
</span><span class="cx">     , m_transformedPoint(point)
</span><span class="cx">     , m_transformedRect(m_boundingBox)
</span><del>-    , m_region(0)
</del><span class="cx">     , m_isRectBased(false)
</span><span class="cx">     , m_isRectilinear(true)
</span><span class="cx"> {
</span><span class="lines">@@ -69,7 +67,6 @@
</span><span class="cx">     , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0))
</span><span class="cx">     , m_transformedPoint(point)
</span><span class="cx">     , m_transformedRect(m_boundingBox)
</span><del>-    , m_region(0)
</del><span class="cx">     , m_isRectBased(false)
</span><span class="cx">     , m_isRectilinear(true)
</span><span class="cx"> {
</span><span class="lines">@@ -78,7 +75,6 @@
</span><span class="cx"> HitTestLocation::HitTestLocation(const FloatPoint&amp; point, const FloatQuad&amp; quad)
</span><span class="cx">     : m_transformedPoint(point)
</span><span class="cx">     , m_transformedRect(quad)
</span><del>-    , m_region(0)
</del><span class="cx">     , m_isRectBased(true)
</span><span class="cx"> {
</span><span class="cx">     m_point = flooredLayoutPoint(point);
</span><span class="lines">@@ -90,19 +86,17 @@
</span><span class="cx">     : m_point(centerPoint)
</span><span class="cx">     , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding))
</span><span class="cx">     , m_transformedPoint(centerPoint)
</span><del>-    , m_region(0)
</del><span class="cx">     , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding)
</span><span class="cx">     , m_isRectilinear(true)
</span><span class="cx"> {
</span><span class="cx">     m_transformedRect = FloatQuad(m_boundingBox);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HitTestLocation::HitTestLocation(const HitTestLocation&amp; other, const LayoutSize&amp; offset, RenderRegion* region)
</del><ins>+HitTestLocation::HitTestLocation(const HitTestLocation&amp; other, const LayoutSize&amp; offset)
</ins><span class="cx">     : m_point(other.m_point)
</span><span class="cx">     , m_boundingBox(other.m_boundingBox)
</span><span class="cx">     , m_transformedPoint(other.m_transformedPoint)
</span><span class="cx">     , m_transformedRect(other.m_transformedRect)
</span><del>-    , m_region(region ? region : other.m_region)
</del><span class="cx">     , m_isRectBased(other.m_isRectBased)
</span><span class="cx">     , m_isRectilinear(other.m_isRectilinear)
</span><span class="cx"> {
</span><span class="lines">@@ -114,7 +108,6 @@
</span><span class="cx">     , m_boundingBox(other.m_boundingBox)
</span><span class="cx">     , m_transformedPoint(other.m_transformedPoint)
</span><span class="cx">     , m_transformedRect(other.m_transformedRect)
</span><del>-    , m_region(other.m_region)
</del><span class="cx">     , m_isRectBased(other.m_isRectBased)
</span><span class="cx">     , m_isRectilinear(other.m_isRectilinear)
</span><span class="cx"> {
</span><span class="lines">@@ -130,7 +123,6 @@
</span><span class="cx">     m_boundingBox = other.m_boundingBox;
</span><span class="cx">     m_transformedPoint = other.m_transformedPoint;
</span><span class="cx">     m_transformedRect = other.m_transformedRect;
</span><del>-    m_region = other.m_region;
</del><span class="cx">     m_isRectBased = other.m_isRectBased;
</span><span class="cx">     m_isRectilinear = other.m_isRectilinear;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestLocationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestLocation.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestLocation.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/HitTestLocation.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -42,7 +42,6 @@
</span><span class="cx"> class Image;
</span><span class="cx"> class URL;
</span><span class="cx"> class Node;
</span><del>-class RenderRegion;
</del><span class="cx"> class Scrollbar;
</span><span class="cx"> 
</span><span class="cx"> class HitTestLocation {
</span><span class="lines">@@ -55,7 +54,7 @@
</span><span class="cx">     // Pass non-zero padding values to perform a rect-based hit test.
</span><span class="cx">     HitTestLocation(const LayoutPoint&amp; centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
</span><span class="cx">     // Make a copy the HitTestLocation in a new region by applying given offset to internal point and area.
</span><del>-    HitTestLocation(const HitTestLocation&amp;, const LayoutSize&amp; offset, RenderRegion* = 0);
</del><ins>+    HitTestLocation(const HitTestLocation&amp;, const LayoutSize&amp; offset);
</ins><span class="cx">     HitTestLocation(const HitTestLocation&amp;);
</span><span class="cx">     ~HitTestLocation();
</span><span class="cx">     HitTestLocation&amp; operator=(const HitTestLocation&amp;);
</span><span class="lines">@@ -63,8 +62,6 @@
</span><span class="cx">     const LayoutPoint&amp; point() const { return m_point; }
</span><span class="cx">     IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
</span><span class="cx"> 
</span><del>-    RenderRegion* region() const { return m_region; }
-
</del><span class="cx">     // Rect-based hit test related methods.
</span><span class="cx">     bool isRectBasedTest() const { return m_isRectBased; }
</span><span class="cx">     bool isRectilinear() const { return m_isRectilinear; }
</span><span class="lines">@@ -95,8 +92,6 @@
</span><span class="cx">     FloatPoint m_transformedPoint;
</span><span class="cx">     FloatQuad m_transformedRect;
</span><span class="cx"> 
</span><del>-    RenderRegion* m_region; // The region we're inside.
-
</del><span class="cx">     bool m_isRectBased;
</span><span class="cx">     bool m_isRectilinear;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/HitTestResult.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx"> class Image;
</span><span class="cx"> class URL;
</span><span class="cx"> class Node;
</span><del>-class RenderRegion;
</del><span class="cx"> class Scrollbar;
</span><span class="cx"> 
</span><span class="cx"> class HitTestResult {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingPaintInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/PaintInfo.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/PaintInfo.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/PaintInfo.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx"> class OverlapTestRequestClient;
</span><span class="cx"> class RenderInline;
</span><span class="cx"> class RenderLayerModelObject;
</span><del>-class RenderNamedFlowFragment;
</del><span class="cx"> class RenderObject;
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;OverlapTestRequestClient*, IntRect&gt; OverlapTestRequestMap;
</span><span class="lines">@@ -51,14 +50,13 @@
</span><span class="cx">  */
</span><span class="cx"> struct PaintInfo {
</span><span class="cx">     PaintInfo(GraphicsContext* newContext, const LayoutRect&amp; newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
</span><del>-        RenderObject* newSubtreePaintRoot = nullptr, RenderNamedFlowFragment* namedFlowFragment = nullptr, ListHashSet&lt;RenderInline*&gt;* newOutlineObjects = nullptr,
</del><ins>+        RenderObject* newSubtreePaintRoot = nullptr, ListHashSet&lt;RenderInline*&gt;* newOutlineObjects = nullptr,
</ins><span class="cx">         OverlapTestRequestMap* overlapTestRequests = nullptr, const RenderLayerModelObject* newPaintContainer = nullptr)
</span><span class="cx">             : context(newContext)
</span><span class="cx">             , rect(newRect)
</span><span class="cx">             , phase(newPhase)
</span><span class="cx">             , paintBehavior(newPaintBehavior)
</span><span class="cx">             , subtreePaintRoot(newSubtreePaintRoot)
</span><del>-            , renderNamedFlowFragment(namedFlowFragment)
</del><span class="cx">             , outlineObjects(newOutlineObjects)
</span><span class="cx">             , overlapTestRequests(overlapTestRequests)
</span><span class="cx">             , paintContainer(newPaintContainer)
</span><span class="lines">@@ -107,7 +105,6 @@
</span><span class="cx">     PaintPhase phase;
</span><span class="cx">     PaintBehavior paintBehavior;
</span><span class="cx">     RenderObject* subtreePaintRoot; // used to draw just one element and its visual children
</span><del>-    RenderNamedFlowFragment* renderNamedFlowFragment;
</del><span class="cx">     ListHashSet&lt;RenderInline*&gt;* outlineObjects; // used to list outlines that should be painted by a block with inline children
</span><span class="cx">     OverlapTestRequestMap* overlapTestRequests;
</span><span class="cx">     const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -1462,15 +1462,16 @@
</span><span class="cx">     
</span><span class="cx">     PaintPhase phase = paintInfo.phase;
</span><span class="cx"> 
</span><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</ins><span class="cx">     // Check our region range to make sure we need to be painting in this region.
</span><del>-    if (paintInfo.renderNamedFlowFragment &amp;&amp; !paintInfo.renderNamedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(this, paintInfo.renderNamedFlowFragment))
</del><ins>+    if (namedFlowFragment &amp;&amp; !namedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(this, namedFlowFragment))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Check if we need to do anything at all.
</span><span class="cx">     // FIXME: Could eliminate the isRoot() check if we fix background painting so that the RenderView
</span><span class="cx">     // paints the root's background.
</span><span class="cx">     if (!isRoot()) {
</span><del>-        LayoutRect overflowBox = overflowRectForPaintRejection(paintInfo.renderNamedFlowFragment);
</del><ins>+        LayoutRect overflowBox = overflowRectForPaintRejection(namedFlowFragment);
</ins><span class="cx">         flipForWritingMode(overflowBox);
</span><span class="cx">         overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
</span><span class="cx">         overflowBox.moveBy(adjustedPaintOffset);
</span><span class="lines">@@ -1600,7 +1601,8 @@
</span><span class="cx">         if (hasBoxDecorations()) {
</span><span class="cx">             bool didClipToRegion = false;
</span><span class="cx">             
</span><del>-            if (paintInfo.paintContainer &amp;&amp; paintInfo.renderNamedFlowFragment &amp;&amp; paintInfo.paintContainer-&gt;isRenderNamedFlowThread()) {
</del><ins>+            RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
+            if (paintInfo.paintContainer &amp;&amp; namedFlowFragment &amp;&amp; paintInfo.paintContainer-&gt;isRenderNamedFlowThread()) {
</ins><span class="cx">                 // If this box goes beyond the current region, then make sure not to overflow the region.
</span><span class="cx">                 // This (overflowing region X altough also fragmented to region X+1) could happen when one of this box's children
</span><span class="cx">                 // overflows region X and is an unsplittable element (like an image).
</span><span class="lines">@@ -1609,7 +1611,7 @@
</span><span class="cx">                 paintInfo.context-&gt;save();
</span><span class="cx">                 didClipToRegion = true;
</span><span class="cx"> 
</span><del>-                paintInfo.context-&gt;clip(toRenderNamedFlowThread(paintInfo.paintContainer)-&gt;decorationsClipRectForBoxInNamedFlowFragment(*this, *paintInfo.renderNamedFlowFragment));
</del><ins>+                paintInfo.context-&gt;clip(toRenderNamedFlowThread(paintInfo.paintContainer)-&gt;decorationsClipRectForBoxInNamedFlowFragment(*this, *namedFlowFragment));
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             paintBoxDecorations(paintInfo, paintOffset);
</span><span class="lines">@@ -1917,9 +1919,10 @@
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    if (paintInfo &amp;&amp; paintInfo-&gt;renderNamedFlowFragment &amp;&amp; paintInfo-&gt;paintContainer-&gt;isRenderFlowThread()) {
</del><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
+    if (paintInfo &amp;&amp; namedFlowFragment &amp;&amp; paintInfo-&gt;paintContainer-&gt;isRenderFlowThread()) {
</ins><span class="cx">         // Make sure the current object is actually flowed into the region being painted.
</span><del>-        if (!toRenderFlowThread(paintInfo-&gt;paintContainer)-&gt;objectShouldFragmentInFlowRegion(this, paintInfo-&gt;renderNamedFlowFragment))
</del><ins>+        if (!toRenderFlowThread(paintInfo-&gt;paintContainer)-&gt;objectShouldFragmentInFlowRegion(this, namedFlowFragment))
</ins><span class="cx">             return result;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2457,14 +2460,12 @@
</span><span class="cx">     LayoutPoint adjustedLocation(accumulatedOffset + location());
</span><span class="cx">     LayoutSize localOffset = toLayoutSize(adjustedLocation);
</span><span class="cx"> 
</span><ins>+    RenderFlowThread* flowThread = flowThreadContainingBlock();
+    RenderNamedFlowFragment* namedFlowFragment = flowThread ? toRenderNamedFlowFragment(flowThread-&gt;currentRegion()) : nullptr;
</ins><span class="cx">     // If we are now searching inside a region, make sure this element
</span><span class="cx">     // is being fragmented into this region.
</span><del>-    if (locationInContainer.region()) {
-        RenderFlowThread* flowThread = flowThreadContainingBlock();
-        ASSERT(flowThread);
-        if (!flowThread-&gt;objectShouldFragmentInFlowRegion(this, locationInContainer.region()))
-            return false;
-    }
</del><ins>+    if (namedFlowFragment &amp;&amp; !flowThread-&gt;objectShouldFragmentInFlowRegion(this, namedFlowFragment))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     if (!isRenderView()) {
</span><span class="cx">         // Check if we need to do anything at all.
</span><span class="lines">@@ -2521,7 +2522,7 @@
</span><span class="cx">     // If we have clipping, then we can't have any spillout.
</span><span class="cx">     bool useOverflowClip = hasOverflowClip() &amp;&amp; !hasSelfPaintingLayer();
</span><span class="cx">     bool useClip = (hasControlClip() || useOverflowClip);
</span><del>-    bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.intersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region(), IncludeOverlayScrollbarSize)));
</del><ins>+    bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.intersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(overflowClipRect(adjustedLocation, namedFlowFragment, IncludeOverlayScrollbarSize)));
</ins><span class="cx">     if (checkChildren) {
</span><span class="cx">         // Hit test descendants first.
</span><span class="cx">         LayoutSize scrolledOffset(localOffset - scrolledContentOffset());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -1136,14 +1136,12 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RenderRegion* regionToUse = locationInContainer.region();
-    if (regionToUse) {
-        RenderFlowThread* flowThread = regionToUse-&gt;flowThread();
</del><ins>+    RenderFlowThread* flowThread = flowThreadContainingBlock();
+    RenderRegion* regionToUse = flowThread ? toRenderNamedFlowFragment(flowThread-&gt;currentRegion()) : nullptr;
</ins><span class="cx"> 
</span><del>-        // If the box is not contained by this region there's no point in going further.
-        if (!flowThread-&gt;objectShouldFragmentInFlowRegion(this, regionToUse))
-            return false;
-    }
</del><ins>+    // If the box is not contained by this region there's no point in going further.
+    if (regionToUse &amp;&amp; !flowThread-&gt;objectShouldFragmentInFlowRegion(this, regionToUse))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     // Check our bounds next. For this purpose always assume that we can only be hit in the
</span><span class="cx">     // foreground phase (which is true for replaced elements like images).
</span><span class="lines">@@ -1213,7 +1211,7 @@
</span><span class="cx">     if (!paintInfo.shouldPaintWithinRoot(*this))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderNamedFlowFragment);
</del><ins>+    LayoutRect paintRect = borderBoxRectInRegion(currentRenderNamedFlowFragment());
</ins><span class="cx">     paintRect.moveBy(paintOffset);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -1685,7 +1683,7 @@
</span><span class="cx">         paintObject(paintInfo, accumulatedOffset);
</span><span class="cx">         paintInfo.phase = PaintPhaseChildBlockBackgrounds;
</span><span class="cx">     }
</span><del>-    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderNamedFlowFragment, IgnoreOverlayScrollbarSize, paintInfo.phase));
</del><ins>+    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, currentRenderNamedFlowFragment(), IgnoreOverlayScrollbarSize, paintInfo.phase));
</ins><span class="cx">     paintInfo.context-&gt;save();
</span><span class="cx">     if (style().hasBorderRadius())
</span><span class="cx">         paintInfo.context-&gt;clipRoundedRect(FloatRoundedRect(style().getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size()))));
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -594,14 +594,14 @@
</span><span class="cx">         context-&gt;setLegacyShadow(shadowOffset, boxShadow-&gt;radius(), boxShadow-&gt;color(), style-&gt;colorSpace());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect&amp; maskRect, InlineFlowBox* box, const LayoutRect&amp; scrolledPaintRect, RenderNamedFlowFragment* namedFlowFragment)
</del><ins>+void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect&amp; maskRect, InlineFlowBox* box, const LayoutRect&amp; scrolledPaintRect)
</ins><span class="cx"> {
</span><span class="cx">     GraphicsContext* maskImageContext = maskImage-&gt;context();
</span><span class="cx">     maskImageContext-&gt;translate(-maskRect.x(), -maskRect.y());
</span><span class="cx"> 
</span><span class="cx">     // Now add the text to the clip. We do this by painting using a special paint phase that signals to
</span><span class="cx">     // InlineTextBoxes that they should just add their contents to the clip.
</span><del>-    PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, namedFlowFragment);
</del><ins>+    PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0);
</ins><span class="cx">     if (box) {
</span><span class="cx">         const RootInlineBox&amp; rootBox = box-&gt;root();
</span><span class="cx">         box-&gt;paint(info, LayoutPoint(scrolledPaintRect.x() - box-&gt;x(), scrolledPaintRect.y() - box-&gt;y()), rootBox.lineTop(), rootBox.lineBottom());
</span><span class="lines">@@ -715,7 +715,7 @@
</span><span class="cx">     if (clippedWithLocalScrolling) {
</span><span class="cx">         // Clip to the overflow area.
</span><span class="cx">         RenderBox* thisBox = toRenderBox(this);
</span><del>-        context-&gt;clip(thisBox-&gt;overflowClipRect(rect.location(), paintInfo.renderNamedFlowFragment));
</del><ins>+        context-&gt;clip(thisBox-&gt;overflowClipRect(rect.location(), currentRenderNamedFlowFragment()));
</ins><span class="cx">         
</span><span class="cx">         // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
</span><span class="cx">         IntSize offset = thisBox-&gt;scrolledContentOffset();
</span><span class="lines">@@ -750,7 +750,7 @@
</span><span class="cx">         maskImage = context-&gt;createCompatibleBuffer(maskRect.size());
</span><span class="cx">         if (!maskImage)
</span><span class="cx">             return;
</span><del>-        paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect, paintInfo.renderNamedFlowFragment);
</del><ins>+        paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect);
</ins><span class="cx"> 
</span><span class="cx">         // The mask has been created.  Now we just need to clip to it.
</span><span class="cx">         backgroundClipStateSaver.save();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx">     void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&amp;, const Path&amp;, const BorderEdge[],
</span><span class="cx">         float thickness, float drawThickness, BoxSide, const RenderStyle&amp;,
</span><span class="cx">         Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
</span><del>-    void paintMaskForTextFillBox(ImageBuffer*, const IntRect&amp;, InlineFlowBox*, const LayoutRect&amp;, RenderNamedFlowFragment*);
</del><ins>+    void paintMaskForTextFillBox(ImageBuffer*, const IntRect&amp;, InlineFlowBox*, const LayoutRect&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry&amp;) const;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -3533,11 +3533,11 @@
</span><span class="cx">     return ScrollableArea::scroll(direction, granularity, multiplier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::paint(GraphicsContext* context, const LayoutRect&amp; damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, RenderNamedFlowFragment* namedFlowFragment, PaintLayerFlags paintFlags)
</del><ins>+void RenderLayer::paint(GraphicsContext* context, const LayoutRect&amp; damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags)
</ins><span class="cx"> {
</span><span class="cx">     OverlapTestRequestMap overlapTestRequests;
</span><span class="cx"> 
</span><del>-    LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, namedFlowFragment, &amp;overlapTestRequests);
</del><ins>+    LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, &amp;overlapTestRequests);
</ins><span class="cx">     paintLayer(context, paintingInfo, paintFlags);
</span><span class="cx"> 
</span><span class="cx">     OverlapTestRequestMap::iterator end = overlapTestRequests.end();
</span><span class="lines">@@ -3681,17 +3681,16 @@
</span><span class="cx">     // Don't paint the layer if the renderer doesn't belong to this region.
</span><span class="cx">     // This is true as long as we clamp the range of a box to its containing block range.
</span><span class="cx"> 
</span><del>-    // FIXME: Hack to disable region information for in flow threads. Implement this logic in a different way.
-    LayerPaintingInfo&amp; info = const_cast&lt;LayerPaintingInfo&amp;&gt;(paintingInfo);
-    RenderNamedFlowFragment* namedFlowFragment = info.renderNamedFlowFragment;
</del><ins>+    // Disable named flow region information for in flow threads such as multi-col.
+    std::unique_ptr&lt;CurrentRenderFlowThreadDisabler&gt; flowThreadDisabler;
+    if (enclosingPaginationLayer())
+        flowThreadDisabler = std::make_unique&lt;CurrentRenderFlowThreadDisabler&gt;(&amp;renderer().view());
+
+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</ins><span class="cx">     if (namedFlowFragment) {
</span><del>-        if (enclosingPaginationLayer())
-            info.renderNamedFlowFragment = nullptr;
-        else {
-            ASSERT(namedFlowFragment-&gt;isValid());
-            if (!namedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(&amp;renderer(), namedFlowFragment))
-                return;
-        }
</del><ins>+        ASSERT(namedFlowFragment-&gt;isValid());
+        if (!namedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(&amp;renderer(), namedFlowFragment))
+            return;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (paintsWithTransparency(paintingInfo.paintBehavior))
</span><span class="lines">@@ -3701,10 +3700,8 @@
</span><span class="cx">     if (paintsWithTransform(paintingInfo.paintBehavior) &amp;&amp; !(paintFlags &amp; PaintLayerAppliedTransform)) {
</span><span class="cx">         TransformationMatrix layerTransform = renderableTransform(paintingInfo.paintBehavior);
</span><span class="cx">         // If the transform can't be inverted, then don't paint anything.
</span><del>-        if (!layerTransform.isInvertible()) {
-            info.renderNamedFlowFragment = namedFlowFragment;
</del><ins>+        if (!layerTransform.isInvertible())
</ins><span class="cx">             return;
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency
</span><span class="cx">         // layer from the parent now, assuming there is a parent
</span><span class="lines">@@ -3717,14 +3714,13 @@
</span><span class="cx"> 
</span><span class="cx">         if (enclosingPaginationLayer()) {
</span><span class="cx">             paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags);
</span><del>-            info.renderNamedFlowFragment = namedFlowFragment;
</del><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Make sure the parent's clip rects have been calculated.
</span><span class="cx">         ClipRect clipRect = paintingInfo.paintDirtyRect;
</span><span class="cx">         if (parent()) {
</span><del>-            ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, (paintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
</del><ins>+            ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
</ins><span class="cx">                 IgnoreOverlayScrollbarSize, (paintFlags &amp; PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
</span><span class="cx">             clipRect = backgroundClipRect(clipRectsContext);
</span><span class="cx">             clipRect.intersect(paintingInfo.paintDirtyRect);
</span><span class="lines">@@ -3739,12 +3735,10 @@
</span><span class="cx">         if (parent())
</span><span class="cx">             parent()-&gt;restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
</span><span class="cx"> 
</span><del>-        info.renderNamedFlowFragment = namedFlowFragment;
</del><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
</span><del>-    info.renderNamedFlowFragment = namedFlowFragment;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::paintLayerContentsAndReflection(GraphicsContext* context, const LayerPaintingInfo&amp; paintingInfo, PaintLayerFlags paintFlags)
</span><span class="lines">@@ -4058,7 +4052,7 @@
</span><span class="cx">             localPaintingInfo.clipToDirtyRect = true;
</span><span class="cx">             paintDirtyRect = selfClipRect();
</span><span class="cx">         }
</span><del>-        collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.renderNamedFlowFragment, paintDirtyRect,
</del><ins>+        collectFragments(layerFragments, localPaintingInfo.rootLayer, paintDirtyRect,
</ins><span class="cx">             (localPaintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
</span><span class="cx">             (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &amp;offsetFromRoot);
</span><span class="cx">         updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localPaintFlags, shouldPaintContent, &amp;offsetFromRoot);
</span><span class="lines">@@ -4155,7 +4149,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Now do a paint with the root layer shifted to be us.
</span><span class="cx">     LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(enclosingRectForPainting(transform.inverse().mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)), paintingInfo.paintBehavior,
</span><del>-        adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.renderNamedFlowFragment, paintingInfo.overlapTestRequests);
</del><ins>+        adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);
</ins><span class="cx">     paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4202,7 +4196,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::collectFragments(LayerFragments&amp; fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect&amp; dirtyRect,
</del><ins>+void RenderLayer::collectFragments(LayerFragments&amp; fragments, const RenderLayer* rootLayer, const LayoutRect&amp; dirtyRect,
</ins><span class="cx">     ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
</span><span class="cx">     const LayoutRect* layerBoundingBox, ShouldApplyRootOffsetToFragments applyRootOffsetToFragments)
</span><span class="cx"> {
</span><span class="lines">@@ -4210,7 +4204,7 @@
</span><span class="cx">     if (!paginationLayer || hasTransform()) {
</span><span class="cx">         // For unpaginated layers, there is only one fragment.
</span><span class="cx">         LayerFragment fragment;
</span><del>-        ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</del><ins>+        ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</ins><span class="cx">         calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot);
</span><span class="cx">         fragments.append(fragment);
</span><span class="cx">         return;
</span><span class="lines">@@ -4222,7 +4216,7 @@
</span><span class="cx">     
</span><span class="cx">     // Calculate clip rects relative to the enclosingPaginationLayer. The purpose of this call is to determine our bounds clipped to intermediate
</span><span class="cx">     // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
</span><del>-    ClipRectsContext paginationClipRectsContext(paginationLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</del><ins>+    ClipRectsContext paginationClipRectsContext(paginationLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</ins><span class="cx">     LayoutRect layerBoundsInFlowThread;
</span><span class="cx">     ClipRect backgroundRectInFlowThread;
</span><span class="cx">     ClipRect foregroundRectInFlowThread;
</span><span class="lines">@@ -4247,7 +4241,7 @@
</span><span class="cx">         layerFragmentBoundingBoxInParentPaginationLayer.moveBy(offsetWithinParentPaginatedLayer);
</span><span class="cx">         
</span><span class="cx">         // Now collect ancestor fragments.
</span><del>-        parentPaginationLayer-&gt;collectFragments(ancestorFragments, rootLayer, region, dirtyRect, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, nullptr, &amp;layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
</del><ins>+        parentPaginationLayer-&gt;collectFragments(ancestorFragments, rootLayer, dirtyRect, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, nullptr, &amp;layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
</ins><span class="cx">         
</span><span class="cx">         if (ancestorFragments.isEmpty())
</span><span class="cx">             return;
</span><span class="lines">@@ -4309,7 +4303,7 @@
</span><span class="cx">     // Get the parent clip rects of the pagination layer, since we need to intersect with that when painting column contents.
</span><span class="cx">     ClipRect ancestorClipRect = dirtyRect;
</span><span class="cx">     if (paginationLayer-&gt;parent()) {
</span><del>-        ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</del><ins>+        ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
</ins><span class="cx">         ancestorClipRect = paginationLayer-&gt;backgroundClipRect(clipRectsContext);
</span><span class="cx">         ancestorClipRect.intersect(dirtyRect);
</span><span class="cx">     }
</span><span class="lines">@@ -4345,7 +4339,7 @@
</span><span class="cx">         fragment.shouldPaintContent = shouldPaintContent;
</span><span class="cx">         if (this != localPaintingInfo.rootLayer || !(localPaintFlags &amp; PaintLayerPaintingOverflowContents)) {
</span><span class="cx">             LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginationOffset;
</span><del>-            fragment.shouldPaintContent &amp;= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &amp;newOffsetFromRoot, localPaintingInfo.renderNamedFlowFragment, fragment.hasBoundingBox ? &amp;fragment.boundingBox : 0);
</del><ins>+            fragment.shouldPaintContent &amp;= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &amp;newOffsetFromRoot, fragment.hasBoundingBox ? &amp;fragment.boundingBox : 0);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -4355,7 +4349,7 @@
</span><span class="cx">     LayerFragments enclosingPaginationFragments;
</span><span class="cx">     LayoutPoint offsetOfPaginationLayerFromRoot;
</span><span class="cx">     LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.paintBehavior);
</span><del>-    enclosingPaginationLayer()-&gt;collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, paintingInfo.paintDirtyRect,
</del><ins>+    enclosingPaginationLayer()-&gt;collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect,
</ins><span class="cx">         (paintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
</span><span class="cx">         (paintFlags &amp; PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &amp;offsetOfPaginationLayerFromRoot, &amp;transformedExtent);
</span><span class="cx">     
</span><span class="lines">@@ -4370,7 +4364,7 @@
</span><span class="cx">         if (parent() != enclosingPaginationLayer()) {
</span><span class="cx">             enclosingPaginationLayer()-&gt;convertToLayerCoords(paintingInfo.rootLayer, offsetOfPaginationLayerFromRoot);
</span><span class="cx">     
</span><del>-            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), paintingInfo.renderNamedFlowFragment, (paintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
</del><ins>+            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), (paintFlags &amp; PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
</ins><span class="cx">                 IgnoreOverlayScrollbarSize, (paintFlags &amp; PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
</span><span class="cx">             LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rect();
</span><span class="cx">             parentClipRect.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot);
</span><span class="lines">@@ -4404,7 +4398,7 @@
</span><span class="cx">         
</span><span class="cx">         // Paint the background.
</span><span class="cx">         // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
</span><del>-        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</del><ins>+        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</ins><span class="cx">         renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
</span><span class="cx"> 
</span><span class="cx">         if (localPaintingInfo.clipToDirtyRect)
</span><span class="lines">@@ -4477,7 +4471,7 @@
</span><span class="cx">         if (shouldClip)
</span><span class="cx">             clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
</span><span class="cx">     
</span><del>-        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</del><ins>+        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</ins><span class="cx">         if (phase == PaintPhaseForeground)
</span><span class="cx">             paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
</span><span class="cx">         renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
</span><span class="lines">@@ -4496,7 +4490,7 @@
</span><span class="cx">             continue;
</span><span class="cx">     
</span><span class="cx">         // Paint our own outline
</span><del>-        PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</del><ins>+        PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</ins><span class="cx">         clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
</span><span class="cx">         renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
</span><span class="cx">         restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineRect);
</span><span class="lines">@@ -4516,7 +4510,7 @@
</span><span class="cx">         
</span><span class="cx">         // Paint the mask.
</span><span class="cx">         // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
</span><del>-        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</del><ins>+        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &amp;localPaintingInfo.rootLayer-&gt;renderer());
</ins><span class="cx">         renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
</span><span class="cx">         
</span><span class="cx">         if (localPaintingInfo.clipToDirtyRect)
</span><span class="lines">@@ -4550,7 +4544,7 @@
</span><span class="cx">     if (!request.ignoreClipping())
</span><span class="cx">         hitTestArea.intersect(renderer().view().frameView().visibleContentRect(LegacyIOSDocumentVisibleRect));
</span><span class="cx"> 
</span><del>-    RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hitTestLocation, false);
</del><ins>+    RenderLayer* insideLayer = hitTestLayer(this, nullptr, request, result, hitTestArea, hitTestLocation, false);
</ins><span class="cx">     if (!insideLayer) {
</span><span class="cx">         // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down, 
</span><span class="cx">         // return ourselves. We do this so mouse events continue getting delivered after a drag has 
</span><span class="lines">@@ -4699,7 +4693,7 @@
</span><span class="cx">         RenderLayer* fixedLayer = fixedLayers.at(i);
</span><span class="cx"> 
</span><span class="cx">         HitTestResult tempResult(result.hitTestLocation());
</span><del>-        RenderLayer* hitLayer = fixedLayer-&gt;hitTestLayer(fixedLayer-&gt;renderer().flowThreadContainingBlock()-&gt;layer(), 0, request, tempResult,
</del><ins>+        RenderLayer* hitLayer = fixedLayer-&gt;hitTestLayer(fixedLayer-&gt;renderer().flowThreadContainingBlock()-&gt;layer(), nullptr, request, tempResult,
</ins><span class="cx">             hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);
</span><span class="cx"> 
</span><span class="cx">         // If it a rect-based test, we can safely append the temporary result since it might had hit
</span><span class="lines">@@ -4734,17 +4728,19 @@
</span><span class="cx">     if (!isSelfPaintingLayer() &amp;&amp; !hasSelfPaintingLayerDescendant())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
+
</ins><span class="cx">     // Prevent hitting the fixed layers inside the flow thread when hitting through regions.
</span><del>-    if (renderer().fixedPositionedWithNamedFlowContainingBlock() &amp;&amp; hitTestLocation.region())
</del><ins>+    if (renderer().fixedPositionedWithNamedFlowContainingBlock() &amp;&amp; namedFlowFragment)
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     // Don't hit-test the layer if the renderer doesn't belong to this region.
</span><span class="cx">     // This is true as long as we clamp the range of a box to its containing block range.
</span><span class="cx">     // FIXME: Fix hit testing with in-flow threads included in out-of-flow threads.
</span><del>-    if (hitTestLocation.region()) {
-        ASSERT(hitTestLocation.region()-&gt;isValid());
-        RenderFlowThread* flowThread = hitTestLocation.region()-&gt;flowThread();
-        if (!flowThread-&gt;objectShouldFragmentInFlowRegion(&amp;renderer(), hitTestLocation.region()))
</del><ins>+    if (namedFlowFragment) {
+        ASSERT(namedFlowFragment-&gt;isValid());
+        RenderFlowThread* flowThread = namedFlowFragment-&gt;flowThread();
+        if (!flowThread-&gt;objectShouldFragmentInFlowRegion(&amp;renderer(), namedFlowFragment))
</ins><span class="cx">             return 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -4757,7 +4753,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Make sure the parent's clip rects have been calculated.
</span><span class="cx">         if (parent()) {
</span><del>-            ClipRectsContext clipRectsContext(rootLayer, hitTestLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
</del><ins>+            ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize);
</ins><span class="cx">             ClipRect clipRect = backgroundClipRect(clipRectsContext);
</span><span class="cx">             // Go ahead and test the enclosing clip now.
</span><span class="cx">             if (!clipRect.intersects(hitTestLocation))
</span><span class="lines">@@ -4847,7 +4843,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Collect the fragments. This will compute the clip rectangles for each layer fragment.
</span><span class="cx">     LayerFragments layerFragments;
</span><del>-    collectFragments(layerFragments, rootLayer, hitTestLocation.region(), hitTestRect, RootRelativeClipRects, IncludeOverlayScrollbarSize);
</del><ins>+    collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRects, IncludeOverlayScrollbarSize);
</ins><span class="cx"> 
</span><span class="cx">     if (canResize() &amp;&amp; hitTestResizerInFragments(layerFragments, hitTestLocation)) {
</span><span class="cx">         renderer().updateHitTestResult(result, hitTestLocation.point());
</span><span class="lines">@@ -4952,7 +4948,7 @@
</span><span class="cx">     LayerFragments enclosingPaginationFragments;
</span><span class="cx">     LayoutPoint offsetOfPaginationLayerFromRoot;
</span><span class="cx">     LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
</span><del>-    enclosingPaginationLayer()-&gt;collectFragments(enclosingPaginationFragments, rootLayer, hitTestLocation.region(), hitTestRect,
</del><ins>+    enclosingPaginationLayer()-&gt;collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect,
</ins><span class="cx">         RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &amp;offsetOfPaginationLayerFromRoot, &amp;transformedExtent);
</span><span class="cx"> 
</span><span class="cx">     for (int i = enclosingPaginationFragments.size() - 1; i &gt;= 0; --i) {
</span><span class="lines">@@ -4966,7 +4962,7 @@
</span><span class="cx">         if (parent() != enclosingPaginationLayer()) {
</span><span class="cx">             enclosingPaginationLayer()-&gt;convertToLayerCoords(rootLayer, offsetOfPaginationLayerFromRoot);
</span><span class="cx">     
</span><del>-            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), hitTestLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
</del><ins>+            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
</ins><span class="cx">             LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rect();
</span><span class="cx">             parentClipRect.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot);
</span><span class="cx">             clipRect.intersect(parentClipRect);
</span><span class="lines">@@ -5129,11 +5125,16 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment* namedFlowFragment, ClipRects&amp; clipRects) const
</del><ins>+bool RenderLayer::mapLayerClipRectsToFragmentationLayer(ClipRects&amp; clipRects) const
</ins><span class="cx"> {
</span><del>-    ASSERT(namedFlowFragment &amp;&amp; namedFlowFragment-&gt;parent() &amp;&amp; namedFlowFragment-&gt;parent()-&gt;isRenderNamedFlowFragmentContainer());
</del><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
+    if (!namedFlowFragment)
+        return false;
+
+    ASSERT(namedFlowFragment-&gt;parent() &amp;&amp; namedFlowFragment-&gt;parent()-&gt;isRenderNamedFlowFragmentContainer());
</ins><span class="cx">     
</span><del>-    ClipRectsContext targetClipRectsContext(&amp;namedFlowFragment-&gt;fragmentContainerLayer(), 0, TemporaryClipRects);
</del><ins>+    CurrentRenderFlowThreadDisabler flowThreadDisabler(&amp;renderer().view());
+    ClipRectsContext targetClipRectsContext(&amp;namedFlowFragment-&gt;fragmentContainerLayer(), TemporaryClipRects);
</ins><span class="cx">     namedFlowFragment-&gt;fragmentContainerLayer().calculateClipRects(targetClipRectsContext, clipRects);
</span><span class="cx"> 
</span><span class="cx">     LayoutRect flowThreadPortionRect = namedFlowFragment-&gt;flowThreadPortionRect();
</span><span class="lines">@@ -5153,6 +5154,8 @@
</span><span class="cx">     ClipRect newPosClipRect = clipRects.posClipRect();
</span><span class="cx">     newPosClipRect.move(moveOffset);
</span><span class="cx">     clipRects.setPosClipRect(newPosClipRect);
</span><ins>+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::calculateClipRects(const ClipRectsContext&amp; clipRectsContext, ClipRects&amp; clipRects) const
</span><span class="lines">@@ -5166,10 +5169,8 @@
</span><span class="cx">     ClipRectsType clipRectsType = clipRectsContext.clipRectsType;
</span><span class="cx">     bool useCached = clipRectsType != TemporaryClipRects;
</span><span class="cx"> 
</span><del>-    if (renderer().isRenderNamedFlowThread() &amp;&amp; clipRectsContext.region) {
-        mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
</del><ins>+    if (renderer().isRenderNamedFlowThread() &amp;&amp; mapLayerClipRectsToFragmentationLayer(clipRects))
</ins><span class="cx">         return;
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     // For transformed layers, the root layer was shifted to be us, so there is no need to
</span><span class="cx">     // examine the parent. We want to cache clip rects with us as the root.
</span><span class="lines">@@ -5215,7 +5216,7 @@
</span><span class="cx">             offset -= renderer().view().frameView().scrollOffsetForFixedPosition();
</span><span class="cx">         
</span><span class="cx">         if (renderer().hasOverflowClip()) {
</span><del>-            ClipRect newOverflowClip = toRenderBox(renderer()).overflowClipRectForChildLayers(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy);
</del><ins>+            ClipRect newOverflowClip = toRenderBox(renderer()).overflowClipRectForChildLayers(offset, currentRenderNamedFlowFragment(), clipRectsContext.overlayScrollbarSizeRelevancy);
</ins><span class="cx">             if (renderer().style().hasBorderRadius())
</span><span class="cx">                 newOverflowClip.setHasRadius(true);
</span><span class="cx">             clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
</span><span class="lines">@@ -5223,7 +5224,7 @@
</span><span class="cx">                 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
</span><span class="cx">         }
</span><span class="cx">         if (renderer().hasClip()) {
</span><del>-            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, clipRectsContext.region);
</del><ins>+            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, currentRenderNamedFlowFragment());
</ins><span class="cx">             clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
</span><span class="cx">             clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
</span><span class="cx">             clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
</span><span class="lines">@@ -5234,10 +5235,8 @@
</span><span class="cx"> void RenderLayer::parentClipRects(const ClipRectsContext&amp; clipRectsContext, ClipRects&amp; clipRects) const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(parent());
</span><del>-    if (renderer().isRenderNamedFlowThread() &amp;&amp; clipRectsContext.region) {
-        mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
</del><ins>+    if (renderer().isRenderNamedFlowThread() &amp;&amp; mapLayerClipRectsToFragmentationLayer(clipRects))
</ins><span class="cx">         return;
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     if (clipRectsContext.clipRectsType == TemporaryClipRects) {
</span><span class="cx">         parent()-&gt;calculateClipRects(clipRectsContext, clipRects);
</span><span class="lines">@@ -5299,9 +5298,11 @@
</span><span class="cx">     else
</span><span class="cx">         convertToLayerCoords(clipRectsContext.rootLayer, offset);
</span><span class="cx"> 
</span><ins>+
+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</ins><span class="cx">     // If the view is scrolled, the flow thread is not scrolled with it and we should
</span><span class="cx">     // take the scroll offset into account.
</span><del>-    if (clipRectsContext.rootLayer-&gt;isOutOfFlowRenderFlowThread() &amp;&amp; !clipRectsContext.region) {
</del><ins>+    if (clipRectsContext.rootLayer-&gt;isOutOfFlowRenderFlowThread() &amp;&amp; !namedFlowFragment) {
</ins><span class="cx">         FloatPoint absPos = renderer().view().localToAbsolute(FloatPoint(), IsFixed);
</span><span class="cx">         offset += LayoutSize(absPos.x(), absPos.y());
</span><span class="cx">     }
</span><span class="lines">@@ -5311,11 +5312,11 @@
</span><span class="cx">     foregroundRect = backgroundRect;
</span><span class="cx">     outlineRect = backgroundRect;
</span><span class="cx"> 
</span><del>-    RenderFlowThread* flowThread = clipRectsContext.region ? clipRectsContext.region-&gt;flowThread() : 0;
</del><ins>+    RenderFlowThread* flowThread = namedFlowFragment ? namedFlowFragment-&gt;flowThread() : 0;
</ins><span class="cx">     if (isSelfPaintingLayer() &amp;&amp; flowThread &amp;&amp; !renderer().isInFlowRenderFlowThread()) {
</span><del>-        ASSERT(clipRectsContext.region-&gt;isValid());
</del><ins>+        ASSERT(namedFlowFragment-&gt;isValid());
</ins><span class="cx">         const RenderBoxModelObject&amp; boxModelObject = toRenderBoxModelObject(renderer());
</span><del>-        LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region-&gt;visualOverflowRectForBox(&amp;boxModelObject);
</del><ins>+        LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment-&gt;visualOverflowRectForBox(&amp;boxModelObject);
</ins><span class="cx"> 
</span><span class="cx">         // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.
</span><span class="cx">         if (&amp;boxModelObject == flowThread &amp;&amp; flowThread-&gt;style().isFlippedBlocksWritingMode()) {
</span><span class="lines">@@ -5334,10 +5335,10 @@
</span><span class="cx"> 
</span><span class="cx">         foregroundRect = backgroundRect;
</span><span class="cx">         outlineRect = backgroundRect;
</span><del>-        
</del><ins>+
</ins><span class="cx">         // If the region does not clip its overflow, inflate the outline rect.
</span><del>-        if (clipRectsContext.region-&gt;isRenderNamedFlowFragment()) {
-            if (!(clipRectsContext.region-&gt;parent()-&gt;hasOverflowClip() &amp;&amp; (&amp;toRenderNamedFlowFragment(clipRectsContext.region)-&gt;fragmentContainerLayer() != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)))
</del><ins>+        if (namedFlowFragment) {
+            if (!(namedFlowFragment-&gt;parent()-&gt;hasOverflowClip() &amp;&amp; (&amp;namedFlowFragment-&gt;fragmentContainerLayer() != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)))
</ins><span class="cx">                 outlineRect.inflate(renderer().maximalOutlineSize(PaintPhaseOutline));
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -5346,14 +5347,14 @@
</span><span class="cx">     if (renderer().hasClipOrOverflowClip()) {
</span><span class="cx">         // This layer establishes a clip of some kind.
</span><span class="cx">         if (renderer().hasOverflowClip() &amp;&amp; (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) {
</span><del>-            foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy));
</del><ins>+            foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(offset, namedFlowFragment, clipRectsContext.overlayScrollbarSizeRelevancy));
</ins><span class="cx">             if (renderer().style().hasBorderRadius())
</span><span class="cx">                 foregroundRect.setHasRadius(true);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (renderer().hasClip()) {
</span><span class="cx">             // Clip applies to *us* as well, so go ahead and update the damageRect.
</span><del>-            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, clipRectsContext.region);
</del><ins>+            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, namedFlowFragment);
</ins><span class="cx">             backgroundRect.intersect(newPosClip);
</span><span class="cx">             foregroundRect.intersect(newPosClip);
</span><span class="cx">             outlineRect.intersect(newPosClip);
</span><span class="lines">@@ -5365,16 +5366,16 @@
</span><span class="cx">         if (renderBox()-&gt;hasVisualOverflow()) {
</span><span class="cx">             // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
</span><span class="cx">             // individual region boxes as overflow.
</span><del>-            LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region ? clipRectsContext.region-&gt;visualOverflowRectForBox(renderBox()) : renderBox()-&gt;visualOverflowRect();
</del><ins>+            LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment ? namedFlowFragment-&gt;visualOverflowRectForBox(renderBox()) : renderBox()-&gt;visualOverflowRect();
</ins><span class="cx">             renderBox()-&gt;flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
</span><span class="cx">             layerBoundsWithVisualOverflow.moveBy(offset);
</span><span class="cx">             if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
</span><span class="cx">                 backgroundRect.intersect(layerBoundsWithVisualOverflow);
</span><span class="cx">         } else {
</span><span class="cx">             // Shift the bounds to be for our region only.
</span><del>-            LayoutRect bounds = renderBox()-&gt;borderBoxRectInRegion(clipRectsContext.region);
-            if (clipRectsContext.region)
-                bounds = clipRectsContext.region-&gt;rectFlowPortionForBox(renderBox(), bounds);
</del><ins>+            LayoutRect bounds = renderBox()-&gt;borderBoxRectInRegion(namedFlowFragment);
+            if (namedFlowFragment)
+                bounds = namedFlowFragment-&gt;rectFlowPortionForBox(renderBox(), bounds);
</ins><span class="cx"> 
</span><span class="cx">             bounds.moveBy(offset);
</span><span class="cx">             if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
</span><span class="lines">@@ -5402,7 +5403,7 @@
</span><span class="cx">     RenderLayer* clippingRootLayer = clippingRootForPainting();
</span><span class="cx">     LayoutRect layerBounds;
</span><span class="cx">     ClipRect backgroundRect, foregroundRect, outlineRect;
</span><del>-    ClipRectsContext clipRectsContext(clippingRootLayer, 0, TemporaryClipRects);
</del><ins>+    ClipRectsContext clipRectsContext(clippingRootLayer, TemporaryClipRects);
</ins><span class="cx">     // Need to use temporary clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (&lt;rdar://problem/11844909&gt;).
</span><span class="cx">     calculateRects(clipRectsContext, renderer().view().unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
</span><span class="cx">     return clippingRootLayer-&gt;renderer().localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox();
</span><span class="lines">@@ -5415,7 +5416,7 @@
</span><span class="cx">     RenderLayer* clippingRootLayer = clippingRootForPainting();
</span><span class="cx">     LayoutRect layerBounds;
</span><span class="cx">     ClipRect backgroundRect, foregroundRect, outlineRect;
</span><del>-    ClipRectsContext clipRectsContext(clippingRootLayer, 0, PaintingClipRects);
</del><ins>+    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
</ins><span class="cx">     calculateRects(clipRectsContext, renderer().view().documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
</span><span class="cx">     return clippingRootLayer-&gt;renderer().localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox();
</span><span class="cx"> }
</span><span class="lines">@@ -5433,7 +5434,7 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutRect layerBounds;
</span><span class="cx">     ClipRect backgroundRect, foregroundRect, outlineRect;
</span><del>-    ClipRectsContext clipRectsContext(clippingRootLayer, 0, PaintingClipRects);
</del><ins>+    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
</ins><span class="cx">     calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, &amp;offsetFromRoot);
</span><span class="cx"> 
</span><span class="cx">     LayoutRect clipRect = backgroundRect.rect();
</span><span class="lines">@@ -5442,7 +5443,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (renderer().hasClip()) {
</span><span class="cx">         // CSS clip may be larger than our border box.
</span><del>-        LayoutRect cssClipRect = toRenderBox(renderer()).clipRect(offsetFromRoot, clipRectsContext.region);
</del><ins>+        LayoutRect cssClipRect = toRenderBox(renderer()).clipRect(offsetFromRoot, currentRenderNamedFlowFragment());
</ins><span class="cx">         clipExceedsBounds = !clipRect.contains(cssClipRect);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -5476,14 +5477,14 @@
</span><span class="cx">     LayoutRect rect = m_blockSelectionGapsBounds;
</span><span class="cx">     rect.move(-scrolledContentOffset());
</span><span class="cx">     if (renderer().hasOverflowClip() &amp;&amp; !usesCompositedScrolling())
</span><del>-        rect.intersect(toRenderBox(renderer()).overflowClipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
</del><ins>+        rect.intersect(toRenderBox(renderer()).overflowClipRect(LayoutPoint(), nullptr)); // FIXME: Regions not accounted for.
</ins><span class="cx">     if (renderer().hasClip())
</span><del>-        rect.intersect(toRenderBox(renderer()).clipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
</del><ins>+        rect.intersect(toRenderBox(renderer()).clipRect(LayoutPoint(), nullptr)); // FIXME: Regions not accounted for.
</ins><span class="cx">     if (!rect.isEmpty())
</span><span class="cx">         renderer().repaintRectangle(rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderLayer::intersectsDamageRect(const LayoutRect&amp; layerBounds, const LayoutRect&amp; damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot, RenderRegion* region, const LayoutRect* cachedBoundingBox) const
</del><ins>+bool RenderLayer::intersectsDamageRect(const LayoutRect&amp; layerBounds, const LayoutRect&amp; damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot, const LayoutRect* cachedBoundingBox) const
</ins><span class="cx"> {
</span><span class="cx">     // Always examine the canvas and the root.
</span><span class="cx">     // FIXME: Could eliminate the isRoot() check if we fix background painting so that the RenderView
</span><span class="lines">@@ -5500,13 +5501,14 @@
</span><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</ins><span class="cx">     // When using regions, some boxes might have their frame rect relative to the flow thread, which could
</span><span class="cx">     // cause the paint rejection algorithm to prevent them from painting when using different width regions.
</span><span class="cx">     // e.g. an absolutely positioned box with bottom:0px and right:0px would have it's frameRect.x relative
</span><span class="cx">     // to the flow thread, not the last region (in which it will end up because of bottom:0px)
</span><del>-    if (region &amp;&amp; renderer().flowThreadContainingBlock()) {
</del><ins>+    if (namedFlowFragment &amp;&amp; renderer().flowThreadContainingBlock()) {
</ins><span class="cx">         LayoutRect b = layerBounds;
</span><del>-        b.moveBy(region-&gt;visualOverflowRectForBox(toRenderBoxModelObject(&amp;renderer())).location());
</del><ins>+        b.moveBy(namedFlowFragment-&gt;visualOverflowRectForBox(toRenderBoxModelObject(&amp;renderer())).location());
</ins><span class="cx">         b.inflate(renderer().view().maximalOutlineSize());
</span><span class="cx">         if (b.intersects(damageRect))
</span><span class="cx">             return true;
</span><span class="lines">@@ -5670,7 +5672,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (RenderLayer* reflection = reflectionLayer()) {
</span><span class="cx">         if (!reflection-&gt;isComposited()) {
</span><del>-            LayoutRect childUnionBounds = reflection-&gt;calculateLayerBounds(this, 0, descendantFlags);
</del><ins>+            LayoutRect childUnionBounds = reflection-&gt;calculateLayerBounds(this, nullptr, descendantFlags);
</ins><span class="cx">             unionBounds.unite(childUnionBounds);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -5686,7 +5688,7 @@
</span><span class="cx">         for (size_t i = 0; i &lt; listSize; ++i) {
</span><span class="cx">             RenderLayer* curLayer = negZOrderList-&gt;at(i);
</span><span class="cx">             if (flags &amp; IncludeCompositedDescendants || !curLayer-&gt;isComposited()) {
</span><del>-                LayoutRect childUnionBounds = curLayer-&gt;calculateLayerBounds(this, 0, descendantFlags);
</del><ins>+                LayoutRect childUnionBounds = curLayer-&gt;calculateLayerBounds(this, nullptr, descendantFlags);
</ins><span class="cx">                 unionBounds.unite(childUnionBounds);
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -5698,7 +5700,7 @@
</span><span class="cx">             RenderLayer* curLayer = posZOrderList-&gt;at(i);
</span><span class="cx">             // The RenderNamedFlowThread is ignored when we calculate the bounds of the RenderView.
</span><span class="cx">             if ((flags &amp; IncludeCompositedDescendants || !curLayer-&gt;isComposited()) &amp;&amp; !curLayer-&gt;isFlowThreadCollectingGraphicsLayersUnderRegions()) {
</span><del>-                LayoutRect childUnionBounds = curLayer-&gt;calculateLayerBounds(this, 0, descendantFlags);
</del><ins>+                LayoutRect childUnionBounds = curLayer-&gt;calculateLayerBounds(this, nullptr, descendantFlags);
</ins><span class="cx">                 unionBounds.unite(childUnionBounds);
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -5712,7 +5714,7 @@
</span><span class="cx">             // so there's no way we could hit a RenderNamedFlowThread here.
</span><span class="cx">             ASSERT(!curLayer-&gt;isFlowThreadCollectingGraphicsLayersUnderRegions());
</span><span class="cx">             if (flags &amp; IncludeCompositedDescendants || !curLayer-&gt;isComposited()) {
</span><del>-                LayoutRect curAbsBounds = curLayer-&gt;calculateLayerBounds(this, 0, descendantFlags);
</del><ins>+                LayoutRect curAbsBounds = curLayer-&gt;calculateLayerBounds(this, nullptr, descendantFlags);
</ins><span class="cx">                 unionBounds.unite(curAbsBounds);
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -6686,8 +6688,11 @@
</span><span class="cx">     context-&gt;save();
</span><span class="cx">     context-&gt;translate(adjustedPaintOffset.x(), adjustedPaintOffset.y());
</span><span class="cx"> 
</span><ins>+    CurrentRenderFlowThreadMaintainer flowThreadMaintainer(toRenderFlowThread(&amp;renderer()));
+    CurrentRenderRegionMaintainer regionMaintainer(*region);
+
</ins><span class="cx">     region-&gt;setRegionObjectsRegionStyle();
</span><del>-    paint(context, paintDirtyRect, paintBehavior, 0, region, paintFlags | PaintLayerTemporaryClipRects);
</del><ins>+    paint(context, paintDirtyRect, paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects);
</ins><span class="cx">     region-&gt;restoreRegionObjectsOriginalStyle();
</span><span class="cx"> 
</span><span class="cx">     context-&gt;restore();
</span><span class="lines">@@ -6782,13 +6787,16 @@
</span><span class="cx">         HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
</span><span class="cx"> 
</span><span class="cx">         // Make a new temporary HitTestLocation in the new region.
</span><del>-        HitTestLocation newHitTestLocation(hitTestLocation, hitTestOffset, region);
</del><ins>+        HitTestLocation newHitTestLocation(hitTestLocation, hitTestOffset);
</ins><span class="cx"> 
</span><span class="cx">         // Expand the hit-test rect to the flow thread's coordinate system.
</span><span class="cx">         LayoutRect hitTestRectInFlowThread = hitTestRect;
</span><span class="cx">         hitTestRectInFlowThread.move(hitTestOffset.width(), hitTestOffset.height());
</span><span class="cx">         hitTestRectInFlowThread.expand(LayoutSize(fabs((double)hitTestOffset.width()), fabs((double)hitTestOffset.height())));
</span><span class="cx"> 
</span><ins>+        CurrentRenderFlowThreadMaintainer flowThreadMaintainer(flowThread);
+        CurrentRenderRegionMaintainer regionMaintainer(*region);
+
</ins><span class="cx">         HitTestResult tempResult(result.hitTestLocation());
</span><span class="cx">         RenderLayer* hitLayer = flowThread-&gt;layer()-&gt;hitTestLayer(flowThread-&gt;layer(), 0, newRequest, tempResult, hitTestRectInFlowThread, newHitTestLocation, false, transformState, zOffsetForDescendants);
</span><span class="cx">         if (result.isRectBasedTest())
</span><span class="lines">@@ -6805,6 +6813,11 @@
</span><span class="cx">     return resultLayer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RenderNamedFlowFragment* RenderLayer::currentRenderNamedFlowFragment() const
+{
+    return renderer().currentRenderNamedFlowFragment();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -351,7 +351,7 @@
</span><span class="cx">     RenderLayer* firstChild() const { return m_first; }
</span><span class="cx">     RenderLayer* lastChild() const { return m_last; }
</span><span class="cx"> 
</span><del>-    void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0);
</del><ins>+    void addChild(RenderLayer* newChild, RenderLayer* beforeChild = nullptr);
</ins><span class="cx">     RenderLayer* removeChild(RenderLayer*);
</span><span class="cx"> 
</span><span class="cx">     void removeOnlyThisLayer();
</span><span class="lines">@@ -412,7 +412,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     // Scrolling methods for layers that can scroll their overflow.
</span><del>-    void scrollByRecursively(const IntSize&amp;, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollableArea** scrolledArea = 0);
</del><ins>+    void scrollByRecursively(const IntSize&amp;, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollableArea** scrolledArea = nullptr);
</ins><span class="cx">     void scrollToOffset(const IntSize&amp;, ScrollOffsetClamping = ScrollOffsetUnclamped);
</span><span class="cx">     void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); }
</span><span class="cx">     void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); }
</span><span class="lines">@@ -666,24 +666,21 @@
</span><span class="cx">     // paints the layers that intersect the damage rect from back to
</span><span class="cx">     // front.  The hitTest method looks for mouse events by walking
</span><span class="cx">     // layers that intersect the point from front to back.
</span><del>-    void paint(GraphicsContext*, const LayoutRect&amp; damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = 0,
-        RenderNamedFlowFragment* = 0, PaintLayerFlags = 0);
</del><ins>+    void paint(GraphicsContext*, const LayoutRect&amp; damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = nullptr, PaintLayerFlags = 0);
</ins><span class="cx">     bool hitTest(const HitTestRequest&amp;, HitTestResult&amp;);
</span><span class="cx">     bool hitTest(const HitTestRequest&amp;, const HitTestLocation&amp;, HitTestResult&amp;);
</span><del>-    void paintOverlayScrollbars(GraphicsContext*, const LayoutRect&amp; damageRect, PaintBehavior, RenderObject* subtreePaintRoot = 0);
</del><ins>+    void paintOverlayScrollbars(GraphicsContext*, const LayoutRect&amp; damageRect, PaintBehavior, RenderObject* subtreePaintRoot = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     void paintNamedFlowThreadInsideRegion(GraphicsContext*, RenderNamedFlowFragment*, LayoutRect, LayoutPoint, PaintBehavior = PaintBehaviorNormal, PaintLayerFlags = 0);
</span><span class="cx"> 
</span><span class="cx">     struct ClipRectsContext {
</span><del>-        ClipRectsContext(const RenderLayer* inRootLayer, RenderRegion* inRegion, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowClip)
</del><ins>+        ClipRectsContext(const RenderLayer* inRootLayer, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowClip)
</ins><span class="cx">             : rootLayer(inRootLayer)
</span><del>-            , region(inRegion)
</del><span class="cx">             , clipRectsType(inClipRectsType)
</span><span class="cx">             , overlayScrollbarSizeRelevancy(inOverlayScrollbarSizeRelevancy)
</span><span class="cx">             , respectOverflowClip(inRespectOverflowClip)
</span><span class="cx">         { }
</span><span class="cx">         const RenderLayer* rootLayer;
</span><del>-        RenderRegion* region;
</del><span class="cx">         ClipRectsType clipRectsType;
</span><span class="cx">         OverlayScrollbarSizeRelevancy overlayScrollbarSizeRelevancy;
</span><span class="cx">         ShouldRespectOverflowClip respectOverflowClip;
</span><span class="lines">@@ -694,7 +691,7 @@
</span><span class="cx">     // for painting/event handling.
</span><span class="cx">     // Pass offsetFromRoot if known.
</span><span class="cx">     void calculateRects(const ClipRectsContext&amp;, const LayoutRect&amp; paintDirtyRect, LayoutRect&amp; layerBounds,
</span><del>-        ClipRect&amp; backgroundRect, ClipRect&amp; foregroundRect, ClipRect&amp; outlineRect, const LayoutPoint* offsetFromRoot = 0) const;
</del><ins>+        ClipRect&amp; backgroundRect, ClipRect&amp; foregroundRect, ClipRect&amp; outlineRect, const LayoutPoint* offsetFromRoot = nullptr) const;
</ins><span class="cx"> 
</span><span class="cx">     // Compute and cache clip rects computed with the given layer as the root
</span><span class="cx">     void updateClipRects(const ClipRectsContext&amp;);
</span><span class="lines">@@ -713,7 +710,7 @@
</span><span class="cx">     LayoutRect localClipRect(bool&amp; clipExceedsBounds) const; // Returns the background clip rect of the layer in the local coordinate space.
</span><span class="cx"> 
</span><span class="cx">     // Pass offsetFromRoot if known.
</span><del>-    bool intersectsDamageRect(const LayoutRect&amp; layerBounds, const LayoutRect&amp; damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0, RenderRegion* = 0, const LayoutRect* cachedBoundingBox = 0) const;
</del><ins>+    bool intersectsDamageRect(const LayoutRect&amp; layerBounds, const LayoutRect&amp; damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = nullptr, const LayoutRect* cachedBoundingBox = nullptr) const;
</ins><span class="cx"> 
</span><span class="cx">     enum CalculateLayerBoundsFlag {
</span><span class="cx">         IncludeSelfTransform = 1 &lt;&lt; 0,
</span><span class="lines">@@ -728,7 +725,7 @@
</span><span class="cx">     typedef unsigned CalculateLayerBoundsFlags;
</span><span class="cx"> 
</span><span class="cx">     // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
</span><del>-    LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutPoint* offsetFromRoot = 0) const;
</del><ins>+    LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutPoint* offsetFromRoot = nullptr) const;
</ins><span class="cx">     // Bounding box in the coordinates of this layer.
</span><span class="cx">     LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
</span><span class="cx">     // Deprecated: Pixel snapped bounding box relative to the root.
</span><span class="lines">@@ -748,7 +745,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Can pass offsetFromRoot if known.
</span><del>-    LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
</del><ins>+    LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = nullptr, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
</ins><span class="cx">     
</span><span class="cx">     // WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects.
</span><span class="cx">     LayoutPoint computeOffsetFromRoot(bool&amp; hasLayerOffset) const;
</span><span class="lines">@@ -906,7 +903,7 @@
</span><span class="cx">     void updateDescendantsAreContiguousInStackingOrder();
</span><span class="cx">     void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap&lt;const RenderLayer*, int&gt;&amp;, int&amp; minIndex, int&amp; maxIndex, int&amp; count, bool firstIteration);
</span><span class="cx"> 
</span><del>-    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = 0);
</del><ins>+    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = nullptr);
</ins><span class="cx">     void computeRepaintRectsIncludingDescendants();
</span><span class="cx">     void clearRepaintRects();
</span><span class="cx"> 
</span><span class="lines">@@ -931,7 +928,7 @@
</span><span class="cx">     // Returns true if the position changed.
</span><span class="cx">     bool updateLayerPosition();
</span><span class="cx"> 
</span><del>-    void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
</del><ins>+    void updateLayerPositions(RenderGeometryMap* = nullptr, UpdateLayerPositionsFlags = defaultFlags);
</ins><span class="cx"> 
</span><span class="cx">     enum UpdateLayerPositionsAfterScrollFlag {
</span><span class="cx">         NoFlag = 0,
</span><span class="lines">@@ -963,12 +960,11 @@
</span><span class="cx">     void updateCompositingAndLayerListsIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     struct LayerPaintingInfo {
</span><del>-        LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect&amp; inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize&amp; inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = 0, RenderNamedFlowFragment* namedFlowFragment = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)
</del><ins>+        LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect&amp; inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize&amp; inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)
</ins><span class="cx">             : rootLayer(inRootLayer)
</span><span class="cx">             , subtreePaintRoot(inSubtreePaintRoot)
</span><span class="cx">             , paintDirtyRect(inDirtyRect)
</span><span class="cx">             , subPixelAccumulation(inSubPixelAccumulation)
</span><del>-            , renderNamedFlowFragment(namedFlowFragment)
</del><span class="cx">             , overlapTestRequests(inOverlapTestRequests)
</span><span class="cx">             , paintBehavior(inPaintBehavior)
</span><span class="cx">             , clipToDirtyRect(true)
</span><span class="lines">@@ -977,7 +973,6 @@
</span><span class="cx">         RenderObject* subtreePaintRoot; // only paint descendants of this object
</span><span class="cx">         LayoutRect paintDirtyRect; // relative to rootLayer;
</span><span class="cx">         LayoutSize subPixelAccumulation;
</span><del>-        RenderNamedFlowFragment* renderNamedFlowFragment; // May be null.
</del><span class="cx">         OverlapTestRequestMap* overlapTestRequests; // May be null.
</span><span class="cx">         PaintBehavior paintBehavior;
</span><span class="cx">         bool clipToDirtyRect;
</span><span class="lines">@@ -997,9 +992,9 @@
</span><span class="cx">     void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&amp;, PaintLayerFlags);
</span><span class="cx">     void paintList(Vector&lt;RenderLayer*&gt;*, GraphicsContext*, const LayerPaintingInfo&amp;, PaintLayerFlags);
</span><span class="cx"> 
</span><del>-    void collectFragments(LayerFragments&amp;, const RenderLayer* rootLayer, RenderRegion*, const LayoutRect&amp; dirtyRect,
</del><ins>+    void collectFragments(LayerFragments&amp;, const RenderLayer* rootLayer, const LayoutRect&amp; dirtyRect,
</ins><span class="cx">         ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
</span><del>-        ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0, const LayoutRect* layerBoundingBox = 0, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
</del><ins>+        ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = nullptr, const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
</ins><span class="cx">     void updatePaintingInfoForFragments(LayerFragments&amp;, const LayerPaintingInfo&amp;, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot);
</span><span class="cx">     void paintBackgroundForFragments(const LayerFragments&amp;, GraphicsContext*, GraphicsContext* transparencyLayerContext,
</span><span class="cx">         const LayoutRect&amp; transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo&amp;, PaintBehavior, RenderObject* paintingRootForRenderer);
</span><span class="lines">@@ -1013,15 +1008,15 @@
</span><span class="cx">     void paintTransformedLayerIntoFragments(GraphicsContext*, const LayerPaintingInfo&amp;, PaintLayerFlags);
</span><span class="cx"> 
</span><span class="cx">     RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&amp; request, HitTestResult&amp; result,
</span><del>-                              const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, bool appliedTransform,
-                              const HitTestingTransformState* transformState = 0, double* zOffset = 0);
</del><ins>+        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, bool appliedTransform,
+        const HitTestingTransformState* = nullptr, double* zOffset = nullptr);
</ins><span class="cx">     RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&amp;, HitTestResult&amp;,
</span><del>-        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, const HitTestingTransformState* = 0, double* zOffset = 0,
</del><ins>+        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, const HitTestingTransformState* = nullptr, double* zOffset = nullptr,
</ins><span class="cx">         const LayoutPoint&amp; translationOffset = LayoutPoint());
</span><span class="cx">     RenderLayer* hitTestList(Vector&lt;RenderLayer*&gt;*, RenderLayer* rootLayer, const HitTestRequest&amp; request, HitTestResult&amp; result,
</span><del>-                             const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;,
-                             const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset,
-                             const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
</del><ins>+        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;,
+        const HitTestingTransformState*, double* zOffsetForDescendants, double* zOffset,
+        const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
</ins><span class="cx"> 
</span><span class="cx">     RenderLayer* hitTestFixedLayersInNamedFlows(RenderLayer* rootLayer,
</span><span class="cx">         const HitTestRequest&amp;, HitTestResult&amp;,
</span><span class="lines">@@ -1032,15 +1027,15 @@
</span><span class="cx">         bool depthSortDescendants);
</span><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;HitTestingTransformState&gt; createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
</span><del>-                            const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;,
-                            const HitTestingTransformState* containerTransformState,
-                            const LayoutPoint&amp; translationOffset = LayoutPoint()) const;
</del><ins>+        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;,
+        const HitTestingTransformState* containerTransformState,
+        const LayoutPoint&amp; translationOffset = LayoutPoint()) const;
</ins><span class="cx">     
</span><span class="cx">     bool hitTestContents(const HitTestRequest&amp;, HitTestResult&amp;, const LayoutRect&amp; layerBounds, const HitTestLocation&amp;, HitTestFilter) const;
</span><span class="cx">     bool hitTestContentsForFragments(const LayerFragments&amp;, const HitTestRequest&amp;, HitTestResult&amp;, const HitTestLocation&amp;, HitTestFilter, bool&amp; insideClipRect) const;
</span><span class="cx">     bool hitTestResizerInFragments(const LayerFragments&amp;, const HitTestLocation&amp;) const;
</span><span class="cx">     RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&amp;, HitTestResult&amp;,
</span><del>-        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, const HitTestingTransformState* = 0, double* zOffset = 0);
</del><ins>+        const LayoutRect&amp; hitTestRect, const HitTestLocation&amp;, const HitTestingTransformState* = nullptr, double* zOffset = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     bool listBackgroundIsKnownToBeOpaqueInRect(const Vector&lt;RenderLayer*&gt;*, const LayoutRect&amp;) const;
</span><span class="cx"> 
</span><span class="lines">@@ -1102,7 +1097,7 @@
</span><span class="cx">     void dirtyAncestorChainVisibleDescendantStatus();
</span><span class="cx">     void setAncestorChainHasVisibleDescendant();
</span><span class="cx"> 
</span><del>-    void updateDescendantDependentFlags(HashSet&lt;const RenderObject*&gt;* outOfFlowDescendantContainingBlocks = 0);
</del><ins>+    void updateDescendantDependentFlags(HashSet&lt;const RenderObject*&gt;* outOfFlowDescendantContainingBlocks = nullptr);
</ins><span class="cx">     bool checkIfDescendantClippingContextNeedsUpdate(bool isClipping);
</span><span class="cx"> 
</span><span class="cx">     bool has3DTransformedDescendant() const { return m_has3DTransformedDescendant; }
</span><span class="lines">@@ -1190,8 +1185,10 @@
</span><span class="cx">         const HitTestingTransformState*, double* zOffsetForDescendants,
</span><span class="cx">         double* zOffset, const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
</span><span class="cx">     void paintFlowThreadIfRegionForFragments(const LayerFragments&amp;, GraphicsContext*, const LayerPaintingInfo&amp;, PaintLayerFlags);
</span><del>-    void mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment*, ClipRects&amp;) const;
</del><ins>+    bool mapLayerClipRectsToFragmentationLayer(ClipRects&amp;) const;
</ins><span class="cx"> 
</span><ins>+    RenderNamedFlowFragment* currentRenderNamedFlowFragment() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     // The bitfields are up here so they will fall into the padding from ScrollableArea on 64-bit.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -460,7 +460,7 @@
</span><span class="cx">             clippingBounds = view.unscaledDocumentRect();
</span><span class="cx"> 
</span><span class="cx">         if (&amp;m_owningLayer != rootLayer)
</span><del>-            clippingBounds.intersect(m_owningLayer.backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
</del><ins>+            clippingBounds.intersect(m_owningLayer.backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
</ins><span class="cx"> 
</span><span class="cx">         LayoutPoint delta;
</span><span class="cx">         m_owningLayer.convertToLayerCoords(rootLayer, delta, RenderLayer::AdjustForColumns);
</span><span class="lines">@@ -776,7 +776,7 @@
</span><span class="cx">         // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
</span><span class="cx">         // for a compositing layer, rootLayer is the layer itself.
</span><span class="cx">         ShouldRespectOverflowClip shouldRespectOverflowClip = compAncestor-&gt;isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip;
</span><del>-        RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
</del><ins>+        RenderLayer::ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
</ins><span class="cx">         LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
</span><span class="cx">         ASSERT(parentClipRect != LayoutRect::infiniteRect());
</span><span class="cx">         m_ancestorClippingLayer-&gt;setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -1019,7 +1019,7 @@
</span><span class="cx">         boundsComputed = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    IntRect clipRect = pixelSnappedIntRect(layer.backgroundClipRect(RenderLayer::ClipRectsContext(&amp;rootRenderLayer(), 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
</del><ins>+    IntRect clipRect = pixelSnappedIntRect(layer.backgroundClipRect(RenderLayer::ClipRectsContext(&amp;rootRenderLayer(), AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
</ins><span class="cx"> 
</span><span class="cx">     // On iOS, pageScaleFactor() is not applied by RenderView, so we should not scale here.
</span><span class="cx">     // FIXME: Set Settings::delegatesPageScaling to true for iOS.
</span><span class="lines">@@ -2336,7 +2336,7 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return layer.backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRoot, 0, TemporaryClipRects)).rect() != LayoutRect::infiniteRect(); // FIXME: Incorrect for CSS regions.
</del><ins>+    return layer.backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRoot, TemporaryClipRects)).rect() != LayoutRect::infiniteRect(); // FIXME: Incorrect for CSS regions.
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Return true if the given layer is a stacking context and has compositing child
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -54,7 +54,8 @@
</span><span class="cx"> #include &quot;RenderIterator.h&quot;
</span><span class="cx"> #include &quot;RenderLayer.h&quot;
</span><span class="cx"> #include &quot;RenderLayerBacking.h&quot;
</span><del>-#include &quot;RenderNamedFlowThread.h&quot;
</del><ins>+#include &quot;RenderNamedFlowFragment.h&quot;
+#include &quot;RenderNamedFlowThread.h&quot; 
</ins><span class="cx"> #include &quot;RenderSVGResourceContainer.h&quot;
</span><span class="cx"> #include &quot;RenderScrollbarPart.h&quot;
</span><span class="cx"> #include &quot;RenderTheme.h&quot;
</span><span class="lines">@@ -2473,6 +2474,26 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RenderNamedFlowFragment* RenderObject::currentRenderNamedFlowFragment() const
+{
+    if (flowThreadState() == NotInsideFlowThread)
+        return nullptr;
+
+    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
+    if (!flowThread)
+        return nullptr;
+
+    ASSERT(flowThread == flowThreadContainingBlock());
+
+    // FIXME: Once regions are fully integrated with the compositing system we should uncomment this assert.
+    // This assert needs to be disabled because it's possible to ask for the ancestor clipping rectangle of
+    // a layer without knowing the containing region in advance.
+    // ASSERT(flowThread-&gt;currentRegion() &amp;&amp; flowThread-&gt;currentRegion()-&gt;isRenderNamedFlowFragment());
+
+    RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(flowThread-&gt;currentRegion());
+    return namedFlowFragment;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -218,6 +218,8 @@
</span><span class="cx">         return locateFlowThreadContainingBlock();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    RenderNamedFlowFragment* currentRenderNamedFlowFragment() const;
+
</ins><span class="cx">     // FIXME: The meaning of this function is unclear.
</span><span class="cx">     virtual bool isEmpty() const { return !firstChildSlow(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -206,8 +206,9 @@
</span><span class="cx">     if (style().visibility() != VISIBLE)
</span><span class="cx">         return false;
</span><span class="cx">     
</span><ins>+    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</ins><span class="cx">     // Check our region range to make sure we need to be painting in this region.
</span><del>-    if (paintInfo.renderNamedFlowFragment &amp;&amp; !paintInfo.renderNamedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(this, paintInfo.renderNamedFlowFragment))
</del><ins>+    if (namedFlowFragment &amp;&amp; !namedFlowFragment-&gt;flowThread()-&gt;objectShouldFragmentInFlowRegion(this, namedFlowFragment))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     LayoutPoint adjustedPaintOffset = paintOffset + location();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplicacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplica.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplica.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderReplica.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">         // Turn around and paint the parent layer. Use temporary clipRects, so that the layer doesn't end up caching clip rects
</span><span class="cx">         // computing using the wrong rootLayer
</span><span class="cx">         RenderLayer* rootPaintingLayer = layer()-&gt;transform() ? layer()-&gt;parent() : layer()-&gt;enclosingTransformedAncestor();
</span><del>-        RenderLayer::LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0, paintInfo.renderNamedFlowFragment);
</del><ins>+        RenderLayer::LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0);
</ins><span class="cx">         RenderLayer::PaintLayerFlags flags = RenderLayer::PaintLayerHaveTransparency | RenderLayer::PaintLayerAppliedTransform | RenderLayer::PaintLayerTemporaryClipRects | RenderLayer::PaintLayerPaintingReflection;
</span><span class="cx">         layer()-&gt;parent()-&gt;paintLayer(paintInfo.context, paintingInfo, flags);
</span><span class="cx">     } else if (paintInfo.phase == PaintPhaseMask)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;LayoutRepainter.h&quot;
</span><span class="cx"> #include &quot;RenderIterator.h&quot;
</span><span class="cx"> #include &quot;RenderLayer.h&quot;
</span><ins>+#include &quot;RenderNamedFlowFragment.h&quot;
</ins><span class="cx"> #include &quot;RenderTableCaption.h&quot;
</span><span class="cx"> #include &quot;RenderTableCell.h&quot;
</span><span class="cx"> #include &quot;RenderTableCol.h&quot;
</span><span class="lines">@@ -1493,7 +1494,7 @@
</span><span class="cx">     LayoutPoint adjustedLocation = accumulatedOffset + location();
</span><span class="cx"> 
</span><span class="cx">     // Check kids first.
</span><del>-    if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region()))) {
</del><ins>+    if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(adjustedLocation, currentRenderNamedFlowFragment()))) {
</ins><span class="cx">         for (RenderObject* child = lastChild(); child; child = child-&gt;previousSibling()) {
</span><span class="cx">             if (child-&gt;isBox() &amp;&amp; !toRenderBox(child)-&gt;hasSelfPaintingLayer() &amp;&amp; (child-&gt;isTableSection() || child-&gt;isTableCaption())) {
</span><span class="cx">                 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableSectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableSection.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;HitTestResult.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;PaintInfo.h&quot;
</span><ins>+#include &quot;RenderNamedFlowFragment.h&quot;
</ins><span class="cx"> #include &quot;RenderTableCell.h&quot;
</span><span class="cx"> #include &quot;RenderTableCol.h&quot;
</span><span class="cx"> #include &quot;RenderTableRow.h&quot;
</span><span class="lines">@@ -1494,7 +1495,7 @@
</span><span class="cx">     // Just forward to our children always.
</span><span class="cx">     LayoutPoint adjustedLocation = accumulatedOffset + location();
</span><span class="cx"> 
</span><del>-    if (hasOverflowClip() &amp;&amp; !locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region())))
</del><ins>+    if (hasOverflowClip() &amp;&amp; !locationInContainer.intersects(overflowClipRect(adjustedLocation, currentRenderNamedFlowFragment())))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (hasOverflowingCell()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx">     // Calculate the clip rects we should use.
</span><span class="cx">     LayoutRect layerBounds;
</span><span class="cx">     ClipRect damageRect, clipRectToApply, outlineRect;
</span><del>-    l-&gt;calculateRects(RenderLayer::ClipRectsContext(rootLayer, 0, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
</del><ins>+    l-&gt;calculateRects(RenderLayer::ClipRectsContext(rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
</ins><span class="cx"> 
</span><span class="cx">     // Ensure our lists are up-to-date.
</span><span class="cx">     l-&gt;updateLayerListsIfNeeded();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -173,10 +173,12 @@
</span><span class="cx"> 
</span><span class="cx"> void RootInlineBox::paint(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
</span><span class="cx"> {
</span><ins>+    RenderNamedFlowFragment* namedFlowFragment = renderer().currentRenderNamedFlowFragment();
+
</ins><span class="cx">     // Check if we are in the correct region.
</span><del>-    if (paintInfo.renderNamedFlowFragment) {
</del><ins>+    if (namedFlowFragment) {
</ins><span class="cx">         RenderRegion* region = containingRegion();
</span><del>-        if (region &amp;&amp; region != reinterpret_cast&lt;RenderRegion*&gt;(paintInfo.renderNamedFlowFragment))
</del><ins>+        if (region &amp;&amp; region != reinterpret_cast&lt;RenderRegion*&gt;(namedFlowFragment))
</ins><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (168966 => 168967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2014-05-16 11:56:14 UTC (rev 168966)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2014-05-16 13:22:00 UTC (rev 168967)
</span><span class="lines">@@ -264,7 +264,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Apply initial viewport clip
</span><span class="cx">     if (shouldApplyViewportClip())
</span><del>-        childPaintInfo.context-&gt;clip(pixelSnappedIntRect(overflowClipRect(paintOffset, paintInfo.renderNamedFlowFragment)));
</del><ins>+        childPaintInfo.context-&gt;clip(pixelSnappedIntRect(overflowClipRect(paintOffset, currentRenderNamedFlowFragment())));
</ins><span class="cx"> 
</span><span class="cx">     // Convert from container offsets (html renderers) to a relative transform (svg renderers).
</span><span class="cx">     // Transform from our paint container's coordinate system to our local coords.
</span></span></pre>
</div>
</div>

</body>
</html>