| 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/dom/ClientRect.h" | 5 #include "core/dom/ClientRect.h" |
| 6 #include "core/frame/BrowserControls.h" | 6 #include "core/frame/BrowserControls.h" |
| 7 #include "core/frame/FrameHost.h" | 7 #include "core/frame/FrameHost.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/RootFrameViewport.h" | 9 #include "core/frame/RootFrameViewport.h" |
| 10 #include "core/frame/VisualViewport.h" | 10 #include "core/frame/VisualViewport.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Make sure we're actually scrolling the DIV and not the FrameView. | 258 // Make sure we're actually scrolling the DIV and not the FrameView. |
| 259 webViewImpl()->handleInputEvent( | 259 webViewImpl()->handleInputEvent( |
| 260 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -100)); | 260 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -100)); |
| 261 EXPECT_FLOAT_EQ(100, container->scrollTop()); | 261 EXPECT_FLOAT_EQ(100, container->scrollTop()); |
| 262 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); | 262 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 { | 265 { |
| 266 // Scroll 50 pixels past the end. Ensure we report the 50 pixels as | 266 // Scroll 50 pixels past the end. Ensure we report the 50 pixels as |
| 267 // overscroll. | 267 // overscroll. |
| 268 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), | 268 EXPECT_CALL(client, |
| 269 WebFloatPoint(100, 100), WebFloatSize())); | 269 didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), |
| 270 WebFloatPoint(100, 100), WebFloatSize())); |
| 270 webViewImpl()->handleInputEvent( | 271 webViewImpl()->handleInputEvent( |
| 271 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -500)); | 272 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -500)); |
| 272 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 273 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 273 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); | 274 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); |
| 274 Mock::VerifyAndClearExpectations(&client); | 275 Mock::VerifyAndClearExpectations(&client); |
| 275 } | 276 } |
| 276 | 277 |
| 277 { | 278 { |
| 278 // Continue the gesture overscroll. | 279 // Continue the gesture overscroll. |
| 279 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 20), WebFloatSize(0, 70), | 280 EXPECT_CALL(client, |
| 280 WebFloatPoint(100, 100), WebFloatSize())); | 281 didOverscroll(WebFloatSize(0, 20), WebFloatSize(0, 70), |
| 282 WebFloatPoint(100, 100), WebFloatSize())); |
| 281 webViewImpl()->handleInputEvent( | 283 webViewImpl()->handleInputEvent( |
| 282 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -20)); | 284 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -20)); |
| 283 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 285 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 284 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); | 286 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); |
| 285 Mock::VerifyAndClearExpectations(&client); | 287 Mock::VerifyAndClearExpectations(&client); |
| 286 } | 288 } |
| 287 | 289 |
| 288 webViewImpl()->handleInputEvent( | 290 webViewImpl()->handleInputEvent( |
| 289 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); | 291 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); |
| 290 | 292 |
| 291 { | 293 { |
| 292 // Make sure a new gesture scroll still won't scroll the frameview and | 294 // Make sure a new gesture scroll still won't scroll the frameview and |
| 293 // overscrolls. | 295 // overscrolls. |
| 294 webViewImpl()->handleInputEvent( | 296 webViewImpl()->handleInputEvent( |
| 295 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); | 297 generateTouchGestureEvent(WebInputEvent::GestureScrollBegin)); |
| 296 | 298 |
| 297 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 30), WebFloatSize(0, 30), | 299 EXPECT_CALL(client, |
| 298 WebFloatPoint(100, 100), WebFloatSize())); | 300 didOverscroll(WebFloatSize(0, 30), WebFloatSize(0, 30), |
| 301 WebFloatPoint(100, 100), WebFloatSize())); |
| 299 webViewImpl()->handleInputEvent( | 302 webViewImpl()->handleInputEvent( |
| 300 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -30)); | 303 generateTouchGestureEvent(WebInputEvent::GestureScrollUpdate, 0, -30)); |
| 301 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); | 304 EXPECT_FLOAT_EQ(maximumScroll, container->scrollTop()); |
| 302 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); | 305 EXPECT_FLOAT_EQ(0, mainFrameView()->getScrollOffset().height()); |
| 303 Mock::VerifyAndClearExpectations(&client); | 306 Mock::VerifyAndClearExpectations(&client); |
| 304 | 307 |
| 305 webViewImpl()->handleInputEvent( | 308 webViewImpl()->handleInputEvent( |
| 306 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); | 309 generateTouchGestureEvent(WebInputEvent::GestureScrollEnd)); |
| 307 } | 310 } |
| 308 | 311 |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 // FrameView without a layout. | 1315 // FrameView without a layout. |
| 1313 iframe->remove(); | 1316 iframe->remove(); |
| 1314 | 1317 |
| 1315 EXPECT_EQ(mainFrameView()->layoutViewportScrollableArea(), | 1318 EXPECT_EQ(mainFrameView()->layoutViewportScrollableArea(), |
| 1316 &mainFrameView()->getRootFrameViewport()->layoutViewport()); | 1319 &mainFrameView()->getRootFrameViewport()->layoutViewport()); |
| 1317 } | 1320 } |
| 1318 | 1321 |
| 1319 } // namespace | 1322 } // namespace |
| 1320 | 1323 |
| 1321 } // namespace blink | 1324 } // namespace blink |
| OLD | NEW |