| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 | 891 |
| 892 FrameView* frameView = webViewImpl()->mainFrameImpl()->frameView(); | 892 FrameView* frameView = webViewImpl()->mainFrameImpl()->frameView(); |
| 893 frameView->layoutViewportScrollableArea()->setScrollPosition(IntPoint(0, 100
0), ProgrammaticScroll); | 893 frameView->layoutViewportScrollableArea()->setScrollPosition(IntPoint(0, 100
0), ProgrammaticScroll); |
| 894 | 894 |
| 895 EXPECT_SIZE_EQ(IntSize(1000, 1000), frameView->frameRect().size()); | 895 EXPECT_SIZE_EQ(IntSize(1000, 1000), frameView->frameRect().size()); |
| 896 | 896 |
| 897 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); | 897 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); |
| 898 visualViewport.setScale(2); | 898 visualViewport.setScale(2); |
| 899 visualViewport.setLocation(FloatPoint(350, 350)); | 899 visualViewport.setLocation(FloatPoint(350, 350)); |
| 900 | 900 |
| 901 RefPtrWillBePersistent<HistoryItem> firstItem = webViewImpl()->mainFrameImpl
()->frame()->loader().currentItem(); | 901 Persistent<HistoryItem> firstItem = webViewImpl()->mainFrameImpl()->frame()-
>loader().currentItem(); |
| 902 EXPECT_POINT_EQ(IntPoint(0, 1000), firstItem->scrollPoint()); | 902 EXPECT_POINT_EQ(IntPoint(0, 1000), firstItem->scrollPoint()); |
| 903 | 903 |
| 904 // Now navigate to a page which causes a smaller frameView. Make sure that | 904 // Now navigate to a page which causes a smaller frameView. Make sure that |
| 905 // navigating doesn't cause the history item to set a new scroll offset | 905 // navigating doesn't cause the history item to set a new scroll offset |
| 906 // before the item was replaced. | 906 // before the item was replaced. |
| 907 navigateTo("about:blank"); | 907 navigateTo("about:blank"); |
| 908 frameView = webViewImpl()->mainFrameImpl()->frameView(); | 908 frameView = webViewImpl()->mainFrameImpl()->frameView(); |
| 909 | 909 |
| 910 EXPECT_NE(firstItem, webViewImpl()->mainFrameImpl()->frame()->loader().curre
ntItem()); | 910 EXPECT_NE(firstItem, webViewImpl()->mainFrameImpl()->frame()->loader().curre
ntItem()); |
| 911 EXPECT_LT(frameView->frameRect().size().width(), 1000); | 911 EXPECT_LT(frameView->frameRect().size().width(), 1000); |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 webViewImpl()->handleInputEvent(pinchUpdate); | 1740 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1741 | 1741 |
| 1742 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1742 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1743 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1743 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1744 | 1744 |
| 1745 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1745 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1746 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1746 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 } // namespace | 1749 } // namespace |
| OLD | NEW |