Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 if (scrollbar == m_hBar.get()) | 935 if (scrollbar == m_hBar.get()) |
| 935 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height()); | 936 return IntSize(horizontalScrollbarStart(0), box().size().height() - box( ).borderBottom() - scrollbar->height()); |
| 936 | 937 |
| 937 ASSERT_NOT_REACHED(); | 938 ASSERT_NOT_REACHED(); |
| 938 return IntSize(); | 939 return IntSize(); |
| 939 } | 940 } |
| 940 | 941 |
| 941 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject) | 942 static inline LayoutObject* layoutObjectForScrollbar(LayoutObject& layoutObject) |
| 942 { | 943 { |
| 943 if (Node* node = layoutObject.node()) { | 944 if (Node* node = layoutObject.node()) { |
| 945 Document* doc = &node->document(); | |
| 946 if (Settings* settings = doc->settings()) { | |
| 947 if (!settings->allowCustomScrollbarInMainFrame() && layoutObject.fra me() && layoutObject.frame()->isMainFrame()) | |
| 948 return &layoutObject; | |
| 949 } | |
| 950 | |
| 951 // 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
| |
| 952 Element* body = doc ? doc->body() : 0; | |
| 953 if (body && body->layoutObject() && body->layoutObject()->style()->hasPs eudoStyle(SCROLLBAR)) | |
| 954 return body->layoutObject(); | |
| 955 | |
| 956 // If the <body> didn't have a custom style, then the root element might . | |
| 957 Element* docElement = doc ? doc->documentElement() : 0; | |
| 958 if (docElement && docElement->layoutObject() && docElement->layoutObject ()->style()->hasPseudoStyle(SCROLLBAR)) | |
| 959 return docElement->layoutObject(); | |
| 960 | |
| 961 // If we have an owning ipage/LocalFrame element, then it can set the cu stom scrollbar also. | |
| 962 LayoutPart* frameLayoutObject = node->document().frame()->ownerLayoutObj ect(); | |
| 963 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCRO LLBAR)) | |
| 964 return frameLayoutObject; | |
| 965 | |
| 944 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { | 966 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { |
| 945 if (shadowRoot->type() == ShadowRootType::UserAgent) | 967 if (shadowRoot->type() == ShadowRootType::UserAgent) |
| 946 return shadowRoot->host()->layoutObject(); | 968 return shadowRoot->host()->layoutObject(); |
| 947 } | 969 } |
| 948 } | 970 } |
| 949 | 971 |
| 950 return &layoutObject; | 972 return &layoutObject; |
| 951 } | 973 } |
| 952 | 974 |
| 953 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation) | 975 PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::createScro llbar(ScrollbarOrientation orientation) |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1443 return false; | 1465 return false; |
| 1444 | 1466 |
| 1445 LocalFrame* frame = box().frame(); | 1467 LocalFrame* frame = box().frame(); |
| 1446 if (!frame || !frame->isMainFrame() || !frame->settings()) | 1468 if (!frame || !frame->isMainFrame() || !frame->settings()) |
| 1447 return false; | 1469 return false; |
| 1448 | 1470 |
| 1449 return frame->settings()->viewportMetaEnabled(); | 1471 return frame->settings()->viewportMetaEnabled(); |
| 1450 } | 1472 } |
| 1451 | 1473 |
| 1452 } // namespace blink | 1474 } // namespace blink |
| OLD | NEW |