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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/dom/AXObjectCache.h" 48 #include "core/dom/AXObjectCache.h"
49 #include "core/dom/Node.h" 49 #include "core/dom/Node.h"
50 #include "core/dom/shadow/ShadowRoot.h" 50 #include "core/dom/shadow/ShadowRoot.h"
51 #include "core/editing/FrameSelection.h" 51 #include "core/editing/FrameSelection.h"
52 #include "core/frame/FrameView.h" 52 #include "core/frame/FrameView.h"
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/frame/Settings.h" 54 #include "core/frame/Settings.h"
55 #include "core/html/HTMLFrameOwnerElement.h" 55 #include "core/html/HTMLFrameOwnerElement.h"
56 #include "core/input/EventHandler.h" 56 #include "core/input/EventHandler.h"
57 #include "core/layout/LayoutGeometryMap.h" 57 #include "core/layout/LayoutGeometryMap.h"
58 #include "core/layout/LayoutPart.h"
58 #include "core/layout/LayoutScrollbar.h" 59 #include "core/layout/LayoutScrollbar.h"
59 #include "core/layout/LayoutScrollbarPart.h" 60 #include "core/layout/LayoutScrollbarPart.h"
60 #include "core/layout/LayoutTheme.h" 61 #include "core/layout/LayoutTheme.h"
61 #include "core/layout/LayoutView.h" 62 #include "core/layout/LayoutView.h"
62 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" 63 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
63 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 64 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
64 #include "core/page/ChromeClient.h" 65 #include "core/page/ChromeClient.h"
65 #include "core/page/FocusController.h" 66 #include "core/page/FocusController.h"
66 #include "core/page/Page.h" 67 #include "core/page/Page.h"
67 #include "core/page/scrolling/ScrollingCoordinator.h" 68 #include "core/page/scrolling/ScrollingCoordinator.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 if (scrollbar == m_hBar.get()) 918 if (scrollbar == m_hBar.get())
918 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height()); 919 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height());
919 920
920 ASSERT_NOT_REACHED(); 921 ASSERT_NOT_REACHED();
921 return IntSize(); 922 return IntSize();
922 } 923 }
923 924
924 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject) 925 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject)
925 { 926 {
926 if (Node* node = layoutObject.node()) { 927 if (Node* node = layoutObject.node()) {
927 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { 928 if (layoutObject.isLayoutView()) {
928 if (shadowRoot->type() == ShadowRootType::UserAgent) 929 Document* doc = &node->document();
skobes 2015/08/12 01:59:25 Since Node::document() returns a reference, let's
MuVen 2015/08/12 07:15:09 Done.
929 return shadowRoot->host()->layoutObject(); 930 if (Settings* settings = doc->settings()) {
931 if (!settings->allowCustomScrollbarInMainFrame() && layoutObject .frame() && layoutObject.frame()->isMainFrame())
932 return &layoutObject;
933 }
934
935 // Try the <body> element first as a scrollbar source.
936 Element* body = doc ? doc->body() : 0;
937 if (body && body->layoutObject() && body->layoutObject()->style()->h asPseudoStyle(SCROLLBAR))
938 return body->layoutObject();
939
940 // If the <body> didn't have a custom style, then the root element m ight.
941 Element* docElement = doc ? doc->documentElement() : 0;
942 if (docElement && docElement->layoutObject() && docElement->layoutOb ject()->style()->hasPseudoStyle(SCROLLBAR))
943 return docElement->layoutObject();
944
945 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also.
946 LayoutPart* frameLayoutObject = node->document().frame()->ownerLayou tObject();
947 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle( SCROLLBAR))
948 return frameLayoutObject;
949
950 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
skobes 2015/08/12 01:59:25 This part should remain outside the LayoutView cas
MuVen 2015/08/12 07:15:09 Done.
951 if (shadowRoot->type() == ShadowRootType::UserAgent)
952 return shadowRoot->host()->layoutObject();
953 }
930 } 954 }
931 } 955 }
932 956
933 return &layoutObject; 957 return &layoutObject;
934 } 958 }
935 959
936 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation) 960 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation)
937 { 961 {
938 RefPtrWillBeRawPtr<Scrollbar> widget = nullptr; 962 RefPtrWillBeRawPtr<Scrollbar> widget = nullptr;
939 LayoutObject* actualLayoutObject = layoutObjectForScrollbar(box()); 963 LayoutObject* actualLayoutObject = layoutObjectForScrollbar(box());
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 return false; 1450 return false;
1427 1451
1428 LocalFrame* frame = box().frame(); 1452 LocalFrame* frame = box().frame();
1429 if (!frame || !frame->isMainFrame() || !frame->settings()) 1453 if (!frame || !frame->isMainFrame() || !frame->settings())
1430 return false; 1454 return false;
1431 1455
1432 return frame->settings()->viewportMetaEnabled(); 1456 return frame->settings()->viewportMetaEnabled();
1433 } 1457 }
1434 1458
1435 } // namespace blink 1459 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698