| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | 5 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // A change in global root scroller requires a compositing inputs update to | 108 // A change in global root scroller requires a compositing inputs update to |
| 109 // the new and old global root scroller since it might change how the | 109 // the new and old global root scroller since it might change how the |
| 110 // ancestor layers are clipped. e.g. An iframe that's the global root | 110 // ancestor layers are clipped. e.g. An iframe that's the global root |
| 111 // scroller clips its layers like the root frame. Normally this is set | 111 // scroller clips its layers like the root frame. Normally this is set |
| 112 // when the local effective root scroller changes but the global root | 112 // when the local effective root scroller changes but the global root |
| 113 // scroller can change because the parent's effective root scroller | 113 // scroller can change because the parent's effective root scroller |
| 114 // changes. | 114 // changes. |
| 115 setNeedsCompositingInputsUpdateOnGlobalRootScroller(); | 115 setNeedsCompositingInputsUpdateOnGlobalRootScroller(); |
| 116 | 116 |
| 117 ScrollableArea* oldRootScrollerArea = |
| 118 m_globalRootScroller |
| 119 ? RootScrollerUtil::scrollableAreaFor(*m_globalRootScroller.get()) |
| 120 : nullptr; |
| 121 |
| 117 m_globalRootScroller = target; | 122 m_globalRootScroller = target; |
| 118 | 123 |
| 119 setNeedsCompositingInputsUpdateOnGlobalRootScroller(); | 124 setNeedsCompositingInputsUpdateOnGlobalRootScroller(); |
| 120 | 125 |
| 121 // Ideally, scroll customization would pass the current element to scroll to | 126 // Ideally, scroll customization would pass the current element to scroll to |
| 122 // the apply scroll callback but this doesn't happen today so we set it | 127 // the apply scroll callback but this doesn't happen today so we set it |
| 123 // through a back door here. This is also needed by the | 128 // through a back door here. This is also needed by the |
| 124 // ViewportScrollCallback to swap the target into the layout viewport | 129 // ViewportScrollCallback to swap the target into the layout viewport |
| 125 // in RootFrameViewport. | 130 // in RootFrameViewport. |
| 126 m_viewportApplyScroll->setScroller(targetScroller); | 131 m_viewportApplyScroll->setScroller(targetScroller); |
| 132 |
| 133 // The scrollers may need to stop using their own scrollbars as Android |
| 134 // Chrome's VisualViewport provides the scrollbars for the root scroller. |
| 135 if (oldRootScrollerArea) |
| 136 oldRootScrollerArea->didChangeGlobalRootScroller(); |
| 137 |
| 138 targetScroller->didChangeGlobalRootScroller(); |
| 127 } | 139 } |
| 128 | 140 |
| 129 Document* TopDocumentRootScrollerController::topDocument() const { | 141 Document* TopDocumentRootScrollerController::topDocument() const { |
| 130 if (!m_frameHost) | 142 if (!m_frameHost) |
| 131 return nullptr; | 143 return nullptr; |
| 132 | 144 |
| 133 if (!m_frameHost->page().mainFrame() || | 145 if (!m_frameHost->page().mainFrame() || |
| 134 !m_frameHost->page().mainFrame()->isLocalFrame()) | 146 !m_frameHost->page().mainFrame()->isLocalFrame()) |
| 135 return nullptr; | 147 return nullptr; |
| 136 | 148 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 213 |
| 202 PaintLayer* TopDocumentRootScrollerController::rootScrollerPaintLayer() const { | 214 PaintLayer* TopDocumentRootScrollerController::rootScrollerPaintLayer() const { |
| 203 return RootScrollerUtil::paintLayerFor(m_globalRootScroller); | 215 return RootScrollerUtil::paintLayerFor(m_globalRootScroller); |
| 204 } | 216 } |
| 205 | 217 |
| 206 Element* TopDocumentRootScrollerController::globalRootScroller() const { | 218 Element* TopDocumentRootScrollerController::globalRootScroller() const { |
| 207 return m_globalRootScroller.get(); | 219 return m_globalRootScroller.get(); |
| 208 } | 220 } |
| 209 | 221 |
| 210 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |