Changeset 164482 in webkit


Ignore:
Timestamp:
Feb 21, 2014 7:29:49 AM (10 years ago)
Author:
stavila@adobe.com
Message:

[CSS Regions] Use the named-flow-specific object RenderNamedFlowFragment instead of the generic RenderRegion whenever possible
https://bugs.webkit.org/show_bug.cgi?id=128599

Reviewed by Andrei Bucur.

Use the named flow specific RenderNamedFlowFragment instead of the generic RenderRegion, whenever possible.
Move named flow specific methods from RenderRegion to RenderNamedFlowFragment.

No new tests required.

  • dom/Element.cpp:

(WebCore::Element::renderNamedFlowFragment):
(WebCore::Element::webkitRegionOverset):
(WebCore::Element::webkitGetRegionFlowRanges):

  • dom/Element.h:
  • inspector/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::buildArrayForRegions):

  • rendering/PaintInfo.h:

(WebCore::PaintInfo::PaintInfo):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::pushContentsClip):
(WebCore::RenderBox::layoutOverflowRectForPropagation):

  • rendering/RenderBox.h:
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • rendering/RenderBoxModelObject.h:
  • rendering/RenderInline.h:
  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::paint):
(WebCore::RenderLayer::paintLayer):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintLayerByApplyingTransform):
(WebCore::RenderLayer::updatePaintingInfoForFragments):
(WebCore::RenderLayer::paintTransformedLayerIntoFragments):
(WebCore::RenderLayer::paintBackgroundForFragments):
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
(WebCore::RenderLayer::paintOutlineForFragments):
(WebCore::RenderLayer::paintMaskForFragments):
(WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderLayer.h:
  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::getRanges):

  • rendering/RenderNamedFlowFragment.h:
  • rendering/RenderNamedFlowThread.cpp:

(WebCore::RenderNamedFlowThread::updateWritingMode):
(WebCore::compareRenderNamedFlowFragments):
(WebCore::addFragmentToList):
(WebCore::RenderNamedFlowThread::addFragmentToNamedFlowThread):
(WebCore::RenderNamedFlowThread::addRegionToThread):
(WebCore::RenderNamedFlowThread::removeRegionFromThread):
(WebCore::RenderNamedFlowThread::computeOversetStateForRegions):
(WebCore::RenderNamedFlowThread::checkInvalidRegions):
(WebCore::RenderNamedFlowThread::getRanges):
(WebCore::RenderNamedFlowThread::checkRegionsWithStyling):
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):

  • rendering/RenderNamedFlowThread.h:
  • rendering/RenderRegion.cpp:
  • rendering/RenderRegion.h:
  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::shouldPaint):

  • rendering/RenderReplica.cpp:

