Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp

Issue 1274073002: Apply custom scrollbar styles to the frame with root layer scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: With TestCase, Need(https://codereview.chromium.org/1273033002/) CL to check. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698