OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/VisualViewport.h" | 5 #include "core/frame/VisualViewport.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/BrowserControls.h" | 8 #include "core/frame/BrowserControls.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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 EXPECT_SIZE_EQ(ScrollOffset(0, 0), frame()->view()->getScrollOffset()); | 428 EXPECT_SIZE_EQ(ScrollOffset(0, 0), frame()->view()->getScrollOffset()); |
429 EXPECT_FLOAT_SIZE_EQ(FloatSize(150, 0), visualViewport.getScrollOffset()); | 429 EXPECT_FLOAT_SIZE_EQ(FloatSize(150, 0), visualViewport.getScrollOffset()); |
430 } | 430 } |
431 | 431 |
432 // Test that the container layer gets sized properly if the WebView is resized | 432 // Test that the container layer gets sized properly if the WebView is resized |
433 // prior to the VisualViewport being attached to the layer tree. | 433 // prior to the VisualViewport being attached to the layer tree. |
434 TEST_P(VisualViewportTest, TestWebViewResizedBeforeAttachment) { | 434 TEST_P(VisualViewportTest, TestWebViewResizedBeforeAttachment) { |
435 initializeWithDesktopSettings(); | 435 initializeWithDesktopSettings(); |
436 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 436 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
437 GraphicsLayer* rootGraphicsLayer = | |
438 frameView.layoutViewItem().compositor()->rootGraphicsLayer(); | |
439 | 437 |
440 // Make sure that a resize that comes in while there's no root layer is | 438 // Make sure that a resize that comes in while there's no root layer is |
441 // honoured when we attach to the layer tree. | 439 // honoured when we attach to the layer tree. |
442 WebFrameWidgetBase* mainFrameWidget = | 440 WebFrameWidgetBase* mainFrameWidget = |
443 webViewImpl()->mainFrameImpl()->frameWidget(); | 441 webViewImpl()->mainFrameImpl()->frameWidget(); |
444 mainFrameWidget->setRootGraphicsLayer(nullptr); | 442 mainFrameWidget->setRootGraphicsLayer(nullptr); |
445 webViewImpl()->resize(IntSize(320, 240)); | 443 webViewImpl()->resize(IntSize(320, 240)); |
446 mainFrameWidget->setRootGraphicsLayer(rootGraphicsLayer); | |
447 | 444 |
448 navigateTo("about:blank"); | 445 navigateTo("about:blank"); |
449 webViewImpl()->updateAllLifecyclePhases(); | 446 webViewImpl()->updateAllLifecyclePhases(); |
| 447 mainFrameWidget->setRootGraphicsLayer( |
| 448 frameView.layoutViewItem().compositor()->rootGraphicsLayer()); |
450 | 449 |
451 VisualViewport& visualViewport = | 450 VisualViewport& visualViewport = |
452 frame()->page()->frameHost().visualViewport(); | 451 frame()->page()->frameHost().visualViewport(); |
453 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), | 452 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), |
454 visualViewport.containerLayer()->size()); | 453 visualViewport.containerLayer()->size()); |
455 } | 454 } |
456 | 455 |
457 // Make sure that the visibleRect method acurately reflects the scale and scroll | 456 // Make sure that the visibleRect method acurately reflects the scale and scroll |
458 // location of the viewport. | 457 // location of the viewport. |
459 TEST_P(VisualViewportTest, TestVisibleRect) { | 458 TEST_P(VisualViewportTest, TestVisibleRect) { |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 " body {" | 2471 " body {" |
2473 " margin: 0px;" | 2472 " margin: 0px;" |
2474 " }" | 2473 " }" |
2475 " div { height:110vh; width: 110vw; }" | 2474 " div { height:110vh; width: 110vw; }" |
2476 "</style>" | 2475 "</style>" |
2477 "<div></div>", | 2476 "<div></div>", |
2478 baseURL); | 2477 baseURL); |
2479 } | 2478 } |
2480 | 2479 |
2481 } // namespace | 2480 } // namespace |
OLD | NEW |