Changeset 154470 in webkit


Ignore:
Timestamp:
Aug 22, 2013 5:28:48 PM (11 years ago)
Author:
Simon Fraser
Message:

compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering
https://bugs.webkit.org/show_bug.cgi?id=119825

Source/WebCore:

Reviewed by Tim Horton.

r137526 and some earlier commits attempted to avoid unconditionally
repainting layers when their size changes, because this was causing
TiledBacking layers to repaint when the document size changed.

However, the approach required that we have good information about
whether size changes require a repaint, which in some cases is hard
to determine, especially when RenderLayer changes affect our
decisions about which layers are composited.

Fix by pushing the decision about whether to repaint on size change
into GraphicsLayer. The default is to repaint on size change,
but GraphicsLayer provides a function that can be overridden to
modify this behavior; GraphicsLayerCA does so to avoid repaints
when layers with TiledBackings get resized.

Test: compositing/repaint/repaint-on-layer-grouping-change.html

  • WebCore.exp.in: WebKit2 needs GraphicsLayer::setSize, which is no longer inline.
  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::setOffsetFromRenderer):
(WebCore::GraphicsLayer::setSize):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::shouldRepaintOnSizeChange):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::shouldRepaintOnSizeChange):

  • platform/graphics/ca/GraphicsLayerCA.h:
  • rendering/RenderLayerBacking.h: No longer need m_boundsConstrainedByClipping
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::RenderLayerBacking::updateCompositedBounds):
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): setSize takes
care of repainting for us now, so we can remove all the conditional code.

LayoutTests:

Reviewed by Tim Horton.

