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

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: addressed review comments 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
« no previous file with comments | « LayoutTests/fast/scrolling/custom-scrollbar-style-applied-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp b/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
index cc972254f72dab60406247ffbb164c1b4518923b..75b2999646e092109c931114f7a27add34ba4c50 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"
@@ -926,6 +927,28 @@ IntSize DeprecatedPaintLayerScrollableArea::scrollbarOffset(const Scrollbar* scr
static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject)
{
if (Node* node = layoutObject.node()) {
+ if (layoutObject.isLayoutView()) {
+ 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.
+ Element* body = doc.body();
+ 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.documentElement();
+ 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();
« no previous file with comments | « LayoutTests/fast/scrolling/custom-scrollbar-style-applied-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698