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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/frame/PinchViewport.h" | 7 #include "core/frame/PinchViewport.h" |
8 | 8 |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 TEST_F(PinchViewportTest, TestMainFrameInitializationSizing) | 1540 TEST_F(PinchViewportTest, TestMainFrameInitializationSizing) |
1541 { | 1541 { |
1542 initializeWithAndroidSettings(); | 1542 initializeWithAndroidSettings(); |
1543 | 1543 |
1544 webViewImpl()->resize(IntSize(100, 200)); | 1544 webViewImpl()->resize(IntSize(100, 200)); |
1545 | 1545 |
1546 registerMockedHttpURLLoad("content-width-1000-min-scale.html"); | 1546 registerMockedHttpURLLoad("content-width-1000-min-scale.html"); |
1547 navigateTo(m_baseURL + "content-width-1000-min-scale.html"); | 1547 navigateTo(m_baseURL + "content-width-1000-min-scale.html"); |
1548 | 1548 |
1549 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl(); | 1549 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl(); |
1550 // The prepareForDestruction() and prepareForDetach() calls are a hack to | |
1551 // prevent createView() from violating invariants about frame state during | |
1552 // navigation/detach. | |
1553 localFrame->frame()->document()->prepareForDestruction(); | |
1554 localFrame->createFrameView(); | 1550 localFrame->createFrameView(); |
1555 | 1551 |
1556 FrameView& frameView = *localFrame->frameView(); | 1552 FrameView& frameView = *localFrame->frameView(); |
1557 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); | 1553 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); |
1558 frameView.prepareForDetach(); | |
1559 } | 1554 } |
1560 | 1555 |
1561 // Tests that the maximum scroll offset of the viewport can be fractional. | 1556 // Tests that the maximum scroll offset of the viewport can be fractional. |
1562 TEST_F(PinchViewportTest, FractionalMaxScrollOffset) | 1557 TEST_F(PinchViewportTest, FractionalMaxScrollOffset) |
1563 { | 1558 { |
1564 initializeWithDesktopSettings(); | 1559 initializeWithDesktopSettings(); |
1565 webViewImpl()->resize(IntSize(101, 201)); | 1560 webViewImpl()->resize(IntSize(101, 201)); |
1566 navigateTo("about:blank"); | 1561 navigateTo("about:blank"); |
1567 | 1562 |
1568 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); | 1563 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo
rt(FloatPoint(50.5, 62.4))); | 1666 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo
rt(FloatPoint(50.5, 62.4))); |
1672 | 1667 |
1673 | 1668 |
1674 // Scrolling the main frame should have no effect. | 1669 // Scrolling the main frame should have no effect. |
1675 frameView.scrollTo(DoublePoint(100, 120)); | 1670 frameView.scrollTo(DoublePoint(100, 120)); |
1676 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(
FloatPoint(80, 100))); | 1671 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame(
FloatPoint(80, 100))); |
1677 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport
(FloatPoint(50, 62))); | 1672 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport
(FloatPoint(50, 62))); |
1678 } | 1673 } |
1679 | 1674 |
1680 } // namespace | 1675 } // namespace |
OLD | NEW |