Test that dumps repaint rects on layers after visibility changes affect
the layer hierarchy.

  • compositing/repaint/repaint-on-layer-grouping-change-expected.txt: Added.
  • compositing/repaint/repaint-on-layer-grouping-change.html: Added.
  • compositing/repaint/resize-repaint-expected.txt: Update result.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154462 r154470  
     12013-08-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=119825
     5
     6        Reviewed by Tim Horton.
     7       
     8        Test that dumps repaint rects on layers after visibility changes affect
     9        the layer hierarchy.
     10
     11        * compositing/repaint/repaint-on-layer-grouping-change-expected.txt: Added.
     12        * compositing/repaint/repaint-on-layer-grouping-change.html: Added.
     13        * compositing/repaint/resize-repaint-expected.txt: Update result.
     14
    1152013-08-22  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    216
  • trunk/LayoutTests/compositing/repaint/resize-repaint-expected.txt

    r148057 r154470  
    1515          (drawsContent 1)
    1616          (repaint rects
    17             (rect 2.00 104.00 398.00 1.00)
    18             (rect 0.00 104.00 402.00 1.00)
     17            (rect 0.00 0.00 402.00 207.00)
    1918          )
    2019        )
  • trunk/Source/WebCore/ChangeLog

    r154469 r154470  
     12013-08-22  Simon Fraser  <simon.fraser@apple.com>
     2
     3        compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering
     4        https://bugs.webkit.org/show_bug.cgi?id=119825
     5
     6        Reviewed by Tim Horton.
     7       
     8        r137526 and some earlier commits attempted to avoid unconditionally
     9        repainting layers when their size changes, because this was causing
     10        TiledBacking layers to repaint when the document size changed.
     11       
     12        However, the approach required that we have good information about
     13        whether size changes require a repaint, which in some cases is hard
     14        to determine, especially when RenderLayer changes affect our
     15        decisions about which layers are composited.
     16       
     17        Fix by pushing the decision about whether to repaint on size change
     18        into GraphicsLayer. The default is to repaint on size change,
     19        but GraphicsLayer provides a function that can be overridden to
     20        modify this behavior; GraphicsLayerCA does so to avoid repaints
     21        when layers with TiledBackings get resized.
     22
     23        Test: compositing/repaint/repaint-on-layer-grouping-change.html
     24
     25        * WebCore.exp.in: WebKit2 needs GraphicsLayer::setSize, which is no longer inline.
     26        * platform/graphics/GraphicsLayer.cpp:
     27        (WebCore::GraphicsLayer::setOffsetFromRenderer):
     28        (WebCore::GraphicsLayer::setSize):
     29        * platform/graphics/GraphicsLayer.h:
     30        (WebCore::GraphicsLayer::shouldRepaintOnSizeChange):
     31        * platform/graphics/ca/GraphicsLayerCA.cpp:
     32        (WebCore::GraphicsLayerCA::shouldRepaintOnSizeChange):
     33        * platform/graphics/ca/GraphicsLayerCA.h:
     34        * rendering/RenderLayerBacking.h: No longer need m_boundsConstrainedByClipping
     35        * rendering/RenderLayerBacking.cpp:
     36        (WebCore::RenderLayerBacking::RenderLayerBacking):
     37        (WebCore::RenderLayerBacking::updateCompositedBounds):
     38        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): setSize takes
     39        care of repainting for us now, so we can remove all the conditional code.
     40
    1412013-08-22  Simon Fraser  <simon.fraser@apple.com>
    242
  • trunk/Source/WebCore/WebCore.exp.in

    r154373 r154470  
    13731373__ZNK7WebCore13ContainerNode14childNodeCountEv
    13741374__ZNK7WebCore13ContainerNode9childNodeEj
     1375__ZN7WebCore13GraphicsLayer7setSizeERKNS_9FloatSizeE
    13751376__ZNK7WebCore13GraphicsLayer18accumulatedOpacityEv
    13761377__ZNK7WebCore13GraphicsLayer18getDebugBorderInfoERNS_5ColorERf
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r151319 r154470  
    308308}
    309309
     310void GraphicsLayer::setSize(const FloatSize& size)
     311{
     312    if (size == m_size)
     313        return;
     314   
     315    m_size = size;
     316
     317    if (shouldRepaintOnSizeChange())
     318        setNeedsDisplay();
     319}
     320
    310321void GraphicsLayer::setBackgroundColor(const Color& color)
    311322{
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r153408 r154470  
    290290    // The size of the layer.
    291291    const FloatSize& size() const { return m_size; }
    292     virtual void setSize(const FloatSize& size) { m_size = size; }
     292    virtual void setSize(const FloatSize&);
    293293
    294294    // The boundOrigin affects the offset at which content is rendered, and sublayers are positioned.
     
    501501    // rotations of >= 180 degrees
    502502    static int validateTransformOperations(const KeyframeValueList&, bool& hasBigRotation);
     503
     504    virtual bool shouldRepaintOnSizeChange() const { return drawsContent(); }
    503505
    504506    virtual void setOpacityInternal(float) { }
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r154314 r154470  
    673673}
    674674
     675bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
     676{
     677    return drawsContent() && !tiledBacking();
     678}
     679
    675680bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& animationName, double timeOffset)
    676681{
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r149694 r154470  
    176176
    177177    virtual double backingStoreMemoryEstimate() const;
     178
     179    virtual bool shouldRepaintOnSizeChange() const OVERRIDE;
    178180
    179181    void updateOpacityOnLayer();
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r154401 r154470  
    111111    , m_scrollLayerID(0)
    112112    , m_artificiallyInflatedBounds(false)
    113     , m_boundsConstrainedByClipping(false)
    114113    , m_isMainFrameRenderViewLayer(false)
    115114    , m_usingTiledCacheLayer(false)
     
    449448
    450449        layerBounds.intersect(clippingBounds);
    451         m_boundsConstrainedByClipping = true;
    452     } else
    453         m_boundsConstrainedByClipping = false;
     450    }
    454451   
    455452    // If the element has a transform-origin that has fixed lengths, and the renderer has zero size,
     
    706703
    707704    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
     705    m_graphicsLayer->setSize(contentsSize);
    708706    m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
    709707
    710     FloatSize oldSize = m_graphicsLayer->size();
    711     if (oldSize != contentsSize) {
    712         m_graphicsLayer->setSize(contentsSize);
    713         // Usually invalidation will happen via layout etc, but if we've affected the layer
    714         // size by constraining relative to a clipping ancestor or the viewport, we
    715         // have to invalidate to avoid showing stretched content.
    716         if (m_boundsConstrainedByClipping)
    717             m_graphicsLayer->setNeedsDisplay();
    718     }
    719708    if (!m_isMainFrameRenderViewLayer) {
    720709        // For non-root layers, background is always painted by the primary graphics layer.
     
    733722   
    734723    if (m_maskLayer) {
    735         if (m_maskLayer->size() != m_graphicsLayer->size()) {
    736             m_maskLayer->setSize(m_graphicsLayer->size());
    737             m_maskLayer->setNeedsDisplay();
    738         }
     724        m_maskLayer->setSize(m_graphicsLayer->size());
    739725        m_maskLayer->setPosition(FloatPoint());
    740726        m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
     
    793779
    794780        m_foregroundLayer->setPosition(foregroundPosition);
    795         if (foregroundSize != m_foregroundLayer->size()) {
    796             m_foregroundLayer->setSize(foregroundSize);
    797             m_foregroundLayer->setNeedsDisplay();
    798         }
     781        m_foregroundLayer->setSize(foregroundSize);
    799782        m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
    800783    }
     
    809792        }
    810793        m_backgroundLayer->setPosition(backgroundPosition);
    811         if (backgroundSize != m_backgroundLayer->size()) {
    812             m_backgroundLayer->setSize(backgroundSize);
    813             m_backgroundLayer->setNeedsDisplay();
    814         }
     794        m_backgroundLayer->setSize(backgroundSize);
    815795        m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
    816796    }
     
    856836
    857837        if (m_foregroundLayer) {
    858             if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
    859                 m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
    860             m_foregroundLayer->setNeedsDisplay();
     838            m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
    861839            m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer());
    862840        }
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r154009 r154470  
    302302
    303303    bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
    304     bool m_boundsConstrainedByClipping;
    305304    bool m_isMainFrameRenderViewLayer;
    306305    bool m_usingTiledCacheLayer;
Note: See TracChangeset for help on using the changeset viewer.