Changeset 140999 in webkit


Ignore:
Timestamp:
Jan 28, 2013 1:18:14 PM (11 years ago)
Author:
vollick@chromium.org
Message:

Promote composited-scrolling layers to stacking containers.
https://bugs.webkit.org/show_bug.cgi?id=106142

Reviewed by Simon Fraser.

With this patch, RenderLayers that use composited scrolling are
treated as stacking contexts. Since isStackingContainer now depends on
the value of m_needsCompositedScrolling, special care needed to be
taken to ensure that the value of isStackingContainer is not used when
updating m_needsCompositedScrolling. In particular, the code for
rebuilding the layer lists needed to be generalized so that we could
build the layer lists using the value of isStackingContext rather than
isStackingContainer when building the layer lists used to determine if
the descendants are contiguous in stacking order. Also, updating
m_needsCompositedScrolling can now affect stacking container status
and can therefore dirty layer lists.

Source/WebCore:

Test: compositing/overflow/composited-scrolling-creates-a-stacking-container.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder):

Modified to use layer lists built based on isStackingContext rather
than isStackingContainer.

(WebCore::RenderLayer::updateNeedsCompositedScrolling):

This function can now affect stacking container status and layer
lists.

(WebCore::RenderLayer::rebuildZOrderLists):

Refactored to generalize layer list building.

(WebCore::RenderLayer::collectLayers):

This function can now stop at either stacking containers or
contexts.

(WebCore::RenderLayer::updateLayerListsIfNeeded):

Layer lists may need to be built a 2nd time if we opt into
composited scrolling.

  • rendering/RenderLayer.h:

(RenderLayer):
(WebCore::RenderLayer::isStackingContainer):

Returns true if we use composited scrolling.

