Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Unified Diff: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp

Issue 2745063005: Remove document.rootScroller compositing clipping effects. (Closed)
Patch Set: Fix Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
index a2b984eb04a445c3edb3221f1481b22b3b0c8845..3aebdb015ba5d79b3be75e957783632aca2f0e8b 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -431,8 +431,6 @@ void PaintLayerCompositor::updateIfNeeded() {
}
}
- updateClippingOnCompositorLayers();
-
GraphicsLayerUpdater updater;
updater.update(*updateRoot, layersNeedingPaintInvalidation);
@@ -485,35 +483,6 @@ void PaintLayerCompositor::updateIfNeeded() {
probe::layerTreeDidChange(m_layoutView.frame());
}
-void PaintLayerCompositor::updateClippingOnCompositorLayers() {
- bool shouldClip = !rootLayer()->hasRootScrollerAsDescendant();
- if (m_rootContentLayer) {
- // FIXME: with rootLayerScrolls, we probably don't even need
- // m_rootContentLayer?
- m_rootContentLayer->setMasksToBounds(
- !RuntimeEnabledFeatures::rootLayerScrollingEnabled() && shouldClip);
- }
-
- const TopDocumentRootScrollerController& globalRootScrollerController =
- m_layoutView.document().page()->globalRootScrollerController();
-
- Element* documentElement = m_layoutView.document().documentElement();
- bool frameIsRootScroller =
- documentElement &&
- documentElement->isSameNode(
- globalRootScrollerController.globalRootScroller());
-
- // We normally clip iframes' (but not the root frame) overflow controls
- // host and container layers but if the root scroller is the iframe itself
- // we want it to behave like the root frame.
- shouldClip &= !frameIsRootScroller && !m_layoutView.frame()->isLocalRoot();
-
- if (m_containerLayer)
- m_containerLayer->setMasksToBounds(shouldClip);
- if (m_overflowControlsHostLayer)
- m_overflowControlsHostLayer->setMasksToBounds(shouldClip);
-}
-
static void restartAnimationOnCompositor(const LayoutObject& layoutObject) {
Node* node = layoutObject.node();
ElementAnimations* elementAnimations =
@@ -1140,6 +1109,13 @@ void PaintLayerCompositor::ensureRootLayer() {
m_rootContentLayer->setPosition(FloatPoint());
m_rootContentLayer->setOwnerNodeId(
DOMNodeIds::idForNode(m_layoutView.node()));
+
+ // FIXME: with rootLayerScrolls, we probably don't even need
+ // m_rootContentLayer?
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ // Need to clip to prevent transformed content showing outside this frame
+ m_rootContentLayer->setMasksToBounds(true);
+ }
}
if (shouldCreateOwnLayers && !m_overflowControlsHostLayer) {
@@ -1147,9 +1123,14 @@ void PaintLayerCompositor::ensureRootLayer() {
ASSERT(!m_containerLayer);
// Create a layer to host the clipping layer and the overflow controls
- // layers. Whether these layers mask the content below is determined
- // in updateClippingOnCompositorLayers.
+ // layers.
m_overflowControlsHostLayer = GraphicsLayer::create(this);
+
+ // Clip iframe's overflow controls layer.
+ bool containerMasksToBounds = !m_layoutView.frame()->isLocalRoot();
+ m_overflowControlsHostLayer->setMasksToBounds(containerMasksToBounds);
+
+ // Create a clipping layer if this is an iframe or settings require to clip.
m_containerLayer = GraphicsLayer::create(this);
m_scrollLayer = GraphicsLayer::create(this);
if (ScrollingCoordinator* scrollingCoordinator =

Powered by Google App Engine
This is Rietveld 408576698