Index: third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
diff --git a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
index b23bf7cfd2002b6d4170398fc7fb00fdb6675afa..46839e5ca4c819321b0ea0ec8bf04f21c04f0153 100644 |
--- a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
+++ b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
@@ -9,9 +9,12 @@ |
#include "core/frame/FrameHost.h" |
#include "core/frame/FrameView.h" |
#include "core/html/HTMLFrameOwnerElement.h" |
+#include "core/layout/LayoutView.h" |
+#include "core/layout/compositing/PaintLayerCompositor.h" |
#include "core/page/ChromeClient.h" |
#include "core/page/scrolling/OverscrollController.h" |
#include "core/page/scrolling/ViewportScrollCallback.h" |
+#include "core/paint/PaintLayer.h" |
#include "platform/scroll/ScrollableArea.h" |
namespace blink { |
@@ -82,8 +85,19 @@ void TopDocumentRootScrollerController::updateGlobalRootScroller() |
// scrolling the element so it will apply scroll to the element itself. |
target->setApplyScroll(m_viewportApplyScroll, "disable-native-scroll"); |
+ // A change in global root scroller requires a compositing inputs update to |
+ // the new and old global root scroller since it might change how the |
+ // ancestor layers are clipped. e.g. An iframe that's the global root |
+ // scroller clips its layers like the root frame. Normally this is set |
+ // when the local effective root scroller changes but the global root |
+ // scroller can change because the parent's effective root scroller |
+ // changes. |
+ setNeedsCompositingInputsUpdateOnGlobalRootScroller(); |
+ |
m_globalRootScroller = target; |
+ setNeedsCompositingInputsUpdateOnGlobalRootScroller(); |
+ |
// Ideally, scroll customization would pass the current element to scroll to |
// the apply scroll callback but this doesn't happen today so we set it |
// through a back door here. This is also needed by the |
@@ -92,12 +106,30 @@ void TopDocumentRootScrollerController::updateGlobalRootScroller() |
m_viewportApplyScroll->setScroller(targetScroller); |
} |
+void TopDocumentRootScrollerController |
+ ::setNeedsCompositingInputsUpdateOnGlobalRootScroller() |
+{ |
+ if (!m_globalRootScroller) |
+ return; |
+ |
+ PaintLayer* layer = m_globalRootScroller->document() |
+ .rootScrollerController()->rootScrollerPaintLayer(); |
+ |
+ if (layer) |
+ layer->setNeedsCompositingInputsUpdate(); |
+ |
+ if (LayoutView* view = m_globalRootScroller->document().layoutView()) { |
+ view->compositor() |
+ ->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
+ } |
+} |
+ |
void TopDocumentRootScrollerController::didUpdateCompositing() |
{ |
- FrameHost* frameHost = m_document->frameHost(); |
+ RootScrollerController::didUpdateCompositing(); |
// Let the compositor-side counterpart know about this change. |
- if (frameHost) |
+ if (FrameHost* frameHost = m_document->frameHost()) |
frameHost->chromeClient().registerViewportLayers(); |
} |
@@ -148,4 +180,9 @@ GraphicsLayer* TopDocumentRootScrollerController::rootScrollerLayer() |
return graphicsLayer; |
} |
+Element* TopDocumentRootScrollerController::globalRootScroller() const |
+{ |
+ return m_globalRootScroller.get(); |
+} |
+ |
} // namespace blink |