Changeset 212153 in webkit


Ignore:
Timestamp:
Feb 10, 2017, 3:02:36 PM (9 years ago)
Author:
Simon Fraser
Message:

Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
https://bugs.webkit.org/show_bug.cgi?id=168127
rdar://problem/30467120

Reviewed by Tim Horton.
Source/WebCore:

Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
which forgot to hit masks and replica layers with a generic traverse() function, which
is then used for setting 'inWindow' as well as resetting tracked repaints.

Tests: compositing/tiling/tiled-mask-inwindow.html

compositing/tiling/tiled-reflection-inwindow.html

  • page/PageOverlayController.cpp:

(WebCore::PageOverlayController::layerWithDocumentOverlays):
(WebCore::PageOverlayController::layerWithViewOverlays):

  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::setIsInWindow):
(WebCore::GraphicsLayer::setReplicatedByLayer):
(WebCore::GraphicsLayer::traverse):
(WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.

  • platform/graphics/GraphicsLayer.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::setIsInWindow):
(WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
(WebCore::resetTrackedRepaintRectsRecursive): Deleted.

Tools:

Reparent the web view before we try to fetch it via:

[[[window contentView] subviews] objectAtIndex:0];

which would throw an exception if the test unparented it.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(resetWebViewToConsistentStateBeforeTesting):
(runTest):

LayoutTests:

  • compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
  • compositing/tiling/tiled-mask-inwindow.html: Added.
  • compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
  • compositing/tiling/tiled-reflection-inwindow.html: Added.
  • platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
  • platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
  • platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
  • platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
  • platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
  • platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
Location:
trunk
Files:
10 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212152 r212153  
     12017-02-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
     4        https://bugs.webkit.org/show_bug.cgi?id=168127
     5        rdar://problem/30467120
     6
     7        Reviewed by Tim Horton.
     8
     9        * compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
     10        * compositing/tiling/tiled-mask-inwindow.html: Added.
     11        * compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
     12        * compositing/tiling/tiled-reflection-inwindow.html: Added.
     13        * platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
     14        * platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
     15        * platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
     16        * platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
     17        * platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
     18        * platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
     19
    1202017-02-09  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/WebCore/ChangeLog

    r212152 r212153  
     12017-02-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
     4        https://bugs.webkit.org/show_bug.cgi?id=168127
     5        rdar://problem/30467120
     6
     7        Reviewed by Tim Horton.
     8       
     9        Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
     10        which forgot to hit masks and replica layers with a generic traverse() function, which
     11        is then used for setting 'inWindow' as well as resetting tracked repaints.
     12
     13        Tests: compositing/tiling/tiled-mask-inwindow.html
     14               compositing/tiling/tiled-reflection-inwindow.html
     15
     16        * page/PageOverlayController.cpp:
     17        (WebCore::PageOverlayController::layerWithDocumentOverlays):
     18        (WebCore::PageOverlayController::layerWithViewOverlays):
     19        * platform/graphics/GraphicsLayer.cpp:
     20        (WebCore::GraphicsLayer::setIsInWindow):
     21        (WebCore::GraphicsLayer::setReplicatedByLayer):
     22        (WebCore::GraphicsLayer::traverse):
     23        (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
     24        * platform/graphics/GraphicsLayer.h:
     25        * rendering/RenderLayerCompositor.cpp:
     26        (WebCore::RenderLayerCompositor::setIsInWindow):
     27        (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
     28        (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
     29
    1302017-02-09  Simon Fraser  <simon.fraser@apple.com>
    231
  • trunk/Source/WebCore/page/PageOverlayController.cpp

    r211929 r212153  
    104104
    105105        GraphicsLayer& layer = *overlayAndLayer.value;
    106         layer.setIsInWindowIncludingDescendants(inWindow);
     106        GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) {
     107            layer.setIsInWindow(inWindow);
     108        });
    107109        updateOverlayGeometry(overlay, layer);
    108110       
     
    126128
    127129        GraphicsLayer& layer = *overlayAndLayer.value;
    128         layer.setIsInWindowIncludingDescendants(inWindow);
     130        GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) {
     131            layer.setIsInWindow(inWindow);
     132        });
    129133        updateOverlayGeometry(overlay, layer);
    130134       
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r211949 r212153  
    364364}
    365365
    366 void GraphicsLayer::setIsInWindowIncludingDescendants(bool inWindow)
     366void GraphicsLayer::setIsInWindow(bool inWindow)
    367367{
    368368    if (TiledBacking* tiledBacking = this->tiledBacking())
    369369        tiledBacking->setIsInWindow(inWindow);
    370 
    371     for (auto* childLayer : children())
    372         childLayer->setIsInWindowIncludingDescendants(inWindow);
    373370}
    374371
     
    379376
    380377    if (m_replicaLayer)
    381         m_replicaLayer->setReplicatedLayer(0);
     378        m_replicaLayer->setReplicatedLayer(nullptr);
    382379
    383380    if (layer)
     
    669666}
    670667
     668void GraphicsLayer::traverse(GraphicsLayer& layer, std::function<void (GraphicsLayer&)> traversalFunc)
     669{
     670    traversalFunc(layer);
     671
     672    for (auto* childLayer : layer.children())
     673        traverse(*childLayer, traversalFunc);
     674
     675    if (auto* replicaLayer = layer.replicaLayer())
     676        traverse(*replicaLayer, traversalFunc);
     677
     678    if (auto* maskLayer = layer.maskLayer())
     679        traverse(*maskLayer, traversalFunc);
     680}
     681
    671682void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeAsTextBehavior behavior) const
    672683{
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r211750 r212153  
    518518    WEBCORE_EXPORT void noteDeviceOrPageScaleFactorChangedIncludingDescendants();
    519519
    520     void setIsInWindowIncludingDescendants(bool);
     520    void setIsInWindow(bool);
    521521
    522522    // Some compositing systems may do internal batching to synchronize compositing updates
     
    561561    virtual bool isGraphicsLayerTextureMapper() const { return false; }
    562562    virtual bool isCoordinatedGraphicsLayer() const { return false; }
     563
     564    static void traverse(GraphicsLayer&, std::function<void (GraphicsLayer&)>);
    563565
    564566protected:
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r211949 r212153  
    20352035        return;
    20362036
    2037     if (GraphicsLayer* rootLayer = rootGraphicsLayer())
    2038         rootLayer->setIsInWindowIncludingDescendants(isInWindow);
     2037    if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
     2038        GraphicsLayer::traverse(*rootLayer, [isInWindow](GraphicsLayer& layer) {
     2039            layer.setIsInWindow(isInWindow);
     2040        });
     2041    }
    20392042
    20402043    if (isInWindow) {
     
    28632866}
    28642867
    2865 static void resetTrackedRepaintRectsRecursive(GraphicsLayer& graphicsLayer)
    2866 {
    2867     graphicsLayer.resetTrackedRepaints();
    2868 
    2869     for (auto* childLayer : graphicsLayer.children())
    2870         resetTrackedRepaintRectsRecursive(*childLayer);
    2871 
    2872     if (GraphicsLayer* replicaLayer = graphicsLayer.replicaLayer())
    2873         resetTrackedRepaintRectsRecursive(*replicaLayer);
    2874 
    2875     if (GraphicsLayer* maskLayer = graphicsLayer.maskLayer())
    2876         resetTrackedRepaintRectsRecursive(*maskLayer);
    2877 }
    2878 
    28792868void RenderLayerCompositor::resetTrackedRepaintRects()
    28802869{
    2881     if (GraphicsLayer* rootLayer = rootGraphicsLayer())
    2882         resetTrackedRepaintRectsRecursive(*rootLayer);
     2870    if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
     2871        GraphicsLayer::traverse(*rootLayer, [](GraphicsLayer& layer) {
     2872            layer.resetTrackedRepaints();
     2873        });
     2874    }
    28832875}
    28842876
  • trunk/Tools/ChangeLog

    r212150 r212153  
     12017-02-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
     4        https://bugs.webkit.org/show_bug.cgi?id=168127
     5        rdar://problem/30467120
     6
     7        Reviewed by Tim Horton.
     8
     9        Reparent the web view before we try to fetch it via:
     10            [[[window contentView] subviews] objectAtIndex:0];
     11        which would throw an exception if the test unparented it.
     12
     13        * DumpRenderTree/mac/DumpRenderTree.mm:
     14        (resetWebViewToConsistentStateBeforeTesting):
     15        (runTest):
     16
    1172017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r212150 r212153  
    18491849    WebView *webView = [mainFrame webView];
    18501850
    1851 #if PLATFORM(MAC)
    1852     if (![webView superview])
    1853         [[mainWindow contentView] addSubview:webView];
    1854 #endif
    1855 
    18561851#if PLATFORM(IOS)
    18571852    adjustWebDocumentForStandardViewport(gWebBrowserView, gWebScrollView);
     
    21122107    }
    21132108
     2109#if PLATFORM(MAC)
     2110    // Make sure the WebView is parented, since the test may have unparented it.
     2111    WebView *webView = [mainFrame webView];
     2112    if (![webView superview])
     2113        [[mainWindow contentView] addSubview:webView];
     2114#endif
     2115
    21142116    if (gTestRunner->closeRemainingWindowsWhenComplete()) {
    21152117        NSArray* array = [DumpRenderTreeWindow openWindows];
Note: See TracChangeset for help on using the changeset viewer.