| Index: third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
|
| index 4940df7bb9d775466499d6dbfeb1b5966f1e3027..1325221e5aef0c91d6cbce4ca556dc62819d32a2 100644
|
| --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
|
| +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
|
| @@ -7,14 +7,16 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/Element.h"
|
| #include "core/frame/FrameView.h"
|
| +#include "core/layout/LayoutBox.h"
|
| #include "core/layout/LayoutBoxModelObject.h"
|
| +#include "core/layout/LayoutView.h"
|
| #include "core/paint/PaintLayerScrollableArea.h"
|
|
|
| namespace blink {
|
|
|
| namespace RootScrollerUtil {
|
|
|
| -ScrollableArea* scrollableAreaFor(const Element& element) {
|
| +ScrollableArea* scrollableAreaForRootScroller(const Element& element) {
|
| if (&element == element.document().documentElement()) {
|
| if (!element.document().view())
|
| return nullptr;
|
| @@ -33,6 +35,27 @@ ScrollableArea* scrollableAreaFor(const Element& element) {
|
| toLayoutBoxModelObject(element.layoutObject())->getScrollableArea());
|
| }
|
|
|
| +PaintLayer* paintLayerForRootScroller(const Element* element) {
|
| + if (!element || !element->layoutObject())
|
| + return nullptr;
|
| +
|
| + DCHECK(element->layoutObject()->isBox());
|
| + LayoutBox* box = toLayoutBox(element->layoutObject());
|
| +
|
| + // 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 (element->isSameNode(element->document().documentElement())) {
|
| + if (!box->view())
|
| + return nullptr;
|
| + return box->view()->layer();
|
| + }
|
| +
|
| + return box->layer();
|
| +}
|
| +
|
| } // namespace RootScrollerUtil
|
|
|
| } // namespace blink
|
|
|