Changeset 236424 in webkit


Ignore:
Timestamp:
Sep 24, 2018, 1:19:46 PM (7 years ago)
Author:
Simon Fraser
Message:

Remove the old "AcceleratedCompositingForOverflowScroll" code
https://bugs.webkit.org/show_bug.cgi?id=189870

Reviewed by Zalan Bujtas.

The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
composited scrolling if an overflow:scroll could be made a stacking context without affecting
z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
Remove this old code (unused by any platform?) to make working on new code easier.
Source/WebCore:

  • page/Settings.yaml:
  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::setHasVisibleContent):
(WebCore::RenderLayer::updateDescendantDependentFlags):
(WebCore::RenderLayer::dirty3DTransformedDescendantStatus):
(WebCore::RenderLayer::stackingContext const):
(WebCore::compositingContainer):
(WebCore::RenderLayer::addChild):
(WebCore::RenderLayer::removeChild):
(WebCore::RenderLayer::hasAcceleratedTouchScrolling const):
(WebCore::RenderLayer::usesAcceleratedScrolling const):
(WebCore::adjustedScrollDelta):
(WebCore::RenderLayer::updateCompositingLayersAfterScroll):
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
(WebCore::RenderLayer::enclosingFragmentedFlowAncestor const):
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::RenderLayer::acceleratedCompositingForOverflowScrollEnabled const): Deleted.
(WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder): Deleted.
(WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive): Deleted.
(WebCore::RenderLayer::positionNewlyCreatedOverflowControls): Deleted.
(WebCore::RenderLayer::canBeStackingContainer const): Deleted.
(WebCore::RenderLayer::stackingContainer const): Deleted.
(WebCore::RenderLayer::needsCompositedScrolling const): Deleted.
(WebCore::RenderLayer::updateNeedsCompositedScrolling): Deleted.

  • rendering/RenderLayer.h:

(WebCore::RenderLayer::clearZOrderLists):
(WebCore::RenderLayer::updateZOrderLists):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateAfterLayout):
(WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const):
(WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const):
(WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
(WebCore::RenderLayerBacking::compositingOpacity const):
(WebCore::traverseVisibleNonCompositedDescendantLayers):
(WebCore::RenderLayerBacking::hasUnpositionedOverflowControlsLayers const): Deleted.

  • rendering/RenderLayerBacking.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
(WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
(WebCore::styleChangeRequiresLayerRebuild):
(WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::requiresCompositingLayer const):
(WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
(WebCore::RenderLayerCompositor::reasonsForCompositing const):
(WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const):
(WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
(WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
(WebCore::RenderLayerCompositor::requiresCompositingForScrolling const): Deleted.

  • rendering/RenderLayerCompositor.h:

Source/WebKit:

  • Shared/WebPreferences.yaml:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
(WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled): Deleted.

  • UIProcess/API/C/WKPreferencesRefPrivate.h:

LayoutTests:

Keep some of the tests; they will be useful later.

  • compositing/overflow/automatically-opt-into-composited-scrolling-expected.txt: Removed.
  • compositing/overflow/automatically-opt-into-composited-scrolling.html: Removed.
  • compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html:
  • compositing/overflow/composited-scrolling-creates-a-stacking-container.html: Removed.
  • compositing/overflow/composited-scrolling-paint-phases.html:
  • compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html:
  • compositing/overflow/dynamic-composited-scrolling-status.html:
  • compositing/overflow/iframe-inside-overflow-clipping.html:
  • compositing/overflow/nested-scrolling.html:
  • compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html:
  • compositing/overflow/paint-neg-z-order-descendants-into-scrolling-contents-layer.html:
  • compositing/overflow/scrolling-content-clip-to-viewport.html:
  • compositing/overflow/scrolling-without-painting.html:
  • compositing/overflow/textarea-scroll-touch.html:
  • compositing/overflow/updating-scrolling-content.html:
  • compositing/rtl/rtl-overflow-scrolling.html:
  • platform/gtk/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
  • platform/ios-simulator-wk2/TestExpectations:
  • platform/ios-wk1/TestExpectations:
  • platform/ios/compositing/overflow/automatically-opt-into-composited-scrolling-expected.txt: Removed.
  • platform/ios/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
  • platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
Location:
trunk
Files:
7 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r236420 r236424  
     12018-09-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Remove the old "AcceleratedCompositingForOverflowScroll" code
     4        https://bugs.webkit.org/show_bug.cgi?id=189870
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
     9        composited scrolling if an overflow:scroll could be made a stacking context without affecting
     10        z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
     11        Remove this old code (unused by any platform?) to make working on new code easier.
     12       
     13        Keep some of the tests; they will be useful later.
     14
     15        * compositing/overflow/automatically-opt-into-composited-scrolling-expected.txt: Removed.
     16        * compositing/overflow/automatically-opt-into-composited-scrolling.html: Removed.
     17        * compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html:
     18        * compositing/overflow/composited-scrolling-creates-a-stacking-container.html: Removed.
     19        * compositing/overflow/composited-scrolling-paint-phases.html:
     20        * compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html:
     21        * compositing/overflow/dynamic-composited-scrolling-status.html:
     22        * compositing/overflow/iframe-inside-overflow-clipping.html:
     23        * compositing/overflow/nested-scrolling.html:
     24        * compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html:
     25        * compositing/overflow/paint-neg-z-order-descendants-into-scrolling-contents-layer.html:
     26        * compositing/overflow/scrolling-content-clip-to-viewport.html:
     27        * compositing/overflow/scrolling-without-painting.html:
     28        * compositing/overflow/textarea-scroll-touch.html:
     29        * compositing/overflow/updating-scrolling-content.html:
     30        * compositing/rtl/rtl-overflow-scrolling.html:
     31        * platform/gtk/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
     32        * platform/ios-simulator-wk2/TestExpectations:
     33        * platform/ios-wk1/TestExpectations:
     34        * platform/ios/compositing/overflow/automatically-opt-into-composited-scrolling-expected.txt: Removed.
     35        * platform/ios/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
     36        * platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt: Removed.
     37
    1382018-09-24  Chris Dumez  <cdumez@apple.com>
    239
  • trunk/LayoutTests/compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html

    r190060 r236424  
    2424    }
    2525  </style>
    26   <script>
    27     if (window.internals)
    28       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    29   </script>
    3026</head>
    3127
  • trunk/LayoutTests/compositing/overflow/composited-scrolling-paint-phases.html

    r190060 r236424  
    3434    if (window.testRunner)
    3535      window.testRunner.dumpAsText(false);
    36 
    37     if (window.internals)
    38       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    3936
    4037    function write(str)
  • trunk/LayoutTests/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html

    r216211 r236424  
    1212    if (window.testRunner)
    1313      window.testRunner.dumpAsText(true);
    14 
    15     if (window.internals)
    16       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    1714
    1815    function endTest()
  • trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status.html

    r190060 r236424  
    2121      testRunner.dumpAsText();
    2222
    23     if (window.internals)
    24       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    25 
    2623    function doTest()
    2724    {
  • trunk/LayoutTests/compositing/overflow/iframe-inside-overflow-clipping.html

    r190060 r236424  
    3232    if (window.testRunner)
    3333      testRunner.dumpAsText();
    34     if (window.internals)
    35       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    3634  </script>
    3735</head>
  • trunk/LayoutTests/compositing/overflow/nested-scrolling.html

    r190060 r236424  
    3131    }
    3232  </style>
    33   <script>
    34     if (window.internals)
    35       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    36   </script>
    3733</head>
    3834<body>
  • trunk/LayoutTests/compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html

    r190060 r236424  
    2323    }
    2424  </style>
    25   <script>
    26     if (window.internals)
    27       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    28   </script>
    2925</head>
    3026
  • trunk/LayoutTests/compositing/overflow/paint-neg-z-order-descendants-into-scrolling-contents-layer.html

    r216211 r236424  
    2727    if (window.testRunner)
    2828      window.testRunner.dumpAsText(true);
    29 
    30     if (window.internals)
    31       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    3229
    3330    function endTest()
  • trunk/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport.html

    r190060 r236424  
    3030    if (window.testRunner)
    3131      testRunner.dumpAsText();
    32     if (window.internals)
    33       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    3432
    3533    window.addEventListener('load', function() {
  • trunk/LayoutTests/compositing/overflow/scrolling-without-painting.html

    r190060 r236424  
    2424  </style>
    2525  <script type="text/javascript">
    26       if (window.internals)
    27           window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    28 
    2926      window.addEventListener('load', function() {
    3027          if (!window.testRunner || !window.internals) {
  • trunk/LayoutTests/compositing/overflow/textarea-scroll-touch.html

    r190060 r236424  
    2020    if (window.testRunner)
    2121      testRunner.dumpAsText();
    22 
    23     if (window.internals)
    24       window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    2522
    2623    function testScrollability(element)
  • trunk/LayoutTests/compositing/overflow/updating-scrolling-content.html

    r190060 r236424  
    2828  </style>
    2929  <script type="text/javascript">
    30       if (window.internals)
    31           window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    32 
    3330      window.addEventListener('load', function() {
    3431          if (!window.testRunner || !window.internals) {
  • trunk/LayoutTests/compositing/rtl/rtl-overflow-scrolling.html

    r194514 r236424  
    33<head>
    44<script type="text/javascript">
    5     if (window.internals)
    6         window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
    7 
    85    function runTest() {
    96        document.getElementById("container").scrollLeft = -715;
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r234212 r236424  
    1515fast/sub-pixel/sub-pixel-composited-layers.html [ ImageOnlyFailure ]
    1616
    17 webkit.org/b/152439 compositing/overflow/dynamic-composited-scrolling-status.html [ Failure ]
     17webkit.org/b/152439 compositing/overflow/dynamic-composited-scrolling-status.html [ Pass Failure ]
    1818
    1919webkit.org/b/173178 [ Release ] svg/animations/svglength-element-removed-crash.svg [ Skip ]
  • trunk/LayoutTests/platform/ios-wk1/TestExpectations

    r236392 r236424  
    569569compositing/layer-creation/no-compositing-for-sticky.html [ Failure ]
    570570compositing/layer-creation/overflow-scroll-overlap.html [ Failure ]
    571 compositing/overflow/automatically-opt-into-composited-scrolling.html [ Failure ]
    572571compositing/overflow/clipping-behaviour-change-is-not-propagated-to-descendants.html [ Failure ]
    573572compositing/overflow/clipping-behaviour-change-is-not-propagated-to-descendants2.html [ Failure ]
    574 compositing/overflow/composited-scrolling-creates-a-stacking-container.html [ Failure ]
    575573compositing/overflow/composited-scrolling-paint-phases.html [ Failure ]
    576574compositing/overflow/content-gains-scrollbars.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r236423 r236424  
     12018-09-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Remove the old "AcceleratedCompositingForOverflowScroll" code
     4        https://bugs.webkit.org/show_bug.cgi?id=189870
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
     9        composited scrolling if an overflow:scroll could be made a stacking context without affecting
     10        z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
     11        Remove this old code (unused by any platform?) to make working on new code easier.
     12
     13        * page/Settings.yaml:
     14        * rendering/RenderLayer.cpp:
     15        (WebCore::RenderLayer::RenderLayer):
     16        (WebCore::RenderLayer::setHasVisibleContent):
     17        (WebCore::RenderLayer::updateDescendantDependentFlags):
     18        (WebCore::RenderLayer::dirty3DTransformedDescendantStatus):
     19        (WebCore::RenderLayer::stackingContext const):
     20        (WebCore::compositingContainer):
     21        (WebCore::RenderLayer::addChild):
     22        (WebCore::RenderLayer::removeChild):
     23        (WebCore::RenderLayer::hasAcceleratedTouchScrolling const):
     24        (WebCore::RenderLayer::usesAcceleratedScrolling const):
     25        (WebCore::adjustedScrollDelta):
     26        (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
     27        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
     28        (WebCore::RenderLayer::enclosingFragmentedFlowAncestor const):
     29        (WebCore::RenderLayer::calculateClipRects const):
     30        (WebCore::RenderLayer::acceleratedCompositingForOverflowScrollEnabled const): Deleted.
     31        (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder): Deleted.
     32        (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive): Deleted.
     33        (WebCore::RenderLayer::positionNewlyCreatedOverflowControls): Deleted.
     34        (WebCore::RenderLayer::canBeStackingContainer const): Deleted.
     35        (WebCore::RenderLayer::stackingContainer const): Deleted.
     36        (WebCore::RenderLayer::needsCompositedScrolling const): Deleted.
     37        (WebCore::RenderLayer::updateNeedsCompositedScrolling): Deleted.
     38        * rendering/RenderLayer.h:
     39        (WebCore::RenderLayer::clearZOrderLists):
     40        (WebCore::RenderLayer::updateZOrderLists):
     41        * rendering/RenderLayerBacking.cpp:
     42        (WebCore::RenderLayerBacking::updateAfterLayout):
     43        (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
     44        (WebCore::RenderLayerBacking::updateGeometry):
     45        (WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const):
     46        (WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const):
     47        (WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
     48        (WebCore::RenderLayerBacking::compositingOpacity const):
     49        (WebCore::traverseVisibleNonCompositedDescendantLayers):
     50        (WebCore::RenderLayerBacking::hasUnpositionedOverflowControlsLayers const): Deleted.
     51        * rendering/RenderLayerBacking.h:
     52        * rendering/RenderLayerCompositor.cpp:
     53        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
     54        (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
     55        (WebCore::styleChangeRequiresLayerRebuild):
     56        (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
     57        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
     58        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
     59        (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
     60        (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
     61        (WebCore::RenderLayerCompositor::reasonsForCompositing const):
     62        (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const):
     63        (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
     64        (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
     65        (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
     66        (WebCore::RenderLayerCompositor::requiresCompositingForScrolling const): Deleted.
     67        * rendering/RenderLayerCompositor.h:
     68
    1692018-09-24  Youenn Fablet  <youenn@apple.com>
    270
  • trunk/Source/WebCore/page/Settings.yaml

    r236010 r236424  
    215215acceleratedCompositingForFixedPositionEnabled:
    216216  initial: defaultAcceleratedCompositingForFixedPositionEnabled
    217 acceleratedCompositingForOverflowScrollEnabled:
    218   initial: false
    219217rubberBandingForSubScrollableRegionsEnabled:
    220218  initial: true
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r236356 r236424  
    277277    , m_hasSelfPaintingLayerDescendant(false)
    278278    , m_hasSelfPaintingLayerDescendantDirty(false)
    279     , m_hasOutOfFlowPositionedDescendant(false)
    280     , m_hasOutOfFlowPositionedDescendantDirty(true)
    281     , m_needsCompositedScrolling(false)
    282     , m_descendantsAreContiguousInStackingOrder(false)
    283279    , m_usedTransparency(false)
    284280    , m_paintingInsideReflection(false)
     
    325321    // Non-stacking containers should have empty z-order lists. As this is already the case,
    326322    // there is no need to dirty / recompute these lists.
    327     m_zOrderListsDirty = isStackingContainer();
     323    m_zOrderListsDirty = isStackingContext();
    328324
    329325    if (!renderer().firstChild()) {
     
    625621}
    626622
    627 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const
    628 {
    629     return renderer().settings().acceleratedCompositingForOverflowScrollEnabled();
    630 }
    631 
    632 // If we are a stacking container, then this function will determine if our
    633 // descendants for a contiguous block in stacking order. This is required in
    634 // order for an element to be safely promoted to a stacking container. It is safe
    635 // to become a stacking container if this change would not alter the stacking
    636 // order of layers on the page. That can only happen if a non-descendant appear
    637 // between us and our descendants in stacking order. Here's an example:
    638 //
    639 //                                 this
    640 //                                /  |  \.
    641 //                               A   B   C
    642 //                              /\   |   /\.
    643 //                             0 -8  D  2  7
    644 //                                   |
    645 //                                   5
    646 //
    647 // I've labeled our normal flow descendants A, B, C, and D, our stacking
    648 // container descendants with their z indices, and us with 'this' (we're a
    649 // stacking container and our zIndex doesn't matter here). These nodes appear in
    650 // three lists: posZOrder, negZOrder, and normal flow (keep in mind that normal
    651 // flow layers don't overlap). So if we arrange these lists in order we get our
    652 // stacking order:
    653 //
    654 //                     [-8], [A-D], [0, 2, 5, 7]--> pos z-order.
    655 //                       |     |
    656 //        Neg z-order. <-+     +--> Normal flow descendants.
    657 //
    658 // We can then assign new, 'stacking' order indices to these elements as follows:
    659 //
    660 //                     [-8], [A-D], [0, 2, 5, 7]
    661 // 'Stacking' indices:  -1     0     1  2  3  4
    662 //
    663 // Note that the normal flow descendants can share an index because they don't
    664 // stack/overlap. Now our problem becomes very simple: a layer can safely become
    665 // a stacking container if the stacking-order indices of it and its descendants
    666 // appear in a contiguous block in the list of stacking indices. This problem
    667 // can be solved very efficiently by calculating the min/max stacking indices in
    668 // the subtree, and the number stacking container descendants. Once we have this
    669 // information, we know that the subtree's indices form a contiguous block if:
    670 //
    671 //           maxStackIndex - minStackIndex == numSCDescendants
    672 //
    673 // So for node A in the example above we would have:
    674 //   maxStackIndex = 1
    675 //   minStackIndex = -1
    676 //   numSCDecendants = 2
    677 //
    678 // and so,
    679 //       maxStackIndex - minStackIndex == numSCDescendants
    680 //  ===>                      1 - (-1) == 2
    681 //  ===>                             2 == 2
    682 //
    683 //  Since this is true, A can safely become a stacking container.
    684 //  Now, for node C we have:
    685 //
    686 //   maxStackIndex = 4
    687 //   minStackIndex = 0 <-- because C has stacking index 0.
    688 //   numSCDecendants = 2
    689 //
    690 // and so,
    691 //       maxStackIndex - minStackIndex == numSCDescendants
    692 //  ===>                         4 - 0 == 2
    693 //  ===>                             4 == 2
    694 //
    695 // Since this is false, C cannot be safely promoted to a stacking container. This
    696 // happened because of the elements with z-index 5 and 0. Now if 5 had been a
    697 // child of C rather than D, and A had no child with Z index 0, we would have had:
    698 //
    699 //   maxStackIndex = 3
    700 //   minStackIndex = 0 <-- because C has stacking index 0.
    701 //   numSCDecendants = 3
    702 //
    703 // and so,
    704 //       maxStackIndex - minStackIndex == numSCDescendants
    705 //  ===>                         3 - 0 == 3
    706 //  ===>                             3 == 3
    707 //
    708 //  And we would conclude that C could be promoted.
    709 void RenderLayer::updateDescendantsAreContiguousInStackingOrder()
    710 {
    711     if (!isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled())
    712         return;
    713 
    714     ASSERT(!m_normalFlowListDirty);
    715     ASSERT(!m_zOrderListsDirty);
    716 
    717     std::unique_ptr<Vector<RenderLayer*>> posZOrderList;
    718     std::unique_ptr<Vector<RenderLayer*>> negZOrderList;
    719     rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList);
    720 
    721     // Create a reverse lookup.
    722     HashMap<const RenderLayer*, int> lookup;
    723 
    724     if (negZOrderList) {
    725         int stackingOrderIndex = -1;
    726         size_t listSize = negZOrderList->size();
    727         for (size_t i = 0; i < listSize; ++i) {
    728             RenderLayer* currentLayer = negZOrderList->at(listSize - i - 1);
    729             if (!currentLayer->isStackingContext())
    730                 continue;
    731             lookup.set(currentLayer, stackingOrderIndex--);
    732         }
    733     }
    734 
    735     if (posZOrderList) {
    736         size_t listSize = posZOrderList->size();
    737         int stackingOrderIndex = 1;
    738         for (size_t i = 0; i < listSize; ++i) {
    739             RenderLayer* currentLayer = posZOrderList->at(i);
    740             if (!currentLayer->isStackingContext())
    741                 continue;
    742             lookup.set(currentLayer, stackingOrderIndex++);
    743         }
    744     }
    745 
    746     int minIndex = 0;
    747     int maxIndex = 0;
    748     int count = 0;
    749     bool firstIteration = true;
    750     updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, maxIndex, count, firstIteration);
    751 }
    752 
    753 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& count, bool firstIteration)
    754 {
    755     if (isStackingContext() && !firstIteration) {
    756         if (lookup.contains(this)) {
    757             minIndex = std::min(minIndex, lookup.get(this));
    758             maxIndex = std::max(maxIndex, lookup.get(this));
    759             count++;
    760         }
    761         return;
    762     }
    763 
    764     for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
    765         int childMinIndex = 0;
    766         int childMaxIndex = 0;
    767         int childCount = 0;
    768         child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, childMinIndex, childMaxIndex, childCount, false);
    769         if (childCount) {
    770             count += childCount;
    771             minIndex = std::min(minIndex, childMinIndex);
    772             maxIndex = std::max(maxIndex, childMaxIndex);
    773         }
    774     }
    775 
    776     if (!isStackingContext()) {
    777         bool newValue = maxIndex - minIndex == count;
    778         bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder;
    779         m_descendantsAreContiguousInStackingOrder = newValue;
    780         if (didUpdate)
    781             updateNeedsCompositedScrolling();
    782     }
    783 }
    784 
    785623void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* geometryMap)
    786624{
     
    893731}
    894732
    895 void RenderLayer::positionNewlyCreatedOverflowControls()
    896 {
    897     if (!backing()->hasUnpositionedOverflowControlsLayers())
    898         return;
    899 
    900     RenderGeometryMap geometryMap(UseTransforms);
    901     if (this != renderer().view().layer() && parent())
    902         geometryMap.pushMappingsToAncestor(parent(), nullptr);
    903 
    904     LayoutPoint offsetFromRoot = LayoutPoint(geometryMap.absolutePoint(FloatPoint()));
    905     positionOverflowControls(toIntSize(roundedIntPoint(offsetFromRoot)));
    906 }
    907 
    908733#if ENABLE(CSS_COMPOSITING)
    909734
     
    1127952}
    1128953
    1129 bool RenderLayer::canBeStackingContainer() const
    1130 {
    1131     if (isStackingContext() || !stackingContainer())
    1132         return true;
    1133 
    1134     return m_descendantsAreContiguousInStackingOrder;
    1135 }
    1136 
    1137954void RenderLayer::setHasVisibleContent()
    1138955{
     
    1149966        // As we became visible, we need to dirty our stacking containers ancestors to be properly
    1150967        // collected. FIXME: When compositing, we could skip this dirtying phase.
    1151         for (RenderLayer* sc = stackingContainer(); sc; sc = sc->stackingContainer()) {
     968        for (RenderLayer* sc = stackingContext(); sc; sc = sc->stackingContext()) {
    1152969            sc->dirtyZOrderLists();
    1153970            if (sc->hasVisibleContent())
     
    11901007void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks)
    11911008{
    1192     if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty || hasNotIsolatedBlendingDescendantsStatusDirty()) {
     1009    if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || hasNotIsolatedBlendingDescendantsStatusDirty()) {
    11931010        bool hasVisibleDescendant = false;
    11941011        bool hasSelfPaintingLayerDescendant = false;
    1195         bool hasOutOfFlowPositionedDescendant = false;
    11961012#if ENABLE(CSS_COMPOSITING)
    11971013        bool hasNotIsolatedBlendingDescendants = false;
     
    12151031            hasVisibleDescendant |= child->m_hasVisibleContent || child->m_hasVisibleDescendant;
    12161032            hasSelfPaintingLayerDescendant |= child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant();
    1217             hasOutOfFlowPositionedDescendant |= !childOutOfFlowDescendantContainingBlocks.isEmpty();
    12181033#if ENABLE(CSS_COMPOSITING)
    12191034            hasNotIsolatedBlendingDescendants |= child->hasBlendMode() || (child->hasNotIsolatedBlendingDescendants() && !child->isolatesBlending());
    12201035#endif
    12211036
    1222             bool allFlagsSet = hasVisibleDescendant && hasSelfPaintingLayerDescendant && hasOutOfFlowPositionedDescendant;
     1037            bool allFlagsSet = hasVisibleDescendant && hasSelfPaintingLayerDescendant;
    12231038#if ENABLE(CSS_COMPOSITING)
    12241039            allFlagsSet &= hasNotIsolatedBlendingDescendants;
     
    12361051        m_hasSelfPaintingLayerDescendantDirty = false;
    12371052
    1238         m_hasOutOfFlowPositionedDescendant = hasOutOfFlowPositionedDescendant;
    1239         if (m_hasOutOfFlowPositionedDescendantDirty)
    1240             updateNeedsCompositedScrolling();
    1241 
    1242         m_hasOutOfFlowPositionedDescendantDirty = false;
    12431053#if ENABLE(CSS_COMPOSITING)
    12441054        m_hasNotIsolatedBlendingDescendants = hasNotIsolatedBlendingDescendants;
     
    12841094void RenderLayer::dirty3DTransformedDescendantStatus()
    12851095{
    1286     RenderLayer* curr = stackingContainer();
     1096    RenderLayer* curr = stackingContext();
    12871097    if (curr)
    12881098        curr->m_3DTransformedDescendantStatusDirty = true;
     
    12921102    while (curr && curr->preserves3D()) {
    12931103        curr->m_3DTransformedDescendantStatusDirty = true;
    1294         curr = curr->stackingContainer();
     1104        curr = curr->stackingContext();
    12951105    }
    12961106}
     
    14391249}
    14401250
    1441 RenderLayer* RenderLayer::stackingContainer() const
     1251RenderLayer* RenderLayer::stackingContext() const
    14421252{
    14431253    RenderLayer* layer = parent();
    1444     while (layer && !layer->isStackingContainer())
     1254    while (layer && !layer->isStackingContext())
    14451255        layer = layer->parent();
    14461256
    1447     ASSERT(!layer || layer->isStackingContainer());
     1257    ASSERT(!layer || layer->isStackingContext());
    14481258    return layer;
    14491259}
     
    15331343static inline const RenderLayer* compositingContainer(const RenderLayer& layer)
    15341344{
    1535     return layer.isNormalFlowOnly() ? layer.parent() : layer.stackingContainer();
     1345    return layer.isNormalFlowOnly() ? layer.parent() : layer.stackingContext();
    15361346}
    15371347
     
    18641674
    18651675    if (!child->isNormalFlowOnly() || child->firstChild()) {
    1866         // Dirty the z-order list in which we are contained. The stackingContainer() can be null in the
     1676        // Dirty the z-order list in which we are contained. The stackingContext() can be null in the
    18671677        // case where we're building up generated content layers. This is ok, since the lists will start
    18681678        // off dirty in that case anyway.
    1869         child->dirtyStackingContainerZOrderLists();
     1679        child->dirtyStackingContextZOrderLists();
    18701680    }
    18711681
     
    18761686    if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
    18771687        setAncestorChainHasSelfPaintingLayerDescendant();
    1878 
    1879     if (child->renderer().isOutOfFlowPositioned() || child->hasOutOfFlowPositionedDescendant())
    1880         setAncestorChainHasOutOfFlowPositionedDescendant(child->renderer().containingBlock());
    18811688
    18821689#if ENABLE(CSS_COMPOSITING)
     
    19091716        // Dirty the z-order list in which we are contained.  When called via the
    19101717        // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
    1911         // from the main layer tree, so we need to null-check the |stackingContainer| value.
    1912         oldChild->dirtyStackingContainerZOrderLists();
    1913     }
    1914 
    1915     if (oldChild->renderer().isOutOfFlowPositioned() || oldChild->hasOutOfFlowPositionedDescendant())
    1916         dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
     1718        // from the main layer tree, so we need to null-check the |stackingContext| value.
     1719        oldChild->dirtyStackingContextZOrderLists();
     1720    }
    19171721
    19181722    oldChild->setPreviousSibling(nullptr);
     
    21511955    if (!scrollsOverflow())
    21521956        return false;
     1957
    21531958    return renderer().style().useTouchOverflowScrolling() || renderer().settings().alwaysUseAcceleratedOverflowScroll();
    21541959#else
     
    21791984    return hasTouchScrollableOverflow();
    21801985#else
    2181     return needsCompositedScrolling();
     1986    return false;
    21821987#endif
    21831988}
     
    22132018}
    22142019
    2215 bool RenderLayer::needsCompositedScrolling() const
    2216 {
    2217     return m_needsCompositedScrolling;
    2218 }
    2219 
    2220 void RenderLayer::updateNeedsCompositedScrolling()
    2221 {
    2222     bool oldNeedsCompositedScrolling = m_needsCompositedScrolling;
    2223 
    2224     if (!renderer().view().frameView().containsScrollableArea(this))
    2225         m_needsCompositedScrolling = false;
    2226     else {
    2227         bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScrollEnabled()
    2228             && canBeStackingContainer()
    2229             && !hasOutOfFlowPositionedDescendant();
    2230 
    2231 #if !PLATFORM(IOS) && ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
    2232         m_needsCompositedScrolling = forceUseCompositedScrolling || renderer().style().useTouchOverflowScrolling();
    2233 #else
    2234         // On iOS we don't want to opt into accelerated composited scrolling, which creates scroll bar
    2235         // layers in WebCore, because we use UIKit to composite our scroll bars.
    2236         m_needsCompositedScrolling = forceUseCompositedScrolling;
    2237 #endif
    2238     }
    2239 
    2240     if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) {
    2241         updateSelfPaintingLayer();
    2242         if (isStackingContainer())
    2243             dirtyZOrderLists();
    2244         else
    2245             clearZOrderLists();
    2246 
    2247         dirtyStackingContainerZOrderLists();
    2248 
    2249         compositor().setShouldReevaluateCompositingAfterLayout();
    2250         compositor().setCompositingLayersNeedRebuild();
    2251     }
    2252 }
    2253 
    2254 static inline int adjustedScrollDelta(int beginningDelta) {
     2020static inline int adjustedScrollDelta(int beginningDelta)
     2021{
    22552022    // This implemention matches Firefox's.
    22562023    // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#856.
     
    25982365        // Our stacking container is guaranteed to contain all of our descendants that may need
    25992366        // repositioning, so update compositing layers from there.
    2600         if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCompositingLayer()) {
    2601             if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescendant())
     2367        if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) {
     2368            if (usesCompositedScrolling())
    26022369                compositor().updateCompositingLayers(CompositingUpdateType::OnCompositedScroll, compositingAncestor);
    26032370            else
     
    35503317}
    35513318
     3319// This is called from layout code (before updateLayerPositions).
    35523320void RenderLayer::updateScrollInfoAfterLayout()
    35533321{
     
    35913359
    35923360    // Composited scrolling may need to be enabled or disabled if the amount of overflow changed.
     3361    // FIXME: this should just dirty the layer and updateLayerPositions should do stuff.
    35933362    if (compositor().updateLayerCompositingState(*this))
    35943363        compositor().setCompositingLayersNeedRebuild();
     
    49204689    RenderLayer* curr = parent();
    49214690    for (; curr && !curr->isRenderFragmentedFlow(); curr = curr->parent()) {
    4922         if (curr->isStackingContainer() && curr->isComposited()) {
     4691        if (curr->isStackingContext() && curr->isComposited()) {
    49234692            // We only adjust the position of the first level of layers.
    49244693            return nullptr;
     
    58615630    }
    58625631   
    5863     ASSERT(isStackingContainer() || (!posZOrderList() || !posZOrderList()->size()));
     5632    ASSERT(isStackingContext() || (!posZOrderList() || !posZOrderList()->size()));
    58645633
    58655634#if !ASSERT_DISABLED
     
    61005869{
    61015870    ASSERT(m_layerListMutationAllowed);
    6102     ASSERT(isStackingContainer());
     5871    ASSERT(isStackingContext());
    61035872
    61045873    if (m_posZOrderList)
     
    61085877    m_zOrderListsDirty = true;
    61095878
    6110     if (!renderer().renderTreeBeingDestroyed()) {
     5879    if (!renderer().renderTreeBeingDestroyed())
    61115880        compositor().setCompositingLayersNeedRebuild();
    6112         if (acceleratedCompositingForOverflowScrollEnabled())
    6113             compositor().setShouldReevaluateCompositingAfterLayout();
    6114     }
    6115 }
    6116 
    6117 void RenderLayer::dirtyStackingContainerZOrderLists()
    6118 {
    6119     RenderLayer* sc = stackingContainer();
     5881}
     5882
     5883void RenderLayer::dirtyStackingContextZOrderLists()
     5884{
     5885    RenderLayer* sc = stackingContext();
    61205886    if (sc)
    61215887        sc->dirtyZOrderLists();
     
    61305896    m_normalFlowListDirty = true;
    61315897
    6132     if (!renderer().renderTreeBeingDestroyed()) {
     5898    if (!renderer().renderTreeBeingDestroyed())
    61335899        compositor().setCompositingLayersNeedRebuild();
    6134         if (acceleratedCompositingForOverflowScrollEnabled())
    6135             compositor().setShouldReevaluateCompositingAfterLayout();
    6136     }
    61375900}
    61385901
     
    61405903{
    61415904    ASSERT(m_layerListMutationAllowed);
    6142     ASSERT(isDirtyStackingContainer());
    6143     rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderList);
     5905    ASSERT(isDirtyStackingContext());
     5906    rebuildZOrderLists(m_posZOrderList, m_negZOrderList);
    61445907    m_zOrderListsDirty = false;
    61455908}
    61465909
    6147 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, std::unique_ptr<Vector<RenderLayer*>>& posZOrderList, std::unique_ptr<Vector<RenderLayer*>>& negZOrderList)
     5910void RenderLayer::rebuildZOrderLists(std::unique_ptr<Vector<RenderLayer*>>& posZOrderList, std::unique_ptr<Vector<RenderLayer*>>& negZOrderList)
    61485911{
    61495912    bool includeHiddenLayers = compositor().inCompositingMode();
    61505913    for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
    61515914        if (!m_reflection || reflectionLayer() != child)
    6152             child->collectLayers(includeHiddenLayers, behavior, posZOrderList, negZOrderList);
     5915            child->collectLayers(includeHiddenLayers, posZOrderList, negZOrderList);
    61535916
    61545917    // Sort the two lists.
     
    61795942}
    61805943
    6181 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, std::unique_ptr<Vector<RenderLayer*>>& posBuffer, std::unique_ptr<Vector<RenderLayer*>>& negBuffer)
     5944void RenderLayer::collectLayers(bool includeHiddenLayers, std::unique_ptr<Vector<RenderLayer*>>& posBuffer, std::unique_ptr<Vector<RenderLayer*>>& negBuffer)
    61825945{
    61835946    updateDescendantDependentFlags();
    61845947
    6185     bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer();
     5948    bool isStacking = isStackingContext();
    61865949    // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists.
    61875950    bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_hasVisibleDescendant && isStacking));
     
    62045967            // Ignore reflections.
    62055968            if (!m_reflection || reflectionLayer() != child)
    6206                 child->collectLayers(includeHiddenLayers, behavior, posBuffer, negBuffer);
     5969                child->collectLayers(includeHiddenLayers, posBuffer, negBuffer);
    62075970        }
    62085971    }
     
    62115974void RenderLayer::updateLayerListsIfNeeded()
    62125975{
    6213     bool shouldUpdateDescendantsAreContiguousInStackingOrder = (m_zOrderListsDirty || m_normalFlowListDirty) && isStackingContext();
    62145976    updateZOrderLists();
    62155977    updateNormalFlowList();
     
    62185980        reflectionLayer->updateZOrderLists();
    62195981        reflectionLayer->updateNormalFlowList();
    6220     }
    6221 
    6222     if (shouldUpdateDescendantsAreContiguousInStackingOrder) {
    6223         updateDescendantsAreContiguousInStackingOrder();
    6224         // The above function can cause us to update m_needsCompositedScrolling
    6225         // and dirty our layer lists. Refresh them if necessary.
    6226         updateZOrderLists();
    6227         updateNormalFlowList();
    62285982    }
    62295983}
     
    62586012{
    62596013    if (compositor().inCompositingMode()) {
    6260         if (isDirtyStackingContainer() || m_normalFlowListDirty)
     6014        if (isDirtyStackingContext() || m_normalFlowListDirty)
    62616015            compositor().updateCompositingLayers(CompositingUpdateType::OnHitTest, this);
    62626016        return;
     
    63266080        || renderer.hasReflection()
    63276081        || renderer.style().hasIsolation()
    6328         || layer.needsCompositedScrolling()
    63296082#if PLATFORM(IOS)
    63306083        || layer.hasAcceleratedTouchScrolling()
     
    63536106
    63546107    return hasOverlayScrollbars()
    6355         || needsCompositedScrolling()
    63566108        || renderer().isTableRow()
    63576109        || renderer().isCanvas()
     
    65116263    bool isStackingContext = this->isStackingContext();
    65126264    if (isStackingContext != wasStackingContext) {
    6513         dirtyStackingContainerZOrderLists();
     6265        dirtyStackingContextZOrderLists();
    65146266        if (isStackingContext)
    65156267            dirtyZOrderLists();
     
    65376289    // likely be folded along with the rest.
    65386290    if (oldStyle->zIndex() != renderer().style().zIndex() || oldStyle->visibility() != renderer().style().visibility()) {
    6539         dirtyStackingContainerZOrderLists();
     6291        dirtyStackingContextZOrderLists();
    65406292        if (isStackingContext)
    65416293            dirtyZOrderLists();
     
    65736325    if (!m_scrollDimensionsDirty)
    65746326        updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
    6575 }
    6576 
    6577 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderBlock* containingBlock)
    6578 {
    6579     for (RenderLayer* layer = this; layer; layer = layer->parent()) {
    6580         if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFlowPositionedDescendant())
    6581             break;
    6582 
    6583         layer->m_hasOutOfFlowPositionedDescendantDirty = false;
    6584         layer->m_hasOutOfFlowPositionedDescendant = true;
    6585         layer->updateNeedsCompositedScrolling();
    6586 
    6587         if (&layer->renderer() == containingBlock)
    6588             break;
    6589     }
    6590 }
    6591 
    6592 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus()
    6593 {
    6594     m_hasOutOfFlowPositionedDescendantDirty = true;
    6595     if (parent())
    6596         parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
    6597 }
    6598 
    6599 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle)
    6600 {
    6601     bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == PositionType::Absolute || oldStyle->position() == PositionType::Fixed);
    6602     if (parent() && (renderer().isOutOfFlowPositioned() != wasOutOfFlowPositioned)) {
    6603         parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
    6604         if (!renderer().renderTreeBeingDestroyed() && acceleratedCompositingForOverflowScrollEnabled())
    6605             compositor().setShouldReevaluateCompositingAfterLayout();
    6606     }
    66076327}
    66086328
     
    66156335        if (p)
    66166336            p->dirtyNormalFlowList();
    6617         dirtyStackingContainerZOrderLists();
     6337        dirtyStackingContextZOrderLists();
    66186338    }
    66196339
     
    66326352    // to recompute the bit once scrollbars have been updated.
    66336353    updateSelfPaintingLayer();
    6634     updateOutOfFlowPositioned(oldStyle);
    66356354
    66366355    if (!hasReflection() && m_reflection)
     
    66586377#endif
    66596378    updateFiltersAfterStyleChange();
    6660 
    6661     updateNeedsCompositedScrolling();
    6662 
     6379   
    66636380    compositor().layerStyleChanged(diff, *this, oldStyle);
    66646381
     
    66956412        m_registeredScrollableArea = false;
    66966413    }
    6697    
    6698     if (addedOrRemoved)
    6699         updateNeedsCompositedScrolling();
    67006414
    67016415#if ENABLE(IOS_TOUCH_EVENTS)
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r235749 r236424  
    324324    void updateLayerPositionsAfterDocumentScroll();
    325325
    326     void positionNewlyCreatedOverflowControls();
    327 
    328326    bool hasCompositedLayerInEnclosingPaginationChain() const;
    329327    enum PaginationInclusionMode { ExcludeCompositedPaginatedLayers, IncludeCompositedPaginatedLayers };
     
    353351    bool isStackingContext() const { return isStackingContext(&renderer().style()); }
    354352
    355     // A stacking container can have z-order lists. All stacking contexts are
    356     // stacking containers, but the converse is not true. Layers that use
    357     // composited scrolling are stacking containers, but they may not
    358     // necessarily be stacking contexts.
    359     bool isStackingContainer() const { return isStackingContext() || needsCompositedScrolling(); }
    360 
    361     // Gets the enclosing stacking container for this layer, excluding this
    362     // layer itself.
    363     RenderLayer* stackingContainer() const;
     353    // Gets the enclosing stacking context for this layer, excluding this layer itself.
     354    RenderLayer* stackingContext() const;
    364355
    365356    // Gets the enclosing stacking container for this layer, possibly the layer
    366357    // itself, if it is a stacking container.
    367     RenderLayer* enclosingStackingContainer() { return isStackingContainer() ? this : stackingContainer(); }
     358    RenderLayer* enclosingStackingContext() { return isStackingContext() ? this : stackingContext(); }
    368359
    369360    void dirtyZOrderLists();
    370     void dirtyStackingContainerZOrderLists();
     361    void dirtyStackingContextZOrderLists();
    371362
    372363    Vector<RenderLayer*>* posZOrderList() const
    373364    {
    374365        ASSERT(!m_zOrderListsDirty);
    375         ASSERT(isStackingContainer() || !m_posZOrderList);
     366        ASSERT(isStackingContext() || !m_posZOrderList);
    376367        return m_posZOrderList.get();
    377368    }
     
    382373    {
    383374        ASSERT(!m_zOrderListsDirty);
    384         ASSERT(isStackingContainer() || !m_negZOrderList);
     375        ASSERT(isStackingContext() || !m_negZOrderList);
    385376        return m_negZOrderList.get();
    386377    }
     
    439430    // Part of the issue is with subtree relayout: we don't check if our ancestors have some descendant flags dirty, missing some updates.
    440431    bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerDescendant; }
    441 
    442     // This returns true if we have an out of flow positioned descendant whose
    443     // containing block is not a descendant of ours. If this is true, we cannot
    444     // automatically opt into composited scrolling since this out of flow
    445     // positioned descendant would become clipped by us, possibly altering the
    446     // rendering of the page.
    447     // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); here but we may hit the same bugs as visible content above.
    448     bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositionedDescendant; }
    449432
    450433    // Gets the nearest enclosing positioned ancestor layer (also includes
     
    656639    bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
    657640    bool hasCompositedMask() const;
     641
    658642    RenderLayerBacking* backing() const { return m_backing.get(); }
    659643    RenderLayerBacking* ensureBacking();
    660644    void clearBacking(bool layerBeingDestroyed = false);
     645
    661646    GraphicsLayer* layerForScrolling() const override;
    662647    GraphicsLayer* layerForHorizontalScrollbar() const override;
    663648    GraphicsLayer* layerForVerticalScrollbar() const override;
    664649    GraphicsLayer* layerForScrollCorner() const override;
     650
    665651    bool usesCompositedScrolling() const override;
    666652    bool usesAsyncScrolling() const override;
    667     WEBCORE_EXPORT bool needsCompositedScrolling() const;
    668653
    669654    bool paintsWithTransparency(OptionSet<PaintBehavior> paintBehavior) const
     
    722707
    723708private:
    724     enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainers };
    725 
    726709    struct LayerPaintingInfo {
    727710        LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, OptionSet<PaintBehavior> inPaintBehavior, const LayoutSize& inSubpixelOffset, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr, bool inRequireSecurityOriginAccessForWidgets = false)
     
    754737    void updateZOrderLists();
    755738    void rebuildZOrderLists();
    756     void rebuildZOrderLists(CollectLayersBehavior, std::unique_ptr<Vector<RenderLayer*>>&, std::unique_ptr<Vector<RenderLayer*>>&);
     739    void rebuildZOrderLists(std::unique_ptr<Vector<RenderLayer*>>&, std::unique_ptr<Vector<RenderLayer*>>&);
    757740    void clearZOrderLists();
    758741
     
    763746    bool isStackingContext(const RenderStyle* style) const { return !style->hasAutoZIndex() || isRenderViewLayer() || m_forcedStackingContext; }
    764747
    765     bool isDirtyStackingContainer() const { return m_zOrderListsDirty && isStackingContainer(); }
     748    bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); }
    766749
    767750    void setAncestorChainHasSelfPaintingLayerDescendant();
    768751    void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
    769 
    770     bool acceleratedCompositingForOverflowScrollEnabled() const;
    771     void updateDescendantsAreContiguousInStackingOrder();
    772     void updateDescendantsAreContiguousInStackingOrderRecursive(const HashMap<const RenderLayer*, int>&, int& minIndex, int& maxIndex, int& count, bool firstIteration);
    773752
    774753    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = nullptr);
     
    788767    void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle);
    789768    void updateScrollbarsAfterLayout();
    790 
    791     void setAncestorChainHasOutOfFlowPositionedDescendant(RenderBlock* containingBlock);
    792     void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
    793     void updateOutOfFlowPositioned(const RenderStyle* oldStyle);
    794 
    795     void updateNeedsCompositedScrolling();
    796769
    797770    // Returns true if the position changed.
     
    820793    LayoutPoint renderBoxLocation() const { return is<RenderBox>(renderer()) ? downcast<RenderBox>(renderer()).location() : LayoutPoint(); }
    821794
    822     void collectLayers(bool includeHiddenLayers, CollectLayersBehavior, std::unique_ptr<Vector<RenderLayer*>>&, std::unique_ptr<Vector<RenderLayer*>>&);
     795    void collectLayers(bool includeHiddenLayers, std::unique_ptr<Vector<RenderLayer*>>&, std::unique_ptr<Vector<RenderLayer*>>&);
    823796
    824797    void updateCompositingAndLayerListsIfNeeded();
     
    1007980    bool mustCompositeForIndirectReasons() const { return m_indirectCompositingReason; }
    1008981
    1009     // Returns true if z ordering would not change if this layer were a stacking container.
    1010     bool canBeStackingContainer() const;
    1011 
    1012982    friend class RenderLayerBacking;
    1013983    friend class RenderLayerCompositor;
     
    10461016    bool m_hasSelfPaintingLayerDescendant : 1;
    10471017    bool m_hasSelfPaintingLayerDescendantDirty : 1;
    1048 
    1049     // If we have no out of flow positioned descendants and no non-descendant
    1050     // appears between our descendants in stacking order, then we may become a
    1051     // stacking context.
    1052     bool m_hasOutOfFlowPositionedDescendant : 1;
    1053     bool m_hasOutOfFlowPositionedDescendantDirty : 1;
    1054 
    1055     bool m_needsCompositedScrolling : 1;
    1056 
    1057     // If this is true, then no non-descendant appears between any of our
    1058     // descendants in stacking order. This is one of the requirements of being
    1059     // able to safely become a stacking context.
    1060     bool m_descendantsAreContiguousInStackingOrder : 1;
    10611018
    10621019    bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether
     
    11771134inline void RenderLayer::clearZOrderLists()
    11781135{
    1179     ASSERT(!isStackingContainer());
     1136    ASSERT(!isStackingContext());
    11801137    ASSERT(m_layerListMutationAllowed);
    11811138
     
    11891146        return;
    11901147
    1191     if (!isStackingContainer()) {
     1148    if (!isStackingContext()) {
    11921149        clearZOrderLists();
    11931150        m_zOrderListsDirty = false;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r236016 r236424  
    659659            updateAfterDescendants();
    660660            compositor().updateRootLayerPosition();
    661             auto* stackingContainer = m_owningLayer.enclosingStackingContainer();
    662             if (!compositor().compositingLayersNeedRebuild() && stackingContainer && (stackingContainer != &m_owningLayer))
    663                 compositor().updateCompositingDescendantGeometry(*stackingContainer, *stackingContainer);
     661            auto* stackingContext = m_owningLayer.enclosingStackingContext();
     662            if (!compositor().compositingLayersNeedRebuild() && stackingContext && (stackingContext != &m_owningLayer))
     663                compositor().updateCompositingDescendantGeometry(*stackingContext, *stackingContext);
    664664        }
    665665    }
     
    923923        ScrollOffset scrollOffset = compositedAncestor->scrollOffset();
    924924        parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), paddingBox.size());
    925     }
    926 #else
    927     if (compositedAncestor->needsCompositedScrolling()) {
    928         auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer());
    929         LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop());
    930         parentGraphicsLayerRect = LayoutRect(scrollOrigin - toLayoutSize(compositedAncestor->scrollOffset()), renderBox.borderBoxRect().size());
    931925    }
    932926#endif
     
    952946{
    953947    // If we haven't built z-order lists yet, wait until later.
    954     if (m_owningLayer.isStackingContainer() && m_owningLayer.m_zOrderListsDirty)
     948    if (m_owningLayer.isStackingContext() && m_owningLayer.m_zOrderListsDirty)
    955949        return;
    956950
     
    14531447bool RenderLayerBacking::requiresHorizontalScrollbarLayer() const
    14541448{
    1455     if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())
     1449    if (!m_owningLayer.hasOverlayScrollbars())
    14561450        return false;
    14571451    return m_owningLayer.horizontalScrollbar();
     
    14601454bool RenderLayerBacking::requiresVerticalScrollbarLayer() const
    14611455{
    1462     if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())
     1456    if (!m_owningLayer.hasOverlayScrollbars())
    14631457        return false;
    14641458    return m_owningLayer.verticalScrollbar();
     
    14671461bool RenderLayerBacking::requiresScrollCornerLayer() const
    14681462{
    1469     if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())
     1463    if (!m_owningLayer.hasOverlayScrollbars())
    14701464        return false;
    14711465    return !m_owningLayer.scrollCornerAndResizerRect().isEmpty();
     
    15611555        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
    15621556    }
    1563 }
    1564 
    1565 bool RenderLayerBacking::hasUnpositionedOverflowControlsLayers() const
    1566 {
    1567     if (auto* layer = layerForHorizontalScrollbar()) {
    1568         if (!layer->drawsContent())
    1569             return true;
    1570     }
    1571 
    1572     if (auto* layer = layerForVerticalScrollbar()) {
    1573         if (!layer->drawsContent())
    1574             return true;
    1575     }
    1576 
    1577     if (auto* layer = layerForScrollCorner()) {
    1578         if (!layer->drawsContent())
    1579             return true;
    1580     }
    1581 
    1582     return false;
    15831557}
    15841558
     
    18141788        // We only care about parents that are stacking contexts.
    18151789        // Recall that opacity creates stacking context.
    1816         if (!curr->isStackingContainer())
     1790        if (!curr->isStackingContext())
    18171791            continue;
    18181792       
     
    21232097    }
    21242098
    2125     if (parent.isStackingContainer() && !parent.hasVisibleDescendant())
     2099    if (parent.isStackingContext() && !parent.hasVisibleDescendant())
    21262100        return LayerTraversal::Continue;
    21272101
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r236016 r236424  
    183183    void updateAfterWidgetResize();
    184184    void positionOverflowControlsLayers();
    185     bool hasUnpositionedOverflowControlsLayers() const;
    186 
     185   
    187186    bool isFrameLayerWithTiledBacking() const { return m_isFrameLayerWithTiledBacking; }
    188187
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r236341 r236424  
    522522void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush()
    523523{
    524 #if PLATFORM(IOS)
    525524    updateCustomLayersAfterFlush();
    526 #endif
    527525
    528526    HashSet<RenderLayer*> layersNeedingUpdate;
     
    554552        layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
    555553}
     554#endif
    556555
    557556void RenderLayerCompositor::updateCustomLayersAfterFlush()
    558557{
     558#if PLATFORM(IOS)
    559559    registerAllViewportConstrainedLayers();
    560560
     
    565565    }
    566566    m_scrollingLayersNeedingUpdate.clear();
    567 }
    568 #endif
     567#endif
     568}
    569569
    570570void RenderLayerCompositor::didFlushChangesForLayer(RenderLayer& layer, const GraphicsLayer* graphicsLayer)
     
    929929
    930930    // When overflow changes, composited layers may need to update their ancestorClipping layers.
    931     if (!layer.isComposited() && (oldStyle.overflowX() != newStyle.overflowX() || oldStyle.overflowY() != newStyle.overflowY()) && layer.stackingContainer()->hasCompositingDescendant())
     931    if (!layer.isComposited() && (oldStyle.overflowX() != newStyle.overflowX() || oldStyle.overflowY() != newStyle.overflowY()) && layer.stackingContext()->hasCompositingDescendant())
    932932        return true;
    933933   
     
    11981198{
    11991199    for (auto* parent = layer.parent(); parent; parent = parent->parent()) {
    1200         if (parent->isStackingContainer())
     1200        if (parent->isStackingContext())
    12011201            return nullptr;
    12021202        if (parent->renderer().hasClipOrOverflowClip())
     
    14001400
    14011401    if (auto* posZOrderList = layer.posZOrderList()) {
    1402         ASSERT(layer.isStackingContainer());
     1402        ASSERT(layer.isStackingContext());
    14031403        for (auto* renderLayer : *posZOrderList)
    14041404            computeCompositingRequirements(&layer, *renderLayer, overlapMap, childState, layersChanged, anyDescendantHas3DTransform);
     
    15681568        UNUSED_PARAM(depth);
    15691569#endif
    1570         if (layerBacking->hasUnpositionedOverflowControlsLayers())
    1571             layer.positionNewlyCreatedOverflowControls();
    15721570    }
    15731571
     
    20532051        || requiresCompositingForFrame(renderer)
    20542052        || requiresCompositingForPlugin(renderer)
    2055 #if PLATFORM(IOS)
    2056         || requiresCompositingForScrolling(*renderer.layer())
    2057 #endif
    20582053        || requiresCompositingForOverflowScrolling(*renderer.layer());
    20592054}
     
    21162111        || requiresCompositingForPlugin(renderer)
    21172112        || requiresCompositingForOverflowScrolling(layer)
    2118 #if PLATFORM(IOS)
    2119         || requiresCompositingForScrolling(layer)
    2120 #endif
    21212113        || renderer.isTransparent()
    21222114        || renderer.hasMask()
     
    21792171    if (requiresCompositingForPosition(renderer, *renderer.layer()))
    21802172        reasons.add(renderer.isFixedPositioned() ? CompositingReason::PositionFixed : CompositingReason::PositionSticky);
    2181 
    2182 #if PLATFORM(IOS)
    2183     if (requiresCompositingForScrolling(*renderer.layer()))
    2184         reasons.add(CompositingReason::OverflowScrollingTouch);
    2185 #endif
    21862173
    21872174    if (requiresCompositingForOverflowScrolling(*renderer.layer()))
     
    24232410   
    24242411    // FIXME: workaround for webkit.org/b/132801
    2425     auto* stackingContext = renderer.layer()->stackingContainer();
     2412    auto* stackingContext = renderer.layer()->stackingContext();
    24262413    if (stackingContext && stackingContext->renderer().style().transformStyle3D() == TransformStyle3D::Preserve3D)
    24272414        return true;
     
    26642651
    26652652    // FIXME: Handle fixed inside of a transform, which should not behave as fixed.
    2666     for (auto* stackingContainer = layer.stackingContainer(); stackingContainer; stackingContainer = stackingContainer->stackingContainer()) {
    2667         if (stackingContainer->isComposited() && stackingContainer->renderer().isFixedPositioned())
     2653    for (auto* stackingContext = layer.stackingContext(); stackingContext; stackingContext = stackingContext->stackingContext()) {
     2654        if (stackingContext->isComposited() && stackingContext->renderer().isFixedPositioned())
    26682655            return false;
    26692656    }
     
    26952682    auto position = renderer.style().position();
    26962683    bool isFixed = renderer.isOutOfFlowPositioned() && position == PositionType::Fixed;
    2697     if (isFixed && !layer.isStackingContainer())
     2684    if (isFixed && !layer.isStackingContext())
    26982685        return false;
    26992686   
     
    27612748bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const RenderLayer& layer) const
    27622749{
    2763     return layer.needsCompositedScrolling();
    2764 }
    2765 
    27662750#if PLATFORM(IOS)
    2767 bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const
    2768 {
    27692751    if (!layer.hasAcceleratedTouchScrolling())
    27702752        return false;
     
    27762758
    27772759    return layer.hasTouchScrollableOverflow();
    2778 }
    2779 #endif
     2760#else
     2761    UNUSED_PARAM(layer);
     2762    return false;
     2763#endif
     2764}
    27802765
    27812766bool RenderLayerCompositor::isRunningTransformAnimation(RenderLayerModelObject& renderer) const
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r236149 r236424  
    433433    static bool styleChangeMayAffectIndirectCompositingReasons(const RenderLayerModelObject& renderer, const RenderStyle& oldStyle);
    434434
    435 #if PLATFORM(IOS)
    436     bool requiresCompositingForScrolling(const RenderLayer&) const;
    437 
    438435    void updateCustomLayersAfterFlush();
    439 #endif
    440436
    441437    void updateScrollCoordinationForThisFrame(ScrollingNodeID);
  • trunk/Source/WebKit/ChangeLog

    r236420 r236424  
     12018-09-21  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Remove the old "AcceleratedCompositingForOverflowScroll" code
     4        https://bugs.webkit.org/show_bug.cgi?id=189870
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
     9        composited scrolling if an overflow:scroll could be made a stacking context without affecting
     10        z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
     11        Remove this old code (unused by any platform?) to make working on new code easier.
     12
     13        * Shared/WebPreferences.yaml:
     14        * UIProcess/API/C/WKPreferences.cpp:
     15        (WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
     16        (WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
     17        * UIProcess/API/C/WKPreferencesRefPrivate.h:
     18
    1192018-09-24  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r236378 r236424  
    432432  defaultValue: false
    433433  webcoreName: showsURLsInToolTips
    434 
    435 AcceleratedCompositingForOverflowScrollEnabled:
    436   type: bool
    437   defaultValue: false
    438434
    439435HiddenPageDOMTimerThrottlingEnabled:
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp

    r235948 r236424  
    452452}
    453453
    454 void WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef preferencesRef, bool flag)
    455 {
    456     toImpl(preferencesRef)->setAcceleratedCompositingForOverflowScrollEnabled(flag);
    457 }
    458 
    459 bool WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef preferencesRef)
    460 {
    461     return toImpl(preferencesRef)->acceleratedCompositingForOverflowScrollEnabled();
    462 }
    463 
    464454void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag)
    465455{
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h

    r236010 r236424  
    8888
    8989// Defaults to false.
    90 WK_EXPORT void WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef, bool);
    91 WK_EXPORT bool WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef);
    92 
    93 // Defaults to false.
    9490WK_EXPORT void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef, bool);
    9591WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef);
Note: See TracChangeset for help on using the changeset viewer.