LayoutTests:

  • compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Added.
  • compositing/overflow/composited-scrolling-creates-a-stacking-container.html: Added.
  • platform/chromium/TestExpectations:
  • platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Added.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140997 r140999  
     12013-01-28  Ian Vollick  <vollick@chromium.org>
     2
     3        Promote composited-scrolling layers to stacking containers.
     4        https://bugs.webkit.org/show_bug.cgi?id=106142
     5
     6        Reviewed by Simon Fraser.
     7
     8        With this patch, RenderLayers that use composited scrolling are
     9        treated as stacking contexts. Since isStackingContainer now depends on
     10        the value of m_needsCompositedScrolling, special care needed to be
     11        taken to ensure that the value of isStackingContainer is not used when
     12        updating m_needsCompositedScrolling. In particular, the code for
     13        rebuilding the layer lists needed to be generalized so that we could
     14        build the layer lists using the value of isStackingContext rather than
     15        isStackingContainer when building the layer lists used to determine if
     16        the descendants are contiguous in stacking order. Also, updating
     17        m_needsCompositedScrolling can now affect stacking container status
     18        and can therefore dirty layer lists.
     19
     20        * compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Added.
     21        * compositing/overflow/composited-scrolling-creates-a-stacking-container.html: Added.
     22        * platform/chromium/TestExpectations:
     23        * platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Added.
     24
    1252013-01-28  Max Vujovic  <mvujovic@adobe.com>
    226
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r140956 r140999  
    36083608webkit.org/b/103156 platform/chromium/virtual/gpu/compositedscrolling/scrollbars/custom-scrollbar-with-incomplete-style.html [ ImageOnlyFailure ]
    36093609
     3610# Requires an updated baseline after 106142.
     3611webkit.org/b/106820 platform/chromium/virtual/gpu/compositedscrolling/overflow/overflow-scroll.html [ Failure ]
     3612
    36103613# Fails due to Bug 85856.
    36113614webkit.org/b/85856 [ Win Mac Android ] fast/block/float/028.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r140997 r140999  
     12013-01-28  Ian Vollick  <vollick@chromium.org>
     2
     3        Promote composited-scrolling layers to stacking containers.
     4        https://bugs.webkit.org/show_bug.cgi?id=106142
     5
     6        Reviewed by Simon Fraser.
     7
     8        With this patch, RenderLayers that use composited scrolling are
     9        treated as stacking contexts. Since isStackingContainer now depends on
     10        the value of m_needsCompositedScrolling, special care needed to be
     11        taken to ensure that the value of isStackingContainer is not used when
     12        updating m_needsCompositedScrolling. In particular, the code for
     13        rebuilding the layer lists needed to be generalized so that we could
     14        build the layer lists using the value of isStackingContext rather than
     15        isStackingContainer when building the layer lists used to determine if
     16        the descendants are contiguous in stacking order. Also, updating
     17        m_needsCompositedScrolling can now affect stacking container status
     18        and can therefore dirty layer lists.
     19
     20        Test: compositing/overflow/composited-scrolling-creates-a-stacking-container.html
     21
     22        * rendering/RenderLayer.cpp:
     23        (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder):
     24          Modified to use layer lists built based on isStackingContext rather
     25          than isStackingContainer.
     26        (WebCore::RenderLayer::updateNeedsCompositedScrolling):
     27          This function can now affect stacking container status and layer
     28          lists.
     29        (WebCore::RenderLayer::rebuildZOrderLists):
     30          Refactored to generalize layer list building.
     31        (WebCore::RenderLayer::collectLayers):
     32          This function can now stop at either stacking containers or
     33          contexts.
     34        (WebCore::RenderLayer::updateLayerListsIfNeeded):
     35          Layer lists may need to be built a 2nd time if we opt into
     36          composited scrolling.
     37        * rendering/RenderLayer.h:
     38        (RenderLayer):
     39        (WebCore::RenderLayer::isStackingContainer):
     40          Returns true if we use composited scrolling.
     41
    1422013-01-28  Max Vujovic  <mvujovic@adobe.com>
    243
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r140749 r140999  
    608608    ASSERT(!m_zOrderListsDirty);
    609609
     610    OwnPtr<Vector<RenderLayer*> > posZOrderList;
     611    OwnPtr<Vector<RenderLayer*> > negZOrderList;
     612    rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList);
     613
    610614    // Create a reverse lookup.
    611615    HashMap<const RenderLayer*, int> lookup;
    612616
    613     if (m_negZOrderList) {
     617    if (negZOrderList) {
    614618        int stackingOrderIndex = -1;
    615         size_t listSize = m_negZOrderList->size();
     619        size_t listSize = negZOrderList->size();
    616620        for (size_t i = 0; i < listSize; ++i) {
    617             RenderLayer* currentLayer = m_negZOrderList->at(listSize - i - 1);
     621            RenderLayer* currentLayer = negZOrderList->at(listSize - i - 1);
    618622            if (!currentLayer->isStackingContext())
    619623                continue;
     
    622626    }
    623627
    624     if (m_posZOrderList) {
    625         size_t listSize = m_posZOrderList->size();
     628    if (posZOrderList) {
     629        size_t listSize = posZOrderList->size();
    626630        int stackingOrderIndex = 1;
    627631        for (size_t i = 0; i < listSize; ++i) {
    628             RenderLayer* currentLayer = m_posZOrderList->at(i);
     632            RenderLayer* currentLayer = posZOrderList->at(i);
    629633            if (!currentLayer->isStackingContext())
    630634                continue;
     
    19251929    }
    19261930
    1927     if (oldNeedsCompositedScrolling != m_needsCompositedScrolling)
     1931    if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) {
    19281932        updateSelfPaintingLayer();
     1933        if (isStackingContainer())
     1934            dirtyZOrderLists();
     1935        else
     1936            clearZOrderLists();
     1937
     1938        dirtyStackingContainerZOrderLists();
     1939
     1940        compositor()->setShouldReevaluateCompositingAfterLayout();
     1941        compositor()->setCompositingLayersNeedRebuild();
     1942    }
    19291943}
    19301944#endif
     
    51615175    ASSERT(m_layerListMutationAllowed);
    51625176    ASSERT(isDirtyStackingContainer());
    5163 
     5177    rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderList);
     5178    m_zOrderListsDirty = false;
     5179}
     5180
     5181void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList)
     5182{
    51645183#if USE(ACCELERATED_COMPOSITING)
    51655184    bool includeHiddenLayers = compositor()->inCompositingMode();
     
    51695188    for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
    51705189        if (!m_reflection || reflectionLayer() != child)
    5171             child->collectLayers(includeHiddenLayers, m_posZOrderList, m_negZOrderList);
     5190            child->collectLayers(includeHiddenLayers, behavior, posZOrderList, negZOrderList);
    51725191
    51735192    // Sort the two lists.
    5174     if (m_posZOrderList)
    5175         std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compareZIndex);
    5176 
    5177     if (m_negZOrderList)
    5178         std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compareZIndex);
     5193    if (posZOrderList)
     5194        std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZIndex);
     5195
     5196    if (negZOrderList)
     5197        std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZIndex);
    51795198
    51805199#if ENABLE(DIALOG_ELEMENT)
     
    51875206            if (childElement && childElement->isInTopLayer()) {
    51885207                RenderLayer* layer = toRenderLayerModelObject(child)->layer();
    5189                 m_posZOrderList->append(layer);
     5208                posZOrderList->append(layer);
    51905209            }
    51915210        }
     
    51935212#endif
    51945213
    5195     m_zOrderListsDirty = false;
    51965214}
    51975215
     
    52155233}
    52165234
    5217 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer)
     5235void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer)
    52185236{
    52195237#if ENABLE(DIALOG_ELEMENT)
     
    52245242    updateDescendantDependentFlags();
    52255243
    5226     bool isStacking = isStackingContainer();
     5244    bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer();
    52275245    // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists.
    52285246    bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_hasVisibleDescendant && isStacking));
     
    52455263            // Ignore reflections.
    52465264            if (!m_reflection || reflectionLayer() != child)
    5247                 child->collectLayers(includeHiddenLayers, posBuffer, negBuffer);
     5265                child->collectLayers(includeHiddenLayers, behavior, posBuffer, negBuffer);
    52485266        }
    52495267    }
     
    52535271{
    52545272    bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty);
    5255 
    52565273    updateZOrderLists();
    52575274    updateNormalFlowList();
     
    52625279    }
    52635280
    5264     if (shouldUpdateDescendantsAreContiguousInStackingOrder)
     5281    if (shouldUpdateDescendantsAreContiguousInStackingOrder) {
    52655282        updateDescendantsAreContiguousInStackingOrder();
     5283        // The above function can cause us to update m_needsCompositedScrolling
     5284        // and dirty our layer lists. Refresh them if necessary.
     5285        updateZOrderLists();
     5286        updateNormalFlowList();
     5287    }
    52665288}
    52675289
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r140749 r140999  
    433433
    434434    // A stacking container can have z-order lists. All stacking contexts are
    435     // stacking containers, but the converse is not true.
    436     bool isStackingContainer() const { return isStackingContext(); }
     435    // stacking containers, but the converse is not true. Layers that use
     436    // composited scrolling are stacking containers, but they may not
     437    // necessarily be stacking contexts.
     438    bool isStackingContainer() const { return isStackingContext() || needsCompositedScrolling(); }
    437439
    438440    // Gets the enclosing stacking container for this layer.
     
    760762
    761763private:
     764    enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainers };
     765
    762766    void updateZOrderLists();
    763767    void rebuildZOrderLists();
     768    void rebuildZOrderLists(CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<RenderLayer*> >&);
    764769    void clearZOrderLists();
    765770
     
    832837    LayoutUnit renderBoxY() const { return renderBoxLocation().y(); }
    833838
    834     void collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<RenderLayer*> >&);
     839    void collectLayers(bool includeHiddenLayers, CollectLayersBehavior, OwnPtr<Vector<RenderLayer*> >&, OwnPtr<Vector<RenderLayer*> >&);
    835840
    836841    void updateCompositingAndLayerListsIfNeeded();
Note: See TracChangeset for help on using the changeset viewer.