Chromium Code Reviews| Index: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp |
| diff --git a/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp b/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp |
| index 87417fe8c4bf2bd461c628b707bb847859500ecf..5634d8cba11634ad9a041b9f5eef947dfee0e909 100644 |
| --- a/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp |
| +++ b/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp |
| @@ -55,6 +55,7 @@ |
| #include "core/html/HTMLFrameOwnerElement.h" |
| #include "core/input/EventHandler.h" |
| #include "core/layout/LayoutGeometryMap.h" |
| +#include "core/layout/LayoutPart.h" |
| #include "core/layout/LayoutScrollbar.h" |
| #include "core/layout/LayoutScrollbarPart.h" |
| #include "core/layout/LayoutTheme.h" |
| @@ -941,6 +942,27 @@ IntSize DeprecatedPaintLayerScrollableArea::scrollbarOffset(const Scrollbar* scr |
| static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject) |
| { |
| if (Node* node = layoutObject.node()) { |
| + Document* doc = &node->document(); |
| + if (Settings* settings = doc->settings()) { |
| + if (!settings->allowCustomScrollbarInMainFrame() && layoutObject.frame() && layoutObject.frame()->isMainFrame()) |
| + return &layoutObject; |
| + } |
| + |
| + // Try the <body> element first as a scrollbar source. |
|
skobes
2015/08/06 20:09:32
I think we only want to run this logic if we are a
|
| + Element* body = doc ? doc->body() : 0; |
| + if (body && body->layoutObject() && body->layoutObject()->style()->hasPseudoStyle(SCROLLBAR)) |
| + return body->layoutObject(); |
| + |
| + // If the <body> didn't have a custom style, then the root element might. |
| + Element* docElement = doc ? doc->documentElement() : 0; |
| + if (docElement && docElement->layoutObject() && docElement->layoutObject()->style()->hasPseudoStyle(SCROLLBAR)) |
| + return docElement->layoutObject(); |
| + |
| + // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. |
| + LayoutPart* frameLayoutObject = node->document().frame()->ownerLayoutObject(); |
| + if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBAR)) |
| + return frameLayoutObject; |
| + |
| if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { |
| if (shadowRoot->type() == ShadowRootType::UserAgent) |
| return shadowRoot->host()->layoutObject(); |