(WebCore::RenderReplica::paint):

  • 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

    r164481 r164482  
     12014-02-21  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Use the named-flow-specific object RenderNamedFlowFragment instead of the generic RenderRegion whenever possible
     4        https://bugs.webkit.org/show_bug.cgi?id=128599
     5
     6        Reviewed by Andrei Bucur.
     7
     8        Use the named flow specific RenderNamedFlowFragment instead of the generic RenderRegion, whenever possible.
     9        Move named flow specific methods from RenderRegion to RenderNamedFlowFragment.
     10
     11        No new tests required.
     12
     13        * dom/Element.cpp:
     14        (WebCore::Element::renderNamedFlowFragment):
     15        (WebCore::Element::webkitRegionOverset):
     16        (WebCore::Element::webkitGetRegionFlowRanges):
     17        * dom/Element.h:
     18        * inspector/InspectorCSSAgent.cpp:
     19        (WebCore::InspectorCSSAgent::buildArrayForRegions):
     20        * rendering/PaintInfo.h:
     21        (WebCore::PaintInfo::PaintInfo):
     22        * rendering/RenderBlock.cpp:
     23        (WebCore::RenderBlock::paint):
     24        (WebCore::RenderBlock::paintObject):
     25        * rendering/RenderBox.cpp:
     26        (WebCore::RenderBox::paintBoxDecorations):
     27        (WebCore::RenderBox::pushContentsClip):
     28        (WebCore::RenderBox::layoutOverflowRectForPropagation):
     29        * rendering/RenderBox.h:
     30        * rendering/RenderBoxModelObject.cpp:
     31        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
     32        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     33        * rendering/RenderBoxModelObject.h:
     34        * rendering/RenderInline.h:
     35        * rendering/RenderLayer.cpp:
     36        (WebCore::RenderLayer::paint):
     37        (WebCore::RenderLayer::paintLayer):
     38        (WebCore::RenderLayer::paintLayerContents):
     39        (WebCore::RenderLayer::paintLayerByApplyingTransform):
     40        (WebCore::RenderLayer::updatePaintingInfoForFragments):
     41        (WebCore::RenderLayer::paintTransformedLayerIntoFragments):
     42        (WebCore::RenderLayer::paintBackgroundForFragments):
     43        (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
     44        (WebCore::RenderLayer::paintOutlineForFragments):
     45        (WebCore::RenderLayer::paintMaskForFragments):
     46        (WebCore::RenderLayer::mapLayerClipRectsToFragmentationLayer):
     47        (WebCore::RenderLayer::calculateClipRects):
     48        * rendering/RenderLayer.h:
     49        * rendering/RenderNamedFlowFragment.cpp:
     50        (WebCore::RenderNamedFlowFragment::getRanges):
     51        * rendering/RenderNamedFlowFragment.h:
     52        * rendering/RenderNamedFlowThread.cpp:
     53        (WebCore::RenderNamedFlowThread::updateWritingMode):
     54        (WebCore::compareRenderNamedFlowFragments):
     55        (WebCore::addFragmentToList):
     56        (WebCore::RenderNamedFlowThread::addFragmentToNamedFlowThread):
     57        (WebCore::RenderNamedFlowThread::addRegionToThread):
     58        (WebCore::RenderNamedFlowThread::removeRegionFromThread):
     59        (WebCore::RenderNamedFlowThread::computeOversetStateForRegions):
     60        (WebCore::RenderNamedFlowThread::checkInvalidRegions):
     61        (WebCore::RenderNamedFlowThread::getRanges):
     62        (WebCore::RenderNamedFlowThread::checkRegionsWithStyling):
     63        (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
     64        * rendering/RenderNamedFlowThread.h:
     65        * rendering/RenderRegion.cpp:
     66        * rendering/RenderRegion.h:
     67        * rendering/RenderReplaced.cpp:
     68        (WebCore::RenderReplaced::shouldPaint):
     69        * rendering/RenderReplica.cpp:
     70        (WebCore::RenderReplica::paint):
     71        * rendering/RootInlineBox.cpp:
     72        (WebCore::RootInlineBox::paint):
     73        * rendering/svg/RenderSVGRoot.cpp:
     74        (WebCore::RenderSVGRoot::paintReplaced):
     75
    1762014-02-21  Andrei Bucur  <abucur@adobe.com>
    277
  • trunk/Source/WebCore/dom/Element.cpp

    r164195 r164482  
    25502550}
    25512551
    2552 RenderRegion* Element::renderRegion() const
     2552RenderNamedFlowFragment* Element::renderNamedFlowFragment() const
    25532553{
    25542554    if (renderer() && renderer()->isRenderNamedFlowFragmentContainer())
    25552555        return toRenderBlockFlow(renderer())->renderNamedFlowFragment();
    25562556
    2557     return 0;
     2557    return nullptr;
    25582558}
    25592559
     
    25812581
    25822582    DEFINE_STATIC_LOCAL(AtomicString, undefinedState, ("undefined", AtomicString::ConstructFromLiteral));
    2583     if (!document().cssRegionsEnabled() || !renderRegion())
     2583    if (!document().cssRegionsEnabled() || !renderNamedFlowFragment())
    25842584        return undefinedState;
    25852585
    2586     switch (renderRegion()->regionOversetState()) {
     2586    switch (renderNamedFlowFragment()->regionOversetState()) {
    25872587    case RegionFit: {
    25882588        DEFINE_STATIC_LOCAL(AtomicString, fitState, ("fit", AtomicString::ConstructFromLiteral));
     
    26132613    document().updateLayoutIgnorePendingStylesheets();
    26142614    if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) {
    2615         RenderNamedFlowFragment* region = toRenderBlockFlow(renderer())->renderNamedFlowFragment();
    2616         if (region->isValid())
    2617             region->getRanges(rangeObjects);
     2615        RenderNamedFlowFragment* namedFlowFragment = toRenderBlockFlow(renderer())->renderNamedFlowFragment();
     2616        if (namedFlowFragment->isValid())
     2617            namedFlowFragment->getRanges(rangeObjects);
    26182618    }
    26192619
  • trunk/Source/WebCore/dom/Element.h

    r164248 r164482  
    4848class PlatformWheelEvent;
    4949class PseudoElement;
    50 class RenderRegion;
     50class RenderNamedFlowFragment;
    5151class ShadowRoot;
    5252
     
    527527    PassRef<RenderStyle> styleForRenderer();
    528528
    529     RenderRegion* renderRegion() const;
     529    RenderNamedFlowFragment* renderNamedFlowFragment() const;
    530530
    531531#if ENABLE(CSS_REGIONS)
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r164245 r164482  
    4949#include "Node.h"
    5050#include "NodeList.h"
    51 #include "RenderRegion.h"
     51#include "RenderNamedFlowFragment.h"
    5252#include "SVGStyleElement.h"
    5353#include "StyleProperties.h"
     
    11971197        Inspector::TypeBuilder::CSS::Region::RegionOverset::Enum regionOverset;
    11981198
    1199         switch (toElement(regionList->item(i))->renderRegion()->regionOversetState()) {
     1199        switch (toElement(regionList->item(i))->renderNamedFlowFragment()->regionOversetState()) {
    12001200        case RegionFit:
    12011201            regionOverset = Inspector::TypeBuilder::CSS::Region::RegionOverset::Fit;
  • trunk/Source/WebCore/rendering/PaintInfo.h

    r163440 r164482  
    4141class RenderInline;
    4242class RenderLayerModelObject;
     43class RenderNamedFlowFragment;
    4344class RenderObject;
    44 class RenderRegion;
    4545
    4646typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
     
    5252struct PaintInfo {
    5353    PaintInfo(GraphicsContext* newContext, const LayoutRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
    54         RenderObject* newSubtreePaintRoot = nullptr, RenderRegion* region = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr,
     54        RenderObject* newSubtreePaintRoot = nullptr, RenderNamedFlowFragment* namedFlowFragment = nullptr, ListHashSet<RenderInline*>* newOutlineObjects = nullptr,
    5555        OverlapTestRequestMap* overlapTestRequests = nullptr, const RenderLayerModelObject* newPaintContainer = nullptr)
    56         : context(newContext)
    57         , rect(newRect)
    58         , phase(newPhase)
    59         , paintBehavior(newPaintBehavior)
    60         , subtreePaintRoot(newSubtreePaintRoot)
    61         , renderRegion(region)
    62         , outlineObjects(newOutlineObjects)
    63         , overlapTestRequests(overlapTestRequests)
    64         , paintContainer(newPaintContainer)
     56            : context(newContext)
     57            , rect(newRect)
     58            , phase(newPhase)
     59            , paintBehavior(newPaintBehavior)
     60            , subtreePaintRoot(newSubtreePaintRoot)
     61            , renderNamedFlowFragment(namedFlowFragment)
     62            , outlineObjects(newOutlineObjects)
     63            , overlapTestRequests(overlapTestRequests)
     64            , paintContainer(newPaintContainer)
    6565    {
    6666    }
     
    108108    PaintBehavior paintBehavior;
    109109    RenderObject* subtreePaintRoot; // used to draw just one element and its visual children
    110     RenderRegion* renderRegion;
     110    RenderNamedFlowFragment* renderNamedFlowFragment;
    111111    ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
    112112    OverlapTestRequestMap* overlapTestRequests;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r164006 r164482  
    19981998
    19991999    // Check our region range to make sure we need to be painting in this region.
    2000     if (paintInfo.renderRegion && !paintInfo.renderRegion->flowThread()->objectShouldPaintInFlowRegion(this, paintInfo.renderRegion))
     2000    if (paintInfo.renderNamedFlowFragment && !paintInfo.renderNamedFlowFragment->flowThread()->objectShouldPaintInFlowRegion(this, paintInfo.renderNamedFlowFragment))
    20012001        return;
    20022002
     
    20052005    // paints the root's background.
    20062006    if (!isRoot()) {
    2007         LayoutRect overflowBox = overflowRectForPaintRejection(paintInfo.renderRegion);
     2007        LayoutRect overflowBox = overflowRectForPaintRejection(paintInfo.renderNamedFlowFragment);
    20082008        flipForWritingMode(overflowBox);
    20092009        overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
     
    23022302            bool didClipToRegion = false;
    23032303           
    2304             if (paintInfo.paintContainer && paintInfo.renderRegion && paintInfo.paintContainer->isRenderFlowThread()) {
     2304            if (paintInfo.paintContainer && paintInfo.renderNamedFlowFragment && paintInfo.paintContainer->isRenderFlowThread()) {
    23052305                // If this box goes beyond the current region, then make sure not to overflow the region.
    23062306                // This (overflowing region X altough also fragmented to region X+1) could happen when one of this box's children
     
    23112311                didClipToRegion = true;
    23122312
    2313                 paintInfo.context->clip(toRenderFlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInRegion(*this, *paintInfo.renderRegion));
     2313                paintInfo.context->clip(toRenderFlowThread(paintInfo.paintContainer)->decorationsClipRectForBoxInRegion(*this, *paintInfo.renderNamedFlowFragment));
    23142314            }
    23152315
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r164471 r164482  
    5151#include "RenderLayer.h"
    5252#include "RenderLayerCompositor.h"
    53 #include "RenderRegion.h"
     53#include "RenderNamedFlowFragment.h"
    5454#include "RenderTableCell.h"
    5555#include "RenderTheme.h"
     
    11871187        return;
    11881188
    1189     LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderRegion);
     1189    LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderNamedFlowFragment);
    11901190    paintRect.moveBy(paintOffset);
    11911191
     
    16461646        paintInfo.phase = PaintPhaseChildBlockBackgrounds;
    16471647    }
    1648     IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion, IgnoreOverlayScrollbarSize, paintInfo.phase));
     1648    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderNamedFlowFragment, IgnoreOverlayScrollbarSize, paintInfo.phase));
    16491649    paintInfo.context->save();
    16501650    if (style().hasBorderRadius())
     
    45224522}
    45234523
    4524 LayoutRect RenderBox::overflowRectForPaintRejection(RenderRegion* region) const
     4524LayoutRect RenderBox::overflowRectForPaintRejection(RenderNamedFlowFragment* namedFlowFragment) const
    45254525{
    45264526    LayoutRect overflowRect = visualOverflowRect();
     
    45304530    // e.g. an absolutely positioned box with bottom:0px and right:0px would have it's frameRect.x relative
    45314531    // to the flow thread, not the last region (in which it will end up because of bottom:0px)
    4532     if (region) {
    4533         if (RenderFlowThread* flowThread = region->flowThread()) {
     4532    if (namedFlowFragment) {
     4533        if (RenderFlowThread* flowThread = namedFlowFragment->flowThread()) {
    45344534            RenderRegion* startRegion = 0;
    45354535            RenderRegion* endRegion = 0;
     
    45374537
    45384538            if (startRegion && endRegion)
    4539                 overflowRect.unite(region->visualOverflowRectForBox(this));
     4539                overflowRect.unite(namedFlowFragment->visualOverflowRectForBox(this));
    45404540        }
    45414541    }
  • trunk/Source/WebCore/rendering/RenderBox.h

    r163793 r164482  
    192192    LayoutUnit logicalRightVisualOverflow() const { return style().isHorizontalWritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); }
    193193
    194     LayoutRect overflowRectForPaintRejection(RenderRegion*) const;
     194    LayoutRect overflowRectForPaintRejection(RenderNamedFlowFragment*) const;
    195195   
    196196    void addLayoutOverflow(const LayoutRect&);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r164474 r164482  
    571571}
    572572
    573 void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect, RenderRegion* region)
     573void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect, RenderNamedFlowFragment* namedFlowFragment)
    574574{
    575575    GraphicsContext* maskImageContext = maskImage->context();
     
    578578    // Now add the text to the clip. We do this by painting using a special paint phase that signals to
    579579    // InlineTextBoxes that they should just add their contents to the clip.
    580     PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, region);
     580    PaintInfo info(maskImageContext, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, namedFlowFragment);
    581581    if (box) {
    582582        const RootInlineBox& rootBox = box->root();
     
    690690        // Clip to the overflow area.
    691691        RenderBox* thisBox = toRenderBox(this);
    692         context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.renderRegion));
     692        context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.renderNamedFlowFragment));
    693693       
    694694        // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
     
    725725        if (!maskImage)
    726726            return;
    727         paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect, paintInfo.renderRegion);
     727        paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect, paintInfo.renderNamedFlowFragment);
    728728
    729729        // The mask has been created.  Now we just need to clip to it.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r164441 r164482  
    5555class InlineFlowBox;
    5656class KeyframeList;
     57class RenderNamedFlowFragment;
    5758class RenderTextFragment;
    5859class StickyPositionViewportConstraints;
     
    341342                            float thickness, float drawThickness, BoxSide, const RenderStyle*,
    342343                            Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
    343     void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&, RenderRegion*);
     344    void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&, RenderNamedFlowFragment*);
    344345};
    345346
  • trunk/Source/WebCore/rendering/RenderInline.h

    r162795 r164482  
    3131
    3232class Position;
     33class RenderRegion;
    3334
    3435class RenderInline : public RenderBoxModelObject {
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r164481 r164482  
    35293529}
    35303530
    3531 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, RenderRegion* region, PaintLayerFlags paintFlags)
     3531void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, RenderNamedFlowFragment* namedFlowFragment, PaintLayerFlags paintFlags)
    35323532{
    35333533    OverlapTestRequestMap overlapTestRequests;
    35343534
    3535     LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, region, &overlapTestRequests);
     3535    LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, namedFlowFragment, &overlapTestRequests);
    35363536    paintLayer(context, paintingInfo, paintFlags);
    35373537
     
    36783678    // FIXME: Hack to disable region information for in flow threads. Implement this logic in a different way.
    36793679    LayerPaintingInfo& info = const_cast<LayerPaintingInfo&>(paintingInfo);
    3680     RenderRegion* region = info.region;
    3681     if (region) {
     3680    RenderNamedFlowFragment* namedFlowFragment = info.renderNamedFlowFragment;
     3681    if (namedFlowFragment) {
    36823682        if (enclosingPaginationLayer())
    3683             info.region = 0;
     3683            info.renderNamedFlowFragment = nullptr;
    36843684        else {
    3685             RenderFlowThread* flowThread = region->flowThread();
     3685            RenderFlowThread* flowThread = namedFlowFragment->flowThread();
    36863686            ASSERT(flowThread);
    36873687
    3688             if (!flowThread->objectShouldPaintInFlowRegion(&renderer(), region))
     3688            if (!flowThread->objectShouldPaintInFlowRegion(&renderer(), namedFlowFragment))
    36893689                return;
    36903690        }
     
    36993699        // If the transform can't be inverted, then don't paint anything.
    37003700        if (!layerTransform.isInvertible()) {
    3701             info.region = region;
     3701            info.renderNamedFlowFragment = namedFlowFragment;
    37023702            return;
    37033703        }
     
    37143714        if (enclosingPaginationLayer()) {
    37153715            paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags);
    3716             info.region = region;
     3716            info.renderNamedFlowFragment = namedFlowFragment;
    37173717            return;
    37183718        }
     
    37213721        ClipRect clipRect = paintingInfo.paintDirtyRect;
    37223722        if (parent()) {
    3723             ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
     3723            ClipRectsContext clipRectsContext(paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
    37243724                IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
    37253725            clipRect = backgroundClipRect(clipRectsContext);
     
    37363736            parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
    37373737
    3738         info.region = region;
     3738        info.renderNamedFlowFragment = namedFlowFragment;
    37393739        return;
    37403740    }
    37413741   
    37423742    paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
    3743     info.region = region;
     3743    info.renderNamedFlowFragment = namedFlowFragment;
    37443744}
    37453745
     
    40574057            paintDirtyRect = selfClipRect();
    40584058        }
    4059         collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.region, paintDirtyRect,
     4059        collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.renderNamedFlowFragment, paintDirtyRect,
    40604060            (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    40614061            (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot);
     
    41494149    // Now do a paint with the root layer shifted to be us.
    41504150    LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior,
    4151         adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.region, paintingInfo.overlapTestRequests);
     4151        adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.renderNamedFlowFragment, paintingInfo.overlapTestRequests);
    41524152    paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
    41534153}
     
    42584258        if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
    42594259            LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginationOffset;
    4260             fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot, localPaintingInfo.region);
     4260            fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot, localPaintingInfo.renderNamedFlowFragment);
    42614261        }
    42624262    }
     
    42684268    LayoutPoint offsetOfPaginationLayerFromRoot;
    42694269    LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.paintBehavior);
    4270     enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect,
     4270    enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.renderNamedFlowFragment, paintingInfo.paintDirtyRect,
    42714271        (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    42724272        (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
     
    42834283            enclosingPaginationLayer()->convertToLayerCoords(paintingInfo.rootLayer, offsetOfPaginationLayerFromRoot);
    42844284   
    4285             ClipRectsContext clipRectsContext(enclosingPaginationLayer(), paintingInfo.region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
     4285            ClipRectsContext clipRectsContext(enclosingPaginationLayer(), paintingInfo.renderNamedFlowFragment, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
    42864286                IgnoreOverlayScrollbarSize, (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
    42874287            LayoutRect parentClipRect = backgroundClipRect(clipRectsContext).rect();
     
    43174317        // Paint the background.
    43184318        // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
    4319         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4319        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
    43204320        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
    43214321
     
    43904390            clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
    43914391   
    4392         PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4392        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
    43934393        if (phase == PaintPhaseForeground)
    43944394            paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
     
    44094409   
    44104410        // Paint our own outline
    4411         PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4411        PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
    44124412        clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
    44134413        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
     
    44294429        // Paint the mask.
    44304430        // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
    4431         PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
     4431        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.renderNamedFlowFragment, 0, 0, &localPaintingInfo.rootLayer->renderer());
    44324432        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
    44334433       
     
    52465246}
    52475247
    5248 void RenderLayer::mapLayerClipRectsToFragmentationLayer(RenderRegion* region, ClipRects& clipRects) const
    5249 {
    5250     ASSERT(region && region->isRenderNamedFlowFragment() && region->parent() && region->parent()->isRenderNamedFlowFragmentContainer());
    5251    
    5252     RenderNamedFlowFragment* flowFragment = toRenderNamedFlowFragment(region);
    5253 
    5254     ClipRectsContext targetClipRectsContext(&flowFragment->fragmentContainerLayer(), 0, TemporaryClipRects);
    5255     flowFragment->fragmentContainerLayer().calculateClipRects(targetClipRectsContext, clipRects);
    5256 
    5257     LayoutRect flowThreadPortionRect = region->flowThreadPortionRect();
     5248void RenderLayer::mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment* namedFlowFragment, ClipRects& clipRects) const
     5249{
     5250    ASSERT(namedFlowFragment && namedFlowFragment->parent() && namedFlowFragment->parent()->isRenderNamedFlowFragmentContainer());
     5251   
     5252    ClipRectsContext targetClipRectsContext(&namedFlowFragment->fragmentContainerLayer(), 0, TemporaryClipRects);
     5253    namedFlowFragment->fragmentContainerLayer().calculateClipRects(targetClipRectsContext, clipRects);
     5254
     5255    LayoutRect flowThreadPortionRect = namedFlowFragment->flowThreadPortionRect();
    52585256
    52595257    LayoutPoint portionLocation = flowThreadPortionRect.location();
    5260     LayoutRect regionContentBox = flowFragment->fragmentContainer().contentBoxRect();
     5258    LayoutRect regionContentBox = namedFlowFragment->fragmentContainer().contentBoxRect();
    52615259    LayoutSize moveOffset = portionLocation - regionContentBox.location();
    52625260
     
    52855283    bool useCached = clipRectsType != TemporaryClipRects;
    52865284
    5287     if (renderer().isRenderFlowThread() && clipRectsContext.region) {
    5288         mapLayerClipRectsToFragmentationLayer(clipRectsContext.region, clipRects);
     5285    if (renderer().isRenderNamedFlowThread() && clipRectsContext.region) {
     5286        mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
    52895287        return;
    52905288    }
     
    53535351{
    53545352    ASSERT(parent());
    5355     if (renderer().isRenderFlowThread() && clipRectsContext.region) {
    5356         mapLayerClipRectsToFragmentationLayer(clipRectsContext.region, clipRects);
     5353    if (renderer().isRenderNamedFlowThread() && clipRectsContext.region) {
     5354        mapLayerClipRectsToFragmentationLayer(toRenderNamedFlowFragment(clipRectsContext.region), clipRects);
    53575355        return;
    53585356    }
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r164481 r164482  
    651651    // layers that intersect the point from front to back.
    652652    void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = 0,
    653         RenderRegion* = 0, PaintLayerFlags = 0);
     653        RenderNamedFlowFragment* = 0, PaintLayerFlags = 0);
    654654    bool hitTest(const HitTestRequest&, HitTestResult&);
    655655    bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
     
    926926
    927927    struct LayerPaintingInfo {
    928         LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = 0, RenderRegion*inRegion = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)
     928        LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = 0, RenderNamedFlowFragment* namedFlowFragment = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)
    929929            : rootLayer(inRootLayer)
    930930            , subtreePaintRoot(inSubtreePaintRoot)
    931931            , paintDirtyRect(inDirtyRect)
    932932            , subPixelAccumulation(inSubPixelAccumulation)
    933             , region(inRegion)
     933            , renderNamedFlowFragment(namedFlowFragment)
    934934            , overlapTestRequests(inOverlapTestRequests)
    935935            , paintBehavior(inPaintBehavior)
     
    940940        LayoutRect paintDirtyRect; // relative to rootLayer;
    941941        LayoutSize subPixelAccumulation;
    942         RenderRegion* region; // May be null.
     942        RenderNamedFlowFragment* renderNamedFlowFragment; // May be null.
    943943        OverlapTestRequestMap* overlapTestRequests; // May be null.
    944944        PaintBehavior paintBehavior;
     
    11561156        const HitTestingTransformState*, double*);
    11571157    void paintFlowThreadIfRegionForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
    1158     void mapLayerClipRectsToFragmentationLayer(RenderRegion*, ClipRects&) const;
     1158    void mapLayerClipRectsToFragmentationLayer(RenderNamedFlowFragment*, ClipRects&) const;
    11591159
    11601160private:
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r164275 r164482  
    9292}
    9393
     94void RenderNamedFlowFragment::getRanges(Vector<RefPtr<Range>>& rangeObjects) const
     95{
     96    const RenderNamedFlowThread& namedFlow = view().flowThreadController().ensureRenderFlowThreadWithName(style().regionThread());
     97    namedFlow.getRanges(rangeObjects, this);
     98}
     99
    94100bool RenderNamedFlowFragment::shouldHaveAutoLogicalHeight() const
    95101{
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h

    r164275 r164482  
    5757    virtual bool isRenderNamedFlowFragment() const override final { return true; }
    5858    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     59
     60    void getRanges(Vector<RefPtr<Range>>&) const;
    5961
    6062    virtual LayoutUnit pageLogicalHeight() const;
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r163969 r164482  
    3737#include "RenderInline.h"
    3838#include "RenderNamedFlowFragment.h"
    39 #include "RenderRegion.h"
    4039#include "RenderText.h"
    4140#include "RenderView.h"
     
    8685void RenderNamedFlowThread::updateWritingMode()
    8786{
    88     RenderRegion* firstRegion = m_regionList.first();
    89     if (!firstRegion)
     87    RenderNamedFlowFragment* firstFragment = toRenderNamedFlowFragment(m_regionList.first());
     88    if (!firstFragment)
    9089        return;
    91     if (style().writingMode() == firstRegion->style().writingMode())
     90    if (style().writingMode() == firstFragment->style().writingMode())
    9291        return;
    9392
    9493    // The first region defines the principal writing mode for the entire flow.
    9594    auto newStyle = RenderStyle::clone(&style());
    96     newStyle.get().setWritingMode(firstRegion->style().writingMode());
     95    newStyle.get().setWritingMode(firstFragment->style().writingMode());
    9796    setStyle(std::move(newStyle));
    9897}
     
    150149// the first region is "less" than the second region.
    151150// If the first region is "less" than the second region, the first region receives content before second region.
    152 static bool compareRenderRegions(const RenderRegion* firstRegion, const RenderRegion* secondRegion)
    153 {
    154     ASSERT(firstRegion);
    155     ASSERT(secondRegion);
    156 
    157     ASSERT(firstRegion->generatingElement());
    158     ASSERT(secondRegion->generatingElement());
     151static bool compareRenderNamedFlowFragments(const RenderNamedFlowFragment* firstFragment, const RenderNamedFlowFragment* secondFragment)
     152{
     153    ASSERT(firstFragment);
     154    ASSERT(secondFragment);
     155
     156    ASSERT(firstFragment->generatingElement());
     157    ASSERT(secondFragment->generatingElement());
    159158
    160159    // If the regions belong to different nodes, compare their position in the DOM.
    161     if (firstRegion->generatingElement() != secondRegion->generatingElement()) {
    162         unsigned short position = firstRegion->generatingElement()->compareDocumentPosition(secondRegion->generatingElement());
     160    if (firstFragment->generatingElement() != secondFragment->generatingElement()) {
     161        unsigned short position = firstFragment->generatingElement()->compareDocumentPosition(secondFragment->generatingElement());
    163162
    164163        // If the second region is contained in the first one, the first region is "less" if it's :before.
    165164        if (position & Node::DOCUMENT_POSITION_CONTAINED_BY) {
    166             ASSERT(secondRegion->style().styleType() == NOPSEUDO);
    167             return firstRegion->style().styleType() == BEFORE;
     165            ASSERT(secondFragment->style().styleType() == NOPSEUDO);
     166            return firstFragment->style().styleType() == BEFORE;
    168167        }
    169168
    170169        // If the second region contains the first region, the first region is "less" if the second is :after.
    171170        if (position & Node::DOCUMENT_POSITION_CONTAINS) {
    172             ASSERT(firstRegion->style().styleType() == NOPSEUDO);
    173             return secondRegion->style().styleType() == AFTER;
     171            ASSERT(firstFragment->style().styleType() == NOPSEUDO);
     172            return secondFragment->style().styleType() == AFTER;
    174173        }
    175174
     
    178177
    179178    // FIXME: Currently it's not possible for an element to be both a region and have pseudo-children. The case is covered anyway.
    180     switch (firstRegion->style().styleType()) {
     179    switch (firstFragment->style().styleType()) {
    181180    case BEFORE:
    182181        // The second region can be the node or the after pseudo-element (before is smaller than any of those).
     
    187186    case NOPSEUDO:
    188187        // The second region can either be the before or the after pseudo-element (the node is only smaller than the after pseudo-element).
    189         return firstRegion->style().styleType() == AFTER;
     188        return firstFragment->style().styleType() == AFTER;
    190189    default:
    191190        break;
     
    197196
    198197// This helper function adds a region to a list preserving the order property of the list.
    199 static void addRegionToList(RenderRegionList& regionList, RenderRegion* renderRegion)
     198static void addFragmentToList(RenderRegionList& regionList, RenderNamedFlowFragment* renderNamedFlowFragment)
    200199{
    201200    if (regionList.isEmpty())
    202         regionList.add(renderRegion);
     201        regionList.add(renderNamedFlowFragment);
    203202    else {
    204         // Find the first region "greater" than renderRegion.
     203        // Find the first region "greater" than renderNamedFlowFragment.
    205204        auto it = regionList.begin();
    206         while (it != regionList.end() && !compareRenderRegions(renderRegion, *it))
     205        while (it != regionList.end() && !compareRenderNamedFlowFragments(renderNamedFlowFragment, toRenderNamedFlowFragment(*it)))
    207206            ++it;
    208         regionList.insertBefore(it, renderRegion);
    209     }
    210 }
    211 
    212 void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegion)
     207        regionList.insertBefore(it, renderNamedFlowFragment);
     208    }
     209}
     210
     211void RenderNamedFlowThread::addFragmentToNamedFlowThread(RenderNamedFlowFragment* renderNamedFlowFragment)
     212{
     213    ASSERT(renderNamedFlowFragment);
     214    ASSERT(!renderNamedFlowFragment->isValid());
     215
     216    if (renderNamedFlowFragment->parentNamedFlowThread())
     217        addDependencyOnFlowThread(renderNamedFlowFragment->parentNamedFlowThread());
     218
     219    renderNamedFlowFragment->setIsValid(true);
     220    addFragmentToList(m_regionList, renderNamedFlowFragment);
     221
     222    if (m_regionList.first() == renderNamedFlowFragment)
     223        updateWritingMode();
     224}
     225
     226void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion)
    213227{
    214228    ASSERT(renderRegion);
    215229    ASSERT(!renderRegion->isValid());
    216230
    217     if (renderRegion->parentNamedFlowThread())
    218         addDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
    219 
    220     renderRegion->setIsValid(true);
    221     addRegionToList(m_regionList, renderRegion);
    222 
    223     if (m_regionList.first() == renderRegion)
    224         updateWritingMode();
    225 }
    226 
    227 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion)
     231    RenderNamedFlowFragment* renderNamedFlowFragment = toRenderNamedFlowFragment(renderRegion);
     232    resetMarkForDestruction();
     233
     234    if (renderNamedFlowFragment->parentNamedFlowThread() && renderNamedFlowFragment->parentNamedFlowThread()->dependsOn(this)) {
     235        // The order of invalid regions is irrelevant.
     236        m_invalidRegionList.add(renderNamedFlowFragment);
     237        // Register ourself to get a notification when the state changes.
     238        renderNamedFlowFragment->parentNamedFlowThread()->m_observerThreadsSet.add(this);
     239        return;
     240    }
     241
     242    addFragmentToNamedFlowThread(renderNamedFlowFragment);
     243
     244    invalidateRegions();
     245}
     246
     247void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion)
    228248{
    229249    ASSERT(renderRegion);
    230     ASSERT(!renderRegion->isValid());
    231 
    232     resetMarkForDestruction();
    233 
    234     if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowThread()->dependsOn(this)) {
    235         // The order of invalid regions is irrelevant.
    236         m_invalidRegionList.add(renderRegion);
    237         // Register ourself to get a notification when the state changes.
    238         renderRegion->parentNamedFlowThread()->m_observerThreadsSet.add(this);
    239         return;
    240     }
    241 
    242     addRegionToNamedFlowThread(renderRegion);
    243 
    244     invalidateRegions();
    245 }
    246 
    247 void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion)
    248 {
    249     ASSERT(renderRegion);
    250 
    251     if (renderRegion->parentNamedFlowThread()) {
    252         if (!renderRegion->isValid()) {
    253             ASSERT(m_invalidRegionList.contains(renderRegion));
    254             m_invalidRegionList.remove(renderRegion);
    255             renderRegion->parentNamedFlowThread()->m_observerThreadsSet.remove(this);
     250
     251    RenderNamedFlowFragment* renderNamedFlowFragment = toRenderNamedFlowFragment(renderRegion);
     252    if (renderNamedFlowFragment->parentNamedFlowThread()) {
     253        if (!renderNamedFlowFragment->isValid()) {
     254            ASSERT(m_invalidRegionList.contains(renderNamedFlowFragment));
     255            m_invalidRegionList.remove(renderNamedFlowFragment);
     256            renderNamedFlowFragment->parentNamedFlowThread()->m_observerThreadsSet.remove(this);
    256257            // No need to invalidate the regions rectangles. The removed region
    257258            // was not taken into account. Just return here.
    258259            return;
    259260        }
    260         removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread());
    261     }
    262 
    263     ASSERT(m_regionList.contains(renderRegion));
    264     bool wasFirst = m_regionList.first() == renderRegion;
    265     m_regionList.remove(renderRegion);
     261        removeDependencyOnFlowThread(renderNamedFlowFragment->parentNamedFlowThread());
     262    }
     263
     264    ASSERT(m_regionList.contains(renderNamedFlowFragment));
     265    bool wasFirst = m_regionList.first() == renderNamedFlowFragment;
     266    m_regionList.remove(renderNamedFlowFragment);
    266267
    267268    if (canBeDestroyed())
     
    296297        height = isHorizontalWritingMode() ? visualOverflowRect().maxY() : visualOverflowRect().maxX();
    297298
    298     RenderRegion* lastReg = lastRegion();
    299     for (auto& region : m_regionList) {
    300         LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().y() : region->flowThreadPortionRect().x());
    301         LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().maxY() : region->flowThreadPortionRect().maxX());
    302         RegionOversetState previousState = region->regionOversetState();
     299    RenderNamedFlowFragment* lastFragment = toRenderNamedFlowFragment(lastRegion());
     300    for (auto& namedFlowFragment : m_regionList) {
     301        LayoutUnit flowMin = height - (isHorizontalWritingMode() ? namedFlowFragment->flowThreadPortionRect().y() : namedFlowFragment->flowThreadPortionRect().x());
     302        LayoutUnit flowMax = height - (isHorizontalWritingMode() ? namedFlowFragment->flowThreadPortionRect().maxY() : namedFlowFragment->flowThreadPortionRect().maxX());
     303        RegionOversetState previousState = namedFlowFragment->regionOversetState();
    303304        RegionOversetState state = RegionFit;
    304305        if (flowMin <= 0)
    305306            state = RegionEmpty;
    306         if (flowMax > 0 && region == lastReg)
     307        if (flowMax > 0 && namedFlowFragment == lastFragment)
    307308            state = RegionOverset;
    308         region->setRegionOversetState(state);
     309        namedFlowFragment->setRegionOversetState(state);
    309310        // determine whether the NamedFlow object should dispatch a regionLayoutUpdate event
    310311        // FIXME: currently it cannot determine whether a region whose regionOverset state remained either "fit" or "overset" has actually
     
    327328    // With the regions overflow state computed we can also set the overset flag for the named flow.
    328329    // If there are no valid regions in the chain, overset is true.
    329     m_overset = lastReg ? lastReg->regionOversetState() == RegionOverset : true;
     330    m_overset = lastFragment ? lastFragment->regionOversetState() == RegionOverset : true;
    330331}
    331332
    332333void RenderNamedFlowThread::checkInvalidRegions()
    333334{
    334     Vector<RenderRegion*> newValidRegions;
     335    Vector<RenderNamedFlowFragment*> newValidFragments;
    335336    for (auto& region : m_invalidRegionList) {
     337        RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(region);
    336338        // The only reason a region would be invalid is because it has a parent flow thread.
    337         ASSERT(!region->isValid() && region->parentNamedFlowThread());
    338         if (region->parentNamedFlowThread()->dependsOn(this))
     339        ASSERT(!namedFlowFragment->isValid() && namedFlowFragment->parentNamedFlowThread());
     340        if (namedFlowFragment->parentNamedFlowThread()->dependsOn(this))
    339341            continue;
    340342
    341         newValidRegions.append(region);
    342     }
    343 
    344     for (auto& region : newValidRegions) {
    345         m_invalidRegionList.remove(region);
    346         region->parentNamedFlowThread()->m_observerThreadsSet.remove(this);
    347         addRegionToNamedFlowThread(region);
    348     }
    349 
    350     if (!newValidRegions.isEmpty())
     343        newValidFragments.append(namedFlowFragment);
     344    }
     345
     346    for (auto& namedFlowFragment : newValidFragments) {
     347        m_invalidRegionList.remove(namedFlowFragment);
     348        namedFlowFragment->parentNamedFlowThread()->m_observerThreadsSet.remove(this);
     349        addFragmentToNamedFlowThread(namedFlowFragment);
     350    }
     351
     352    if (!newValidFragments.isEmpty())
    351353        invalidateRegions();
    352354
     
    539541}
    540542
    541 void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range>>& rangeObjects, const RenderRegion* region) const
     543void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range>>& rangeObjects, const RenderNamedFlowFragment* namedFlowFragment) const
    542544{
    543545    LayoutUnit logicalTopForRegion;
     
    545547
    546548    // extend the first region top to contain everything up to its logical height
    547     if (region->isFirstRegion())
     549    if (namedFlowFragment->isFirstRegion())
    548550        logicalTopForRegion = LayoutUnit::min();
    549551    else
    550         logicalTopForRegion =  region->logicalTopForFlowThreadContent();
     552        logicalTopForRegion =  namedFlowFragment->logicalTopForFlowThreadContent();
    551553
    552554    // extend the last region to contain everything above its y()
    553     if (region->isLastRegion())
     555    if (namedFlowFragment->isLastRegion())
    554556        logicalBottomForRegion = LayoutUnit::max();
    555557    else
    556         logicalBottomForRegion = region->logicalBottomForFlowThreadContent();
     558        logicalBottomForRegion = namedFlowFragment->logicalBottomForFlowThreadContent();
    557559
    558560    Vector<Element*> elements;
     
    596598            boundingBox.moveBy(logicalOffsetFromTop);
    597599
    598             LayoutUnit logicalTopForRenderer = region->logicalTopOfFlowThreadContentRect(boundingBox);
    599             LayoutUnit logicalBottomForRenderer = region->logicalBottomOfFlowThreadContentRect(boundingBox);
     600            LayoutUnit logicalTopForRenderer = namedFlowFragment->logicalTopOfFlowThreadContentRect(boundingBox);
     601            LayoutUnit logicalBottomForRenderer = namedFlowFragment->logicalBottomOfFlowThreadContentRect(boundingBox);
    600602
    601603            // if the bounding box of the current element doesn't intersect the region box
     
    700702    bool hasRegionsWithStyling = false;
    701703    for (const auto& region : m_regionList) {
    702         const RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(region);
    703         if (namedFlowFragment->hasCustomRegionStyle()) {
     704        if (toRenderNamedFlowFragment(region)->hasCustomRegionStyle()) {
    704705            hasRegionsWithStyling = true;
    705706            break;
     
    714715    // FIXME: Region styling is not computed only for the region range of the object so this is why we need to walk the whole chain.
    715716    for (auto& region : m_regionList) {
    716         RenderNamedFlowFragment* namedFlowFragment = toRenderNamedFlowFragment(region);
    717         namedFlowFragment->clearObjectStyleInRegion(object);
     717        toRenderNamedFlowFragment(region)->clearObjectStyleInRegion(object);
    718718    }
    719719}
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.h

    r163969 r164482  
    7878
    7979    bool isMarkedForDestruction() const;
    80     void getRanges(Vector<RefPtr<Range>>&, const RenderRegion*) const;
     80    void getRanges(Vector<RefPtr<Range>>&, const RenderNamedFlowFragment*) const;
    8181
    8282    virtual bool collectsGraphicsLayersUnderRegions() const override;
     
    106106    void removeDependencyOnFlowThread(RenderNamedFlowThread*);
    107107
    108     void addRegionToNamedFlowThread(RenderRegion*);
     108    void addFragmentToNamedFlowThread(RenderNamedFlowFragment*);
    109109
    110110    void checkInvalidRegions();
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r164419 r164482  
    447447}
    448448
    449 void RenderRegion::getRanges(Vector<RefPtr<Range>>& rangeObjects) const
    450 {
    451     const RenderNamedFlowThread& namedFlow = view().flowThreadController().ensureRenderFlowThreadWithName(style().regionThread());
    452     namedFlow.getRanges(rangeObjects, this);
    453 }
    454 
    455449void RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds)
    456450{
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r164419 r164482  
    9494    LayoutUnit logicalBottomForFlowThreadContent() const { return logicalBottomOfFlowThreadContentRect(flowThreadPortionRect()); };
    9595
    96     void getRanges(Vector<RefPtr<Range>>&) const;
    97 
    9896    // This method represents the logical height of the entire flow thread portion used by the region or set.
    9997    // For RenderRegions it matches logicalPaginationHeight(), but for sets it is the height of all the pages
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r164265 r164482  
    3434#include "RenderImage.h"
    3535#include "RenderLayer.h"
    36 #include "RenderRegion.h"
     36#include "RenderNamedFlowFragment.h"
    3737#include "RenderTheme.h"
    3838#include "RenderView.h"
     
    206206   
    207207    // Check our region range to make sure we need to be painting in this region.
    208     if (paintInfo.renderRegion && !paintInfo.renderRegion->flowThread()->objectShouldPaintInFlowRegion(this, paintInfo.renderRegion))
     208    if (paintInfo.renderNamedFlowFragment && !paintInfo.renderNamedFlowFragment->flowThread()->objectShouldPaintInFlowRegion(this, paintInfo.renderNamedFlowFragment))
    209209        return false;
    210210
  • trunk/Source/WebCore/rendering/RenderReplica.cpp

    r158097 r164482  
    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.renderRegion);
     77        RenderLayer::LayerPaintingInfo paintingInfo(rootPaintingLayer, paintInfo.rect, PaintBehaviorNormal, LayoutSize(), 0, paintInfo.renderNamedFlowFragment);
    7878        RenderLayer::PaintLayerFlags flags = RenderLayer::PaintLayerHaveTransparency | RenderLayer::PaintLayerAppliedTransform | RenderLayer::PaintLayerTemporaryClipRects | RenderLayer::PaintLayerPaintingReflection;
    7979        layer()->parent()->paintLayer(paintInfo.context, paintingInfo, flags);
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r163717 r164482  
    172172{
    173173    // Check if we are in the correct region.
    174     if (paintInfo.renderRegion && m_hasContainingRegion && containingRegion() != paintInfo.renderRegion)
     174    if (paintInfo.renderNamedFlowFragment && m_hasContainingRegion && containingRegion() != reinterpret_cast<RenderRegion*>(paintInfo.renderNamedFlowFragment))
    175175        return;
    176176   
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r164441 r164482  
    3333#include "Page.h"
    3434#include "RenderIterator.h"
     35#include "RenderNamedFlowFragment.h"
    3536#include "RenderView.h"
    3637#include "SVGImage.h"
     
    268269
    269270    // Apply initial viewport clip - not affected by overflow handling
    270     childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset, paintInfo.renderRegion)));
     271    childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset, paintInfo.renderNamedFlowFragment)));
    271272
    272273    // Convert from container offsets (html renderers) to a relative transform (svg renderers).
Note: See TracChangeset for help on using the changeset viewer.