| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 ScrollableArea* targetScroller = RootScrollerUtil::scrollableAreaFor(*target); | 75 ScrollableArea* targetScroller = RootScrollerUtil::scrollableAreaFor(*target); |
| 76 | 76 |
| 77 if (!targetScroller) | 77 if (!targetScroller) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 if (m_globalRootScroller) | 80 if (m_globalRootScroller) |
| 81 m_globalRootScroller->removeApplyScroll(); | 81 m_globalRootScroller->removeApplyScroll(); |
| 82 | 82 |
| 83 // Use disable-native-scroll since the ViewportScrollCallback needs to | 83 // Use disable-native-scroll since the ViewportScrollCallback needs to |
| 84 // apply scroll actions both before (TopControls) and after (overscroll) | 84 // apply scroll actions both before (BrowserControls) and after (overscroll) |
| 85 // scrolling the element so it will apply scroll to the element itself. | 85 // scrolling the element so it will apply scroll to the element itself. |
| 86 target->setApplyScroll(m_viewportApplyScroll, "disable-native-scroll"); | 86 target->setApplyScroll(m_viewportApplyScroll, "disable-native-scroll"); |
| 87 | 87 |
| 88 // A change in global root scroller requires a compositing inputs update to | 88 // A change in global root scroller requires a compositing inputs update to |
| 89 // the new and old global root scroller since it might change how the | 89 // the new and old global root scroller since it might change how the |
| 90 // ancestor layers are clipped. e.g. An iframe that's the global root | 90 // ancestor layers are clipped. e.g. An iframe that's the global root |
| 91 // scroller clips its layers like the root frame. Normally this is set | 91 // scroller clips its layers like the root frame. Normally this is set |
| 92 // when the local effective root scroller changes but the global root | 92 // when the local effective root scroller changes but the global root |
| 93 // scroller can change because the parent's effective root scroller | 93 // scroller can change because the parent's effective root scroller |
| 94 // changes. | 94 // changes. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return; | 139 return; |
| 140 | 140 |
| 141 // Let the compositor-side counterpart know about this change. | 141 // Let the compositor-side counterpart know about this change. |
| 142 m_frameHost->chromeClient().registerViewportLayers(); | 142 m_frameHost->chromeClient().registerViewportLayers(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void TopDocumentRootScrollerController::initializeViewportScrollCallback( | 145 void TopDocumentRootScrollerController::initializeViewportScrollCallback( |
| 146 RootFrameViewport& rootFrameViewport) { | 146 RootFrameViewport& rootFrameViewport) { |
| 147 DCHECK(m_frameHost); | 147 DCHECK(m_frameHost); |
| 148 m_viewportApplyScroll = ViewportScrollCallback::create( | 148 m_viewportApplyScroll = ViewportScrollCallback::create( |
| 149 &m_frameHost->topControls(), &m_frameHost->overscrollController(), | 149 &m_frameHost->browserControls(), &m_frameHost->overscrollController(), |
| 150 rootFrameViewport); | 150 rootFrameViewport); |
| 151 | 151 |
| 152 recomputeGlobalRootScroller(); | 152 recomputeGlobalRootScroller(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool TopDocumentRootScrollerController::isViewportScrollCallback( | 155 bool TopDocumentRootScrollerController::isViewportScrollCallback( |
| 156 const ScrollStateCallback* callback) const { | 156 const ScrollStateCallback* callback) const { |
| 157 if (!callback) | 157 if (!callback) |
| 158 return false; | 158 return false; |
| 159 | 159 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 177 // the root scroller gets composited. | 177 // the root scroller gets composited. |
| 178 | 178 |
| 179 return graphicsLayer; | 179 return graphicsLayer; |
| 180 } | 180 } |
| 181 | 181 |
| 182 Element* TopDocumentRootScrollerController::globalRootScroller() const { | 182 Element* TopDocumentRootScrollerController::globalRootScroller() const { |
| 183 return m_globalRootScroller.get(); | 183 return m_globalRootScroller.get(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |