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/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 EXPECT_SIZE_EQ(FloatSize(50, 60), visual_viewport.GetScrollOffset()); | 774 EXPECT_SIZE_EQ(FloatSize(50, 60), visual_viewport.GetScrollOffset()); |
775 EXPECT_EQ(2, visual_viewport.Scale()); | 775 EXPECT_EQ(2, visual_viewport.Scale()); |
776 | 776 |
777 // Navigate again, this time the FrameView should be smaller. | 777 // Navigate again, this time the FrameView should be smaller. |
778 RegisterMockedHttpURLLoad("viewport-device-width.html"); | 778 RegisterMockedHttpURLLoad("viewport-device-width.html"); |
779 NavigateTo(base_url_ + "viewport-device-width.html"); | 779 NavigateTo(base_url_ + "viewport-device-width.html"); |
780 | 780 |
781 // Ensure the scroll layer matches the frame view's size. | 781 // Ensure the scroll layer matches the frame view's size. |
782 EXPECT_SIZE_EQ(FloatSize(320, 240), visual_viewport.ScrollLayer()->Size()); | 782 EXPECT_SIZE_EQ(FloatSize(320, 240), visual_viewport.ScrollLayer()->Size()); |
783 | 783 |
784 EXPECT_EQ(static_cast<int>(CompositorSubElementId::kViewport), | 784 EXPECT_EQ(CompositorSubElementId::kViewport, |
785 visual_viewport.ScrollLayer()->GetElementId().secondaryId); | 785 SubElementIdFromCompositorElementId( |
| 786 visual_viewport.ScrollLayer()->GetElementId())); |
786 | 787 |
787 // Ensure the location and scale were reset. | 788 // Ensure the location and scale were reset. |
788 EXPECT_SIZE_EQ(FloatSize(), visual_viewport.GetScrollOffset()); | 789 EXPECT_SIZE_EQ(FloatSize(), visual_viewport.GetScrollOffset()); |
789 EXPECT_EQ(1, visual_viewport.Scale()); | 790 EXPECT_EQ(1, visual_viewport.Scale()); |
790 } | 791 } |
791 | 792 |
792 // The main FrameView's size should be set such that its the size of the visual | 793 // The main FrameView's size should be set such that its the size of the visual |
793 // viewport at minimum scale. Test that the FrameView is appropriately sized in | 794 // viewport at minimum scale. Test that the FrameView is appropriately sized in |
794 // the presence of a viewport <meta> tag. | 795 // the presence of a viewport <meta> tag. |
795 TEST_P(VisualViewportTest, TestFrameViewSizedToViewportMetaMinimumScale) { | 796 TEST_P(VisualViewportTest, TestFrameViewSizedToViewportMetaMinimumScale) { |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 " margin: 0px;" | 2455 " margin: 0px;" |
2455 " }" | 2456 " }" |
2456 " div { height:110vh; width: 110vw; }" | 2457 " div { height:110vh; width: 110vw; }" |
2457 "</style>" | 2458 "</style>" |
2458 "<div></div>", | 2459 "<div></div>", |
2459 base_url); | 2460 base_url); |
2460 } | 2461 } |
2461 | 2462 |
2462 } // namespace | 2463 } // namespace |
2463 } // namespace blink | 2464 } // namespace blink |
OLD | NEW |