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/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // prior to the VisualViewport being attached to the layer tree. | 418 // prior to the VisualViewport being attached to the layer tree. |
419 TEST_P(ParameterizedVisualViewportTest, TestWebViewResizedBeforeAttachment) | 419 TEST_P(ParameterizedVisualViewportTest, TestWebViewResizedBeforeAttachment) |
420 { | 420 { |
421 initializeWithDesktopSettings(); | 421 initializeWithDesktopSettings(); |
422 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 422 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
423 GraphicsLayer* rootGraphicsLayer = | 423 GraphicsLayer* rootGraphicsLayer = |
424 frameView.layoutView()->compositor()->rootGraphicsLayer(); | 424 frameView.layoutView()->compositor()->rootGraphicsLayer(); |
425 | 425 |
426 // Make sure that a resize that comes in while there's no root layer is | 426 // Make sure that a resize that comes in while there's no root layer is |
427 // honoured when we attach to the layer tree. | 427 // honoured when we attach to the layer tree. |
428 webViewImpl()->setRootGraphicsLayer(nullptr); | 428 WebFrameWidget* mainFrameWidget = static_cast<WebFrameWidget*>(webViewImpl()
->mainFrame()->toWebLocalFrame()->frameWidget()); |
| 429 mainFrameWidget->setRootGraphicsLayer(nullptr); |
429 webViewImpl()->resize(IntSize(320, 240)); | 430 webViewImpl()->resize(IntSize(320, 240)); |
430 webViewImpl()->setRootGraphicsLayer(rootGraphicsLayer); | 431 mainFrameWidget->setRootGraphicsLayer(rootGraphicsLayer); |
431 | 432 |
432 navigateTo("about:blank"); | 433 navigateTo("about:blank"); |
433 webViewImpl()->updateAllLifecyclePhases(); | 434 webViewImpl()->updateAllLifecyclePhases(); |
434 | 435 |
435 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); | 436 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); |
436 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), visualViewport.containerLayer()->s
ize()); | 437 EXPECT_FLOAT_SIZE_EQ(FloatSize(320, 240), visualViewport.containerLayer()->s
ize()); |
437 } | 438 } |
438 | 439 |
439 // Make sure that the visibleRect method acurately reflects the scale and scroll
location | 440 // Make sure that the visibleRect method acurately reflects the scale and scroll
location |
440 // of the viewport. | 441 // of the viewport. |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 webViewImpl()->handleInputEvent(pinchUpdate); | 1859 webViewImpl()->handleInputEvent(pinchUpdate); |
1859 | 1860 |
1860 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1861 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
1861 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1862 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
1862 | 1863 |
1863 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1864 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
1864 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1865 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
1865 } | 1866 } |
1866 | 1867 |
1867 } // namespace | 1868 } // namespace |
OLD | NEW |