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..e62fe85f1be2fe14356312a1c10c280ef97bdb30 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" |
@@ -88,6 +90,17 @@ void RootScrollerController::globalRootScrollerMayHaveChanged() |
{ |
} |
+void RootScrollerController::setNeedsCompositingInputsUpdateOnAncestorChain( |
+ PaintLayer* layer) |
+{ |
+ if (layer) { |
+ while (layer) { |
+ layer->setNeedsCompositingInputsUpdate(); |
bokan
2016/09/09 00:19:03
I set this on all ancestor layers since we need a
chrishtr
2016/09/09 18:21:16
I think it's overkill. PaintLayer::setNeedsComposi
bokan
2016/09/10 00:05:54
My read of that is that it ensures we recursively
chrishtr
2016/09/12 21:01:28
Oh in that case you just need setNeedsGraphicsLaye
bokan
2016/09/13 20:40:51
Ok, I used setNeedsCompositingUpdate since I can't
|
+ layer = layer->parent(); |
+ } |
+ } |
+} |
+ |
void RootScrollerController::recomputeEffectiveRootScroller() |
{ |
bool rootScrollerValid = |
@@ -100,8 +113,13 @@ void RootScrollerController::recomputeEffectiveRootScroller() |
if (m_effectiveRootScroller == newEffectiveRootScroller) |
return; |
+ PaintLayer* oldRootScrollerLayer = rootScrollerPaintLayer(); |
+ |
m_effectiveRootScroller = newEffectiveRootScroller; |
+ setNeedsCompositingInputsUpdateOnAncestorChain(oldRootScrollerLayer); |
+ setNeedsCompositingInputsUpdateOnAncestorChain(rootScrollerPaintLayer()); |
+ |
m_document->topDocument().rootScrollerController() |
->globalRootScrollerMayHaveChanged(); |
} |
@@ -172,6 +190,28 @@ bool RootScrollerController::isViewportScrollCallback( |
return topDocumentController->isViewportScrollCallback(callback); |
} |
+PaintLayer* RootScrollerController::rootScrollerPaintLayer() const |
+{ |
+ if (!m_effectiveRootScroller) |
+ return nullptr; |
+ |
+ LayoutBox* box = toLayoutBox(m_effectiveRootScroller->layoutObject()); |
+ if (!box) |
+ return nullptr; |
+ |
+ 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); |