Changeset 249455 in webkit


Ignore:
Timestamp:
Sep 3, 2019 9:54:55 PM (5 years ago)
Author:
Antti Koivisto
Message:

Remove redundant painting phase arguments from GraphicsLayerClient functions
https://bugs.webkit.org/show_bug.cgi?id=201443

Reviewed by Simon Fraser.

Source/WebCore:

It is available from the GraphicsLayer.

  • page/PageOverlayController.cpp:

(WebCore::PageOverlayController::paintContents):

  • page/PageOverlayController.h:
  • page/mac/ServicesOverlayController.h:
  • page/mac/ServicesOverlayController.mm:

(WebCore::ServicesOverlayController::Highlight::paintContents):

  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::paintGraphicsLayerContents):

  • platform/graphics/GraphicsLayerClient.h:

(WebCore::GraphicsLayerClient::paintContents):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintFlagsForLayer const):

Factor into a function.

(WebCore::RenderLayerBacking::paintContents):

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

(WebCore::RenderLayerCompositor::paintContents):

  • rendering/RenderLayerCompositor.h:

Source/WebKitLegacy/win:

  • WebView.cpp:

(WebView::paintContents):

  • WebView.h:
Location:
trunk/Source
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249453 r249455  
     12019-09-03  Antti Koivisto  <antti@apple.com>
     2
     3        Remove redundant painting phase arguments from GraphicsLayerClient functions
     4        https://bugs.webkit.org/show_bug.cgi?id=201443
     5
     6        Reviewed by Simon Fraser.
     7
     8        It is available from the GraphicsLayer.
     9
     10        * page/PageOverlayController.cpp:
     11        (WebCore::PageOverlayController::paintContents):
     12        * page/PageOverlayController.h:
     13        * page/mac/ServicesOverlayController.h:
     14        * page/mac/ServicesOverlayController.mm:
     15        (WebCore::ServicesOverlayController::Highlight::paintContents):
     16        * platform/graphics/GraphicsLayer.cpp:
     17        (WebCore::GraphicsLayer::paintGraphicsLayerContents):
     18        * platform/graphics/GraphicsLayerClient.h:
     19        (WebCore::GraphicsLayerClient::paintContents):
     20        * rendering/RenderLayerBacking.cpp:
     21        (WebCore::RenderLayerBacking::paintIntoLayer):
     22        (WebCore::RenderLayerBacking::paintFlagsForLayer const):
     23
     24        Factor into a function.
     25
     26        (WebCore::RenderLayerBacking::paintContents):
     27        * rendering/RenderLayerBacking.h:
     28        * rendering/RenderLayerCompositor.cpp:
     29        (WebCore::RenderLayerCompositor::paintContents):
     30        * rendering/RenderLayerCompositor.h:
     31
    1322019-09-03  Myles C. Maxfield  <mmaxfield@apple.com>
    233
  • trunk/Source/WebCore/page/PageOverlayController.cpp

    r246231 r249455  
    392392}
    393393
    394 void PageOverlayController::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clipRect, GraphicsLayerPaintBehavior)
     394void PageOverlayController::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, const FloatRect& clipRect, GraphicsLayerPaintBehavior)
    395395{
    396396    for (auto& overlayAndGraphicsLayer : m_overlayGraphicsLayers) {
  • trunk/Source/WebCore/page/PageOverlayController.h

    r245950 r249455  
    9494    // GraphicsLayerClient
    9595    void notifyFlushRequired(const GraphicsLayer*) override;
    96     void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
     96    void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& clipRect, GraphicsLayerPaintBehavior) override;
    9797    float deviceScaleFactor() const override;
    9898    bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
  • trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp

    r248846 r249455  
    8686
    8787private:
    88     void paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior) override
     88    void paintContents(const GraphicsLayer*, GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior) override
    8989    {
    9090        GraphicsContextStateSaver stateSaver(context);
  • trunk/Source/WebCore/page/mac/ServicesOverlayController.h

    r245950 r249455  
    8383        // GraphicsLayerClient
    8484        void notifyFlushRequired(const GraphicsLayer*) override;
    85         void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& inClip, GraphicsLayerPaintBehavior) override;
     85        void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& inClip, GraphicsLayerPaintBehavior) override;
    8686        float deviceScaleFactor() const override;
    8787
  • trunk/Source/WebCore/page/mac/ServicesOverlayController.mm

    r246231 r249455  
    125125}
    126126
    127 void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect&, GraphicsLayerPaintBehavior)
     127void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, const FloatRect&, GraphicsLayerPaintBehavior)
    128128{
    129129    if (!DataDetectorsLibrary())
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r248846 r249455  
    509509    clipRect.move(offset);
    510510
    511     client().paintContents(this, context, m_paintingPhase, clipRect, layerPaintBehavior);
     511    client().paintContents(this, context, clipRect, layerPaintBehavior);
    512512}
    513513
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r246668 r249455  
    103103    virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) { }
    104104
    105     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& /* inClip */, GraphicsLayerPaintBehavior) { }
     105    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& /* inClip */, GraphicsLayerPaintBehavior) { }
    106106    virtual void didChangePlatformLayerForLayer(const GraphicsLayer*) { }
    107107
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r249440 r249455  
    27772777void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, GraphicsContext& context,
    27782778    const IntRect& paintDirtyRect, // In the coords of rootLayer.
    2779     OptionSet<PaintBehavior> paintBehavior, OptionSet<GraphicsLayerPaintingPhase> paintingPhase)
    2780 {
    2781     if ((paintsIntoWindow() || paintsIntoCompositedAncestor()) && paintingPhase != OptionSet<GraphicsLayerPaintingPhase>(GraphicsLayerPaintingPhase::ChildClippingMask)) {
     2779    OptionSet<PaintBehavior> paintBehavior)
     2780{
     2781    if ((paintsIntoWindow() || paintsIntoCompositedAncestor()) && graphicsLayer->paintingPhase() != OptionSet<GraphicsLayerPaintingPhase>(GraphicsLayerPaintingPhase::ChildClippingMask)) {
    27822782#if !PLATFORM(IOS_FAMILY) && !OS(WINDOWS)
    27832783        // FIXME: Looks like the CALayer tree is out of sync with the GraphicsLayer heirarchy
     
    27892789    }
    27902790
     2791    auto paintFlags = paintFlagsForLayer(*graphicsLayer);
     2792
     2793#ifndef NDEBUG
     2794    RenderElement::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(&renderer());
     2795#endif
     2796
     2797    auto paintOneLayer = [&](RenderLayer& layer, OptionSet<RenderLayer::PaintLayerFlag> paintFlags) {
     2798        InspectorInstrumentation::willPaint(layer.renderer());
     2799
     2800        FrameView::PaintingState paintingState;
     2801        if (layer.isRenderViewLayer())
     2802            renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState);
     2803
     2804        RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer);
     2805
     2806        if (&layer == &m_owningLayer) {
     2807            layer.paintLayerContents(context, paintingInfo, paintFlags);
     2808
     2809            if (layer.containsDirtyOverlayScrollbars())
     2810                layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
     2811        } else
     2812            layer.paintLayerWithEffects(context, paintingInfo, paintFlags);
     2813
     2814        if (layer.isRenderViewLayer())
     2815            renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState);
     2816
     2817        ASSERT(!m_owningLayer.m_usedTransparency);
     2818
     2819        InspectorInstrumentation::didPaint(layer.renderer(), paintDirtyRect);
     2820    };
     2821
     2822    paintOneLayer(m_owningLayer, paintFlags);
     2823   
     2824    // FIXME: Need to check m_foregroundLayer, masking etc. webkit.org/b/197565.
     2825    GraphicsLayer* destinationForSharingLayers = m_scrolledContentsLayer ? m_scrolledContentsLayer.get() : m_graphicsLayer.get();
     2826
     2827    if (graphicsLayer == destinationForSharingLayers) {
     2828        OptionSet<RenderLayer::PaintLayerFlag> sharingLayerPaintFlags = {
     2829            RenderLayer::PaintLayerPaintingCompositingBackgroundPhase,
     2830            RenderLayer::PaintLayerPaintingCompositingForegroundPhase };
     2831
     2832        if (graphicsLayer->paintingPhase().contains(GraphicsLayerPaintingPhase::OverflowContents))
     2833            sharingLayerPaintFlags.add(RenderLayer::PaintLayerPaintingOverflowContents);
     2834
     2835        for (auto& layerWeakPtr : m_backingSharingLayers)
     2836            paintOneLayer(*layerWeakPtr, sharingLayerPaintFlags);
     2837    }
     2838
     2839    compositor().didPaintBacking(this);
     2840}
     2841
     2842OptionSet<RenderLayer::PaintLayerFlag> RenderLayerBacking::paintFlagsForLayer(const GraphicsLayer& graphicsLayer) const
     2843{
    27912844    OptionSet<RenderLayer::PaintLayerFlag> paintFlags;
     2845
     2846    auto paintingPhase = graphicsLayer.paintingPhase();
    27922847    if (paintingPhase.contains(GraphicsLayerPaintingPhase::Background))
    27932848        paintFlags.add(RenderLayer::PaintLayerPaintingCompositingBackgroundPhase);
     
    28052860        paintFlags.add(RenderLayer::PaintLayerPaintingCompositingScrollingPhase);
    28062861
    2807     if (graphicsLayer == m_backgroundLayer.get() && m_backgroundLayerPaintsFixedRootBackground)
     2862    if (&graphicsLayer == m_backgroundLayer.get() && m_backgroundLayerPaintsFixedRootBackground)
    28082863        paintFlags.add({ RenderLayer::PaintLayerPaintingRootBackgroundOnly, RenderLayer::PaintLayerPaintingCompositingForegroundPhase }); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
    28092864    else if (compositor().fixedRootBackgroundLayer())
    28102865        paintFlags.add(RenderLayer::PaintLayerPaintingSkipRootBackground);
    28112866
    2812 #ifndef NDEBUG
    2813     RenderElement::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(&renderer());
    2814 #endif
    2815 
    2816     auto paintOneLayer = [&](RenderLayer& layer, OptionSet<RenderLayer::PaintLayerFlag> paintFlags) {
    2817         InspectorInstrumentation::willPaint(layer.renderer());
    2818 
    2819         FrameView::PaintingState paintingState;
    2820         if (layer.isRenderViewLayer())
    2821             renderer().view().frameView().willPaintContents(context, paintDirtyRect, paintingState);
    2822 
    2823         RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer);
    2824 
    2825         if (&layer == &m_owningLayer) {
    2826             layer.paintLayerContents(context, paintingInfo, paintFlags);
    2827 
    2828             if (layer.containsDirtyOverlayScrollbars())
    2829                 layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
    2830         } else
    2831             layer.paintLayerWithEffects(context, paintingInfo, paintFlags);
    2832 
    2833         if (layer.isRenderViewLayer())
    2834             renderer().view().frameView().didPaintContents(context, paintDirtyRect, paintingState);
    2835 
    2836         ASSERT(!m_owningLayer.m_usedTransparency);
    2837 
    2838         InspectorInstrumentation::didPaint(layer.renderer(), paintDirtyRect);
    2839     };
    2840 
    2841     paintOneLayer(m_owningLayer, paintFlags);
    2842    
    2843     // FIXME: Need to check m_foregroundLayer, masking etc. webkit.org/b/197565.
    2844     GraphicsLayer* destinationForSharingLayers = m_scrolledContentsLayer ? m_scrolledContentsLayer.get() : m_graphicsLayer.get();
    2845 
    2846     if (graphicsLayer == destinationForSharingLayers) {
    2847         OptionSet<RenderLayer::PaintLayerFlag> sharingLayerPaintFlags = {
    2848             RenderLayer::PaintLayerPaintingCompositingBackgroundPhase,
    2849             RenderLayer::PaintLayerPaintingCompositingForegroundPhase };
    2850 
    2851         if (paintingPhase.contains(GraphicsLayerPaintingPhase::OverflowContents))
    2852             sharingLayerPaintFlags.add(RenderLayer::PaintLayerPaintingOverflowContents);
    2853 
    2854         for (auto& layerWeakPtr : m_backingSharingLayers)
    2855             paintOneLayer(*layerWeakPtr, sharingLayerPaintFlags);
    2856     }
    2857 
    2858     compositor().didPaintBacking(this);
     2867    return paintFlags;
    28592868}
    28602869
     
    29792988
    29802989// Up-call from compositing layer drawing callback.
    2981 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase> paintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
     2990void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
    29822991{
    29832992#ifndef NDEBUG
     
    30043013        || graphicsLayer == m_scrolledContentsLayer.get()) {
    30053014
    3006         if (!paintingPhase.contains(GraphicsLayerPaintingPhase::OverflowContents))
     3015        if (!graphicsLayer->paintingPhase().contains(GraphicsLayerPaintingPhase::OverflowContents))
    30073016            dirtyRect.intersect(enclosingIntRect(compositedBoundsIncludingMargin()));
    30083017
     
    30153024            behavior.add(PaintBehavior::TileFirstPaint);
    30163025
    3017         paintIntoLayer(graphicsLayer, context, dirtyRect, behavior, paintingPhase);
     3026        paintIntoLayer(graphicsLayer, context, dirtyRect, behavior);
    30183027
    30193028        if (renderer().settings().visibleDebugOverlayRegions() & NonFastScrollableRegion) // Piggy-back off the setting that shows touch handler regions.
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r249440 r249455  
    231231    void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
    232232
    233     void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior) override;
     233    void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect& clip, GraphicsLayerPaintBehavior) override;
    234234
    235235    float deviceScaleFactor() const override;
     
    377377    GraphicsLayer* tileCacheFlatteningLayer() const { return m_isFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
    378378
    379     void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>, OptionSet<GraphicsLayerPaintingPhase>);
     379    void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, OptionSet<PaintBehavior>);
     380    OptionSet<RenderLayer::PaintLayerFlag> paintFlagsForLayer(const GraphicsLayer&) const;
    380381   
    381382    void paintDebugOverlays(const GraphicsLayer*, GraphicsContext&);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r249440 r249455  
    33833383}
    33843384
    3385 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& clip, GraphicsLayerPaintBehavior)
     3385void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior)
    33863386{
    33873387#if PLATFORM(MAC)
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r249440 r249455  
    398398    // GraphicsLayerClient implementation
    399399    void notifyFlushRequired(const GraphicsLayer*) override;
    400     void paintContents(const GraphicsLayer*, GraphicsContext&, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect&, GraphicsLayerPaintBehavior) override;
     400    void paintContents(const GraphicsLayer*, GraphicsContext&, const FloatRect&, GraphicsLayerPaintBehavior) override;
    401401    void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const override;
    402402    bool isTrackingRepaints() const override { return m_isTrackingRepaints; }
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r249175 r249455  
     12019-09-03  Antti Koivisto  <antti@apple.com>
     2
     3        Remove redundant painting phase arguments from GraphicsLayerClient functions
     4        https://bugs.webkit.org/show_bug.cgi?id=201443
     5
     6        Reviewed by Simon Fraser.
     7
     8        * WebView.cpp:
     9        (WebView::paintContents):
     10        * WebView.h:
     11
    1122019-08-27  Mark Lam  <mark.lam@apple.com>
    213
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.cpp

    r248885 r249455  
    325325}
    326326
    327 void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& rectToPaint, GraphicsLayerPaintBehavior)
     327void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, const FloatRect& rectToPaint, GraphicsLayerPaintBehavior)
    328328{
    329329    context.save();
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/AcceleratedCompositingContext.h

    r248885 r249455  
    5454
    5555    // GraphicsLayerClient
    56     void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, OptionSet<WebCore::GraphicsLayerPaintingPhase>, const WebCore::FloatRect& rectToPaint, WebCore::GraphicsLayerPaintBehavior) override;
     56    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, const WebCore::FloatRect& rectToPaint, WebCore::GraphicsLayerPaintBehavior) override;
    5757    float deviceScaleFactor() const override;
    5858
  • trunk/Source/WebKitLegacy/win/WebView.cpp

    r248960 r249455  
    73717371}
    73727372
    7373 void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect& inClipPixels, GraphicsLayerPaintBehavior)
     7373void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, const FloatRect& inClipPixels, GraphicsLayerPaintBehavior)
    73747374{
    73757375    Frame* frame = core(m_mainFrame);
  • trunk/Source/WebKitLegacy/win/WebView.h

    r248444 r249455  
    567567    void notifyAnimationStarted(const WebCore::GraphicsLayer*, const String&, MonotonicTime) override;
    568568    void notifyFlushRequired(const WebCore::GraphicsLayer*) override;
    569     void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, OptionSet<WebCore::GraphicsLayerPaintingPhase>, const WebCore::FloatRect& inClip, WebCore::GraphicsLayerPaintBehavior) override;
     569    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, const WebCore::FloatRect& inClip, WebCore::GraphicsLayerPaintBehavior) override;
    570570
    571571#if USE(CA)
Note: See TracChangeset for help on using the changeset viewer.