Changeset 236424 in webkit
- Timestamp:
- Sep 24, 2018, 1:19:46 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r236420 r236424 1 2018-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 1 38 2018-09-24 Chris Dumez <cdumez@apple.com> 2 39 -
trunk/LayoutTests/compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html
r190060 r236424 24 24 } 25 25 </style> 26 <script>27 if (window.internals)28 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);29 </script>30 26 </head> 31 27 -
trunk/LayoutTests/compositing/overflow/composited-scrolling-paint-phases.html
r190060 r236424 34 34 if (window.testRunner) 35 35 window.testRunner.dumpAsText(false); 36 37 if (window.internals)38 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);39 36 40 37 function write(str) -
trunk/LayoutTests/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html
r216211 r236424 12 12 if (window.testRunner) 13 13 window.testRunner.dumpAsText(true); 14 15 if (window.internals)16 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);17 14 18 15 function endTest() -
trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status.html
r190060 r236424 21 21 testRunner.dumpAsText(); 22 22 23 if (window.internals)24 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);25 26 23 function doTest() 27 24 { -
trunk/LayoutTests/compositing/overflow/iframe-inside-overflow-clipping.html
r190060 r236424 32 32 if (window.testRunner) 33 33 testRunner.dumpAsText(); 34 if (window.internals)35 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);36 34 </script> 37 35 </head> -
trunk/LayoutTests/compositing/overflow/nested-scrolling.html
r190060 r236424 31 31 } 32 32 </style> 33 <script>34 if (window.internals)35 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);36 </script>37 33 </head> 38 34 <body> -
trunk/LayoutTests/compositing/overflow/overflow-clip-with-accelerated-scrolling-ancestor.html
r190060 r236424 23 23 } 24 24 </style> 25 <script>26 if (window.internals)27 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);28 </script>29 25 </head> 30 26 -
trunk/LayoutTests/compositing/overflow/paint-neg-z-order-descendants-into-scrolling-contents-layer.html
r216211 r236424 27 27 if (window.testRunner) 28 28 window.testRunner.dumpAsText(true); 29 30 if (window.internals)31 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);32 29 33 30 function endTest() -
trunk/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport.html
r190060 r236424 30 30 if (window.testRunner) 31 31 testRunner.dumpAsText(); 32 if (window.internals)33 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);34 32 35 33 window.addEventListener('load', function() { -
trunk/LayoutTests/compositing/overflow/scrolling-without-painting.html
r190060 r236424 24 24 </style> 25 25 <script type="text/javascript"> 26 if (window.internals)27 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);28 29 26 window.addEventListener('load', function() { 30 27 if (!window.testRunner || !window.internals) { -
trunk/LayoutTests/compositing/overflow/textarea-scroll-touch.html
r190060 r236424 20 20 if (window.testRunner) 21 21 testRunner.dumpAsText(); 22 23 if (window.internals)24 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);25 22 26 23 function testScrollability(element) -
trunk/LayoutTests/compositing/overflow/updating-scrolling-content.html
r190060 r236424 28 28 </style> 29 29 <script type="text/javascript"> 30 if (window.internals)31 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);32 33 30 window.addEventListener('load', function() { 34 31 if (!window.testRunner || !window.internals) { -
trunk/LayoutTests/compositing/rtl/rtl-overflow-scrolling.html
r194514 r236424 3 3 <head> 4 4 <script type="text/javascript"> 5 if (window.internals)6 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);7 8 5 function runTest() { 9 6 document.getElementById("container").scrollLeft = -715; -
trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations
r234212 r236424 15 15 fast/sub-pixel/sub-pixel-composited-layers.html [ ImageOnlyFailure ] 16 16 17 webkit.org/b/152439 compositing/overflow/dynamic-composited-scrolling-status.html [ Failure ]17 webkit.org/b/152439 compositing/overflow/dynamic-composited-scrolling-status.html [ Pass Failure ] 18 18 19 19 webkit.org/b/173178 [ Release ] svg/animations/svglength-element-removed-crash.svg [ Skip ] -
trunk/LayoutTests/platform/ios-wk1/TestExpectations
r236392 r236424 569 569 compositing/layer-creation/no-compositing-for-sticky.html [ Failure ] 570 570 compositing/layer-creation/overflow-scroll-overlap.html [ Failure ] 571 compositing/overflow/automatically-opt-into-composited-scrolling.html [ Failure ]572 571 compositing/overflow/clipping-behaviour-change-is-not-propagated-to-descendants.html [ Failure ] 573 572 compositing/overflow/clipping-behaviour-change-is-not-propagated-to-descendants2.html [ Failure ] 574 compositing/overflow/composited-scrolling-creates-a-stacking-container.html [ Failure ]575 573 compositing/overflow/composited-scrolling-paint-phases.html [ Failure ] 576 574 compositing/overflow/content-gains-scrollbars.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r236423 r236424 1 2018-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 1 69 2018-09-24 Youenn Fablet <youenn@apple.com> 2 70 -
trunk/Source/WebCore/page/Settings.yaml
r236010 r236424 215 215 acceleratedCompositingForFixedPositionEnabled: 216 216 initial: defaultAcceleratedCompositingForFixedPositionEnabled 217 acceleratedCompositingForOverflowScrollEnabled:218 initial: false219 217 rubberBandingForSubScrollableRegionsEnabled: 220 218 initial: true -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r236356 r236424 277 277 , m_hasSelfPaintingLayerDescendant(false) 278 278 , m_hasSelfPaintingLayerDescendantDirty(false) 279 , m_hasOutOfFlowPositionedDescendant(false)280 , m_hasOutOfFlowPositionedDescendantDirty(true)281 , m_needsCompositedScrolling(false)282 , m_descendantsAreContiguousInStackingOrder(false)283 279 , m_usedTransparency(false) 284 280 , m_paintingInsideReflection(false) … … 325 321 // Non-stacking containers should have empty z-order lists. As this is already the case, 326 322 // there is no need to dirty / recompute these lists. 327 m_zOrderListsDirty = isStackingCont ainer();323 m_zOrderListsDirty = isStackingContext(); 328 324 329 325 if (!renderer().firstChild()) { … … 625 621 } 626 622 627 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const628 {629 return renderer().settings().acceleratedCompositingForOverflowScrollEnabled();630 }631 632 // If we are a stacking container, then this function will determine if our633 // descendants for a contiguous block in stacking order. This is required in634 // order for an element to be safely promoted to a stacking container. It is safe635 // to become a stacking container if this change would not alter the stacking636 // order of layers on the page. That can only happen if a non-descendant appear637 // between us and our descendants in stacking order. Here's an example:638 //639 // this640 // / | \.641 // A B C642 // /\ | /\.643 // 0 -8 D 2 7644 // |645 // 5646 //647 // I've labeled our normal flow descendants A, B, C, and D, our stacking648 // container descendants with their z indices, and us with 'this' (we're a649 // stacking container and our zIndex doesn't matter here). These nodes appear in650 // three lists: posZOrder, negZOrder, and normal flow (keep in mind that normal651 // flow layers don't overlap). So if we arrange these lists in order we get our652 // 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 4662 //663 // Note that the normal flow descendants can share an index because they don't664 // stack/overlap. Now our problem becomes very simple: a layer can safely become665 // a stacking container if the stacking-order indices of it and its descendants666 // appear in a contiguous block in the list of stacking indices. This problem667 // can be solved very efficiently by calculating the min/max stacking indices in668 // the subtree, and the number stacking container descendants. Once we have this669 // information, we know that the subtree's indices form a contiguous block if:670 //671 // maxStackIndex - minStackIndex == numSCDescendants672 //673 // So for node A in the example above we would have:674 // maxStackIndex = 1675 // minStackIndex = -1676 // numSCDecendants = 2677 //678 // and so,679 // maxStackIndex - minStackIndex == numSCDescendants680 // ===> 1 - (-1) == 2681 // ===> 2 == 2682 //683 // Since this is true, A can safely become a stacking container.684 // Now, for node C we have:685 //686 // maxStackIndex = 4687 // minStackIndex = 0 <-- because C has stacking index 0.688 // numSCDecendants = 2689 //690 // and so,691 // maxStackIndex - minStackIndex == numSCDescendants692 // ===> 4 - 0 == 2693 // ===> 4 == 2694 //695 // Since this is false, C cannot be safely promoted to a stacking container. This696 // happened because of the elements with z-index 5 and 0. Now if 5 had been a697 // child of C rather than D, and A had no child with Z index 0, we would have had:698 //699 // maxStackIndex = 3700 // minStackIndex = 0 <-- because C has stacking index 0.701 // numSCDecendants = 3702 //703 // and so,704 // maxStackIndex - minStackIndex == numSCDescendants705 // ===> 3 - 0 == 3706 // ===> 3 == 3707 //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 785 623 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* geometryMap) 786 624 { … … 893 731 } 894 732 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 908 733 #if ENABLE(CSS_COMPOSITING) 909 734 … … 1127 952 } 1128 953 1129 bool RenderLayer::canBeStackingContainer() const1130 {1131 if (isStackingContext() || !stackingContainer())1132 return true;1133 1134 return m_descendantsAreContiguousInStackingOrder;1135 }1136 1137 954 void RenderLayer::setHasVisibleContent() 1138 955 { … … 1149 966 // As we became visible, we need to dirty our stacking containers ancestors to be properly 1150 967 // collected. FIXME: When compositing, we could skip this dirtying phase. 1151 for (RenderLayer* sc = stackingCont ainer(); sc; sc = sc->stackingContainer()) {968 for (RenderLayer* sc = stackingContext(); sc; sc = sc->stackingContext()) { 1152 969 sc->dirtyZOrderLists(); 1153 970 if (sc->hasVisibleContent()) … … 1190 1007 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks) 1191 1008 { 1192 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty ||hasNotIsolatedBlendingDescendantsStatusDirty()) {1009 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || hasNotIsolatedBlendingDescendantsStatusDirty()) { 1193 1010 bool hasVisibleDescendant = false; 1194 1011 bool hasSelfPaintingLayerDescendant = false; 1195 bool hasOutOfFlowPositionedDescendant = false;1196 1012 #if ENABLE(CSS_COMPOSITING) 1197 1013 bool hasNotIsolatedBlendingDescendants = false; … … 1215 1031 hasVisibleDescendant |= child->m_hasVisibleContent || child->m_hasVisibleDescendant; 1216 1032 hasSelfPaintingLayerDescendant |= child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant(); 1217 hasOutOfFlowPositionedDescendant |= !childOutOfFlowDescendantContainingBlocks.isEmpty();1218 1033 #if ENABLE(CSS_COMPOSITING) 1219 1034 hasNotIsolatedBlendingDescendants |= child->hasBlendMode() || (child->hasNotIsolatedBlendingDescendants() && !child->isolatesBlending()); 1220 1035 #endif 1221 1036 1222 bool allFlagsSet = hasVisibleDescendant && hasSelfPaintingLayerDescendant && hasOutOfFlowPositionedDescendant;1037 bool allFlagsSet = hasVisibleDescendant && hasSelfPaintingLayerDescendant; 1223 1038 #if ENABLE(CSS_COMPOSITING) 1224 1039 allFlagsSet &= hasNotIsolatedBlendingDescendants; … … 1236 1051 m_hasSelfPaintingLayerDescendantDirty = false; 1237 1052 1238 m_hasOutOfFlowPositionedDescendant = hasOutOfFlowPositionedDescendant;1239 if (m_hasOutOfFlowPositionedDescendantDirty)1240 updateNeedsCompositedScrolling();1241 1242 m_hasOutOfFlowPositionedDescendantDirty = false;1243 1053 #if ENABLE(CSS_COMPOSITING) 1244 1054 m_hasNotIsolatedBlendingDescendants = hasNotIsolatedBlendingDescendants; … … 1284 1094 void RenderLayer::dirty3DTransformedDescendantStatus() 1285 1095 { 1286 RenderLayer* curr = stackingCont ainer();1096 RenderLayer* curr = stackingContext(); 1287 1097 if (curr) 1288 1098 curr->m_3DTransformedDescendantStatusDirty = true; … … 1292 1102 while (curr && curr->preserves3D()) { 1293 1103 curr->m_3DTransformedDescendantStatusDirty = true; 1294 curr = curr->stackingCont ainer();1104 curr = curr->stackingContext(); 1295 1105 } 1296 1106 } … … 1439 1249 } 1440 1250 1441 RenderLayer* RenderLayer::stackingCont ainer() const1251 RenderLayer* RenderLayer::stackingContext() const 1442 1252 { 1443 1253 RenderLayer* layer = parent(); 1444 while (layer && !layer->isStackingCont ainer())1254 while (layer && !layer->isStackingContext()) 1445 1255 layer = layer->parent(); 1446 1256 1447 ASSERT(!layer || layer->isStackingCont ainer());1257 ASSERT(!layer || layer->isStackingContext()); 1448 1258 return layer; 1449 1259 } … … 1533 1343 static inline const RenderLayer* compositingContainer(const RenderLayer& layer) 1534 1344 { 1535 return layer.isNormalFlowOnly() ? layer.parent() : layer.stackingCont ainer();1345 return layer.isNormalFlowOnly() ? layer.parent() : layer.stackingContext(); 1536 1346 } 1537 1347 … … 1864 1674 1865 1675 if (!child->isNormalFlowOnly() || child->firstChild()) { 1866 // Dirty the z-order list in which we are contained. The stackingCont ainer() can be null in the1676 // Dirty the z-order list in which we are contained. The stackingContext() can be null in the 1867 1677 // case where we're building up generated content layers. This is ok, since the lists will start 1868 1678 // off dirty in that case anyway. 1869 child->dirtyStackingCont ainerZOrderLists();1679 child->dirtyStackingContextZOrderLists(); 1870 1680 } 1871 1681 … … 1876 1686 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) 1877 1687 setAncestorChainHasSelfPaintingLayerDescendant(); 1878 1879 if (child->renderer().isOutOfFlowPositioned() || child->hasOutOfFlowPositionedDescendant())1880 setAncestorChainHasOutOfFlowPositionedDescendant(child->renderer().containingBlock());1881 1688 1882 1689 #if ENABLE(CSS_COMPOSITING) … … 1909 1716 // Dirty the z-order list in which we are contained. When called via the 1910 1717 // 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 } 1917 1721 1918 1722 oldChild->setPreviousSibling(nullptr); … … 2151 1955 if (!scrollsOverflow()) 2152 1956 return false; 1957 2153 1958 return renderer().style().useTouchOverflowScrolling() || renderer().settings().alwaysUseAcceleratedOverflowScroll(); 2154 1959 #else … … 2179 1984 return hasTouchScrollableOverflow(); 2180 1985 #else 2181 return needsCompositedScrolling();1986 return false; 2182 1987 #endif 2183 1988 } … … 2213 2018 } 2214 2019 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) { 2020 static inline int adjustedScrollDelta(int beginningDelta) 2021 { 2255 2022 // This implemention matches Firefox's. 2256 2023 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#856. … … 2598 2365 // Our stacking container is guaranteed to contain all of our descendants that may need 2599 2366 // repositioning, so update compositing layers from there. 2600 if (RenderLayer* compositingAncestor = stackingCont ainer()->enclosingCompositingLayer()) {2601 if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescendant())2367 if (RenderLayer* compositingAncestor = stackingContext()->enclosingCompositingLayer()) { 2368 if (usesCompositedScrolling()) 2602 2369 compositor().updateCompositingLayers(CompositingUpdateType::OnCompositedScroll, compositingAncestor); 2603 2370 else … … 3550 3317 } 3551 3318 3319 // This is called from layout code (before updateLayerPositions). 3552 3320 void RenderLayer::updateScrollInfoAfterLayout() 3553 3321 { … … 3591 3359 3592 3360 // 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. 3593 3362 if (compositor().updateLayerCompositingState(*this)) 3594 3363 compositor().setCompositingLayersNeedRebuild(); … … 4920 4689 RenderLayer* curr = parent(); 4921 4690 for (; curr && !curr->isRenderFragmentedFlow(); curr = curr->parent()) { 4922 if (curr->isStackingCont ainer() && curr->isComposited()) {4691 if (curr->isStackingContext() && curr->isComposited()) { 4923 4692 // We only adjust the position of the first level of layers. 4924 4693 return nullptr; … … 5861 5630 } 5862 5631 5863 ASSERT(isStackingCont ainer() || (!posZOrderList() || !posZOrderList()->size()));5632 ASSERT(isStackingContext() || (!posZOrderList() || !posZOrderList()->size())); 5864 5633 5865 5634 #if !ASSERT_DISABLED … … 6100 5869 { 6101 5870 ASSERT(m_layerListMutationAllowed); 6102 ASSERT(isStackingCont ainer());5871 ASSERT(isStackingContext()); 6103 5872 6104 5873 if (m_posZOrderList) … … 6108 5877 m_zOrderListsDirty = true; 6109 5878 6110 if (!renderer().renderTreeBeingDestroyed()) {5879 if (!renderer().renderTreeBeingDestroyed()) 6111 5880 compositor().setCompositingLayersNeedRebuild(); 6112 if (acceleratedCompositingForOverflowScrollEnabled()) 6113 compositor().setShouldReevaluateCompositingAfterLayout(); 6114 } 6115 } 6116 6117 void RenderLayer::dirtyStackingContainerZOrderLists() 6118 { 6119 RenderLayer* sc = stackingContainer(); 5881 } 5882 5883 void RenderLayer::dirtyStackingContextZOrderLists() 5884 { 5885 RenderLayer* sc = stackingContext(); 6120 5886 if (sc) 6121 5887 sc->dirtyZOrderLists(); … … 6130 5896 m_normalFlowListDirty = true; 6131 5897 6132 if (!renderer().renderTreeBeingDestroyed()) {5898 if (!renderer().renderTreeBeingDestroyed()) 6133 5899 compositor().setCompositingLayersNeedRebuild(); 6134 if (acceleratedCompositingForOverflowScrollEnabled())6135 compositor().setShouldReevaluateCompositingAfterLayout();6136 }6137 5900 } 6138 5901 … … 6140 5903 { 6141 5904 ASSERT(m_layerListMutationAllowed); 6142 ASSERT(isDirtyStackingCont ainer());6143 rebuildZOrderLists( StopAtStackingContainers,m_posZOrderList, m_negZOrderList);5905 ASSERT(isDirtyStackingContext()); 5906 rebuildZOrderLists(m_posZOrderList, m_negZOrderList); 6144 5907 m_zOrderListsDirty = false; 6145 5908 } 6146 5909 6147 void RenderLayer::rebuildZOrderLists( CollectLayersBehavior behavior,std::unique_ptr<Vector<RenderLayer*>>& posZOrderList, std::unique_ptr<Vector<RenderLayer*>>& negZOrderList)5910 void RenderLayer::rebuildZOrderLists(std::unique_ptr<Vector<RenderLayer*>>& posZOrderList, std::unique_ptr<Vector<RenderLayer*>>& negZOrderList) 6148 5911 { 6149 5912 bool includeHiddenLayers = compositor().inCompositingMode(); 6150 5913 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 6151 5914 if (!m_reflection || reflectionLayer() != child) 6152 child->collectLayers(includeHiddenLayers, behavior,posZOrderList, negZOrderList);5915 child->collectLayers(includeHiddenLayers, posZOrderList, negZOrderList); 6153 5916 6154 5917 // Sort the two lists. … … 6179 5942 } 6180 5943 6181 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior,std::unique_ptr<Vector<RenderLayer*>>& posBuffer, std::unique_ptr<Vector<RenderLayer*>>& negBuffer)5944 void RenderLayer::collectLayers(bool includeHiddenLayers, std::unique_ptr<Vector<RenderLayer*>>& posBuffer, std::unique_ptr<Vector<RenderLayer*>>& negBuffer) 6182 5945 { 6183 5946 updateDescendantDependentFlags(); 6184 5947 6185 bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer();5948 bool isStacking = isStackingContext(); 6186 5949 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. 6187 5950 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_hasVisibleDescendant && isStacking)); … … 6204 5967 // Ignore reflections. 6205 5968 if (!m_reflection || reflectionLayer() != child) 6206 child->collectLayers(includeHiddenLayers, behavior,posBuffer, negBuffer);5969 child->collectLayers(includeHiddenLayers, posBuffer, negBuffer); 6207 5970 } 6208 5971 } … … 6211 5974 void RenderLayer::updateLayerListsIfNeeded() 6212 5975 { 6213 bool shouldUpdateDescendantsAreContiguousInStackingOrder = (m_zOrderListsDirty || m_normalFlowListDirty) && isStackingContext();6214 5976 updateZOrderLists(); 6215 5977 updateNormalFlowList(); … … 6218 5980 reflectionLayer->updateZOrderLists(); 6219 5981 reflectionLayer->updateNormalFlowList(); 6220 }6221 6222 if (shouldUpdateDescendantsAreContiguousInStackingOrder) {6223 updateDescendantsAreContiguousInStackingOrder();6224 // The above function can cause us to update m_needsCompositedScrolling6225 // and dirty our layer lists. Refresh them if necessary.6226 updateZOrderLists();6227 updateNormalFlowList();6228 5982 } 6229 5983 } … … 6258 6012 { 6259 6013 if (compositor().inCompositingMode()) { 6260 if (isDirtyStackingCont ainer() || m_normalFlowListDirty)6014 if (isDirtyStackingContext() || m_normalFlowListDirty) 6261 6015 compositor().updateCompositingLayers(CompositingUpdateType::OnHitTest, this); 6262 6016 return; … … 6326 6080 || renderer.hasReflection() 6327 6081 || renderer.style().hasIsolation() 6328 || layer.needsCompositedScrolling()6329 6082 #if PLATFORM(IOS) 6330 6083 || layer.hasAcceleratedTouchScrolling() … … 6353 6106 6354 6107 return hasOverlayScrollbars() 6355 || needsCompositedScrolling()6356 6108 || renderer().isTableRow() 6357 6109 || renderer().isCanvas() … … 6511 6263 bool isStackingContext = this->isStackingContext(); 6512 6264 if (isStackingContext != wasStackingContext) { 6513 dirtyStackingCont ainerZOrderLists();6265 dirtyStackingContextZOrderLists(); 6514 6266 if (isStackingContext) 6515 6267 dirtyZOrderLists(); … … 6537 6289 // likely be folded along with the rest. 6538 6290 if (oldStyle->zIndex() != renderer().style().zIndex() || oldStyle->visibility() != renderer().style().visibility()) { 6539 dirtyStackingCont ainerZOrderLists();6291 dirtyStackingContextZOrderLists(); 6540 6292 if (isStackingContext) 6541 6293 dirtyZOrderLists(); … … 6573 6325 if (!m_scrollDimensionsDirty) 6574 6326 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 }6607 6327 } 6608 6328 … … 6615 6335 if (p) 6616 6336 p->dirtyNormalFlowList(); 6617 dirtyStackingCont ainerZOrderLists();6337 dirtyStackingContextZOrderLists(); 6618 6338 } 6619 6339 … … 6632 6352 // to recompute the bit once scrollbars have been updated. 6633 6353 updateSelfPaintingLayer(); 6634 updateOutOfFlowPositioned(oldStyle);6635 6354 6636 6355 if (!hasReflection() && m_reflection) … … 6658 6377 #endif 6659 6378 updateFiltersAfterStyleChange(); 6660 6661 updateNeedsCompositedScrolling(); 6662 6379 6663 6380 compositor().layerStyleChanged(diff, *this, oldStyle); 6664 6381 … … 6695 6412 m_registeredScrollableArea = false; 6696 6413 } 6697 6698 if (addedOrRemoved)6699 updateNeedsCompositedScrolling();6700 6414 6701 6415 #if ENABLE(IOS_TOUCH_EVENTS) -
trunk/Source/WebCore/rendering/RenderLayer.h
r235749 r236424 324 324 void updateLayerPositionsAfterDocumentScroll(); 325 325 326 void positionNewlyCreatedOverflowControls();327 328 326 bool hasCompositedLayerInEnclosingPaginationChain() const; 329 327 enum PaginationInclusionMode { ExcludeCompositedPaginatedLayers, IncludeCompositedPaginatedLayers }; … … 353 351 bool isStackingContext() const { return isStackingContext(&renderer().style()); } 354 352 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; 364 355 365 356 // Gets the enclosing stacking container for this layer, possibly the layer 366 357 // itself, if it is a stacking container. 367 RenderLayer* enclosingStackingCont ainer() { return isStackingContainer() ? this : stackingContainer(); }358 RenderLayer* enclosingStackingContext() { return isStackingContext() ? this : stackingContext(); } 368 359 369 360 void dirtyZOrderLists(); 370 void dirtyStackingCont ainerZOrderLists();361 void dirtyStackingContextZOrderLists(); 371 362 372 363 Vector<RenderLayer*>* posZOrderList() const 373 364 { 374 365 ASSERT(!m_zOrderListsDirty); 375 ASSERT(isStackingCont ainer() || !m_posZOrderList);366 ASSERT(isStackingContext() || !m_posZOrderList); 376 367 return m_posZOrderList.get(); 377 368 } … … 382 373 { 383 374 ASSERT(!m_zOrderListsDirty); 384 ASSERT(isStackingCont ainer() || !m_negZOrderList);375 ASSERT(isStackingContext() || !m_negZOrderList); 385 376 return m_negZOrderList.get(); 386 377 } … … 439 430 // Part of the issue is with subtree relayout: we don't check if our ancestors have some descendant flags dirty, missing some updates. 440 431 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerDescendant; } 441 442 // This returns true if we have an out of flow positioned descendant whose443 // containing block is not a descendant of ours. If this is true, we cannot444 // automatically opt into composited scrolling since this out of flow445 // positioned descendant would become clipped by us, possibly altering the446 // 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; }449 432 450 433 // Gets the nearest enclosing positioned ancestor layer (also includes … … 656 639 bool hasCompositingDescendant() const { return m_hasCompositingDescendant; } 657 640 bool hasCompositedMask() const; 641 658 642 RenderLayerBacking* backing() const { return m_backing.get(); } 659 643 RenderLayerBacking* ensureBacking(); 660 644 void clearBacking(bool layerBeingDestroyed = false); 645 661 646 GraphicsLayer* layerForScrolling() const override; 662 647 GraphicsLayer* layerForHorizontalScrollbar() const override; 663 648 GraphicsLayer* layerForVerticalScrollbar() const override; 664 649 GraphicsLayer* layerForScrollCorner() const override; 650 665 651 bool usesCompositedScrolling() const override; 666 652 bool usesAsyncScrolling() const override; 667 WEBCORE_EXPORT bool needsCompositedScrolling() const;668 653 669 654 bool paintsWithTransparency(OptionSet<PaintBehavior> paintBehavior) const … … 722 707 723 708 private: 724 enum CollectLayersBehavior { StopAtStackingContexts, StopAtStackingContainers };725 726 709 struct LayerPaintingInfo { 727 710 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, OptionSet<PaintBehavior> inPaintBehavior, const LayoutSize& inSubpixelOffset, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr, bool inRequireSecurityOriginAccessForWidgets = false) … … 754 737 void updateZOrderLists(); 755 738 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*>>&); 757 740 void clearZOrderLists(); 758 741 … … 763 746 bool isStackingContext(const RenderStyle* style) const { return !style->hasAutoZIndex() || isRenderViewLayer() || m_forcedStackingContext; } 764 747 765 bool isDirtyStackingCont ainer() const { return m_zOrderListsDirty && isStackingContainer(); }748 bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); } 766 749 767 750 void setAncestorChainHasSelfPaintingLayerDescendant(); 768 751 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);773 752 774 753 void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = nullptr); … … 788 767 void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); 789 768 void updateScrollbarsAfterLayout(); 790 791 void setAncestorChainHasOutOfFlowPositionedDescendant(RenderBlock* containingBlock);792 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();793 void updateOutOfFlowPositioned(const RenderStyle* oldStyle);794 795 void updateNeedsCompositedScrolling();796 769 797 770 // Returns true if the position changed. … … 820 793 LayoutPoint renderBoxLocation() const { return is<RenderBox>(renderer()) ? downcast<RenderBox>(renderer()).location() : LayoutPoint(); } 821 794 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*>>&); 823 796 824 797 void updateCompositingAndLayerListsIfNeeded(); … … 1007 980 bool mustCompositeForIndirectReasons() const { return m_indirectCompositingReason; } 1008 981 1009 // Returns true if z ordering would not change if this layer were a stacking container.1010 bool canBeStackingContainer() const;1011 1012 982 friend class RenderLayerBacking; 1013 983 friend class RenderLayerCompositor; … … 1046 1016 bool m_hasSelfPaintingLayerDescendant : 1; 1047 1017 bool m_hasSelfPaintingLayerDescendantDirty : 1; 1048 1049 // If we have no out of flow positioned descendants and no non-descendant1050 // appears between our descendants in stacking order, then we may become a1051 // 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 our1058 // descendants in stacking order. This is one of the requirements of being1059 // able to safely become a stacking context.1060 bool m_descendantsAreContiguousInStackingOrder : 1;1061 1018 1062 1019 bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether … … 1177 1134 inline void RenderLayer::clearZOrderLists() 1178 1135 { 1179 ASSERT(!isStackingCont ainer());1136 ASSERT(!isStackingContext()); 1180 1137 ASSERT(m_layerListMutationAllowed); 1181 1138 … … 1189 1146 return; 1190 1147 1191 if (!isStackingCont ainer()) {1148 if (!isStackingContext()) { 1192 1149 clearZOrderLists(); 1193 1150 m_zOrderListsDirty = false; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r236016 r236424 659 659 updateAfterDescendants(); 660 660 compositor().updateRootLayerPosition(); 661 auto* stackingCont ainer = m_owningLayer.enclosingStackingContainer();662 if (!compositor().compositingLayersNeedRebuild() && stackingCont ainer && (stackingContainer!= &m_owningLayer))663 compositor().updateCompositingDescendantGeometry(*stackingCont ainer, *stackingContainer);661 auto* stackingContext = m_owningLayer.enclosingStackingContext(); 662 if (!compositor().compositingLayersNeedRebuild() && stackingContext && (stackingContext != &m_owningLayer)) 663 compositor().updateCompositingDescendantGeometry(*stackingContext, *stackingContext); 664 664 } 665 665 } … … 923 923 ScrollOffset scrollOffset = compositedAncestor->scrollOffset(); 924 924 parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), paddingBox.size()); 925 }926 #else927 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());931 925 } 932 926 #endif … … 952 946 { 953 947 // If we haven't built z-order lists yet, wait until later. 954 if (m_owningLayer.isStackingCont ainer() && m_owningLayer.m_zOrderListsDirty)948 if (m_owningLayer.isStackingContext() && m_owningLayer.m_zOrderListsDirty) 955 949 return; 956 950 … … 1453 1447 bool RenderLayerBacking::requiresHorizontalScrollbarLayer() const 1454 1448 { 1455 if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())1449 if (!m_owningLayer.hasOverlayScrollbars()) 1456 1450 return false; 1457 1451 return m_owningLayer.horizontalScrollbar(); … … 1460 1454 bool RenderLayerBacking::requiresVerticalScrollbarLayer() const 1461 1455 { 1462 if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())1456 if (!m_owningLayer.hasOverlayScrollbars()) 1463 1457 return false; 1464 1458 return m_owningLayer.verticalScrollbar(); … … 1467 1461 bool RenderLayerBacking::requiresScrollCornerLayer() const 1468 1462 { 1469 if (!m_owningLayer.hasOverlayScrollbars() && !m_owningLayer.needsCompositedScrolling())1463 if (!m_owningLayer.hasOverlayScrollbars()) 1470 1464 return false; 1471 1465 return !m_owningLayer.scrollCornerAndResizerRect().isEmpty(); … … 1561 1555 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); 1562 1556 } 1563 }1564 1565 bool RenderLayerBacking::hasUnpositionedOverflowControlsLayers() const1566 {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;1583 1557 } 1584 1558 … … 1814 1788 // We only care about parents that are stacking contexts. 1815 1789 // Recall that opacity creates stacking context. 1816 if (!curr->isStackingCont ainer())1790 if (!curr->isStackingContext()) 1817 1791 continue; 1818 1792 … … 2123 2097 } 2124 2098 2125 if (parent.isStackingCont ainer() && !parent.hasVisibleDescendant())2099 if (parent.isStackingContext() && !parent.hasVisibleDescendant()) 2126 2100 return LayerTraversal::Continue; 2127 2101 -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r236016 r236424 183 183 void updateAfterWidgetResize(); 184 184 void positionOverflowControlsLayers(); 185 bool hasUnpositionedOverflowControlsLayers() const; 186 185 187 186 bool isFrameLayerWithTiledBacking() const { return m_isFrameLayerWithTiledBacking; } 188 187 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r236341 r236424 522 522 void RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush() 523 523 { 524 #if PLATFORM(IOS)525 524 updateCustomLayersAfterFlush(); 526 #endif527 525 528 526 HashSet<RenderLayer*> layersNeedingUpdate; … … 554 552 layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar); 555 553 } 554 #endif 556 555 557 556 void RenderLayerCompositor::updateCustomLayersAfterFlush() 558 557 { 558 #if PLATFORM(IOS) 559 559 registerAllViewportConstrainedLayers(); 560 560 … … 565 565 } 566 566 m_scrollingLayersNeedingUpdate.clear(); 567 } 568 #endif 567 #endif 568 } 569 569 570 570 void RenderLayerCompositor::didFlushChangesForLayer(RenderLayer& layer, const GraphicsLayer* graphicsLayer) … … 929 929 930 930 // 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.stackingCont ainer()->hasCompositingDescendant())931 if (!layer.isComposited() && (oldStyle.overflowX() != newStyle.overflowX() || oldStyle.overflowY() != newStyle.overflowY()) && layer.stackingContext()->hasCompositingDescendant()) 932 932 return true; 933 933 … … 1198 1198 { 1199 1199 for (auto* parent = layer.parent(); parent; parent = parent->parent()) { 1200 if (parent->isStackingCont ainer())1200 if (parent->isStackingContext()) 1201 1201 return nullptr; 1202 1202 if (parent->renderer().hasClipOrOverflowClip()) … … 1400 1400 1401 1401 if (auto* posZOrderList = layer.posZOrderList()) { 1402 ASSERT(layer.isStackingCont ainer());1402 ASSERT(layer.isStackingContext()); 1403 1403 for (auto* renderLayer : *posZOrderList) 1404 1404 computeCompositingRequirements(&layer, *renderLayer, overlapMap, childState, layersChanged, anyDescendantHas3DTransform); … … 1568 1568 UNUSED_PARAM(depth); 1569 1569 #endif 1570 if (layerBacking->hasUnpositionedOverflowControlsLayers())1571 layer.positionNewlyCreatedOverflowControls();1572 1570 } 1573 1571 … … 2053 2051 || requiresCompositingForFrame(renderer) 2054 2052 || requiresCompositingForPlugin(renderer) 2055 #if PLATFORM(IOS)2056 || requiresCompositingForScrolling(*renderer.layer())2057 #endif2058 2053 || requiresCompositingForOverflowScrolling(*renderer.layer()); 2059 2054 } … … 2116 2111 || requiresCompositingForPlugin(renderer) 2117 2112 || requiresCompositingForOverflowScrolling(layer) 2118 #if PLATFORM(IOS)2119 || requiresCompositingForScrolling(layer)2120 #endif2121 2113 || renderer.isTransparent() 2122 2114 || renderer.hasMask() … … 2179 2171 if (requiresCompositingForPosition(renderer, *renderer.layer())) 2180 2172 reasons.add(renderer.isFixedPositioned() ? CompositingReason::PositionFixed : CompositingReason::PositionSticky); 2181 2182 #if PLATFORM(IOS)2183 if (requiresCompositingForScrolling(*renderer.layer()))2184 reasons.add(CompositingReason::OverflowScrollingTouch);2185 #endif2186 2173 2187 2174 if (requiresCompositingForOverflowScrolling(*renderer.layer())) … … 2423 2410 2424 2411 // FIXME: workaround for webkit.org/b/132801 2425 auto* stackingContext = renderer.layer()->stackingCont ainer();2412 auto* stackingContext = renderer.layer()->stackingContext(); 2426 2413 if (stackingContext && stackingContext->renderer().style().transformStyle3D() == TransformStyle3D::Preserve3D) 2427 2414 return true; … … 2664 2651 2665 2652 // FIXME: Handle fixed inside of a transform, which should not behave as fixed. 2666 for (auto* stackingCont ainer = layer.stackingContainer(); stackingContainer; stackingContainer = stackingContainer->stackingContainer()) {2667 if (stackingCont ainer->isComposited() && stackingContainer->renderer().isFixedPositioned())2653 for (auto* stackingContext = layer.stackingContext(); stackingContext; stackingContext = stackingContext->stackingContext()) { 2654 if (stackingContext->isComposited() && stackingContext->renderer().isFixedPositioned()) 2668 2655 return false; 2669 2656 } … … 2695 2682 auto position = renderer.style().position(); 2696 2683 bool isFixed = renderer.isOutOfFlowPositioned() && position == PositionType::Fixed; 2697 if (isFixed && !layer.isStackingCont ainer())2684 if (isFixed && !layer.isStackingContext()) 2698 2685 return false; 2699 2686 … … 2761 2748 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const RenderLayer& layer) const 2762 2749 { 2763 return layer.needsCompositedScrolling();2764 }2765 2766 2750 #if PLATFORM(IOS) 2767 bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const2768 {2769 2751 if (!layer.hasAcceleratedTouchScrolling()) 2770 2752 return false; … … 2776 2758 2777 2759 return layer.hasTouchScrollableOverflow(); 2778 } 2779 #endif 2760 #else 2761 UNUSED_PARAM(layer); 2762 return false; 2763 #endif 2764 } 2780 2765 2781 2766 bool RenderLayerCompositor::isRunningTransformAnimation(RenderLayerModelObject& renderer) const -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r236149 r236424 433 433 static bool styleChangeMayAffectIndirectCompositingReasons(const RenderLayerModelObject& renderer, const RenderStyle& oldStyle); 434 434 435 #if PLATFORM(IOS)436 bool requiresCompositingForScrolling(const RenderLayer&) const;437 438 435 void updateCustomLayersAfterFlush(); 439 #endif440 436 441 437 void updateScrollCoordinationForThisFrame(ScrollingNodeID); -
trunk/Source/WebKit/ChangeLog
r236420 r236424 1 2018-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 1 19 2018-09-24 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r236378 r236424 432 432 defaultValue: false 433 433 webcoreName: showsURLsInToolTips 434 435 AcceleratedCompositingForOverflowScrollEnabled:436 type: bool437 defaultValue: false438 434 439 435 HiddenPageDOMTimerThrottlingEnabled: -
trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
r235948 r236424 452 452 } 453 453 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 464 454 void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag) 465 455 { -
trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
r236010 r236424 88 88 89 89 // Defaults to false. 90 WK_EXPORT void WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef, bool);91 WK_EXPORT bool WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef);92 93 // Defaults to false.94 90 WK_EXPORT void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef, bool); 95 91 WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef);
Note:
See TracChangeset
for help on using the changeset viewer.