Changeset 200284 in webkit


Ignore:
Timestamp:
Apr 29, 2016 9:13:22 PM (8 years ago)
Author:
Simon Fraser
Message:

Make clipToRect() and restoreClip() have similar signatures
https://bugs.webkit.org/show_bug.cgi?id=157229

Reviewed by Zalan Bujtas.

clipToRect() and restoreClip() are always called in pairs, but had different
parameter order, and parameter types. So make them more similar.

In future we could use them in a stack-based class.

No behavior change.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::clipToRect):
(WebCore::RenderLayer::restoreClip):
(WebCore::RenderLayer::paintLayer):
(WebCore::RenderLayer::applyFilters):
(WebCore::RenderLayer::paintTransformedLayerIntoFragments):
(WebCore::RenderLayer::paintBackgroundForFragments):
(WebCore::RenderLayer::paintForegroundForFragments):
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
(WebCore::RenderLayer::paintOutlineForFragments):
(WebCore::RenderLayer::paintMaskForFragments):
(WebCore::RenderLayer::paintChildClippingMaskForFragments):
(WebCore::RenderLayer::paintOverflowControlsForFragments):
(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderLayer.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r200283 r200284  
     12016-04-29  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make clipToRect() and restoreClip() have similar signatures
     4        https://bugs.webkit.org/show_bug.cgi?id=157229
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        clipToRect() and restoreClip() are always called in pairs, but had different
     9        parameter order, and parameter types. So make them more similar.
     10       
     11        In future we could use them in a stack-based class.
     12
     13        No behavior change.
     14
     15        * rendering/RenderLayer.cpp:
     16        (WebCore::RenderLayer::clipToRect):
     17        (WebCore::RenderLayer::restoreClip):
     18        (WebCore::RenderLayer::paintLayer):
     19        (WebCore::RenderLayer::applyFilters):
     20        (WebCore::RenderLayer::paintTransformedLayerIntoFragments):
     21        (WebCore::RenderLayer::paintBackgroundForFragments):
     22        (WebCore::RenderLayer::paintForegroundForFragments):
     23        (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
     24        (WebCore::RenderLayer::paintOutlineForFragments):
     25        (WebCore::RenderLayer::paintMaskForFragments):
     26        (WebCore::RenderLayer::paintChildClippingMaskForFragments):
     27        (WebCore::RenderLayer::paintOverflowControlsForFragments):
     28        (WebCore::RenderLayer::calculateClipRects):
     29        * rendering/RenderLayer.h:
     30
    1312016-04-29  Simon Fraser  <simon.fraser@apple.com>
    232
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r200283 r200284  
    38283828}
    38293829
    3830 void RenderLayer::clipToRect(const LayerPaintingInfo& paintingInfo, GraphicsContext& context, const ClipRect& clipRect, BorderRadiusClippingRule rule)
     3830void RenderLayer::clipToRect(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const ClipRect& clipRect, BorderRadiusClippingRule rule)
    38313831{
    38323832    float deviceScaleFactor = renderer().document().deviceScaleFactor();
     
    38623862}
    38633863
    3864 void RenderLayer::restoreClip(GraphicsContext& context, const LayoutRect& paintDirtyRect, const ClipRect& clipRect)
    3865 {
    3866     if ((!clipRect.isInfinite() && clipRect.rect() != paintDirtyRect) || clipRect.affectedByRadius())
     3864void RenderLayer::restoreClip(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const ClipRect& clipRect)
     3865{
     3866    if ((!clipRect.isInfinite() && clipRect.rect() != paintingInfo.paintDirtyRect) || clipRect.affectedByRadius())
    38673867        context.restore();
    38683868}
     
    39833983       
    39843984            // Push the parent coordinate space's clip.
    3985             parent()->clipToRect(paintingInfo, context, clipRect);
     3985            parent()->clipToRect(context, paintingInfo, clipRect);
    39863986        }
    39873987
     
    39903990        // Restore the clip.
    39913991        if (parent())
    3992             parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
     3992            parent()->restoreClip(context, paintingInfo, clipRect);
    39933993
    39943994        return;
     
    42034203    // FIXME: Handle more than one fragment.
    42044204    ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect;
    4205     clipToRect(paintingInfo, originalContext, backgroundRect);
     4205    clipToRect(originalContext, paintingInfo, backgroundRect);
    42064206    filterPainter->applyFilterEffect(originalContext);
    4207     restoreClip(originalContext, paintingInfo.paintDirtyRect, backgroundRect);
     4207    restoreClip(originalContext, paintingInfo, backgroundRect);
    42084208}
    42094209
     
    46644664        }
    46654665
    4666         parent()->clipToRect(paintingInfo, context, clipRect);
     4666        parent()->clipToRect(context, paintingInfo, clipRect);
    46674667        paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset);
    4668         parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
     4668        parent()->restoreClip(context, paintingInfo, clipRect);
    46694669    }
    46704670}
     
    46854685            // Paint our background first, before painting any child layers.
    46864686            // Establish the clip used to paint our background.
    4687             clipToRect(localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Background painting will handle clipping to self.
     4687            clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Background painting will handle clipping to self.
    46884688        }
    46894689       
     
    46944694
    46954695        if (localPaintingInfo.clipToDirtyRect)
    4696             restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
     4696            restoreClip(context, localPaintingInfo, fragment.backgroundRect);
    46974697    }
    46984698}
     
    47254725    if (shouldClip) {
    47264726        clippedRect = layerFragments[0].foregroundRect;
    4727         clipToRect(localPaintingInfo, context, clippedRect);
     4727        clipToRect(context, localPaintingInfo, clippedRect);
    47284728    }
    47294729   
     
    47404740   
    47414741    if (shouldClip)
    4742         restoreClip(context, localPaintingInfo.paintDirtyRect, clippedRect);
     4742        restoreClip(context, localPaintingInfo, clippedRect);
    47434743}
    47444744
     
    47534753       
    47544754        if (shouldClip)
    4755             clipToRect(localPaintingInfo, context, fragment.foregroundRect);
     4755            clipToRect(context, localPaintingInfo, fragment.foregroundRect);
    47564756   
    47574757        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
     
    47614761       
    47624762        if (shouldClip)
    4763             restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
     4763            restoreClip(context, localPaintingInfo, fragment.foregroundRect);
    47644764    }
    47654765}
     
    47744774        // Paint our own outline
    47754775        PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer());
    4776         clipToRect(localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius);
     4776        clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius);
    47774777        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation));
    4778         restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
     4778        restoreClip(context, localPaintingInfo, fragment.backgroundRect);
    47794779    }
    47804780}
     
    47884788
    47894789        if (localPaintingInfo.clipToDirtyRect)
    4790             clipToRect(localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.
     4790            clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.
    47914791       
    47924792        // Paint the mask.
     
    47964796       
    47974797        if (localPaintingInfo.clipToDirtyRect)
    4798             restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
     4798            restoreClip(context, localPaintingInfo, fragment.backgroundRect);
    47994799    }
    48004800}
     
    48084808
    48094809        if (localPaintingInfo.clipToDirtyRect)
    4810             clipToRect(localPaintingInfo, context, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.
     4810            clipToRect(context, localPaintingInfo, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.
    48114811
    48124812        // Paint the clipped mask.
     
    48154815
    48164816        if (localPaintingInfo.clipToDirtyRect)
    4817             restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
     4817            restoreClip(context, localPaintingInfo, fragment.foregroundRect);
    48184818    }
    48194819}
     
    48244824        if (fragment.backgroundRect.isEmpty())
    48254825            continue;
    4826         clipToRect(localPaintingInfo, context, fragment.backgroundRect);
     4826        clipToRect(context, localPaintingInfo, fragment.backgroundRect);
    48274827        paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)),
    48284828            snappedIntRect(fragment.backgroundRect.rect()), true);
    4829         restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
     4829        restoreClip(context, localPaintingInfo, fragment.backgroundRect);
    48304830    }
    48314831}
     
    70057005        // Optimize clipping for the single fragment case.
    70067006        if (shouldClip)
    7007             clipToRect(paintingInfo, context, clipRect);
     7007            clipToRect(context, paintingInfo, clipRect);
    70087008
    70097009        flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelAccumulation,
     
    70117011
    70127012        if (shouldClip)
    7013             restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
     7013            restoreClip(context, paintingInfo, clipRect);
    70147014    }
    70157015}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r200283 r200284  
    727727    void clearRepaintRects();
    728728
    729     void clipToRect(const LayerPaintingInfo&, GraphicsContext&, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
    730     void restoreClip(GraphicsContext&, const LayoutRect& paintDirtyRect, const ClipRect&);
     729    void clipToRect(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
     730    void restoreClip(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&);
    731731
    732732    bool shouldRepaintAfterLayout() const;
Note: See TracChangeset for help on using the changeset viewer.