Changeset 86189 in webkit


Ignore:
Timestamp:
May 10, 2011 3:57:50 PM (13 years ago)
Author:
jamesr@google.com
Message:

2011-05-10 James Robinson <jamesr@chromium.org>

Reviewed by Nate Chapin.

[chromium] Use parent/child terms for compositor tree structures consistently instead of superlayer/sublayer
https://bugs.webkit.org/show_bug.cgi?id=60588

GraphicsLayer uses parent/child terminology for tree structure, as does CCLayerImpl. LayerChromium was using
superlayer/sublayer terms, inherited from this code's branching from the platform/graphics/win/CACF code. The
mixed terminology is confusing and parent/child is more common, so this unifies everything to use parent/child.

No new tests, refactor only.

  • platform/graphics/chromium/GraphicsLayerChromium.cpp: (WebCore::GraphicsLayerChromium::setChildren): (WebCore::GraphicsLayerChromium::addChild): (WebCore::GraphicsLayerChromium::addChildAtIndex): (WebCore::GraphicsLayerChromium::addChildBelow): (WebCore::GraphicsLayerChromium::addChildAbove): (WebCore::GraphicsLayerChromium::replaceChild): (WebCore::GraphicsLayerChromium::removeFromParent): (WebCore::GraphicsLayerChromium::setContentsToImage): (WebCore::GraphicsLayerChromium::setContentsToCanvas): (WebCore::GraphicsLayerChromium::setContentsToMedia): (WebCore::GraphicsLayerChromium::hostLayerForChildren): (WebCore::GraphicsLayerChromium::layerForParent): (WebCore::GraphicsLayerChromium::updateChildList): (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): (WebCore::GraphicsLayerChromium::setupContentsLayer):
  • platform/graphics/chromium/GraphicsLayerChromium.h:
  • platform/graphics/chromium/LayerChromium.cpp: (WebCore::LayerChromium::LayerChromium): (WebCore::LayerChromium::~LayerChromium): (WebCore::LayerChromium::addChild): (WebCore::LayerChromium::insertChild): (WebCore::LayerChromium::removeFromParent): (WebCore::LayerChromium::removeChild): (WebCore::LayerChromium::replaceChild): (WebCore::LayerChromium::indexOfChild): (WebCore::LayerChromium::rootLayer): (WebCore::LayerChromium::removeAllChildren): (WebCore::LayerChromium::setChildren): (WebCore::LayerChromium::parent): (WebCore::LayerChromium::dumpLayer):
  • platform/graphics/chromium/LayerChromium.h: (WebCore::LayerChromium::children): (WebCore::LayerChromium::setParent): (WebCore::LayerChromium::numChildren):
  • platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::updatePropertiesAndRenderSurfaces): (WebCore::LayerRendererChromium::updateCompositorResourcesRecursive): (WebCore::LayerRendererChromium::dumpRenderSurfaces):
  • platform/graphics/chromium/cc/CCLayerImpl.cpp: (WebCore::CCLayerImpl::parent): (WebCore::CCLayerImpl::descendantsDrawsContent):
  • platform/graphics/chromium/cc/CCLayerImpl.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86188 r86189  
     12011-05-10  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        [chromium] Use parent/child terms for compositor tree structures consistently instead of superlayer/sublayer
     6        https://bugs.webkit.org/show_bug.cgi?id=60588
     7
     8        GraphicsLayer uses parent/child terminology for tree structure, as does CCLayerImpl.  LayerChromium was using
     9        superlayer/sublayer terms, inherited from this code's branching from the platform/graphics/win/CACF code.  The
     10        mixed terminology is confusing and parent/child is more common, so this unifies everything to use parent/child.
     11
     12        No new tests, refactor only.
     13
     14        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     15        (WebCore::GraphicsLayerChromium::setChildren):
     16        (WebCore::GraphicsLayerChromium::addChild):
     17        (WebCore::GraphicsLayerChromium::addChildAtIndex):
     18        (WebCore::GraphicsLayerChromium::addChildBelow):
     19        (WebCore::GraphicsLayerChromium::addChildAbove):
     20        (WebCore::GraphicsLayerChromium::replaceChild):
     21        (WebCore::GraphicsLayerChromium::removeFromParent):
     22        (WebCore::GraphicsLayerChromium::setContentsToImage):
     23        (WebCore::GraphicsLayerChromium::setContentsToCanvas):
     24        (WebCore::GraphicsLayerChromium::setContentsToMedia):
     25        (WebCore::GraphicsLayerChromium::hostLayerForChildren):
     26        (WebCore::GraphicsLayerChromium::layerForParent):
     27        (WebCore::GraphicsLayerChromium::updateChildList):
     28        (WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
     29        (WebCore::GraphicsLayerChromium::setupContentsLayer):
     30        * platform/graphics/chromium/GraphicsLayerChromium.h:
     31        * platform/graphics/chromium/LayerChromium.cpp:
     32        (WebCore::LayerChromium::LayerChromium):
     33        (WebCore::LayerChromium::~LayerChromium):
     34        (WebCore::LayerChromium::addChild):
     35        (WebCore::LayerChromium::insertChild):
     36        (WebCore::LayerChromium::removeFromParent):
     37        (WebCore::LayerChromium::removeChild):
     38        (WebCore::LayerChromium::replaceChild):
     39        (WebCore::LayerChromium::indexOfChild):
     40        (WebCore::LayerChromium::rootLayer):
     41        (WebCore::LayerChromium::removeAllChildren):
     42        (WebCore::LayerChromium::setChildren):
     43        (WebCore::LayerChromium::parent):
     44        (WebCore::LayerChromium::dumpLayer):
     45        * platform/graphics/chromium/LayerChromium.h:
     46        (WebCore::LayerChromium::children):
     47        (WebCore::LayerChromium::setParent):
     48        (WebCore::LayerChromium::numChildren):
     49        * platform/graphics/chromium/LayerRendererChromium.cpp:
     50        (WebCore::LayerRendererChromium::updatePropertiesAndRenderSurfaces):
     51        (WebCore::LayerRendererChromium::updateCompositorResourcesRecursive):
     52        (WebCore::LayerRendererChromium::dumpRenderSurfaces):
     53        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     54        (WebCore::CCLayerImpl::parent):
     55        (WebCore::CCLayerImpl::descendantsDrawsContent):
     56        * platform/graphics/chromium/cc/CCLayerImpl.h:
     57
    1582011-05-10  Levi Weintraub  <leviw@chromium.org>
    259
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r86067 r86189  
    131131{
    132132    bool childrenChanged = GraphicsLayer::setChildren(children);
    133     // FIXME: GraphicsLayer::setChildren calls addChild() for each sublayer, which
    134     // will end up calling updateSublayerList() N times.
     133    // FIXME: GraphicsLayer::setChildren calls addChild() for each child, which
     134    // will end up calling updateChildList() N times.
    135135    if (childrenChanged)
    136         updateSublayerList();
     136        updateChildList();
    137137
    138138    return childrenChanged;
     
    142142{
    143143    GraphicsLayer::addChild(childLayer);
    144     updateSublayerList();
     144    updateChildList();
    145145}
    146146
     
    148148{
    149149    GraphicsLayer::addChildAtIndex(childLayer, index);
    150     updateSublayerList();
     150    updateChildList();
    151151}
    152152
     
    154154{
    155155    GraphicsLayer::addChildBelow(childLayer, sibling);
    156     updateSublayerList();
     156    updateChildList();
    157157}
    158158
     
    160160{
    161161    GraphicsLayer::addChildAbove(childLayer, sibling);
    162     updateSublayerList();
     162    updateChildList();
    163163}
    164164
     
    166166{
    167167    if (GraphicsLayer::replaceChild(oldChild, newChild)) {
    168         updateSublayerList();
     168        updateChildList();
    169169        return true;
    170170    }
     
    175175{
    176176    GraphicsLayer::removeFromParent();
    177     layerForSuperlayer()->removeFromSuperlayer();
     177    layerForParent()->removeFromParent();
    178178}
    179179
     
    363363            childrenChanged = true;
    364364
    365             // The old contents layer will be removed via updateSublayerList.
     365            // The old contents layer will be removed via updateChildList.
    366366            m_contentsLayer = 0;
    367367        }
     
    369369
    370370    if (childrenChanged)
    371         updateSublayerList();
     371        updateChildList();
    372372}
    373373
     
    389389            childrenChanged = true;
    390390
    391             // The old contents layer will be removed via updateSublayerList.
     391            // The old contents layer will be removed via updateChildList.
    392392            m_contentsLayer = 0;
    393393        }
     
    395395
    396396    if (childrenChanged)
    397         updateSublayerList();
     397        updateChildList();
    398398}
    399399
     
    415415            childrenChanged = true;
    416416 
    417             // The old contents layer will be removed via updateSublayerList.
     417            // The old contents layer will be removed via updateChildList.
    418418            m_contentsLayer = 0;
    419419        }
     
    421421 
    422422    if (childrenChanged)
    423         updateSublayerList();
    424 }
    425 
    426 PlatformLayer* GraphicsLayerChromium::hostLayerForSublayers() const
     423        updateChildList();
     424}
     425
     426PlatformLayer* GraphicsLayerChromium::hostLayerForChildren() const
    427427{
    428428    return m_transformLayer ? m_transformLayer.get() : m_layer.get();
    429429}
    430430
    431 PlatformLayer* GraphicsLayerChromium::layerForSuperlayer() const
     431PlatformLayer* GraphicsLayerChromium::layerForParent() const
    432432{
    433433    return m_transformLayer ? m_transformLayer.get() : m_layer.get();
     
    458458}
    459459
    460 void GraphicsLayerChromium::updateSublayerList()
    461 {
    462     Vector<RefPtr<LayerChromium> > newSublayers;
     460void GraphicsLayerChromium::updateChildList()
     461{
     462    Vector<RefPtr<LayerChromium> > newChildren;
    463463
    464464    if (m_transformLayer) {
    465465        // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
    466         newSublayers.append(m_layer.get());
     466        newChildren.append(m_layer.get());
    467467    } else if (m_contentsLayer) {
    468468        // FIXME: add the contents layer in the correct order with negative z-order children.
    469469        // This does not cause visible rendering issues because currently contents layers are only used
    470470        // for replaced elements that don't have children.
    471         newSublayers.append(m_contentsLayer.get());
     471        newChildren.append(m_contentsLayer.get());
    472472    }
    473473
     
    477477        GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
    478478
    479         LayerChromium* childLayer = curChild->layerForSuperlayer();
    480         newSublayers.append(childLayer);
    481     }
    482 
    483     for (size_t i = 0; i < newSublayers.size(); ++i)
    484         newSublayers[i]->removeFromSuperlayer();
     479        LayerChromium* childLayer = curChild->layerForParent();
     480        newChildren.append(childLayer);
     481    }
     482
     483    for (size_t i = 0; i < newChildren.size(); ++i)
     484        newChildren[i]->removeFromParent();
    485485
    486486    if (m_transformLayer) {
    487         m_transformLayer->setSublayers(newSublayers);
     487        m_transformLayer->setChildren(newChildren);
    488488
    489489        if (m_contentsLayer) {
    490490            // If we have a transform layer, then the contents layer is parented in the
    491491            // primary layer (which is itself a child of the transform layer).
    492             m_layer->removeAllSublayers();
    493             m_layer->addSublayer(m_contentsLayer);
     492            m_layer->removeAllChildren();
     493            m_layer->addChild(m_contentsLayer);
    494494        }
    495495    } else
    496         m_layer->setSublayers(newSublayers);
     496        m_layer->setChildren(newChildren);
    497497}
    498498
     
    582582
    583583        // Move this layer to be a child of the transform layer.
    584         if (m_layer->superlayer())
    585             m_layer->superlayer()->replaceSublayer(m_layer.get(), m_transformLayer.get());
    586         m_transformLayer->addSublayer(m_layer.get());
    587 
    588         updateSublayerList();
     584        if (m_layer->parent())
     585            m_layer->parent()->replaceChild(m_layer.get(), m_transformLayer.get());
     586        m_transformLayer->addChild(m_layer.get());
     587
     588        updateChildList();
    589589    } else if (!m_preserves3D && m_transformLayer) {
    590590        // Relace the transformLayer in the parent with this layer.
    591         m_layer->removeFromSuperlayer();
    592         if (m_transformLayer->superlayer())
    593             m_transformLayer->superlayer()->replaceSublayer(m_transformLayer.get(), m_layer.get());
     591        m_layer->removeFromParent();
     592        if (m_transformLayer->parent())
     593            m_transformLayer->parent()->replaceChild(m_transformLayer.get(), m_layer.get());
    594594
    595595        // Release the transform layer.
     
    602602        updateChildrenTransform();
    603603
    604         updateSublayerList();
     604        updateChildList();
    605605    }
    606606
     
    649649
    650650    if (m_contentsLayer) {
    651         m_contentsLayer->removeFromSuperlayer();
     651        m_contentsLayer->removeFromParent();
    652652        m_contentsLayer = 0;
    653653    }
     
    660660        // Insert the content layer first. Video elements require this, because they have
    661661        // shadow content that must display in front of the video.
    662         m_layer->insertSublayer(m_contentsLayer.get(), 0);
     662        m_layer->insertChild(m_contentsLayer.get(), 0);
    663663
    664664        updateContentsRect();
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h

    r80327 r86189  
    105105
    106106    LayerChromium* primaryLayer() const  { return m_transformLayer.get() ? m_transformLayer.get() : m_layer.get(); }
    107     LayerChromium* hostLayerForSublayers() const;
    108     LayerChromium* layerForSuperlayer() const;
     107    LayerChromium* hostLayerForChildren() const;
     108    LayerChromium* layerForParent() const;
    109109
    110110    void updateNames();
    111     void updateSublayerList();
     111    void updateChildList();
    112112    void updateLayerPosition();
    113113    void updateLayerSize();
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r85136 r86189  
    6464    , m_maskLayer(0)
    6565    , m_ccLayerImpl(0)
    66     , m_superlayer(0)
     66    , m_parent(0)
    6767#ifndef NDEBUG
    6868    , m_debugID(s_nextLayerDebugID++)
     
    8888{
    8989    ASSERT(!LayerRendererChromium::s_inPaintLayerContents);
    90     // Our superlayer should be holding a reference to us so there should be no
    91     // way for us to be destroyed while we still have a superlayer.
    92     ASSERT(!superlayer());
     90    // Our parent should be holding a reference to us so there should be no
     91    // way for us to be destroyed while we still have a parent.
     92    ASSERT(!parent());
    9393
    9494    if (m_ccLayerImpl)
    9595        m_ccLayerImpl->resetOwner();
    9696
    97     // Remove the superlayer reference from all sublayers.
    98     removeAllSublayers();
     97    // Remove the parent reference from all children.
     98    removeAllChildren();
    9999}
    100100
     
    126126}
    127127
    128 void LayerChromium::addSublayer(PassRefPtr<LayerChromium> sublayer)
    129 {
    130     insertSublayer(sublayer, numSublayers());
    131 }
    132 
    133 void LayerChromium::insertSublayer(PassRefPtr<LayerChromium> sublayer, size_t index)
    134 {
    135     index = min(index, m_sublayers.size());
    136     sublayer->removeFromSuperlayer();
    137     sublayer->setSuperlayer(this);
    138     m_sublayers.insert(index, sublayer);
    139     setNeedsCommit();
    140 }
    141 
    142 void LayerChromium::removeFromSuperlayer()
    143 {
    144     if (m_superlayer)
    145         m_superlayer->removeSublayer(this);
    146 }
    147 
    148 void LayerChromium::removeSublayer(LayerChromium* sublayer)
    149 {
    150     int foundIndex = indexOfSublayer(sublayer);
     128void LayerChromium::addChild(PassRefPtr<LayerChromium> child)
     129{
     130    insertChild(child, numChildren());
     131}
     132
     133void LayerChromium::insertChild(PassRefPtr<LayerChromium> child, size_t index)
     134{
     135    index = min(index, m_children.size());
     136    child->removeFromParent();
     137    child->setParent(this);
     138    m_children.insert(index, child);
     139    setNeedsCommit();
     140}
     141
     142void LayerChromium::removeFromParent()
     143{
     144    if (m_parent)
     145        m_parent->removeChild(this);
     146}
     147
     148void LayerChromium::removeChild(LayerChromium* child)
     149{
     150    int foundIndex = indexOfChild(child);
    151151    if (foundIndex == -1)
    152152        return;
    153153
    154     sublayer->setSuperlayer(0);
    155     m_sublayers.remove(foundIndex);
    156     setNeedsCommit();
    157 }
    158 
    159 void LayerChromium::replaceSublayer(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer)
     154    child->setParent(0);
     155    m_children.remove(foundIndex);
     156    setNeedsCommit();
     157}
     158
     159void LayerChromium::replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer)
    160160{
    161161    ASSERT_ARG(reference, reference);
    162     ASSERT_ARG(reference, reference->superlayer() == this);
     162    ASSERT_ARG(reference, reference->parent() == this);
    163163
    164164    if (reference == newLayer)
    165165        return;
    166166
    167     int referenceIndex = indexOfSublayer(reference);
     167    int referenceIndex = indexOfChild(reference);
    168168    if (referenceIndex == -1) {
    169169        ASSERT_NOT_REACHED();
     
    171171    }
    172172
    173     reference->removeFromSuperlayer();
     173    reference->removeFromParent();
    174174
    175175    if (newLayer) {
    176         newLayer->removeFromSuperlayer();
    177         insertSublayer(newLayer, referenceIndex);
    178     }
    179 }
    180 
    181 int LayerChromium::indexOfSublayer(const LayerChromium* reference)
    182 {
    183     for (size_t i = 0; i < m_sublayers.size(); i++) {
    184         if (m_sublayers[i] == reference)
     176        newLayer->removeFromParent();
     177        insertChild(newLayer, referenceIndex);
     178    }
     179}
     180
     181int LayerChromium::indexOfChild(const LayerChromium* reference)
     182{
     183    for (size_t i = 0; i < m_children.size(); i++) {
     184        if (m_children[i] == reference)
    185185            return i;
    186186    }
     
    215215{
    216216    const LayerChromium* layer = this;
    217     for (LayerChromium* superlayer = layer->superlayer(); superlayer; layer = superlayer, superlayer = superlayer->superlayer()) { }
     217    for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
    218218    return layer;
    219219}
    220220
    221 void LayerChromium::removeAllSublayers()
    222 {
    223     while (m_sublayers.size()) {
    224         LayerChromium* layer = m_sublayers[0].get();
    225         ASSERT(layer->superlayer());
    226         layer->removeFromSuperlayer();
    227     }
    228 }
    229 
    230 void LayerChromium::setSublayers(const Vector<RefPtr<LayerChromium> >& sublayers)
    231 {
    232     if (sublayers == m_sublayers)
     221void LayerChromium::removeAllChildren()
     222{
     223    while (m_children.size()) {
     224        LayerChromium* layer = m_children[0].get();
     225        ASSERT(layer->parent());
     226        layer->removeFromParent();
     227    }
     228}
     229
     230void LayerChromium::setChildren(const Vector<RefPtr<LayerChromium> >& children)
     231{
     232    if (children == m_children)
    233233        return;
    234234
    235     removeAllSublayers();
    236     size_t listSize = sublayers.size();
     235    removeAllChildren();
     236    size_t listSize = children.size();
    237237    for (size_t i = 0; i < listSize; i++)
    238         addSublayer(sublayers[i]);
    239 }
    240 
    241 LayerChromium* LayerChromium::superlayer() const
    242 {
    243     return m_superlayer;
     238        addChild(children[i]);
     239}
     240
     241LayerChromium* LayerChromium::parent() const
     242{
     243    return m_parent;
    244244}
    245245
     
    375375        m_maskLayer->dumpLayer(ts, indent+3);
    376376    }
    377     for (size_t i = 0; i < m_sublayers.size(); ++i)
    378         m_sublayers[i]->dumpLayer(ts, indent+1);
     377    for (size_t i = 0; i < m_children.size(); ++i)
     378        m_children[i]->dumpLayer(ts, indent+1);
    379379}
    380380
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r83941 r86189  
    6767
    6868    const LayerChromium* rootLayer() const;
    69     LayerChromium* superlayer() const;
    70     void addSublayer(PassRefPtr<LayerChromium>);
    71     void insertSublayer(PassRefPtr<LayerChromium>, size_t index);
    72     void replaceSublayer(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer);
    73     void removeFromSuperlayer();
    74     void removeAllSublayers();
    75     void setSublayers(const Vector<RefPtr<LayerChromium> >&);
    76     const Vector<RefPtr<LayerChromium> >& getSublayers() const { return m_sublayers; }
     69    LayerChromium* parent() const;
     70    void addChild(PassRefPtr<LayerChromium>);
     71    void insertChild(PassRefPtr<LayerChromium>, size_t index);
     72    void replaceChild(LayerChromium* reference, PassRefPtr<LayerChromium> newLayer);
     73    void removeFromParent();
     74    void removeAllChildren();
     75    void setChildren(const Vector<RefPtr<LayerChromium> >&);
     76    const Vector<RefPtr<LayerChromium> >& children() const { return m_children; }
    7777
    7878    void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; setNeedsCommit(); }
     
    225225    void setNeedsCommit();
    226226
    227     void setSuperlayer(LayerChromium* superlayer) { m_superlayer = superlayer; }
    228 
    229     size_t numSublayers() const
     227    void setParent(LayerChromium* parent) { m_parent = parent; }
     228
     229    size_t numChildren() const
    230230    {
    231         return m_sublayers.size();
     231        return m_children.size();
    232232    }
    233233
    234     // Returns the index of the sublayer or -1 if not found.
    235     int indexOfSublayer(const LayerChromium*);
    236 
    237     // This should only be called from removeFromSuperlayer.
    238     void removeSublayer(LayerChromium*);
    239 
    240     Vector<RefPtr<LayerChromium> > m_sublayers;
    241     LayerChromium* m_superlayer;
     234    // Returns the index of the child or -1 if not found.
     235    int indexOfChild(const LayerChromium*);
     236
     237    // This should only be called from removeFromParent.
     238    void removeChild(LayerChromium*);
     239
     240    Vector<RefPtr<LayerChromium> > m_children;
     241    LayerChromium* m_parent;
    242242
    243243    RefPtr<LayerRendererChromium> m_layerRenderer;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r85959 r86189  
    568568
    569569    // Compute the new matrix transformation that will be applied to this layer and
    570     // all its sublayers. It's important to remember that the layer's position
     570    // all its children. It's important to remember that the layer's position
    571571    // is the position of the layer's anchor point. Also, the coordinate system used
    572572    // assumes that the origin is at the lower left even though the coordinates the browser
     
    621621    bool useSurfaceForMasking = drawLayer->maskLayer();
    622622    bool useSurfaceForReflection = drawLayer->replicaLayer();
    623     bool useSurfaceForFlatDescendants = (drawLayer->superlayer() && drawLayer->superlayer()->preserves3D() && !drawLayer->preserves3D() && drawLayer->descendantsDrawsContent());
     623    bool useSurfaceForFlatDescendants = (drawLayer->parent() && drawLayer->parent()->preserves3D() && !drawLayer->preserves3D() && drawLayer->descendantsDrawsContent());
    624624    if (useSurfaceForMasking || useSurfaceForReflection || useSurfaceForFlatDescendants || ((useSurfaceForClipping || useSurfaceForOpacity) && drawLayer->descendantsDrawsContent())) {
    625625        RenderSurfaceChromium* renderSurface = drawLayer->renderSurface();
     
    636636        // Layer's opacity will be applied when drawing the render surface.
    637637        renderSurface->m_drawOpacity = drawLayer->opacity();
    638         if (drawLayer->superlayer() && drawLayer->superlayer()->preserves3D())
    639             renderSurface->m_drawOpacity *= drawLayer->superlayer()->drawOpacity();
     638        if (drawLayer->parent() && drawLayer->parent()->preserves3D())
     639            renderSurface->m_drawOpacity *= drawLayer->parent()->drawOpacity();
    640640        drawLayer->setDrawOpacity(1);
    641641
     
    647647        // The render surface scissor rect is the scissor rect that needs to
    648648        // be applied before drawing the render surface onto its containing
    649         // surface and is therefore expressed in the superlayer's coordinate system.
    650         renderSurface->m_scissorRect = drawLayer->superlayer() ? drawLayer->superlayer()->scissorRect() : drawLayer->scissorRect();
     649        // surface and is therefore expressed in the parent's coordinate system.
     650        renderSurface->m_scissorRect = drawLayer->parent() ? drawLayer->parent()->scissorRect() : drawLayer->scissorRect();
    651651
    652652        renderSurface->m_layerList.clear();
     
    669669        drawLayer->setDrawOpacity(drawLayer->opacity());
    670670
    671         if (drawLayer->superlayer()) {
    672             if (drawLayer->superlayer()->preserves3D())
    673                drawLayer->setDrawOpacity(drawLayer->drawOpacity() * drawLayer->superlayer()->drawOpacity());
    674 
    675             // Layers inherit the scissor rect from their superlayer.
    676             drawLayer->setScissorRect(drawLayer->superlayer()->scissorRect());
    677 
    678             drawLayer->setTargetRenderSurface(drawLayer->superlayer()->targetRenderSurface());
     671        if (drawLayer->parent()) {
     672            if (drawLayer->parent()->preserves3D())
     673               drawLayer->setDrawOpacity(drawLayer->drawOpacity() * drawLayer->parent()->drawOpacity());
     674
     675            // Layers inherit the scissor rect from their parent.
     676            drawLayer->setScissorRect(drawLayer->parent()->scissorRect());
     677
     678            drawLayer->setTargetRenderSurface(drawLayer->parent()->targetRenderSurface());
    679679        }
    680680
     
    693693        drawLayer->setTargetRenderSurface(drawLayer->renderSurface());
    694694    else {
    695         ASSERT(drawLayer->superlayer());
    696         drawLayer->setTargetRenderSurface(drawLayer->superlayer()->targetRenderSurface());
     695        ASSERT(drawLayer->parent());
     696        drawLayer->setTargetRenderSurface(drawLayer->parent()->targetRenderSurface());
    697697    }
    698698
     
    720720    sublayerMatrix.multiply(drawLayer->sublayerTransform());
    721721
    722     // The origin of the sublayers is the top left corner of the layer, not the
    723     // center. The matrix passed down to the sublayers is therefore:
     722    // The origin of the children is the top left corner of the layer, not the
     723    // center. The matrix passed down to the children is therefore:
    724724    // M[s] = M * Tr[-center]
    725725    sublayerMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0);
     
    729729    unsigned thisLayerIndex = descendants.size() - 1;
    730730
    731     const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
    732     for (size_t i = 0; i < sublayers.size(); ++i) {
    733         sublayers[i]->createCCLayerImplIfNeeded();
    734         CCLayerImpl* sublayer = sublayers[i]->ccLayerImpl();
    735         updatePropertiesAndRenderSurfaces(sublayers[i].get(), sublayerMatrix, renderSurfaceLayerList, descendants);
    736 
    737         if (sublayer->renderSurface()) {
    738             RenderSurfaceChromium* sublayerRenderSurface = sublayer->renderSurface();
     731    const Vector<RefPtr<LayerChromium> >& children = layer->children();
     732    for (size_t i = 0; i < children.size(); ++i) {
     733        children[i]->createCCLayerImplIfNeeded();
     734        CCLayerImpl* child = children[i]->ccLayerImpl();
     735        updatePropertiesAndRenderSurfaces(children[i].get(), sublayerMatrix, renderSurfaceLayerList, descendants);
     736
     737        if (child->renderSurface()) {
     738            RenderSurfaceChromium* childRenderSurface = child->renderSurface();
    739739            IntRect drawableContentRect = drawLayer->drawableContentRect();
    740             drawableContentRect.unite(enclosingIntRect(sublayerRenderSurface->drawableContentRect()));
     740            drawableContentRect.unite(enclosingIntRect(childRenderSurface->drawableContentRect()));
    741741            drawLayer->setDrawableContentRect(drawableContentRect);
    742             descendants.append(sublayer);
     742            descendants.append(child);
    743743        } else {
    744744            IntRect drawableContentRect = drawLayer->drawableContentRect();
    745             drawableContentRect.unite(sublayer->drawableContentRect());
     745            drawableContentRect.unite(child->drawableContentRect());
    746746            drawLayer->setDrawableContentRect(drawableContentRect);
    747747        }
     
    798798
    799799    // If preserves-3d then sort all the descendants in 3D so that they can be
    800     // drawn from back to front. If the preserves-3d property is also set on the superlayer then
    801     // skip the sorting as the superlayer will sort all the descendants anyway.
    802     if (drawLayer->preserves3D() && (!drawLayer->superlayer() || !drawLayer->superlayer()->preserves3D()))
     800    // drawn from back to front. If the preserves-3d property is also set on the parent then
     801    // skip the sorting as the parent will sort all the descendants anyway.
     802    if (drawLayer->preserves3D() && (!drawLayer->parent() || !drawLayer->parent()->preserves3D()))
    803803        m_layerSorter.sort(&descendants.at(thisLayerIndex), descendants.end());
    804804}
     
    806806void LayerRendererChromium::updateCompositorResourcesRecursive(LayerChromium* layer)
    807807{
    808     const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers();
    809     for (size_t i = 0; i < sublayers.size(); ++i)
    810         updateCompositorResourcesRecursive(sublayers[i].get());
     808    const Vector<RefPtr<LayerChromium> >& children = layer->children();
     809    for (size_t i = 0; i < children.size(); ++i)
     810        updateCompositorResourcesRecursive(children[i].get());
    811811
    812812    if (layer->bounds().isEmpty())
     
    11191119        layer->ccLayerImpl()->renderSurface()->dumpSurface(ts, indent);
    11201120
    1121     for (size_t i = 0; i < layer->getSublayers().size(); ++i)
    1122         dumpRenderSurfaces(ts, indent, layer->getSublayers()[i].get());
     1121    for (size_t i = 0; i < layer->children().size(); ++i)
     1122        dumpRenderSurfaces(ts, indent, layer->children()[i].get());
    11231123}
    11241124
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r86067 r86189  
    8686
    8787// These are pseudo-structural hacks until we get real tree syncing up in this piece.
    88 CCLayerImpl* CCLayerImpl::superlayer() const
    89 {
    90     return m_owner->superlayer() ? m_owner->superlayer()->ccLayerImpl() : 0;
     88CCLayerImpl* CCLayerImpl::parent() const
     89{
     90    return m_owner->parent() ? m_owner->parent()->ccLayerImpl() : 0;
    9191}
    9292
     
    114114bool CCLayerImpl::descendantsDrawsContent()
    115115{
    116     const Vector<RefPtr<LayerChromium> >& sublayers = m_owner->getSublayers();
    117     for (size_t i = 0; i < sublayers.size(); ++i) {
    118         sublayers[i]->createCCLayerImplIfNeeded();
    119         if (sublayers[i]->ccLayerImpl()->drawsContent() || sublayers[i]->ccLayerImpl()->descendantsDrawsContent())
     116    const Vector<RefPtr<LayerChromium> >& children = m_owner->children();
     117    for (size_t i = 0; i < children.size(); ++i) {
     118        children[i]->createCCLayerImplIfNeeded();
     119        if (children[i]->ccLayerImpl()->drawsContent() || children[i]->ccLayerImpl()->descendantsDrawsContent())
    120120            return true;
    121121    }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r85814 r86189  
    5858#endif
    5959
    60     CCLayerImpl* superlayer() const;
     60    CCLayerImpl* parent() const;
    6161    CCLayerImpl* maskLayer() const;
    6262    CCLayerImpl* replicaLayer() const;
Note: See TracChangeset for help on using the changeset viewer.