OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
6 #include "core/frame/RootFrameViewport.h" | 6 #include "core/frame/RootFrameViewport.h" |
7 | 7 |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/layout/ScrollAlignment.h" | 9 #include "core/layout/ScrollAlignment.h" |
10 #include "platform/geometry/DoubleRect.h" | 10 #include "platform/geometry/DoubleRect.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (event.railsMode() != PlatformEvent::RailsModeHorizontal) | 115 if (event.railsMode() != PlatformEvent::RailsModeHorizontal) |
116 locationDelta.setY(-event.deltaY()); | 116 locationDelta.setY(-event.deltaY()); |
117 } | 117 } |
118 | 118 |
119 DoublePoint targetPosition = visualViewport().adjustScrollPositionWithinRang
e( | 119 DoublePoint targetPosition = visualViewport().adjustScrollPositionWithinRang
e( |
120 visualViewport().scrollPositionDouble() + toDoubleSize(locationDelta)); | 120 visualViewport().scrollPositionDouble() + toDoubleSize(locationDelta)); |
121 visualViewport().setScrollPosition(targetPosition, UserScroll); | 121 visualViewport().setScrollPosition(targetPosition, UserScroll); |
122 | 122 |
123 DoublePoint usedLocationDelta(visualViewport().scrollPositionDouble() - oldO
ffset); | 123 DoublePoint usedLocationDelta(visualViewport().scrollPositionDouble() - oldO
ffset); |
124 if (!viewScrollResult.didScroll() && usedLocationDelta == DoublePoint::zero(
)) | 124 if (!viewScrollResult.didScroll() && usedLocationDelta == DoublePoint::zero(
)) |
125 return ScrollResult(); | 125 return ScrollResult(false, false, viewScrollResult.unusedScrollDeltaX -
usedLocationDelta.x(), viewScrollResult.unusedScrollDeltaY - usedLocationDelta.y
()); |
126 | 126 |
127 DoubleSize unusedLocationDelta(locationDelta - usedLocationDelta); | 127 DoubleSize unusedLocationDelta(locationDelta - usedLocationDelta); |
128 bool didScrollX = viewScrollResult.didScrollX || unusedLocationDelta.width()
; | 128 bool didScrollX = viewScrollResult.didScrollX || unusedLocationDelta.width()
; |
129 bool didScrollY = viewScrollResult.didScrollY || unusedLocationDelta.height(
); | 129 bool didScrollY = viewScrollResult.didScrollY || unusedLocationDelta.height(
); |
130 return ScrollResult(didScrollX, didScrollY, -unusedLocationDelta.width(), -u
nusedLocationDelta.height()); | 130 return ScrollResult(didScrollX, didScrollY, -unusedLocationDelta.width(), -u
nusedLocationDelta.height()); |
131 } | 131 } |
132 | 132 |
133 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, co
nst ScrollAlignment& alignX, const ScrollAlignment& alignY) | 133 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, co
nst ScrollAlignment& alignX, const ScrollAlignment& alignY) |
134 { | 134 { |
135 // We want to move the rect into the viewport that excludes the scrollbars s
o we intersect | 135 // We want to move the rect into the viewport that excludes the scrollbars s
o we intersect |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 void RootFrameViewport::updateCompositorScrollAnimations() | 325 void RootFrameViewport::updateCompositorScrollAnimations() |
326 { | 326 { |
327 ScrollableArea::updateCompositorScrollAnimations(); | 327 ScrollableArea::updateCompositorScrollAnimations(); |
328 layoutViewport().updateCompositorScrollAnimations(); | 328 layoutViewport().updateCompositorScrollAnimations(); |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 } // namespace blink | 332 } // namespace blink |
OLD | NEW |