Changeset 39640 in webkit


Ignore:
Timestamp:
Jan 5, 2009 9:37:27 PM (15 years ago)
Author:
Simon Fraser
Message:

2009-01-05 Simon Fraser <Simon Fraser>

Reviewed by Dave Hyatt

https://bugs.webkit.org/show_bug.cgi?id=22985

Add an assertion that clip rects are being used when painting with the same
rootLayer that they were computed with.

Fix two issues detected by the assertion:

RenderLayer::updateClipRects() should not unconditionally update the clip rects
on its parent, but stop when reaching rootLayer (just like calculateClipRects()).

We need to pass the temporaryClipRects flag down through reflection painting
to handle the case of nested reflections.

Also use temporary clip rects in RenderTreeAsText, since that code does not
reset the painting root for transformed layers, so cached clip rects will not
match those used for painting.

  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::clearClipRects):
  • rendering/RenderLayer.h:
  • rendering/RenderTreeAsText.cpp: (WebCore::writeLayers):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39639 r39640  
     12009-01-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Dave Hyatt
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=22985
     6       
     7        Add an assertion that clip rects are being used when painting with the same
     8        rootLayer that they were computed with.
     9       
     10        Fix two issues detected by the assertion:
     11
     12        RenderLayer::updateClipRects() should not unconditionally update the clip rects
     13        on its parent, but stop when reaching rootLayer (just like calculateClipRects()).
     14       
     15        We need to pass the temporaryClipRects flag down through reflection painting
     16        to handle the case of nested reflections.
     17       
     18        Also use temporary clip rects in RenderTreeAsText, since that code does not
     19        reset the painting root for transformed layers, so cached clip rects will not
     20        match those used for painting.
     21
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::RenderLayer):
     24        (WebCore::RenderLayer::paintLayer):
     25        (WebCore::RenderLayer::updateClipRects):
     26        (WebCore::RenderLayer::clearClipRects):
     27        * rendering/RenderLayer.h:
     28        * rendering/RenderTreeAsText.cpp:
     29        (WebCore::writeLayers):
     30
    1312009-01-05  Adam Treat  <adam.treat@torchmobile.com>
    232
  • trunk/WebCore/rendering/RenderLayer.cpp

    r39635 r39640  
    141141    , m_overflowList(0)
    142142    , m_clipRects(0)
     143#ifndef NDEBUG   
     144    , m_clipRectsRoot(0)
     145#endif
    143146    , m_scrollDimensionsDirty(true)
    144147    , m_zOrderListsDirty(true)
     
    17131716        // Mark that we are now inside replica painting.
    17141717        m_paintingInsideReflection = true;
    1715         reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot);
     1718        reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, false, temporaryClipRects);
    17161719        m_paintingInsideReflection = false;
    17171720    }
     
    20032006void RenderLayer::updateClipRects(const RenderLayer* rootLayer)
    20042007{
    2005     if (m_clipRects)
     2008    if (m_clipRects) {
     2009        ASSERT(rootLayer == m_clipRectsRoot);
    20062010        return; // We have the correct cached value.
    2007 
    2008     if (parent())
    2009         parent()->updateClipRects(rootLayer);
     2011    }
     2012   
     2013    // For transformed layers, the root layer was shifted to be us, so there is no need to
     2014    // examine the parent.  We want to cache clip rects with us as the root.
     2015    RenderLayer* parentLayer = rootLayer != this ? parent() : 0;
     2016    if (parentLayer)
     2017        parentLayer->updateClipRects(rootLayer);
    20102018
    20112019    ClipRects clipRects;
    20122020    calculateClipRects(rootLayer, clipRects, true);
    20132021
    2014     if (parent() && parent()->clipRects() && clipRects == *parent()->clipRects())
    2015         m_clipRects = parent()->clipRects();
     2022    if (parentLayer && parentLayer->clipRects() && clipRects == *parentLayer->clipRects())
     2023        m_clipRects = parentLayer->clipRects();
    20162024    else
    20172025        m_clipRects = new (m_object->renderArena()) ClipRects(clipRects);
    20182026    m_clipRects->ref();
     2027#ifndef NDEBUG
     2028    m_clipRectsRoot = rootLayer;
     2029#endif
    20192030}
    20202031
     
    22702281        m_clipRects->deref(m_object->renderArena());
    22712282        m_clipRects = 0;
     2283#ifndef NDEBUG
     2284        m_clipRectsRoot = 0;
     2285#endif   
    22722286    }
    22732287}
  • trunk/WebCore/rendering/RenderLayer.h

    r39635 r39640  
    479479
    480480    ClipRects* m_clipRects;      // Cached clip rects used when painting and hit testing.
     481#ifndef NDEBUG
     482    const RenderLayer* m_clipRectsRoot;   // Root layer used to compute clip rects.
     483#endif
    481484
    482485    bool m_scrollDimensionsDirty : 1;
  • trunk/WebCore/rendering/RenderTreeAsText.cpp

    r34589 r39640  
    417417    // Calculate the clip rects we should use.
    418418    IntRect layerBounds, damageRect, clipRectToApply, outlineRect;
    419     l->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
     419    l->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, true);
    420420
    421421    // Ensure our lists are up-to-date.
Note: See TracChangeset for help on using the changeset viewer.