Chromium Code Reviews| 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..22ae23f29af89eca8e1efb0d933e283fbaee5329 100644 |
| --- a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
| +++ b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp |
| @@ -12,6 +12,7 @@ |
| #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 +83,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 +104,25 @@ 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(); |
|
chrishtr
2016/09/14 17:16:41
I think you're going to need
compositor()->setNee
bokan
2016/09/14 17:25:46
Ah, yes, you're right, thanks for catching that. D
|
| +} |
| + |
| 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 +173,9 @@ GraphicsLayer* TopDocumentRootScrollerController::rootScrollerLayer() |
| return graphicsLayer; |
| } |
| +Element* TopDocumentRootScrollerController::globalRootScroller() const |
| +{ |
| + return m_globalRootScroller.get(); |
| +} |
| + |
| } // namespace blink |