Changeset 116195 in webkit


Ignore:
Timestamp:
May 4, 2012 5:38:03 PM (12 years ago)
Author:
shawnsingh@chromium.org
Message:

[chromium] Changes to layer tree structure need to be tracked properly
https://bugs.webkit.org/show_bug.cgi?id=85421

Reviewed by Adrienne Walker.

Unit test added: TreeSynchronizerTest.syncSimpleTreeAndTrackStackingOrderChange

Source/WebCore:

Earlier, we were relying on WebCore behavior that always called
setNeedsDisplay whenever the layer tree structure changed.
However, in general it is more correct to consider layer tree
changes even when things don't need repainting; for example Aura
code is encountring this bug now. This patch corrects the
compositor so that layer tree structural changes are considered
property changes, without requiring that layers needed to be
repainted.

  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::LayerChromium):
(WebCore::LayerChromium::insertChild):
(WebCore::LayerChromium::pushPropertiesTo):

  • platform/graphics/chromium/LayerChromium.h:

(LayerChromium):

  • platform/graphics/chromium/cc/CCLayerImpl.cpp:

(WebCore::CCLayerImpl::setStackingOrderChanged):
(WebCore):

  • platform/graphics/chromium/cc/CCLayerImpl.h:

(CCLayerImpl):

Source/WebKit/chromium:

  • tests/TreeSynchronizerTest.cpp:

(WebKitTests):
(WebKitTests::TEST):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116194 r116195  
     12012-05-04  Shawn Singh  <shawnsingh@chromium.org>
     2
     3        [chromium] Changes to layer tree structure need to be tracked properly
     4        https://bugs.webkit.org/show_bug.cgi?id=85421
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Unit test added: TreeSynchronizerTest.syncSimpleTreeAndTrackStackingOrderChange
     9
     10        Earlier, we were relying on WebCore behavior that always called
     11        setNeedsDisplay whenever the layer tree structure changed.
     12        However, in general it is more correct to consider layer tree
     13        changes even when things don't need repainting; for example Aura
     14        code is encountring this bug now. This patch corrects the
     15        compositor so that layer tree structural changes are considered
     16        property changes, without requiring that layers needed to be
     17        repainted.
     18
     19        * platform/graphics/chromium/LayerChromium.cpp:
     20        (WebCore::LayerChromium::LayerChromium):
     21        (WebCore::LayerChromium::insertChild):
     22        (WebCore::LayerChromium::pushPropertiesTo):
     23        * platform/graphics/chromium/LayerChromium.h:
     24        (LayerChromium):
     25        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     26        (WebCore::CCLayerImpl::setStackingOrderChanged):
     27        (WebCore):
     28        * platform/graphics/chromium/cc/CCLayerImpl.h:
     29        (CCLayerImpl):
     30
    1312012-05-04  Jeffrey Pfau  <jpfau@apple.com>
    232
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r116142 r116195  
    5858LayerChromium::LayerChromium()
    5959    : m_needsDisplay(false)
     60    , m_stackingOrderChanged(false)
    6061    , m_layerId(s_nextLayerId++)
    6162    , m_parent(0)
     
    154155    child->removeFromParent();
    155156    child->setParent(this);
     157    child->m_stackingOrderChanged = true;
    156158    m_children.insert(index, child);
    157159    setNeedsCommit();
     
    515517    layer->setSentScrollDelta(IntSize());
    516518
     519    layer->setStackingOrderChanged(m_stackingOrderChanged);
     520
    517521    if (maskLayer())
    518522        maskLayer()->pushPropertiesTo(layer->maskLayer());
     
    523527
    524528    // Reset any state that should be cleared for the next update.
     529    m_stackingOrderChanged = false;
    525530    m_updateRect = FloatRect();
    526531}
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r116142 r116195  
    265265    bool m_needsDisplay;
    266266
     267    // Tracks whether this layer may have changed stacking order with its siblings.
     268    bool m_stackingOrderChanged;
     269
    267270    // The update rect is the region of the compositor resource that was actually updated by the compositor.
    268271    // For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r116142 r116195  
    266266}
    267267
     268void CCLayerImpl::setStackingOrderChanged(bool stackingOrderChanged)
     269{
     270    // We don't need to store this flag; we only need to track that the change occurred.
     271    if (stackingOrderChanged)
     272        noteLayerPropertyChangedForSubtree();
     273}
     274
    268275void CCLayerImpl::noteLayerPropertyChangedForSubtree()
    269276{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r116142 r116195  
    230230    String layerTreeAsText() const;
    231231
     232    void setStackingOrderChanged(bool);
     233
    232234    bool layerPropertyChanged() const { return m_layerPropertyChanged; }
    233235    void resetAllChangeTrackingForSubtree();
  • trunk/Source/WebKit/chromium/ChangeLog

    r116190 r116195  
     12012-05-04  Shawn Singh  <shawnsingh@chromium.org>
     2
     3        [chromium] Changes to layer tree structure need to be tracked properly
     4        https://bugs.webkit.org/show_bug.cgi?id=85421
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Unit test added: TreeSynchronizerTest.syncSimpleTreeAndTrackStackingOrderChange
     9
     10        * tests/TreeSynchronizerTest.cpp:
     11        (WebKitTests):
     12        (WebKitTests::TEST):
     13
    1142012-05-04  Tony Chang  <tony@chromium.org>
    215
  • trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp

    r114808 r116195  
    198198}
    199199
     200// Constructs a very simple tree and checks that a stacking-order change is tracked properly.
     201TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
     202{
     203    DebugScopedSetImplThread impl;
     204    Vector<int> ccLayerDestructionList;
     205
     206    // Set up the tree and sync once. child2 needs to be synced here, too, even though we
     207    // remove it to set up the intended scenario.
     208    RefPtr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList);
     209    RefPtr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList);
     210    layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList));
     211    layerTreeRoot->addChild(child2);
     212    OwnPtr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), nullptr);
     213    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
     214    ccLayerTreeRoot->resetAllChangeTrackingForSubtree();
     215
     216    // re-insert the layer and sync again.
     217    child2->removeFromParent();
     218    layerTreeRoot->addChild(child2);
     219    ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.release());
     220    expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get());
     221
     222    // Check that the impl thread properly tracked the change.
     223    EXPECT_FALSE(ccLayerTreeRoot->layerPropertyChanged());
     224    EXPECT_FALSE(ccLayerTreeRoot->children()[0]->layerPropertyChanged());
     225    EXPECT_TRUE(ccLayerTreeRoot->children()[1]->layerPropertyChanged());
     226}
     227
    200228TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
    201229{
Note: See TracChangeset for help on using the changeset viewer.