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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp

Issue 2289833002: Disable clipping on root scroller's ancestors. (Closed)
Patch Set: Also setNeedsCompositingUpdate from TopDocumentRootScrollerController Created 4 years, 3 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/page/scrolling/RootScrollerController.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
index 0125aa0da4c16dcf65be4480bfc40b2cf8714df9..c8c9761ab92f6a1ad280d6af8fd2aba66baecee7 100644
--- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
@@ -10,6 +10,8 @@
#include "core/frame/FrameView.h"
#include "core/layout/LayoutBox.h"
#include "core/layout/api/LayoutViewItem.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
#include "core/paint/PaintLayerScrollableArea.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/scroll/ScrollableArea.h"
@@ -100,8 +102,23 @@ void RootScrollerController::recomputeEffectiveRootScroller()
if (m_effectiveRootScroller == newEffectiveRootScroller)
return;
+ PaintLayer* oldRootScrollerLayer = rootScrollerPaintLayer();
+
m_effectiveRootScroller = newEffectiveRootScroller;
+ // This change affects both the old and new layers.
+ if (oldRootScrollerLayer)
+ oldRootScrollerLayer->setNeedsCompositingInputsUpdate();
+ if (rootScrollerPaintLayer())
+ rootScrollerPaintLayer()->setNeedsCompositingInputsUpdate();
+
+ // The above may not be enough as we need to update existing ancestor
+ // GraphicsLayers. This will force us to rebuild the GraphicsLayer tree.
+ if (LayoutView* layoutView = m_document->layoutView()) {
+ layoutView->compositor()
+ ->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+ }
+
m_document->topDocument().rootScrollerController()
->globalRootScrollerMayHaveChanged();
}
@@ -172,6 +189,27 @@ bool RootScrollerController::isViewportScrollCallback(
return topDocumentController->isViewportScrollCallback(callback);
}
+PaintLayer* RootScrollerController::rootScrollerPaintLayer() const
+{
+ if (!m_effectiveRootScroller
+ || !m_effectiveRootScroller->layoutObject()
+ || !m_effectiveRootScroller->layoutObject()->isBox())
+ return nullptr;
+
+ LayoutBox* box = toLayoutBox(m_effectiveRootScroller->layoutObject());
+ PaintLayer* layer = box->layer();
+
+ // If the root scroller is the <html> element we do a bit of a fake out because
+ // while <html> has a PaintLayer, scrolling for it is handled by the #document's
+ // PaintLayer (i.e. the PaintLayerCompositor's root layer). The reason the root
+ // scroller is the <html> layer and not #document is because the latter is a Node
+ // but not an Element.
+ if (m_effectiveRootScroller->isSameNode(m_document->documentElement()))
+ return layer->compositor()->rootLayer();
+
+ return layer;
+}
+
Element* RootScrollerController::defaultEffectiveRootScroller()
{
DCHECK(m_document);

Powered by Google App Engine
This is Rietveld 408576698