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" |
11 #include "core/frame/TopControls.h" | 11 #include "core/frame/TopControls.h" |
12 #include "core/html/HTMLBodyElement.h" | 12 #include "core/html/HTMLBodyElement.h" |
13 #include "core/html/HTMLElement.h" | 13 #include "core/html/HTMLElement.h" |
14 #include "core/input/EventHandler.h" | 14 #include "core/input/EventHandler.h" |
15 #include "core/layout/LayoutObject.h" | 15 #include "core/layout/LayoutObject.h" |
16 #include "core/layout/api/LayoutViewItem.h" | 16 #include "core/layout/api/LayoutViewItem.h" |
17 #include "core/layout/compositing/PaintLayerCompositor.h" | 17 #include "core/layout/compositing/PaintLayerCompositor.h" |
18 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
19 #include "platform/PlatformGestureEvent.h" | 19 #include "platform/PlatformGestureEvent.h" |
20 #include "platform/geometry/DoublePoint.h" | 20 #include "platform/geometry/DoublePoint.h" |
21 #include "platform/geometry/DoubleRect.h" | 21 #include "platform/geometry/DoubleRect.h" |
| 22 #include "platform/graphics/CompositorElementId.h" |
22 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 23 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
23 #include "platform/testing/URLTestHelpers.h" | 24 #include "platform/testing/URLTestHelpers.h" |
24 #include "public/platform/Platform.h" | 25 #include "public/platform/Platform.h" |
25 #include "public/platform/WebCachePolicy.h" | 26 #include "public/platform/WebCachePolicy.h" |
26 #include "public/platform/WebLayerTreeView.h" | 27 #include "public/platform/WebLayerTreeView.h" |
27 #include "public/platform/WebURLLoaderMockFactory.h" | 28 #include "public/platform/WebURLLoaderMockFactory.h" |
28 #include "public/web/WebCache.h" | 29 #include "public/web/WebCache.h" |
29 #include "public/web/WebContextMenuData.h" | 30 #include "public/web/WebContextMenuData.h" |
30 #include "public/web/WebDocument.h" | 31 #include "public/web/WebDocument.h" |
31 #include "public/web/WebFrameClient.h" | 32 #include "public/web/WebFrameClient.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 EXPECT_SIZE_EQ(FloatSize(50, 60), visualViewport.scrollOffset()); | 777 EXPECT_SIZE_EQ(FloatSize(50, 60), visualViewport.scrollOffset()); |
777 EXPECT_EQ(2, visualViewport.scale()); | 778 EXPECT_EQ(2, visualViewport.scale()); |
778 | 779 |
779 // Navigate again, this time the FrameView should be smaller. | 780 // Navigate again, this time the FrameView should be smaller. |
780 registerMockedHttpURLLoad("viewport-device-width.html"); | 781 registerMockedHttpURLLoad("viewport-device-width.html"); |
781 navigateTo(m_baseURL + "viewport-device-width.html"); | 782 navigateTo(m_baseURL + "viewport-device-width.html"); |
782 | 783 |
783 // Ensure the scroll layer matches the frame view's size. | 784 // Ensure the scroll layer matches the frame view's size. |
784 EXPECT_SIZE_EQ(FloatSize(320, 240), visualViewport.scrollLayer()->size()); | 785 EXPECT_SIZE_EQ(FloatSize(320, 240), visualViewport.scrollLayer()->size()); |
785 | 786 |
| 787 EXPECT_EQ(static_cast<int>(CompositorSubElementId::Viewport), |
| 788 visualViewport.scrollLayer()->elementId().secondaryId); |
| 789 |
786 // Ensure the location and scale were reset. | 790 // Ensure the location and scale were reset. |
787 EXPECT_SIZE_EQ(FloatSize(), visualViewport.scrollOffset()); | 791 EXPECT_SIZE_EQ(FloatSize(), visualViewport.scrollOffset()); |
788 EXPECT_EQ(1, visualViewport.scale()); | 792 EXPECT_EQ(1, visualViewport.scale()); |
789 } | 793 } |
790 | 794 |
791 // The main FrameView's size should be set such that its the size of the visual | 795 // The main FrameView's size should be set such that its the size of the visual |
792 // viewport at minimum scale. Test that the FrameView is appropriately sized in | 796 // viewport at minimum scale. Test that the FrameView is appropriately sized in |
793 // the presence of a viewport <meta> tag. | 797 // the presence of a viewport <meta> tag. |
794 TEST_P(ParameterizedVisualViewportTest, | 798 TEST_P(ParameterizedVisualViewportTest, |
795 TestFrameViewSizedToViewportMetaMinimumScale) { | 799 TestFrameViewSizedToViewportMetaMinimumScale) { |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 webViewImpl()->resize(IntSize(600, 800)); | 2069 webViewImpl()->resize(IntSize(600, 800)); |
2066 | 2070 |
2067 EXPECT_SIZE_EQ(ScrollOffset(), | 2071 EXPECT_SIZE_EQ(ScrollOffset(), |
2068 frameView.layoutViewportScrollableArea()->scrollOffset()); | 2072 frameView.layoutViewportScrollableArea()->scrollOffset()); |
2069 EXPECT_EQ(600, scroller->scrollTop()); | 2073 EXPECT_EQ(600, scroller->scrollTop()); |
2070 | 2074 |
2071 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); | 2075 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); |
2072 } | 2076 } |
2073 | 2077 |
2074 } // namespace | 2078 } // namespace |
OLD | NEW |