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

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
« no previous file with comments | « LayoutTests/fast/scrolling/custom-scrollbar-style-applied-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 if (scrollbar == m_hBar.get()) 920 if (scrollbar == m_hBar.get())
920 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height()); 921 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height());
921 922
922 ASSERT_NOT_REACHED(); 923 ASSERT_NOT_REACHED();
923 return IntSize(); 924 return IntSize();
924 } 925 }
925 926
926 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject) 927 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject)
927 { 928 {
928 if (Node* node = layoutObject.node()) { 929 if (Node* node = layoutObject.node()) {
930 if (layoutObject.isLayoutView()) {
931 Document& doc = node->document();
932 if (Settings* settings = doc.settings()) {
933 if (!settings->allowCustomScrollbarInMainFrame() && layoutObject .frame() && layoutObject.frame()->isMainFrame())
934 return &layoutObject;
935 }
936
937 // Try the <body> element first as a scrollbar source.
938 Element* body = doc.body();
939 if (body && body->layoutObject() && body->layoutObject()->style()->h asPseudoStyle(SCROLLBAR))
940 return body->layoutObject();
941
942 // If the <body> didn't have a custom style, then the root element m ight.
943 Element* docElement = doc.documentElement();
944 if (docElement && docElement->layoutObject() && docElement->layoutOb ject()->style()->hasPseudoStyle(SCROLLBAR))
945 return docElement->layoutObject();
946
947 // If we have an owning ipage/LocalFrame element, then it can set th e custom scrollbar also.
948 LayoutPart* frameLayoutObject = node->document().frame()->ownerLayou tObject();
949 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle( SCROLLBAR))
950 return frameLayoutObject;
951 }
929 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { 952 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
930 if (shadowRoot->type() == ShadowRootType::UserAgent) 953 if (shadowRoot->type() == ShadowRootType::UserAgent)
931 return shadowRoot->host()->layoutObject(); 954 return shadowRoot->host()->layoutObject();
932 } 955 }
933 } 956 }
934 957
935 return &layoutObject; 958 return &layoutObject;
936 } 959 }
937 960
938 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation) 961 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation)
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 return false; 1451 return false;
1429 1452
1430 LocalFrame* frame = box().frame(); 1453 LocalFrame* frame = box().frame();
1431 if (!frame || !frame->isMainFrame() || !frame->settings()) 1454 if (!frame || !frame->isMainFrame() || !frame->settings())
1432 return false; 1455 return false;
1433 1456
1434 return frame->settings()->viewportMetaEnabled(); 1457 return frame->settings()->viewportMetaEnabled();
1435 } 1458 }
1436 1459
1437 } // namespace blink 1460 } // namespace blink
OLDNEW
« 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