Diff
Modified: trunk/LayoutTests/ChangeLog (243208 => 243209)
--- trunk/LayoutTests/ChangeLog 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/LayoutTests/ChangeLog 2019-03-20 16:32:32 UTC (rev 243209)
@@ -1,3 +1,13 @@
+2019-03-20 Simon Fraser <[email protected]>
+
+ Explicitly trigger compositing for layers that need to be moved by ScrollingTreePositionedNodes
+ https://bugs.webkit.org/show_bug.cgi?id=195710
+
+ Reviewed by Zalan Bujtas.
+
+ * compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt: Added.
+ * compositing/layer-creation/absolute-in-async-overflow-scroll.html: Added.
+
2019-03-20 Devin Rousso <[email protected]>
Web Inspector: Search: allow DOM searches to be case sensitive
Added: trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt (0 => 243209)
--- trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt 2019-03-20 16:32:32 UTC (rev 243209)
@@ -0,0 +1,43 @@
+This layer should be composited.
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 18.00 10.00)
+ (bounds 202.00 202.00)
+ (opacity 0.80)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=1 height=1)
+ (position 1.00 1.00)
+ (bounds 200.00 200.00)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=1 height=1)
+ (anchor 0.00 0.00)
+ (bounds 200.00 840.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 0.00 89.00)
+ (bounds 320.00 40.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll.html (0 => 243209)
--- trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/absolute-in-async-overflow-scroll.html 2019-03-20 16:32:32 UTC (rev 243209)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <title></title>
+ <style>
+ .scroller {
+ margin: 10px;
+ overflow: scroll;
+ width: 200px;
+ height: 200px;
+ border: 1px solid black;
+ opacity: 0.8;
+ }
+
+ .absolute {
+ position: absolute;
+ top: 100px;
+ width: 300px;
+ height: 20px;
+ background-color: green;
+ padding: 10px;
+ }
+
+ .spacer {
+ height: 800px;
+ }
+
+ </style>
+ <script>
+ if (window.internals)
+ window.internals.settings.setAsyncOverflowScrollingEnabled(true);
+
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ window.addEventListener("load", () => {
+ if (window.internals)
+ document.getElementById("layers").innerText = window.internals.layerTreeAsText(document);
+ }, false);
+ </script>
+<body>
+ <div class='scroller'>
+ <div class="spacer">
+ <div class='absolute'>This layer should be composited.</div>
+ </div>
+<pre id="layers">Layer tree goes here</pre>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt (243208 => 243209)
--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt 2019-03-20 16:32:32 UTC (rev 243209)
@@ -81,6 +81,14 @@
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0)
(has enabled vertical scrollbar 1))
+ (children 1
+ (Positioned node
+ (layout constraints
+ (layer-position-at-last-layout (81,30))
+ (positioning-behavior stationary))
+ (related overflow nodes 1)
+ )
+ )
)
)
)
Modified: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt (243208 => 243209)
--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt 2019-03-20 16:32:32 UTC (rev 243209)
@@ -82,6 +82,14 @@
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0)
(has enabled vertical scrollbar 1))
+ (children 1
+ (Positioned node
+ (layout constraints
+ (layer-position-at-last-layout (81,28))
+ (positioning-behavior stationary))
+ (related overflow nodes 1)
+ )
+ )
)
)
)
Modified: trunk/Source/WebCore/ChangeLog (243208 => 243209)
--- trunk/Source/WebCore/ChangeLog 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/Source/WebCore/ChangeLog 2019-03-20 16:32:32 UTC (rev 243209)
@@ -1,3 +1,32 @@
+2019-03-20 Simon Fraser <[email protected]>
+
+ Explicitly trigger compositing for layers that need to be moved by ScrollingTreePositionedNodes
+ https://bugs.webkit.org/show_bug.cgi?id=195710
+ <rdar://problem/48867502>
+
+ Reviewed by Zalan Bujtas.
+
+ A position:absolute layer whose containing block is outside an enclosing overflow:scroll, but
+ whose compositing ancestor is the overflow or is inside it, needs to be composited so that
+ we can make a Positioning scrolling tree node for it.
+
+ Handle this case as a "OverflowScrollPositioning" indirect compositing reason.
+
+ Test: compositing/layer-creation/absolute-in-async-overflow-scroll.html
+
+ * inspector/agents/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+ (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
+ (WebCore::RenderLayerCompositor::reasonsForCompositing const):
+ (WebCore::RenderLayerCompositor::logReasonsForCompositing):
+ (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
+ (WebCore::RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary):
+ (WebCore::layerContainingBlockCrossesCoordinatedScrollingBoundary): Deleted.
+ * rendering/RenderLayerCompositor.h: Generalize OverflowScrollingTouch to OverflowScrolling.
+
2019-03-20 Devin Rousso <[email protected]>
Web Inspector: Search: allow DOM searches to be case sensitive
Modified: trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp (243208 => 243209)
--- trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp 2019-03-20 16:32:32 UTC (rev 243209)
@@ -276,9 +276,11 @@
if (reasons.contains(CompositingReason::PositionSticky))
compositingReasons->setPositionSticky(true);
- if (reasons.contains(CompositingReason::OverflowScrollingTouch))
+ if (reasons.contains(CompositingReason::OverflowScrolling))
compositingReasons->setOverflowScrollingTouch(true);
+ // FIXME: handle OverflowScrollPositioning (webkit.org/b/195985).
+
if (reasons.contains(CompositingReason::Stacking))
compositingReasons->setStacking(true);
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (243208 => 243209)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2019-03-20 16:32:32 UTC (rev 243209)
@@ -1123,6 +1123,7 @@
enum class IndirectCompositingReason {
None,
Stacking,
+ OverflowScrollPositioning,
Overlap,
BackgroundLayer,
GraphicalEffect, // opacity, mask, filter, transform etc.
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (243208 => 243209)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-03-20 16:32:32 UTC (rev 243209)
@@ -955,7 +955,7 @@
// Now check for reasons to become composited that depend on the state of descendant layers.
RenderLayer::IndirectCompositingReason indirectCompositingReason;
if (!willBeComposited && canBeComposited(layer)
- && requiresCompositingForIndirectReason(layer.renderer(), childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
+ && requiresCompositingForIndirectReason(layer.renderer(), compositingState.compositingAncestor, childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
layer.setIndirectCompositingReason(indirectCompositingReason);
childState.compositingAncestor = &layer;
overlapMap.pushCompositingContainer();
@@ -2228,6 +2228,7 @@
if (layer.mustCompositeForIndirectReasons()) {
RenderLayer::IndirectCompositingReason reason = layer.indirectCompositingReason();
return reason == RenderLayer::IndirectCompositingReason::Overlap
+ || reason == RenderLayer::IndirectCompositingReason::OverflowScrollPositioning
|| reason == RenderLayer::IndirectCompositingReason::Stacking
|| reason == RenderLayer::IndirectCompositingReason::BackgroundLayer
|| reason == RenderLayer::IndirectCompositingReason::GraphicalEffect
@@ -2284,7 +2285,7 @@
reasons.add(renderer.isFixedPositioned() ? CompositingReason::PositionFixed : CompositingReason::PositionSticky);
if (requiresCompositingForOverflowScrolling(*renderer.layer(), queryData))
- reasons.add(CompositingReason::OverflowScrollingTouch);
+ reasons.add(CompositingReason::OverflowScrolling);
switch (renderer.layer()->indirectCompositingReason()) {
case RenderLayer::IndirectCompositingReason::None:
@@ -2292,6 +2293,9 @@
case RenderLayer::IndirectCompositingReason::Stacking:
reasons.add(CompositingReason::Stacking);
break;
+ case RenderLayer::IndirectCompositingReason::OverflowScrollPositioning:
+ reasons.add(CompositingReason::OverflowScrollPositioning);
+ break;
case RenderLayer::IndirectCompositingReason::Overlap:
reasons.add(CompositingReason::Overlap);
break;
@@ -2374,8 +2378,8 @@
if (reasons & CompositingReason::PositionSticky)
return "position: sticky";
- if (reasons & CompositingReason::OverflowScrollingTouch)
- return "-webkit-overflow-scrolling: touch";
+ if (reasons & CompositingReason::OverflowScrolling)
+ return "async overflow scrolling";
if (reasons & CompositingReason::Stacking)
return "stacking";
@@ -2766,9 +2770,9 @@
}
// FIXME: why doesn't this handle the clipping cases?
-bool RenderLayerCompositor::requiresCompositingForIndirectReason(RenderLayerModelObject& renderer, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason& reason) const
+bool RenderLayerCompositor::requiresCompositingForIndirectReason(RenderLayerModelObject& renderer, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason& reason) const
{
- auto& layer = *downcast<RenderBoxModelObject>(renderer).layer();
+ auto& layer = *renderer.layer();
// When a layer has composited descendants, some effects, like 2d transforms, filters, masks etc must be implemented
// via compositing so that they also apply to those composited descendants.
@@ -2791,6 +2795,13 @@
}
}
+ if (renderer.isAbsolutelyPositioned() && compositingAncestor) {
+ if (layerContainingBlockCrossesCoordinatedScrollingBoundary(layer, *compositingAncestor)) {
+ reason = RenderLayer::IndirectCompositingReason::OverflowScrollPositioning;
+ return true;
+ }
+ }
+
reason = RenderLayer::IndirectCompositingReason::None;
return false;
}
@@ -2892,10 +2903,9 @@
}
// Is this layer's containingBlock an ancestor of scrollable overflow, and is the layer's compositing ancestor inside that overflow?
-static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
+bool RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
{
- ASSERT(layer.isComposited());
- ASSERT(layer.renderer().style().position() == PositionType::Absolute);
+ ASSERT(layer.renderer().isAbsolutelyPositioned());
bool sawCompositingAncestor = false;
for (const auto* currLayer = layer.parent(); currLayer; currLayer = currLayer->parent()) {
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (243208 => 243209)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2019-03-20 16:28:16 UTC (rev 243208)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2019-03-20 16:32:32 UTC (rev 243209)
@@ -65,22 +65,23 @@
Filters = 1 << 8,
PositionFixed = 1 << 9,
PositionSticky = 1 << 10,
- OverflowScrollingTouch = 1 << 11,
+ OverflowScrolling = 1 << 11,
Stacking = 1 << 12,
Overlap = 1 << 13,
- NegativeZIndexChildren = 1 << 14,
- TransformWithCompositedDescendants = 1 << 15,
- OpacityWithCompositedDescendants = 1 << 16,
- MaskWithCompositedDescendants = 1 << 17,
- ReflectionWithCompositedDescendants = 1 << 18,
- FilterWithCompositedDescendants = 1 << 19,
- BlendingWithCompositedDescendants = 1 << 20,
- Perspective = 1 << 21,
- Preserve3D = 1 << 22,
- WillChange = 1 << 23,
- Root = 1 << 24,
- IsolatesCompositedBlendingDescendants = 1 << 25,
- EmbeddedView = 1 << 26,
+ OverflowScrollPositioning = 1 << 14,
+ NegativeZIndexChildren = 1 << 15,
+ TransformWithCompositedDescendants = 1 << 16,
+ OpacityWithCompositedDescendants = 1 << 17,
+ MaskWithCompositedDescendants = 1 << 18,
+ ReflectionWithCompositedDescendants = 1 << 19,
+ FilterWithCompositedDescendants = 1 << 20,
+ BlendingWithCompositedDescendants = 1 << 21,
+ Perspective = 1 << 22,
+ Preserve3D = 1 << 23,
+ WillChange = 1 << 24,
+ Root = 1 << 25,
+ IsolatesCompositedBlendingDescendants = 1 << 26,
+ EmbeddedView = 1 << 27,
};
enum class ScrollCoordinationRole {
@@ -475,8 +476,10 @@
bool requiresCompositingForPosition(RenderLayerModelObject&, const RenderLayer&, RequiresCompositingData&) const;
bool requiresCompositingForOverflowScrolling(const RenderLayer&, RequiresCompositingData&) const;
bool requiresCompositingForEditableImage(RenderLayerModelObject&) const;
- bool requiresCompositingForIndirectReason(RenderLayerModelObject&, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
+ bool requiresCompositingForIndirectReason(RenderLayerModelObject&, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
+ static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer&, const RenderLayer& compositedAncestor);
+
static bool styleChangeMayAffectIndirectCompositingReasons(const RenderStyle& oldStyle, const RenderStyle& newStyle);
enum class ScrollingNodeChangeFlags {