Changeset 168967 in webkit


Ignore:
Timestamp:
May 16, 2014 6:22:00 AM (10 years ago)
Author:
abucur@adobe.com
Message:

[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):

Location:
trunk/Source/WebCore
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168966 r168967  
     12014-05-16  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Reduce the RenderRegion invasiveness in rendering code
     4        https://bugs.webkit.org/show_bug.cgi?id=132121
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Remove the RenderRegion / RenderNamedFlowFragment parameters and fields from
     9        the painting / hit testing data structures and use a stateful approach to
     10        correctly handle regions.
     11
     12        When painting or hit testing, the current flow thread is saved along the current
     13        region. They are accessed through the |currentRenderNamedFlowFragment| helper
     14        method on RenderObject or RenderLayer.
     15
     16        The patch also changes a bunch of 0s to nullptrs.
     17
     18        Tests: No new tests, no functional change.
     19
     20        * html/shadow/MediaControlElements.cpp:
     21        (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
     22        * rendering/HitTestLocation.cpp:
     23        (WebCore::HitTestLocation::HitTestLocation):
     24        (WebCore::HitTestLocation::operator=):
     25        * rendering/HitTestLocation.h:
     26        (WebCore::HitTestLocation::region): Deleted.
     27        * rendering/HitTestResult.h:
     28        * rendering/PaintInfo.h:
     29        (WebCore::PaintInfo::PaintInfo):
     30        * rendering/RenderBlock.cpp:
     31        (WebCore::RenderBlock::paint):
     32        (WebCore::RenderBlock::paintObject):
     33        (WebCore::RenderBlock::selectionGaps):
     34        (WebCore::RenderBlock::nodeAtPoint):
     35        * rendering/RenderBox.cpp:
     36        (WebCore::RenderBox::nodeAtPoint):
     37        (WebCore::RenderBox::paintBoxDecorations):
     38        (WebCore::RenderBox::pushContentsClip):
     39        * rendering/RenderBoxModelObject.cpp:
     40        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
     41        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     42        * rendering/RenderBoxModelObject.h:
     43        * rendering/RenderLayer.cpp:
     44        (WebCore::RenderLayer::paint):
     45        (WebCore::RenderLayer::paintLayer):
     46        (WebCore::RenderLayer::paintLayerContents):
     47        (WebCore::RenderLayer::paintLayerByApplyingTransform):
     48        (WebCore::RenderLayer::collectFragments):
     49        (WebCore::RenderLayer::updatePaintingInfoForFragments):
     50        (WebCore::RenderLayer::paintTransformedLayerIntoFragments):
     51        (WebCore::RenderLayer::paintBackgroundForFragments):
     52        (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
     53        (WebCore::RenderLayer::paintOutlineForFragments):
     54        (WebCore::RenderLayer::paintMaskForFragments):
     55        (WebCore::RenderLayer::hitTest):
     56        (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
     57        (WebCore::RenderLayer::hitTestLayer):
     58        (WebCore::RenderLayer::hitTestTransformedLayerInFragments):
     59        (WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
     60        (WebCore::RenderLayer::calculateClipRects):
     61        * rendering/RenderLayer.h:
     62        * rendering/RenderLayerBacking.cpp:
     63        (WebCore::RenderLayerBacking::updateCompositedBounds):
     64        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     65        * rendering/RenderLayerCompositor.cpp:
     66        (WebCore::RenderLayerCompositor::addToOverlapMap):
     67        (WebCore::RenderLayerCompositor::clippedByAncestor):
     68        * rendering/RenderObject.cpp:
     69        (WebCore::RenderObject::currentRenderNamedFlowFragment):
     70        * rendering/RenderObject.h:
     71        * rendering/RenderReplaced.cpp:
     72        (WebCore::RenderReplaced::shouldPaint):
     73        * rendering/RenderReplica.cpp:
     74        (WebCore::RenderReplica::paint):
     75        * rendering/RenderTable.cpp:
     76        (WebCore::RenderTable::nodeAtPoint):
     77        * rendering/RenderTableSection.cpp:
     78        (WebCore::RenderTableSection::nodeAtPoint):
     79        * rendering/RenderTreeAsText.cpp:
     80        (WebCore::writeLayers):
     81        * rendering/RootInlineBox.cpp:
     82        (WebCore::RootInlineBox::paint):
     83        * rendering/svg/RenderSVGRoot.cpp:
     84        (WebCore::RenderSVGRoot::paintReplaced):
     85
    1862014-05-16  Kiran  <kiran.guduru@samsung.com>
    287
  • trunk/Source/WebCore/html/shadow/MediaControlElements.cpp

    r168905 r168967  
    14801480        return nullptr;
    14811481
    1482     layer->paint(buffer->context(), paintingRect, PaintBehaviorFlattenCompositingLayers, nullptr, nullptr, RenderLayer::PaintLayerPaintingCompositingAllPhases);
     1482    layer->paint(buffer->context(), paintingRect, PaintBehaviorFlattenCompositingLayers, nullptr, RenderLayer::PaintLayerPaintingCompositingAllPhases);
    14831483
    14841484    return buffer->copyImage();
  • trunk/Source/WebCore/rendering/HitTestLocation.cpp

    r168905 r168967  
    4848
    4949HitTestLocation::HitTestLocation()
    50     : m_region(0)
    51     , m_isRectBased(false)
     50    : m_isRectBased(false)
    5251    , m_isRectilinear(true)
    5352{
     
    5958    , m_transformedPoint(point)
    6059    , m_transformedRect(m_boundingBox)
    61     , m_region(0)
    6260    , m_isRectBased(false)
    6361    , m_isRectilinear(true)
     
    7068    , m_transformedPoint(point)
    7169    , m_transformedRect(m_boundingBox)
    72     , m_region(0)
    7370    , m_isRectBased(false)
    7471    , m_isRectilinear(true)
     
    7976    : m_transformedPoint(point)
    8077    , m_transformedRect(quad)
    81     , m_region(0)
    8278    , m_isRectBased(true)
    8379{
     
    9187    , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding))
    9288    , m_transformedPoint(centerPoint)
    93     , m_region(0)
    9489    , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding)
    9590    , m_isRectilinear(true)
     
    9893}
    9994
    100 HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& offset, RenderRegion* region)
     95HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& offset)
    10196    : m_point(other.m_point)
    10297    , m_boundingBox(other.m_boundingBox)
    10398    , m_transformedPoint(other.m_transformedPoint)
    10499    , m_transformedRect(other.m_transformedRect)
    105     , m_region(region ? region : other.m_region)
    106100    , m_isRectBased(other.m_isRectBased)
    107101    , m_isRectilinear(other.m_isRectilinear)
     
    115109    , m_transformedPoint(other.m_transformedPoint)
    116110    , m_transformedRect(other.m_transformedRect)
    117     , m_region(other.m_region)
    118111    , m_isRectBased(other.m_isRectBased)
    119112    , m_isRectilinear(other.m_isRectilinear)
     
    131124    m_transformedPoint = other.m_transformedPoint;
    132125    m_transformedRect = other.m_transformedRect;
    133     m_region = other.m_region;
    134126    m_isRectBased = other.m_isRectBased;
    135127    m_isRectilinear = other.m_isRectilinear;
  • trunk/Source/WebCore/rendering/HitTestLocation.h

    r168905 r168967  
    4343class URL;
    4444class Node;
    45 class RenderRegion;
    4645class Scrollbar;
    4746
     
    5655    HitTestLocation(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
    5756    // Make a copy the HitTestLocation in a new region by applying given offset to internal point and area.
    58     HitTestLocation(const HitTestLocation&, const LayoutSize& offset, RenderRegion* = 0);
     57    HitTestLocation(const HitTestLocation&, const LayoutSize& offset);
    5958    HitTestLocation(const HitTestLocation&);
    6059    ~HitTestLocation();
     
    6362    const LayoutPoint& point() const { return m_point; }
    6463    IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
    65 
    66     RenderRegion* region() const { return m_region; }
    6764
    6865    // Rect-based hit test related methods.
     
    9693    FloatQuad m_transformedRect;
    9794
    98     RenderRegion* m_region; // The region we're inside.
    99 
    10095    bool m_isRectBased;
    10196    bool m_isRectilinear;
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r168905 r168967  
    4444class URL;
    4545class Node;
    46 class RenderRegion;
    4746class Scrollbar;
    4847
  • trunk/Source/WebCore/rendering/PaintInfo.h

    r168905 r168967  
    4141class RenderInline;
    4242class RenderLayerModelObject;
    43 class RenderNamedFlowFragment;
    4443class RenderObject;
    4544
     
    5251struct PaintInfo {
    5352    PaintInfo(GraphicsContext* newContext, const LayoutRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
    54         RenderObject* newSubtreePaintRoot = nullptr, RenderNamedFlowFragment* namedFlowFragment = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr,
     53        RenderObject* newSubtreePaintRoot = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr,
    5554        OverlapTestRequestMap* overlapTestRequests = nullptr, const RenderLayerModelObject* newPaintContainer = nullptr)
    5655            : context(newContext)
     
    5958            , paintBehavior(newPaintBehavior)
    6059            , subtreePaintRoot(newSubtreePaintRoot)
    61             , renderNamedFlowFragment(namedFlowFragment)
    6260            , outlineObjects(newOutlineObjects)
    6361            , overlapTestRequests(overlapTestRequests)
     
    108106    PaintBehavior paintBehavior;
    109107    RenderObject* subtreePaintRoot; // used to draw just one element and its visual children
    110     RenderNamedFlowFragment* renderNamedFlowFragment;
    111108    ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
    112109    OverlapTestRequestMap* overlapTestRequests;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r168905 r168967  
    14631463    PaintPhase phase = paintInfo.phase;
    14641464
     1465    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    14651466    // Check our region range to make sure we need to be painting in this region.
    1466     if (paintInfo.renderNamedFlowFragment && !paintInfo.renderNamedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(this, paintInfo.renderNamedFlowFragment))
     1467    if (namedFlowFragment && !namedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(this, namedFlowFragment))
    14671468        return;
    14681469
     
    14711472    // paints the root's background.
    14721473    if (!isRoot()) {
    1473         LayoutRect overflowBox = overflowRectForPaintRejection(paintInfo.renderNamedFlowFragment);
     1474        LayoutRect overflowBox = overflowRectForPaintRejection(namedFlowFragment);
    14741475        flipForWritingMode(overflowBox);
    14751476        overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
     
    16011602            bool didClipToRegion = false;
    16021603           
    1603             if (paintInfo.paintContainer && paintInfo.renderNamedFlowFragment && paintInfo.paintContainer->isRenderNamedFlowThread()) {
     1604            RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
     1605            if (paintInfo.paintContainer && namedFlowFragment && paintInfo.paintContainer->isRenderNamedFlowThread()) {
    16041606                // If this box goes beyond the current region, then make sure not to overflow the region.
    16051607                // This (overflowing region X altough also fragmented to region X+1) could happen when one of this box's children
     
    16101612                didClipToRegion = true;
    16111613
    1612                 paintInfo.context->clip(toRenderNamedFlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInNamedFlowFragment(*this, *paintInfo.renderNamedFlowFragment));
     1614                paintInfo.context->clip(toRenderNamedFlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInNamedFlowFragment(*this, *namedFlowFragment));
    16131615            }
    16141616
     
    19181920    }
    19191921   
    1920     if (paintInfo && paintInfo->renderNamedFlowFragment && paintInfo->paintContainer->isRenderFlowThread()) {
     1922    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
     1923    if (paintInfo && namedFlowFragment && paintInfo->paintContainer->isRenderFlowThread()) {
    19211924        // Make sure the current object is actually flowed into the region being painted.
    1922         if (!toRenderFlowThread(paintInfo->paintContainer)->objectShouldFragmentInFlowRegion(this, paintInfo->renderNamedFlowFragment))
     1925        if (!toRenderFlowThread(paintInfo->paintContainer)->objectShouldFragmentInFlowRegion(this, namedFlowFragment))
    19231926            return result;
    19241927    }
     
    24582461    LayoutSize localOffset = toLayoutSize(adjustedLocation);
    24592462
     2463    RenderFlowThread* flowThread = flowThreadContainingBlock();
     2464    RenderNamedFlowFragment* namedFlowFragment = flowThread ? toRenderNamedFlowFragment(flowThread->currentRegion()) : nullptr;
    24602465    // If we are now searching inside a region, make sure this element
    24612466    // is being fragmented into this region.
    2462     if (locationInContainer.region()) {
    2463         RenderFlowThread* flowThread = flowThreadContainingBlock();
    2464         ASSERT(flowThread);
    2465         if (!flowThread->objectShouldFragmentInFlowRegion(this, locationInContainer.region()))
    2466             return false;
    2467     }
     2467    if (namedFlowFragment && !flowThread->objectShouldFragmentInFlowRegion(this, namedFlowFragment))
     2468        return false;
    24682469
    24692470    if (!isRenderView()) {
     
    25222523    bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
    25232524    bool useClip = (hasControlClip() || useOverflowClip);
    2524     bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.intersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region(), IncludeOverlayScrollbarSize)));
     2525    bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.intersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(overflowClipRect(adjustedLocation, namedFlowFragment, IncludeOverlayScrollbarSize)));
    25252526    if (checkChildren) {
    25262527        // Hit test descendants first.
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r168905 r168967  
    11371137    }
    11381138
    1139     RenderRegion* regionToUse = locationInContainer.region();
    1140     if (regionToUse) {
    1141         RenderFlowThread* flowThread = regionToUse->flowThread();
    1142 
    1143         // If the box is not contained by this region there's no point in going further.
    1144         if (!flowThread->objectShouldFragmentInFlowRegion(this, regionToUse))
    1145             return false;
    1146     }
     1139    RenderFlowThread* flowThread = flowThreadContainingBlock();
     1140    RenderRegion* regionToUse = flowThread ? toRenderNamedFlowFragment(flowThread->currentRegion()) : nullptr;
     1141
     1142    // If the box is not contained by this region there's no point in going further.
     1143    if (regionToUse && !flowThread->objectShouldFragmentInFlowRegion(this, regionToUse))
     1144        return false;
    11471145
    11481146    // Check our bounds next. For this purpose always assume that we can only be hit in the
     
    12141212        return;
    12151213
    1216     LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderNamedFlowFragment);
     1214    LayoutRect paintRect = borderBoxRectInRegion(currentRenderNamedFlowFragment());
    12171215    paintRect.moveBy(paintOffset);
    12181216
     
    16861684        paintInfo.phase = PaintPhaseChildBlockBackgrounds;
    16871685    }
    1688     IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderNamedFlowFragment, IgnoreOverlayScrollbarSize, paintInfo.phase));
     1686    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, currentRenderNamedFlowFragment(), IgnoreOverlayScrollbarSize, paintInfo.phase));
    16891687    paintInfo.context->save();
    16901688    if (style().hasBorderRadius())
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r168905 r168967  
    595595}
    596596
    597 void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect, RenderNamedFlowFragment* namedFlowFragment)
     597void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect)
    598598{
    599599    GraphicsContext* maskImageContext = maskImage->context();
     
    602602    // Now add the text to the clip. We do this by painting using a special paint phase that signals to
    603603    // InlineTextBoxes that they should just add their contents to the clip.
    604     PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, namedFlowFragment);
     604    PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0);
    605605    if (box) {
    606606        const RootInlineBox& rootBox = box->root();
     
    716716        // Clip to the overflow area.
    717717        RenderBox* thisBox = toRenderBox(this);
    718         context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.renderNamedFlowFragment));
     718        context->clip(thisBox->overflowClipRect(rect.location(), currentRenderNamedFlowFragment()));
    719719       
    720720        // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
     
    751751        if (!maskImage)
    752752            return;
    753         paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect, paintInfo.renderNamedFlowFragment);
     753        paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect);
    754754
    755755        // The mask has been created.  Now we just need to clip to it.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r168905 r168967  
    328328        float thickness, float drawThickness, BoxSide, const RenderStyle&,
    329329        Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
    330     void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&, RenderNamedFlowFragment*);
     330    void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&);
    331331
    332332    void pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry&) const;
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r168905 r168967  
    35343534}
    35353535
    3536 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, RenderNamedFlowFragment* namedFlowFragment, PaintLayerFlags paintFlags)
     3536void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags)
    35373537{
    35383538    OverlapTestRequestMap overlapTestRequests;
    35393539
    3540     LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, namedFlowFragment, &overlapTestRequests);
     3540    LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, &overlapTestRequests);
    35413541    paintLayer(context, paintingInfo, paintFlags);
    35423542
     
    36823682    // This is true as long as we clamp the range of a box to its containing block range.
    36833683
    3684     // FIXME: Hack to disable region information for in flow threads. Implement this logic in a different way.
    3685     LayerPaintingInfo& info = const_cast<LayerPaintingInfo&>(paintingInfo);
    3686     RenderNamedFlowFragment* namedFlowFragment = info.renderNamedFlowFragment;
     3684    // Disable named flow region information for in flow threads such as multi-col.
     3685    std::unique_ptr<CurrentRenderFlowThreadDisabler> flowThreadDisabler;
     3686    if (enclosingPaginationLayer())
     3687        flowThreadDisabler = std::make_unique<CurrentRenderFlowThreadDisabler>(&renderer().view());
     3688
     3689    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    36873690    if (namedFlowFragment) {
    3688         if (enclosingPaginationLayer())
    3689             info.renderNamedFlowFragment = nullptr;
    3690         else {
    3691             ASSERT(namedFlowFragment->isValid());
    3692             if (!namedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(&renderer(), namedFlowFragment))
    3693                 return;
    3694         }
     3691        ASSERT(namedFlowFragment->isValid());
     3692        if (!namedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(&renderer(), namedFlowFragment))
     3693            return;
    36953694    }
    36963695
     
    37023701        TransformationMatrix layerTransform = renderableTransform(paintingInfo.paintBehavior);
    37033702        // If the transform can't be inverted, then don't paint anything.
    3704         if (!layerTransform.isInvertible()) {
    3705             info.renderNamedFlowFragment = namedFlowFragment;
     3703        if (!layerTransform.isInvertible())
    37063704            return;
    3707         }
    37083705
    37093706        // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency
     
    37183715        if (enclosingPaginationLayer()) {
    37193716            paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags);
    3720             info.renderNamedFlowFragment = namedFlowFragment;
    37213717            return;
    37223718        }
     
    37253721        ClipRect clipRect = paintingInfo.paintDirtyRect;
    37263722        if (parent()) {
    3727             ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
     3723            ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
    37283724                IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
    37293725            clipRect = backgroundClipRect(clipRectsContext);
     
    37403736            parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
    37413737
    3742         info.renderNamedFlowFragment = namedFlowFragment;
    37433738        return;
    37443739    }
    37453740   
    37463741    paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
    3747     info.renderNamedFlowFragment = namedFlowFragment;
    37483742}
    37493743
     
    40594053            paintDirtyRect = selfClipRect();
    40604054        }
    4061         collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.renderNamedFlowFragment, paintDirtyRect,
     4055        collectFragments(layerFragments, localPaintingInfo.rootLayer, paintDirtyRect,
    40624056            (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    40634057            (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot);
     
    41564150    // Now do a paint with the root layer shifted to be us.
    41574151    LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(enclosingRectForPainting(transform.inverse().mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)), paintingInfo.paintBehavior,
    4158         adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.renderNamedFlowFragment, paintingInfo.overlapTestRequests);
     4152        adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);
    41594153    paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
    41604154}
     
    42034197}
    42044198
    4205 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect,
     4199void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
    42064200    ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
    42074201    const LayoutRect* layerBoundingBox, ShouldApplyRootOffsetToFragments applyRootOffsetToFragments)
     
    42114205        // For unpaginated layers, there is only one fragment.
    42124206        LayerFragment fragment;
    4213         ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
     4207        ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
    42144208        calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot);
    42154209        fragments.append(fragment);
     
    42234217    // Calculate clip rects relative to the enclosingPaginationLayer. The purpose of this call is to determine our bounds clipped to intermediate
    42244218    // 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.
    4225     ClipRectsContext paginationClipRectsContext(paginationLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
     4219    ClipRectsContext paginationClipRectsContext(paginationLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
    42264220    LayoutRect layerBoundsInFlowThread;
    42274221    ClipRect backgroundRectInFlowThread;
     
    42484242       
    42494243        // Now collect ancestor fragments.
    4250         parentPaginationLayer->collectFragments(ancestorFragments, rootLayer, region, dirtyRect, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, nullptr, &layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
     4244        parentPaginationLayer->collectFragments(ancestorFragments, rootLayer, dirtyRect, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, nullptr, &layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
    42514245       
    42524246        if (ancestorFragments.isEmpty())
     
    43104304    ClipRect ancestorClipRect = dirtyRect;
    43114305    if (paginationLayer->parent()) {
    4312         ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
     4306        ClipRectsContext clipRectsContext(rootLayer, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
    43134307        ancestorClipRect = paginationLayer->backgroundClipRect(clipRectsContext);
    43144308        ancestorClipRect.intersect(dirtyRect);
     
    43464340        if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
    43474341            LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginationOffset;
    4348             fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot, localPaintingInfo.renderNamedFlowFragment, fragment.hasBoundingBox ? &fragment.boundingBox : 0);
     4342            fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot, fragment.hasBoundingBox ? &fragment.boundingBox : 0);
    43494343        }
    43504344    }
     
    43564350    LayoutPoint offsetOfPaginationLayerFromRoot;
    43574351    LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.paintBehavior);
    4358     enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, paintingInfo.paintDirtyRect,
     4352    enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect,
    43594353        (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    43604354        (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
     
    43714365            enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLayer, offsetOfPaginationLayerFromRoot);
    43724366   
    4373             ClipRectsContext clipRectsContext(enclosingPaginationLayer(), paintingInfo.renderNamedFlowFragment, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
     4367            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
    43744368                IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
    43754369            LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rect();
     
    44054399        // Paint the background.
    44064400        // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
    4407         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4401        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
    44084402        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
    44094403
     
    44784472            clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
    44794473   
    4480         PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4474        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
    44814475        if (phase == PaintPhaseForeground)
    44824476            paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
     
    44974491   
    44984492        // Paint our own outline
    4499         PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4493        PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
    45004494        clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
    45014495        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
     
    45174511        // Paint the mask.
    45184512        // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
    4519         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4513        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
    45204514        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
    45214515       
     
    45514545        hitTestArea.intersect(renderer().view().frameView().visibleContentRect(LegacyIOSDocumentVisibleRect));
    45524546
    4553     RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hitTestLocation, false);
     4547    RenderLayer* insideLayer = hitTestLayer(this, nullptr, request, result, hitTestArea, hitTestLocation, false);
    45544548    if (!insideLayer) {
    45554549        // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down,
     
    47004694
    47014695        HitTestResult tempResult(result.hitTestLocation());
    4702         RenderLayer* hitLayer = fixedLayer->hitTestLayer(fixedLayer->renderer().flowThreadContainingBlock()->layer(), 0, request, tempResult,
     4696        RenderLayer* hitLayer = fixedLayer->hitTestLayer(fixedLayer->renderer().flowThreadContainingBlock()->layer(), nullptr, request, tempResult,
    47034697            hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);
    47044698
     
    47354729        return 0;
    47364730
     4731    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
     4732
    47374733    // Prevent hitting the fixed layers inside the flow thread when hitting through regions.
    4738     if (renderer().fixedPositionedWithNamedFlowContainingBlock() && hitTestLocation.region())
     4734    if (renderer().fixedPositionedWithNamedFlowContainingBlock() && namedFlowFragment)
    47394735        return 0;
    47404736
     
    47424738    // This is true as long as we clamp the range of a box to its containing block range.
    47434739    // FIXME: Fix hit testing with in-flow threads included in out-of-flow threads.
    4744     if (hitTestLocation.region()) {
    4745         ASSERT(hitTestLocation.region()->isValid());
    4746         RenderFlowThread* flowThread = hitTestLocation.region()->flowThread();
    4747         if (!flowThread->objectShouldFragmentInFlowRegion(&renderer(), hitTestLocation.region()))
     4740    if (namedFlowFragment) {
     4741        ASSERT(namedFlowFragment->isValid());
     4742        RenderFlowThread* flowThread = namedFlowFragment->flowThread();
     4743        if (!flowThread->objectShouldFragmentInFlowRegion(&renderer(), namedFlowFragment))
    47484744            return 0;
    47494745    }
     
    47584754        // Make sure the parent's clip rects have been calculated.
    47594755        if (parent()) {
    4760             ClipRectsContext clipRectsContext(rootLayer, hitTestLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
     4756            ClipRectsContext clipRectsContext(rootLayer, RootRelativeClipRects, IncludeOverlayScrollbarSize);
    47614757            ClipRect clipRect = backgroundClipRect(clipRectsContext);
    47624758            // Go ahead and test the enclosing clip now.
     
    48484844    // Collect the fragments. This will compute the clip rectangles for each layer fragment.
    48494845    LayerFragments layerFragments;
    4850     collectFragments(layerFragments, rootLayer, hitTestLocation.region(), hitTestRect, RootRelativeClipRects, IncludeOverlayScrollbarSize);
     4846    collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRects, IncludeOverlayScrollbarSize);
    48514847
    48524848    if (canResize() && hitTestResizerInFragments(layerFragments, hitTestLocation)) {
     
    49534949    LayoutPoint offsetOfPaginationLayerFromRoot;
    49544950    LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
    4955     enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestLocation.region(), hitTestRect,
     4951    enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect,
    49564952        RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
    49574953
     
    49674963            enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginationLayerFromRoot);
    49684964   
    4969             ClipRectsContext clipRectsContext(enclosingPaginationLayer(), hitTestLocation.region(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
     4965            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), RootRelativeClipRects, IncludeOverlayScrollbarSize);
    49704966            LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rect();
    49714967            parentClipRect.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot);
     
    51305126}
    51315127
    5132 void RenderLayer::mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment* namedFlowFragment, ClipRects& clipRects) const
    5133 {
    5134     ASSERT(namedFlowFragment && namedFlowFragment->parent() && namedFlowFragment->parent()->isRenderNamedFlowFragmentContainer());
    5135    
    5136     ClipRectsContext targetClipRectsContext(&namedFlowFragment->fragmentContainerLayer(), 0, TemporaryClipRects);
     5128bool RenderLayer::mapLayerClipRectsToFragmentationLayer(ClipRects& clipRects) const
     5129{
     5130    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
     5131    if (!namedFlowFragment)
     5132        return false;
     5133
     5134    ASSERT(namedFlowFragment->parent() && namedFlowFragment->parent()->isRenderNamedFlowFragmentContainer());
     5135   
     5136    CurrentRenderFlowThreadDisabler flowThreadDisabler(&renderer().view());
     5137    ClipRectsContext targetClipRectsContext(&namedFlowFragment->fragmentContainerLayer(), TemporaryClipRects);
    51375138    namedFlowFragment->fragmentContainerLayer().calculateClipRects(targetClipRectsContext, clipRects);
    51385139
     
    51545155    newPosClipRect.move(moveOffset);
    51555156    clipRects.setPosClipRect(newPosClipRect);
     5157
     5158    return true;
    51565159}
    51575160
     
    51675170    bool useCached = clipRectsType != TemporaryClipRects;
    51685171
    5169     if (renderer().isRenderNamedFlowThread() && clipRectsContext.region) {
    5170         mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
    5171         return;
    5172     }
     5172    if (renderer().isRenderNamedFlowThread() && mapLayerClipRectsToFragmentationLayer(clipRects))
     5173        return;
    51735174
    51745175    // For transformed layers, the root layer was shifted to be us, so there is no need to
     
    52165217       
    52175218        if (renderer().hasOverflowClip()) {
    5218             ClipRect newOverflowClip = toRenderBox(renderer()).overflowClipRectForChildLayers(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy);
     5219            ClipRect newOverflowClip = toRenderBox(renderer()).overflowClipRectForChildLayers(offset, currentRenderNamedFlowFragment(), clipRectsContext.overlayScrollbarSizeRelevancy);
    52195220            if (renderer().style().hasBorderRadius())
    52205221                newOverflowClip.setHasRadius(true);
     
    52245225        }
    52255226        if (renderer().hasClip()) {
    5226             LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, clipRectsContext.region);
     5227            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, currentRenderNamedFlowFragment());
    52275228            clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
    52285229            clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
     
    52355236{
    52365237    ASSERT(parent());
    5237     if (renderer().isRenderNamedFlowThread() && clipRectsContext.region) {
    5238         mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
    5239         return;
    5240     }
     5238    if (renderer().isRenderNamedFlowThread() && mapLayerClipRectsToFragmentationLayer(clipRects))
     5239        return;
    52415240
    52425241    if (clipRectsContext.clipRectsType == TemporaryClipRects) {
     
    53005299        convertToLayerCoords(clipRectsContext.rootLayer, offset);
    53015300
     5301
     5302    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    53025303    // If the view is scrolled, the flow thread is not scrolled with it and we should
    53035304    // take the scroll offset into account.
    5304     if (clipRectsContext.rootLayer->isOutOfFlowRenderFlowThread() && !clipRectsContext.region) {
     5305    if (clipRectsContext.rootLayer->isOutOfFlowRenderFlowThread() && !namedFlowFragment) {
    53055306        FloatPoint absPos = renderer().view().localToAbsolute(FloatPoint(), IsFixed);
    53065307        offset += LayoutSize(absPos.x(), absPos.y());
     
    53125313    outlineRect = backgroundRect;
    53135314
    5314     RenderFlowThread* flowThread = clipRectsContext.region ? clipRectsContext.region->flowThread() : 0;
     5315    RenderFlowThread* flowThread = namedFlowFragment ? namedFlowFragment->flowThread() : 0;
    53155316    if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread()) {
    5316         ASSERT(clipRectsContext.region->isValid());
     5317        ASSERT(namedFlowFragment->isValid());
    53175318        const RenderBoxModelObject& boxModelObject = toRenderBoxModelObject(renderer());
    5318         LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region->visualOverflowRectForBox(&boxModelObject);
     5319        LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment->visualOverflowRectForBox(&boxModelObject);
    53195320
    53205321        // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.
     
    53355336        foregroundRect = backgroundRect;
    53365337        outlineRect = backgroundRect;
    5337        
     5338
    53385339        // If the region does not clip its overflow, inflate the outline rect.
    5339         if (clipRectsContext.region->isRenderNamedFlowFragment()) {
    5340             if (!(clipRectsContext.region->parent()->hasOverflowClip() && (&toRenderNamedFlowFragment(clipRectsContext.region)->fragmentContainerLayer() != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)))
     5340        if (namedFlowFragment) {
     5341            if (!(namedFlowFragment->parent()->hasOverflowClip() && (&namedFlowFragment->fragmentContainerLayer() != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)))
    53415342                outlineRect.inflate(renderer().maximalOutlineSize(PaintPhaseOutline));
    53425343        }
     
    53475348        // This layer establishes a clip of some kind.
    53485349        if (renderer().hasOverflowClip() && (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) {
    5349             foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy));
     5350            foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(offset, namedFlowFragment, clipRectsContext.overlayScrollbarSizeRelevancy));
    53505351            if (renderer().style().hasBorderRadius())
    53515352                foregroundRect.setHasRadius(true);
     
    53545355        if (renderer().hasClip()) {
    53555356            // Clip applies to *us* as well, so go ahead and update the damageRect.
    5356             LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, clipRectsContext.region);
     5357            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(offset, namedFlowFragment);
    53575358            backgroundRect.intersect(newPosClip);
    53585359            foregroundRect.intersect(newPosClip);
     
    53665367            // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
    53675368            // individual region boxes as overflow.
    5368             LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region ? clipRectsContext.region->visualOverflowRectForBox(renderBox()) : renderBox()->visualOverflowRect();
     5369            LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment ? namedFlowFragment->visualOverflowRectForBox(renderBox()) : renderBox()->visualOverflowRect();
    53695370            renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
    53705371            layerBoundsWithVisualOverflow.moveBy(offset);
     
    53735374        } else {
    53745375            // Shift the bounds to be for our region only.
    5375             LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsContext.region);
    5376             if (clipRectsContext.region)
    5377                 bounds = clipRectsContext.region->rectFlowPortionForBox(renderBox(), bounds);
     5376            LayoutRect bounds = renderBox()->borderBoxRectInRegion(namedFlowFragment);
     5377            if (namedFlowFragment)
     5378                bounds = namedFlowFragment->rectFlowPortionForBox(renderBox(), bounds);
    53785379
    53795380            bounds.moveBy(offset);
     
    54035404    LayoutRect layerBounds;
    54045405    ClipRect backgroundRect, foregroundRect, outlineRect;
    5405     ClipRectsContext clipRectsContext(clippingRootLayer, 0, TemporaryClipRects);
     5406    ClipRectsContext clipRectsContext(clippingRootLayer, TemporaryClipRects);
    54065407    // Need to use temporary clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>).
    54075408    calculateRects(clipRectsContext, renderer().view().unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
     
    54165417    LayoutRect layerBounds;
    54175418    ClipRect backgroundRect, foregroundRect, outlineRect;
    5418     ClipRectsContext clipRectsContext(clippingRootLayer, 0, PaintingClipRects);
     5419    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
    54195420    calculateRects(clipRectsContext, renderer().view().documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
    54205421    return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox();
     
    54345435    LayoutRect layerBounds;
    54355436    ClipRect backgroundRect, foregroundRect, outlineRect;
    5436     ClipRectsContext clipRectsContext(clippingRootLayer, 0, PaintingClipRects);
     5437    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
    54375438    calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, &offsetFromRoot);
    54385439
     
    54435444    if (renderer().hasClip()) {
    54445445        // CSS clip may be larger than our border box.
    5445         LayoutRect cssClipRect = toRenderBox(renderer()).clipRect(offsetFromRoot, clipRectsContext.region);
     5446        LayoutRect cssClipRect = toRenderBox(renderer()).clipRect(offsetFromRoot, currentRenderNamedFlowFragment());
    54465447        clipExceedsBounds = !clipRect.contains(cssClipRect);
    54475448    }
     
    54775478    rect.move(-scrolledContentOffset());
    54785479    if (renderer().hasOverflowClip() && !usesCompositedScrolling())
    5479         rect.intersect(toRenderBox(renderer()).overflowClipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
     5480        rect.intersect(toRenderBox(renderer()).overflowClipRect(LayoutPoint(), nullptr)); // FIXME: Regions not accounted for.
    54805481    if (renderer().hasClip())
    5481         rect.intersect(toRenderBox(renderer()).clipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
     5482        rect.intersect(toRenderBox(renderer()).clipRect(LayoutPoint(), nullptr)); // FIXME: Regions not accounted for.
    54825483    if (!rect.isEmpty())
    54835484        renderer().repaintRectangle(rect);
    54845485}
    54855486
    5486 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot, RenderRegion* region, const LayoutRect* cachedBoundingBox) const
     5487bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot, const LayoutRect* cachedBoundingBox) const
    54875488{
    54885489    // Always examine the canvas and the root.
     
    55015502    }
    55025503
     5504    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    55035505    // When using regions, some boxes might have their frame rect relative to the flow thread, which could
    55045506    // cause the paint rejection algorithm to prevent them from painting when using different width regions.
    55055507    // e.g. an absolutely positioned box with bottom:0px and right:0px would have it's frameRect.x relative
    55065508    // to the flow thread, not the last region (in which it will end up because of bottom:0px)
    5507     if (region && renderer().flowThreadContainingBlock()) {
     5509    if (namedFlowFragment && renderer().flowThreadContainingBlock()) {
    55085510        LayoutRect b = layerBounds;
    5509         b.moveBy(region->visualOverflowRectForBox(toRenderBoxModelObject(&renderer())).location());
     5511        b.moveBy(namedFlowFragment->visualOverflowRectForBox(toRenderBoxModelObject(&renderer())).location());
    55105512        b.inflate(renderer().view().maximalOutlineSize());
    55115513        if (b.intersects(damageRect))
     
    56715673    if (RenderLayer* reflection = reflectionLayer()) {
    56725674        if (!reflection->isComposited()) {
    5673             LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
     5675            LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, nullptr, descendantFlags);
    56745676            unionBounds.unite(childUnionBounds);
    56755677        }
     
    56875689            RenderLayer* curLayer = negZOrderList->at(i);
    56885690            if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
    5689                 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
     5691                LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
    56905692                unionBounds.unite(childUnionBounds);
    56915693            }
     
    56995701            // The RenderNamedFlowThread is ignored when we calculate the bounds of the RenderView.
    57005702            if ((flags & IncludeCompositedDescendants || !curLayer->isComposited()) && !curLayer->isFlowThreadCollectingGraphicsLayersUnderRegions()) {
    5701                 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
     5703                LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
    57025704                unionBounds.unite(childUnionBounds);
    57035705            }
     
    57135715            ASSERT(!curLayer->isFlowThreadCollectingGraphicsLayersUnderRegions());
    57145716            if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
    5715                 LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
     5717                LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
    57165718                unionBounds.unite(curAbsBounds);
    57175719            }
     
    66876689    context->translate(adjustedPaintOffset.x(), adjustedPaintOffset.y());
    66886690
     6691    CurrentRenderFlowThreadMaintainer flowThreadMaintainer(toRenderFlowThread(&renderer()));
     6692    CurrentRenderRegionMaintainer regionMaintainer(*region);
     6693
    66896694    region->setRegionObjectsRegionStyle();
    6690     paint(context, paintDirtyRect, paintBehavior, 0, region, paintFlags | PaintLayerTemporaryClipRects);
     6695    paint(context, paintDirtyRect, paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects);
    66916696    region->restoreRegionObjectsOriginalStyle();
    66926697
     
    67836788
    67846789        // Make a new temporary HitTestLocation in the new region.
    6785         HitTestLocation newHitTestLocation(hitTestLocation, hitTestOffset, region);
     6790        HitTestLocation newHitTestLocation(hitTestLocation, hitTestOffset);
    67866791
    67876792        // Expand the hit-test rect to the flow thread's coordinate system.
     
    67896794        hitTestRectInFlowThread.move(hitTestOffset.width(), hitTestOffset.height());
    67906795        hitTestRectInFlowThread.expand(LayoutSize(fabs((double)hitTestOffset.width()), fabs((double)hitTestOffset.height())));
     6796
     6797        CurrentRenderFlowThreadMaintainer flowThreadMaintainer(flowThread);
     6798        CurrentRenderRegionMaintainer regionMaintainer(*region);
    67916799
    67926800        HitTestResult tempResult(result.hitTestLocation());
     
    68066814}
    68076815
     6816RenderNamedFlowFragment* RenderLayer::currentRenderNamedFlowFragment() const
     6817{
     6818    return renderer().currentRenderNamedFlowFragment();
     6819}
     6820
    68086821} // namespace WebCore
    68096822
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r168905 r168967  
    352352    RenderLayer* lastChild() const { return m_last; }
    353353
    354     void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0);
     354    void addChild(RenderLayer* newChild, RenderLayer* beforeChild = nullptr);
    355355    RenderLayer* removeChild(RenderLayer*);
    356356
     
    413413
    414414    // Scrolling methods for layers that can scroll their overflow.
    415     void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollableArea** scrolledArea = 0);
     415    void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollableArea** scrolledArea = nullptr);
    416416    void scrollToOffset(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped);
    417417    void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); }
     
    667667    // front.  The hitTest method looks for mouse events by walking
    668668    // layers that intersect the point from front to back.
    669     void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = 0,
    670         RenderNamedFlowFragment* = 0, PaintLayerFlags = 0);
     669    void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = nullptr, PaintLayerFlags = 0);
    671670    bool hitTest(const HitTestRequest&, HitTestResult&);
    672671    bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
    673     void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* subtreePaintRoot = 0);
     672    void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* subtreePaintRoot = nullptr);
    674673
    675674    void paintNamedFlowThreadInsideRegion(GraphicsContext*, RenderNamedFlowFragment*, LayoutRect, LayoutPoint, PaintBehavior = PaintBehaviorNormal, PaintLayerFlags = 0);
    676675
    677676    struct ClipRectsContext {
    678         ClipRectsContext(const RenderLayer* inRootLayer, RenderRegion* inRegion, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowClip)
     677        ClipRectsContext(const RenderLayer* inRootLayer, ClipRectsType inClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip inRespectOverflowClip = RespectOverflowClip)
    679678            : rootLayer(inRootLayer)
    680             , region(inRegion)
    681679            , clipRectsType(inClipRectsType)
    682680            , overlayScrollbarSizeRelevancy(inOverlayScrollbarSizeRelevancy)
     
    684682        { }
    685683        const RenderLayer* rootLayer;
    686         RenderRegion* region;
    687684        ClipRectsType clipRectsType;
    688685        OverlayScrollbarSizeRelevancy overlayScrollbarSizeRelevancy;
     
    695692    // Pass offsetFromRoot if known.
    696693    void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
    697         ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutPoint* offsetFromRoot = 0) const;
     694        ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutPoint* offsetFromRoot = nullptr) const;
    698695
    699696    // Compute and cache clip rects computed with the given layer as the root
     
    714711
    715712    // Pass offsetFromRoot if known.
    716     bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0, RenderRegion* = 0, const LayoutRect* cachedBoundingBox = 0) const;
     713    bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = nullptr, const LayoutRect* cachedBoundingBox = nullptr) const;
    717714
    718715    enum CalculateLayerBoundsFlag {
     
    729726
    730727    // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
    731     LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutPoint* offsetFromRoot = 0) const;
     728    LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutPoint* offsetFromRoot = nullptr) const;
    732729    // Bounding box in the coordinates of this layer.
    733730    LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
     
    749746
    750747    // Can pass offsetFromRoot if known.
    751     LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
     748    LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = nullptr, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
    752749   
    753750    // WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects.
     
    907904    void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<const RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIteration);
    908905
    909     void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = 0);
     906    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = nullptr);
    910907    void computeRepaintRectsIncludingDescendants();
    911908    void clearRepaintRects();
     
    932929    bool updateLayerPosition();
    933930
    934     void updateLayerPositions(RenderGeometryMap* = 0, UpdateLayerPositionsFlags = defaultFlags);
     931    void updateLayerPositions(RenderGeometryMap* = nullptr, UpdateLayerPositionsFlags = defaultFlags);
    935932
    936933    enum UpdateLayerPositionsAfterScrollFlag {
     
    964961
    965962    struct LayerPaintingInfo {
    966         LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = 0, RenderNamedFlowFragment* namedFlowFragment = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)
     963        LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)
    967964            : rootLayer(inRootLayer)
    968965            , subtreePaintRoot(inSubtreePaintRoot)
    969966            , paintDirtyRect(inDirtyRect)
    970967            , subPixelAccumulation(inSubPixelAccumulation)
    971             , renderNamedFlowFragment(namedFlowFragment)
    972968            , overlapTestRequests(inOverlapTestRequests)
    973969            , paintBehavior(inPaintBehavior)
     
    978974        LayoutRect paintDirtyRect; // relative to rootLayer;
    979975        LayoutSize subPixelAccumulation;
    980         RenderNamedFlowFragment* renderNamedFlowFragment; // May be null.
    981976        OverlapTestRequestMap* overlapTestRequests; // May be null.
    982977        PaintBehavior paintBehavior;
     
    998993    void paintList(Vector<RenderLayer*>*, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
    999994
    1000     void collectFragments(LayerFragments&, const RenderLayer* rootLayer, RenderRegion*, const LayoutRect& dirtyRect,
     995    void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
    1001996        ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
    1002         ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0, const LayoutRect* layerBoundingBox = 0, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
     997        ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = nullptr, const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
    1003998    void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo&, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot);
    1004999    void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, GraphicsContext* transparencyLayerContext,
     
    10141009
    10151010    RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
    1016                               const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
    1017                               const HitTestingTransformState* transformState = 0, double* zOffset = 0);
     1011        const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
     1012        const HitTestingTransformState* = nullptr, double* zOffset = nullptr);
    10181013    RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&, HitTestResult&,
    1019         const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = 0, double* zOffset = 0,
     1014        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = nullptr, double* zOffset = nullptr,
    10201015        const LayoutPoint& translationOffset = LayoutPoint());
    10211016    RenderLayer* hitTestList(Vector<RenderLayer*>*, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
    1022                              const LayoutRect& hitTestRect, const HitTestLocation&,
    1023                              const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset,
    1024                              const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
     1017        const LayoutRect& hitTestRect, const HitTestLocation&,
     1018        const HitTestingTransformState*, double* zOffsetForDescendants, double* zOffset,
     1019        const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
    10251020
    10261021    RenderLayer* hitTestFixedLayersInNamedFlows(RenderLayer* rootLayer,
     
    10331028
    10341029    PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
    1035                             const LayoutRect& hitTestRect, const HitTestLocation&,
    1036                             const HitTestingTransformState* containerTransformState,
    1037                             const LayoutPoint& translationOffset = LayoutPoint()) const;
     1030        const LayoutRect& hitTestRect, const HitTestLocation&,
     1031        const HitTestingTransformState* containerTransformState,
     1032        const LayoutPoint& translationOffset = LayoutPoint()) const;
    10381033   
    10391034    bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const HitTestLocation&, HitTestFilter) const;
     
    10411036    bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&) const;
    10421037    RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&, HitTestResult&,
    1043         const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = 0, double* zOffset = 0);
     1038        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = nullptr, double* zOffset = nullptr);
    10441039
    10451040    bool listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer*>*, const LayoutRect&) const;
     
    11031098    void setAncestorChainHasVisibleDescendant();
    11041099
    1105     void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks = 0);
     1100    void updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks = nullptr);
    11061101    bool checkIfDescendantClippingContextNeedsUpdate(bool isClipping);
    11071102
     
    11911186        double* zOffset, const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
    11921187    void paintFlowThreadIfRegionForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
    1193     void mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment*, ClipRects&) const;
     1188    bool mapLayerClipRectsToFragmentationLayer(ClipRects&) const;
     1189
     1190    RenderNamedFlowFragment* currentRenderNamedFlowFragment() const;
    11941191
    11951192private:
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r168905 r168967  
    461461
    462462        if (&m_owningLayer != rootLayer)
    463             clippingBounds.intersect(m_owningLayer.backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
     463            clippingBounds.intersect(m_owningLayer.backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
    464464
    465465        LayoutPoint delta;
     
    777777        // for a compositing layer, rootLayer is the layer itself.
    778778        ShouldRespectOverflowClip shouldRespectOverflowClip = compAncestor->isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip;
    779         RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
     779        RenderLayer::ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip);
    780780        LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions.
    781781        ASSERT(parentClipRect != LayoutRect::infiniteRect());
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r168905 r168967  
    10201020    }
    10211021
    1022     IntRect clipRect = pixelSnappedIntRect(layer.backgroundClipRect(RenderLayer::ClipRectsContext(&rootRenderLayer(), 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
     1022    IntRect clipRect = pixelSnappedIntRect(layer.backgroundClipRect(RenderLayer::ClipRectsContext(&rootRenderLayer(), AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
    10231023
    10241024    // On iOS, pageScaleFactor() is not applied by RenderView, so we should not scale here.
     
    23372337    }
    23382338
    2339     return layer.backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRoot, 0, TemporaryClipRects)).rect() != LayoutRect::infiniteRect(); // FIXME: Incorrect for CSS regions.
     2339    return layer.backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRoot, TemporaryClipRects)).rect() != LayoutRect::infiniteRect(); // FIXME: Incorrect for CSS regions.
    23402340}
    23412341
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r168905 r168967  
    5555#include "RenderLayer.h"
    5656#include "RenderLayerBacking.h"
    57 #include "RenderNamedFlowThread.h"
     57#include "RenderNamedFlowFragment.h"
     58#include "RenderNamedFlowThread.h"
    5859#include "RenderSVGResourceContainer.h"
    5960#include "RenderScrollbarPart.h"
     
    24742475}
    24752476
     2477RenderNamedFlowFragment* RenderObject::currentRenderNamedFlowFragment() const
     2478{
     2479    if (flowThreadState() == NotInsideFlowThread)
     2480        return nullptr;
     2481
     2482    RenderFlowThread* flowThread = view().flowThreadController().currentRenderFlowThread();
     2483    if (!flowThread)
     2484        return nullptr;
     2485
     2486    ASSERT(flowThread == flowThreadContainingBlock());
     2487
     2488    // FIXME: Once regions are fully integrated with the compositing system we should uncomment this assert.
     2489    // This assert needs to be disabled because it's possible to ask for the ancestor clipping rectangle of
     2490    // a layer without knowing the containing region in advance.
     2491    // ASSERT(flowThread->currentRegion() && flowThread->currentRegion()->isRenderNamedFlowFragment());
     2492
     2493    RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(flowThread->currentRegion());
     2494    return namedFlowFragment;
     2495}
     2496
    24762497} // namespace WebCore
    24772498
  • trunk/Source/WebCore/rendering/RenderObject.h

    r168905 r168967  
    218218        return locateFlowThreadContainingBlock();
    219219    }
     220
     221    RenderNamedFlowFragment* currentRenderNamedFlowFragment() const;
    220222
    221223    // FIXME: The meaning of this function is unclear.
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r168905 r168967  
    207207        return false;
    208208   
     209    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    209210    // Check our region range to make sure we need to be painting in this region.
    210     if (paintInfo.renderNamedFlowFragment && !paintInfo.renderNamedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(this, paintInfo.renderNamedFlowFragment))
     211    if (namedFlowFragment && !namedFlowFragment->flowThread()->objectShouldFragmentInFlowRegion(this, namedFlowFragment))
    211212        return false;
    212213
  • trunk/Source/WebCore/rendering/RenderReplica.cpp

    r168905 r168967  
    7575        // computing using the wrong rootLayer
    7676        RenderLayer* rootPaintingLayer = layer()->transform() ? layer()->parent() : layer()->enclosingTransformedAncestor();
    77         RenderLayer::LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0, paintInfo.renderNamedFlowFragment);
     77        RenderLayer::LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0);
    7878        RenderLayer::PaintLayerFlags flags = RenderLayer::PaintLayerHaveTransparency | RenderLayer::PaintLayerAppliedTransform | RenderLayer::PaintLayerTemporaryClipRects | RenderLayer::PaintLayerPaintingReflection;
    7979        layer()->parent()->paintLayer(paintInfo.context, paintingInfo, flags);
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r168905 r168967  
    3838#include "RenderIterator.h"
    3939#include "RenderLayer.h"
     40#include "RenderNamedFlowFragment.h"
    4041#include "RenderTableCaption.h"
    4142#include "RenderTableCell.h"
     
    14941495
    14951496    // Check kids first.
    1496     if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region()))) {
     1497    if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(adjustedLocation, currentRenderNamedFlowFragment()))) {
    14971498        for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
    14981499            if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r168905 r168967  
    3030#include "HTMLNames.h"
    3131#include "PaintInfo.h"
     32#include "RenderNamedFlowFragment.h"
    3233#include "RenderTableCell.h"
    3334#include "RenderTableCol.h"
     
    14951496    LayoutPoint adjustedLocation = accumulatedOffset + location();
    14961497
    1497     if (hasOverflowClip() && !locationInContainer.intersects(overflowClipRect(adjustedLocation, locationInContainer.region())))
     1498    if (hasOverflowClip() && !locationInContainer.intersects(overflowClipRect(adjustedLocation, currentRenderNamedFlowFragment())))
    14981499        return false;
    14991500
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r168905 r168967  
    742742    LayoutRect layerBounds;
    743743    ClipRect damageRect, clipRectToApply, outlineRect;
    744     l->calculateRects(RenderLayer::ClipRectsContext(rootLayer, 0, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
     744    l->calculateRects(RenderLayer::ClipRectsContext(rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
    745745
    746746    // Ensure our lists are up-to-date.
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r168905 r168967  
    174174void RootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
    175175{
     176    RenderNamedFlowFragment* namedFlowFragment = renderer().currentRenderNamedFlowFragment();
     177
    176178    // Check if we are in the correct region.
    177     if (paintInfo.renderNamedFlowFragment) {
     179    if (namedFlowFragment) {
    178180        RenderRegion* region = containingRegion();
    179         if (region && region != reinterpret_cast<RenderRegion*>(paintInfo.renderNamedFlowFragment))
     181        if (region && region != reinterpret_cast<RenderRegion*>(namedFlowFragment))
    180182            return;
    181183    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r168905 r168967  
    265265    // Apply initial viewport clip
    266266    if (shouldApplyViewportClip())
    267         childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset, paintInfo.renderNamedFlowFragment)));
     267        childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset, currentRenderNamedFlowFragment())));
    268268
    269269    // Convert from container offsets (html renderers) to a relative transform (svg renderers).
Note: See TracChangeset for help on using the changeset viewer.