Changeset 170282 in webkit


Ignore:
Timestamp:
Jun 22, 2014, 9:28:16 PM (11 years ago)
Author:
Alan Bujtas
Message:

Make offset from ancestor computation explicit by moving it to the callers.
https://bugs.webkit.org/show_bug.cgi?id=134168.

Reviewed by Simon Fraser.

Explicit offset computation helps code reading and less error-prone than passing
the offset pointer and compute it locally when it is null.

No change in functionality.

  • rendering/RenderLayer.cpp:

(WebCore::transparencyClipBox):
(WebCore::performOverlapTests):
(WebCore::RenderLayer::setupClipPath):
(WebCore::RenderLayer::setupFilters):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::collectFragments):
(WebCore::RenderLayer::updatePaintingInfoForFragments):
(WebCore::RenderLayer::paintTransformedLayerIntoFragments):
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::hitTestTransformedLayerInFragments):
(WebCore::RenderLayer::calculateClipRects):

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

(WebCore::RenderLayerCompositor::calculateCompositedBounds):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):

  • rendering/RenderTreeAsText.cpp:

(WebCore::writeLayers):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r170273 r170282  
     12014-06-22  Zalan Bujtas  <zalan@apple.com>
     2
     3        Make offset from ancestor computation explicit by moving it to the callers.
     4        https://bugs.webkit.org/show_bug.cgi?id=134168.
     5
     6        Reviewed by Simon Fraser.
     7       
     8        Explicit offset computation helps code reading and less error-prone than passing
     9        the offset pointer and compute it locally when it is null.
     10
     11        No change in functionality.
     12
     13        * rendering/RenderLayer.cpp:
     14        (WebCore::transparencyClipBox):
     15        (WebCore::performOverlapTests):
     16        (WebCore::RenderLayer::setupClipPath):
     17        (WebCore::RenderLayer::setupFilters):
     18        (WebCore::RenderLayer::paintLayerContents):
     19        (WebCore::RenderLayer::collectFragments):
     20        (WebCore::RenderLayer::updatePaintingInfoForFragments):
     21        (WebCore::RenderLayer::paintTransformedLayerIntoFragments):
     22        (WebCore::RenderLayer::hitTestLayer):
     23        (WebCore::RenderLayer::hitTestTransformedLayerInFragments):
     24        (WebCore::RenderLayer::calculateClipRects):
     25        * rendering/RenderLayer.h:
     26        * rendering/RenderLayerCompositor.cpp:
     27        (WebCore::RenderLayerCompositor::calculateCompositedBounds):
     28        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
     29        * rendering/RenderTreeAsText.cpp:
     30        (WebCore::writeLayers):
     31
    1322014-06-22  Zalan Bujtas  <zalan@apple.com>
    233
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r170273 r170282  
    16371637    }
    16381638   
    1639     LayoutRect clipRect = layer->boundingBox(rootLayer, transparencyBehavior == HitTestingTransparencyClipBox ? RenderLayer::UseFragmentBoxesIncludingCompositing : RenderLayer::UseFragmentBoxesExcludingCompositing);
     1639    LayoutRect clipRect = layer->boundingBox(rootLayer, layer->offsetFromAncestor(rootLayer), transparencyBehavior == HitTestingTransparencyClipBox ? RenderLayer::UseFragmentBoxesIncludingCompositing : RenderLayer::UseFragmentBoxesExcludingCompositing);
    16401640    expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, paintBehavior);
    16411641#if ENABLE(CSS_FILTERS)
     
    35793579    Vector<OverlapTestRequestClient*> overlappedRequestClients;
    35803580    OverlapTestRequestMap::iterator end = overlapTestRequests.end();
    3581     LayoutRect boundingBox = layer->boundingBox(rootLayer);
     3581    LayoutRect boundingBox = layer->boundingBox(rootLayer, layer->offsetFromAncestor(rootLayer));
    35823582    for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) {
    35833583        if (!boundingBox.intersects(it->value))
     
    37963796
    37973797    if (!rootRelativeBoundsComputed) {
    3798         rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &offsetFromRoot, 0);
     3798        rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, 0);
    37993799        rootRelativeBoundsComputed = true;
    38003800    }
     
    38583858
    38593859    if (!rootRelativeBoundsComputed) {
    3860         rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &offsetFromRoot, 0);
     3860        rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, offsetFromRoot, 0);
    38613861        rootRelativeBoundsComputed = true;
    38623862    }
     
    40234023        collectFragments(layerFragments, localPaintingInfo.rootLayer, paintDirtyRect, ExcludeCompositedPaginatedLayers,
    40244024            (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    4025             (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot);
    4026         updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localPaintFlags, shouldPaintContent, &offsetFromRoot);
     4025            (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, offsetFromRoot);
     4026        updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localPaintFlags, shouldPaintContent, offsetFromRoot);
    40274027    }
    40284028   
     
    41664166
    41674167void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect, PaginationInclusionMode inclusionMode,
    4168     ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutSize* offsetFromRoot,
     4168    ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutSize& offsetFromRoot,
    41694169    const LayoutRect* layerBoundingBox, ShouldApplyRootOffsetToFragments applyRootOffsetToFragments)
    41704170{
     
    41904190    ClipRect outlineRectInFlowThread;
    41914191    calculateRects(paginationClipRectsContext, LayoutRect::infiniteRect(), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThread,
    4192         outlineRectInFlowThread, &offsetWithinPaginatedLayer);
     4192        outlineRectInFlowThread, offsetWithinPaginatedLayer);
    41934193   
    41944194    // Take our bounding box within the flow thread and clip it.
    4195     LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : boundingBox(paginationLayer, 0, &offsetWithinPaginatedLayer);
     4195    LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : boundingBox(paginationLayer, offsetWithinPaginatedLayer);
    41964196    layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
    41974197   
     
    42084208       
    42094209        // Now collect ancestor fragments.
    4210         parentPaginationLayer->collectFragments(ancestorFragments, rootLayer, dirtyRect, inclusionMode, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, nullptr, &layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
     4210        parentPaginationLayer->collectFragments(ancestorFragments, rootLayer, dirtyRect, inclusionMode, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip,
     4211            offsetFromAncestor(rootLayer), &layerFragmentBoundingBoxInParentPaginationLayer, ApplyRootOffsetToFragments);
    42114212       
    42124213        if (ancestorFragments.isEmpty())
     
    42974298
    42984299void RenderLayer::updatePaintingInfoForFragments(LayerFragments& fragments, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags,
    4299     bool shouldPaintContent, const LayoutSize* offsetFromRoot)
    4300 {
    4301     ASSERT(offsetFromRoot);
     4300    bool shouldPaintContent, const LayoutSize& offsetFromRoot)
     4301{
    43024302    for (size_t i = 0; i < fragments.size(); ++i) {
    43034303        LayerFragment& fragment = fragments.at(i);
    43044304        fragment.shouldPaintContent = shouldPaintContent;
    43054305        if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
    4306             LayoutSize newOffsetFromRoot = *offsetFromRoot + fragment.paginationOffset;
    4307             fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot, fragment.hasBoundingBox ? &fragment.boundingBox : 0);
     4306            LayoutSize newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset;
     4307            fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, newOffsetFromRoot, fragment.hasBoundingBox ? &fragment.boundingBox : 0);
    43084308        }
    43094309    }
     
    43184318    paginatedLayer->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, ExcludeCompositedPaginatedLayers,
    43194319        (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
    4320         (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
     4320        (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, offsetOfPaginationLayerFromRoot, &transformedExtent);
    43214321   
    43224322    for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
     
    48104810    // Collect the fragments. This will compute the clip rectangles for each layer fragment.
    48114811    LayerFragments layerFragments;
    4812     collectFragments(layerFragments, rootLayer, hitTestRect, IncludeCompositedPaginatedLayers, RootRelativeClipRects, IncludeOverlayScrollbarSize);
     4812    collectFragments(layerFragments, rootLayer, hitTestRect, IncludeCompositedPaginatedLayers, RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
     4813        offsetFromAncestor(rootLayer));
    48134814
    48144815    if (canResize() && hitTestResizerInFragments(layerFragments, hitTestLocation)) {
     
    49174918    LayoutRect transformedExtent = transparencyClipBox(this, paginatedLayer, HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
    49184919    paginatedLayer->collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect, IncludeCompositedPaginatedLayers,
    4919         RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
     4920        RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, offsetOfPaginationLayerFromRoot, &transformedExtent);
    49204921
    49214922    for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
     
    52525253
    52535254void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
    5254     ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutSize* offsetFromRoot) const
     5255    ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutSize& offsetFromRoot) const
    52555256{
    52565257    if (clipRectsContext.rootLayer != this && parent()) {
     
    52605261        backgroundRect = paintDirtyRect;
    52615262
    5262     LayoutSize offsetFromAcestor;
    5263     if (offsetFromRoot)
    5264         offsetFromAcestor = *offsetFromRoot;
    5265     else
    5266         offsetFromAcestor = offsetFromAncestor(clipRectsContext.rootLayer);
    5267 
     5263    LayoutSize offsetFromRootLocal = offsetFromRoot;
    52685264    RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
    52695265    // If the view is scrolled, the flow thread is not scrolled with it and we should
     
    52715267    if (clipRectsContext.rootLayer->isOutOfFlowRenderFlowThread() && !namedFlowFragment) {
    52725268        LayoutPoint absPos = LayoutPoint(renderer().view().localToAbsolute(FloatPoint(), IsFixed));
    5273         offsetFromAcestor += toLayoutSize(absPos);
    5274     }
    5275 
    5276     layerBounds = LayoutRect(toLayoutPoint(offsetFromAcestor), size());
     5269        offsetFromRootLocal += toLayoutSize(absPos);
     5270    }
     5271
     5272    layerBounds = LayoutRect(toLayoutPoint(offsetFromRootLocal), size());
    52775273
    52785274    foregroundRect = backgroundRect;
     
    52975293        }
    52985294
    5299         layerBoundsWithVisualOverflow.move(offsetFromAcestor);
     5295        layerBoundsWithVisualOverflow.move(offsetFromRootLocal);
    53005296        backgroundRect.intersect(layerBoundsWithVisualOverflow);
    53015297
     
    53145310        // This layer establishes a clip of some kind.
    53155311        if (renderer().hasOverflowClip() && (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) {
    5316             foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(toLayoutPoint(offsetFromAcestor), namedFlowFragment, clipRectsContext.overlayScrollbarSizeRelevancy));
     5312            foregroundRect.intersect(toRenderBox(renderer()).overflowClipRect(toLayoutPoint(offsetFromRootLocal), namedFlowFragment, clipRectsContext.overlayScrollbarSizeRelevancy));
    53175313            if (renderer().style().hasBorderRadius())
    53185314                foregroundRect.setHasRadius(true);
     
    53215317        if (renderer().hasClip()) {
    53225318            // Clip applies to *us* as well, so go ahead and update the damageRect.
    5323             LayoutRect newPosClip = toRenderBox(renderer()).clipRect(toLayoutPoint(offsetFromAcestor), namedFlowFragment);
     5319            LayoutRect newPosClip = toRenderBox(renderer()).clipRect(toLayoutPoint(offsetFromRootLocal), namedFlowFragment);
    53245320            backgroundRect.intersect(newPosClip);
    53255321            foregroundRect.intersect(newPosClip);
     
    53355331            LayoutRect layerBoundsWithVisualOverflow = namedFlowFragment ? namedFlowFragment->visualOverflowRectForBox(renderBox()) : renderBox()->visualOverflowRect();
    53365332            renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
    5337             layerBoundsWithVisualOverflow.move(offsetFromAcestor);
     5333            layerBoundsWithVisualOverflow.move(offsetFromRootLocal);
    53385334            if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
    53395335                backgroundRect.intersect(layerBoundsWithVisualOverflow);
     
    53445340                bounds = namedFlowFragment->rectFlowPortionForBox(renderBox(), bounds);
    53455341
    5346             bounds.move(offsetFromAcestor);
     5342            bounds.move(offsetFromRootLocal);
    53475343            if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
    53485344                backgroundRect.intersect(bounds);
     
    53725368    ClipRectsContext clipRectsContext(clippingRootLayer, TemporaryClipRects);
    53735369    // Need to use temporary clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>).
    5374     calculateRects(clipRectsContext, renderer().view().unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
     5370    calculateRects(clipRectsContext, renderer().view().unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, offsetFromAncestor(clipRectsContext.rootLayer));
    53755371    return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox();
    53765372}
     
    53845380    ClipRect backgroundRect, foregroundRect, outlineRect;
    53855381    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
    5386     calculateRects(clipRectsContext, renderer().view().documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect);
     5382    calculateRects(clipRectsContext, renderer().view().documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, offsetFromAncestor(clippingRootLayer));
    53875383    return clippingRootLayer->renderer().localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox();
    53885384}
     
    54005396    ClipRect backgroundRect, foregroundRect, outlineRect;
    54015397    ClipRectsContext clipRectsContext(clippingRootLayer, PaintingClipRects);
    5402     calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, &offsetFromRoot);
     5398    calculateRects(clipRectsContext, LayoutRect::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect, offsetFromRoot);
    54035399
    54045400    LayoutRect clipRect = backgroundRect.rect();
     
    54465442}
    54475443
    5448 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize* offsetFromRoot, const LayoutRect* cachedBoundingBox) const
     5444bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect* cachedBoundingBox) const
    54495445{
    54505446    // Always examine the canvas and the root.
     
    54825478        return cachedBoundingBox->intersects(damageRect);
    54835479   
    5484     return boundingBox(rootLayer, 0, offsetFromRoot).intersects(damageRect);
     5480    return boundingBox(rootLayer, offsetFromRoot).intersects(damageRect);
    54855481}
    54865482
     
    55285524}
    55295525
    5530 LayoutRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer, CalculateLayerBoundsFlags flags, const LayoutSize* offsetFromRoot) const
     5526LayoutRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer, const LayoutSize& offsetFromRoot, CalculateLayerBoundsFlags flags) const
    55315527{   
    55325528    LayoutRect result = localBoundingBox(flags);
     
    55625558    }
    55635559   
    5564     LayoutSize delta;
    5565     if (offsetFromRoot)
    5566         delta = *offsetFromRoot;
    5567     else
    5568         delta = offsetFromAncestor(ancestorLayer);
    5569    
    5570     result.move(delta);
     5560    result.move(offsetFromRoot);
    55715561    return result;
    55725562}
     
    55745564IntRect RenderLayer::absoluteBoundingBox() const
    55755565{
    5576     return pixelSnappedIntRect(boundingBox(root()));
     5566    const RenderLayer* rootLayer = root();
     5567    return pixelSnappedIntRect(boundingBox(rootLayer, offsetFromAncestor(rootLayer)));
    55775568}
    55785569
    55795570FloatRect RenderLayer::absoluteBoundingBoxForPainting() const
    55805571{
    5581     return pixelSnappedForPainting(boundingBox(root()), renderer().document().deviceScaleFactor());
    5582 }
    5583 
    5584 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutSize* offsetFromRoot, CalculateLayerBoundsFlags flags) const
     5572    const RenderLayer* rootLayer = root();
     5573    return pixelSnappedForPainting(boundingBox(rootLayer, offsetFromAncestor(rootLayer)), renderer().document().deviceScaleFactor());
     5574}
     5575
     5576LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutSize& offsetFromRoot, CalculateLayerBoundsFlags flags) const
    55855577{
    55865578    if (!isSelfPaintingLayer())
     
    56335625    if (RenderLayer* reflection = reflectionLayer()) {
    56345626        if (!reflection->isComposited()) {
    5635             LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, nullptr, descendantFlags);
     5627            LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, reflection->offsetFromAncestor(this), descendantFlags);
    56365628            unionBounds.unite(childUnionBounds);
    56375629        }
     
    56495641            RenderLayer* curLayer = negZOrderList->at(i);
    56505642            if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
    5651                 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
     5643                LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, curLayer->offsetFromAncestor(this), descendantFlags);
    56525644                unionBounds.unite(childUnionBounds);
    56535645            }
     
    56615653            // The RenderNamedFlowThread is ignored when we calculate the bounds of the RenderView.
    56625654            if ((flags & IncludeCompositedDescendants || !curLayer->isComposited()) && !curLayer->isFlowThreadCollectingGraphicsLayersUnderRegions()) {
    5663                 LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
     5655                LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, curLayer->offsetFromAncestor(this), descendantFlags);
    56645656                unionBounds.unite(childUnionBounds);
    56655657            }
     
    56755667            ASSERT(!curLayer->isFlowThreadCollectingGraphicsLayersUnderRegions());
    56765668            if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
    5677                 LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, nullptr, descendantFlags);
     5669                LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, curLayer->offsetFromAncestor(this), descendantFlags);
    56785670                unionBounds.unite(curAbsBounds);
    56795671            }
     
    56945686        unionBounds = affineTrans->mapRect(unionBounds);
    56955687    }
    5696 
    5697     LayoutSize offsetFromAncestor;
    5698     if (offsetFromRoot)
    5699         offsetFromAncestor = *offsetFromRoot;
    5700     else
    5701         offsetFromAncestor = this->offsetFromAncestor(ancestorLayer);
    5702     unionBounds.move(offsetFromAncestor);
    5703    
     5688    unionBounds.move(offsetFromRoot);
    57045689    return unionBounds;
    57055690}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r170273 r170282  
    701701    // Pass offsetFromRoot if known.
    702702    void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
    703         ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutSize* offsetFromRoot = nullptr) const;
     703        ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutSize& offsetFromRoot) const;
    704704
    705705    // Compute and cache clip rects computed with the given layer as the root
     
    720720
    721721    // Pass offsetFromRoot if known.
    722     bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize* offsetFromRoot = nullptr, const LayoutRect* cachedBoundingBox = nullptr) const;
     722    bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect* cachedBoundingBox = nullptr) const;
    723723
    724724    enum CalculateLayerBoundsFlag {
     
    736736
    737737    // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
    738     LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutSize* offsetFromRoot = nullptr) const;
     738    LayoutRect boundingBox(const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot = LayoutSize(), CalculateLayerBoundsFlags = 0) const;
    739739    // Bounding box in the coordinates of this layer.
    740740    LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
     
    745745
    746746    // Bounds used for layer overlap testing in RenderLayerCompositor.
    747     LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? calculateLayerBounds(this) : localBoundingBox(); }
     747    LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? calculateLayerBounds(this, LayoutSize()) : localBoundingBox(); }
    748748
    749749#if ENABLE(CSS_FILTERS)
     
    756756
    757757    // Can pass offsetFromRoot if known.
    758     LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutSize* offsetFromRoot = nullptr, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
     758    LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutSize& offsetFromRoot, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
    759759   
    760760    // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
     
    10021002    void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
    10031003        PaginationInclusionMode,
    1004         ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
    1005         ShouldRespectOverflowClip = RespectOverflowClip, const LayoutSize* offsetFromRoot = nullptr, const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
    1006     void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo&, PaintLayerFlags, bool shouldPaintContent, const LayoutSize* offsetFromRoot);
     1004        ClipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip, const LayoutSize& offsetFromRoot,
     1005        const LayoutRect* layerBoundingBox = nullptr, ShouldApplyRootOffsetToFragments = IgnoreRootOffsetForFragments);
     1006    void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo&, PaintLayerFlags, bool shouldPaintContent, const LayoutSize& offsetFromRoot);
    10071007    void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, GraphicsContext* transparencyLayerContext,
    10081008        const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r170220 r170282  
    976976    if (!canBeComposited(layer))
    977977        return LayoutRect();
    978     return layer.calculateLayerBounds(&ancestorLayer, nullptr, RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask);
     978    return layer.calculateLayerBounds(&ancestorLayer, layer.offsetFromAncestor(&ancestorLayer), RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask);
    979979}
    980980
     
    26512651    // Fixed position elements that are invisible in the current view don't get their own layer.
    26522652    LayoutRect viewBounds = m_renderView.frameView().viewportConstrainedVisibleContentRect();
    2653     LayoutRect layerBounds = layer.calculateLayerBounds(&layer, 0, RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxesExcludingCompositing
     2653    LayoutRect layerBounds = layer.calculateLayerBounds(&layer, LayoutSize(), RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxesExcludingCompositing
    26542654        | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
    26552655    // Map to m_renderView to ignore page scale.
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r168967 r170282  
    742742    LayoutRect layerBounds;
    743743    ClipRect damageRect, clipRectToApply, outlineRect;
    744     l->calculateRects(RenderLayer::ClipRectsContext(rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
     744    l->calculateRects(RenderLayer::ClipRectsContext(rootLayer, TemporaryClipRects), paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, l->offsetFromAncestor(rootLayer));
    745745
    746746    // Ensure our lists are up-to-date.
    747747    l->updateLayerListsIfNeeded();
    748748
    749     bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : l->intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer);
     749    bool shouldPaint = (behavior & RenderAsTextShowAllLayers) ? true : l->intersectsDamageRect(layerBounds, damageRect.rect(), rootLayer, l->offsetFromAncestor(rootLayer));
    750750    Vector<RenderLayer*>* negList = l->negZOrderList();
    751751    bool paintsBackgroundSeparately = negList && negList->size() > 0;
Note: See TracChangeset for help on using the changeset viewer.