| 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/frame/FrameHost.h" | 5 #include "core/frame/FrameHost.h" |
| 6 #include "core/frame/FrameView.h" | 6 #include "core/frame/FrameView.h" |
| 7 #include "core/frame/RootFrameViewport.h" | 7 #include "core/frame/RootFrameViewport.h" |
| 8 #include "core/frame/TopControls.h" | 8 #include "core/frame/TopControls.h" |
| 9 #include "core/html/HTMLFrameOwnerElement.h" | 9 #include "core/html/HTMLFrameOwnerElement.h" |
| 10 #include "core/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 webViewImpl()->handleInputEvent(generateTouchGestureEvent( | 201 webViewImpl()->handleInputEvent(generateTouchGestureEvent( |
| 202 WebInputEvent::GestureScrollUpdate, 0, -topControls().height())); | 202 WebInputEvent::GestureScrollUpdate, 0, -topControls().height())); |
| 203 EXPECT_FLOAT_EQ(0, topControls().shownRatio()); | 203 EXPECT_FLOAT_EQ(0, topControls().shownRatio()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 { | 206 { |
| 207 // Make sure we're actually scrolling the DIV and not the FrameView. | 207 // Make sure we're actually scrolling the DIV and not the FrameView. |
| 208 webViewImpl()->handleInputEvent( | 208 webViewImpl()->handleInputEvent( |
| 209 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -100)); | 209 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -100)); |
| 210 EXPECT_FLOAT_EQ(100, container->scrollTop()); | 210 EXPECT_FLOAT_EQ(100, container->scrollTop()); |
| 211 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollPositionDouble().y()); | 211 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollOffset().height()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 { | 214 { |
| 215 // Scroll 50 pixels past the end. Ensure we report the 50 pixels as | 215 // Scroll 50 pixels past the end. Ensure we report the 50 pixels as |
| 216 // overscroll. | 216 // overscroll. |
| 217 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), | 217 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), |
| 218 WebFloatPoint(100, 100), WebFloatSize())); | 218 WebFloatPoint(100, 100), WebFloatSize())); |
| 219 webViewImpl()->handleInputEvent( | 219 webViewImpl()->handleInputEvent( |
| 220 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -550)); | 220 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -550)); |
| 221 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 221 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 222 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollPositionDouble().y()); | 222 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollOffset().height()); |
| 223 Mock::VerifyAndClearExpectations(&client); | 223 Mock::VerifyAndClearExpectations(&client); |
| 224 } | 224 } |
| 225 | 225 |
| 226 { | 226 { |
| 227 // Continue the gesture overscroll. | 227 // Continue the gesture overscroll. |
| 228 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 20), WebFloatSize(0, 70), | 228 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 20), WebFloatSize(0, 70), |
| 229 WebFloatPoint(100, 100), WebFloatSize())); | 229 WebFloatPoint(100, 100), WebFloatSize())); |
| 230 webViewImpl()->handleInputEvent( | 230 webViewImpl()->handleInputEvent( |
| 231 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -20)); | 231 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -20)); |
| 232 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 232 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 233 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollPositionDouble().y()); | 233 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollOffset().height()); |
| 234 Mock::VerifyAndClearExpectations(&client); | 234 Mock::VerifyAndClearExpectations(&client); |
| 235 } | 235 } |
| 236 | 236 |
| 237 webViewImpl()->handleInputEvent( | 237 webViewImpl()->handleInputEvent( |
| 238 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); | 238 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); |
| 239 | 239 |
| 240 { | 240 { |
| 241 // Make sure a new gesture scroll still won't scroll the frameview and | 241 // Make sure a new gesture scroll still won't scroll the frameview and |
| 242 // overscrolls. | 242 // overscrolls. |
| 243 webViewImpl()->handleInputEvent( | 243 webViewImpl()->handleInputEvent( |
| 244 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); | 244 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); |
| 245 | 245 |
| 246 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 30), WebFloatSize(0, 30), | 246 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 30), WebFloatSize(0, 30), |
| 247 WebFloatPoint(100, 100), WebFloatSize())); | 247 WebFloatPoint(100, 100), WebFloatSize())); |
| 248 webViewImpl()->handleInputEvent( | 248 webViewImpl()->handleInputEvent( |
| 249 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -30)); | 249 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -30)); |
| 250 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 250 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 251 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollPositionDouble().y()); | 251 EXPECT_FLOAT_EQ(0, mainFrameView()->scrollOffset().height()); |
| 252 Mock::VerifyAndClearExpectations(&client); | 252 Mock::VerifyAndClearExpectations(&client); |
| 253 | 253 |
| 254 webViewImpl()->handleInputEvent( | 254 webViewImpl()->handleInputEvent( |
| 255 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); | 255 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); |
| 256 } | 256 } |
| 257 | 257 |
| 258 { | 258 { |
| 259 // Scrolling up should show the top controls. | 259 // Scrolling up should show the top controls. |
| 260 webViewImpl()->handleInputEvent( | 260 webViewImpl()->handleInputEvent( |
| 261 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); | 261 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 mainFrameView()->getRootFrameViewport()->serviceScrollAnimations(0); | 905 mainFrameView()->getRootFrameViewport()->serviceScrollAnimations(0); |
| 906 | 906 |
| 907 EXPECT_EQ(iframe->contentDocument()->documentElement(), | 907 EXPECT_EQ(iframe->contentDocument()->documentElement(), |
| 908 effectiveRootScroller(iframe->contentDocument())); | 908 effectiveRootScroller(iframe->contentDocument())); |
| 909 } | 909 } |
| 910 } | 910 } |
| 911 | 911 |
| 912 } // namespace | 912 } // namespace |
| 913 | 913 |
| 914 } // namespace blink | 914 } // namespace blink |
| OLD | NEW |