| 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 | 902 |
| 903 FrameView* frameView = webViewImpl()->mainFrameImpl()->frameView(); | 903 FrameView* frameView = webViewImpl()->mainFrameImpl()->frameView(); |
| 904 frameView->layoutViewportScrollableArea()->setScrollPosition(IntPoint(0, 100
0), ProgrammaticScroll); | 904 frameView->layoutViewportScrollableArea()->setScrollPosition(IntPoint(0, 100
0), ProgrammaticScroll); |
| 905 | 905 |
| 906 EXPECT_SIZE_EQ(IntSize(1000, 1000), frameView->frameRect().size()); | 906 EXPECT_SIZE_EQ(IntSize(1000, 1000), frameView->frameRect().size()); |
| 907 | 907 |
| 908 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); | 908 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); |
| 909 visualViewport.setScale(2); | 909 visualViewport.setScale(2); |
| 910 visualViewport.setLocation(FloatPoint(350, 350)); | 910 visualViewport.setLocation(FloatPoint(350, 350)); |
| 911 | 911 |
| 912 RefPtrWillBePersistent<HistoryItem> firstItem = webViewImpl()->mainFrameImpl
()->frame()->loader().currentItem(); | 912 Persistent<HistoryItem> firstItem = webViewImpl()->mainFrameImpl()->frame()-
>loader().currentItem(); |
| 913 EXPECT_POINT_EQ(IntPoint(0, 1000), firstItem->scrollPoint()); | 913 EXPECT_POINT_EQ(IntPoint(0, 1000), firstItem->scrollPoint()); |
| 914 | 914 |
| 915 // Now navigate to a page which causes a smaller frameView. Make sure that | 915 // Now navigate to a page which causes a smaller frameView. Make sure that |
| 916 // navigating doesn't cause the history item to set a new scroll offset | 916 // navigating doesn't cause the history item to set a new scroll offset |
| 917 // before the item was replaced. | 917 // before the item was replaced. |
| 918 navigateTo("about:blank"); | 918 navigateTo("about:blank"); |
| 919 frameView = webViewImpl()->mainFrameImpl()->frameView(); | 919 frameView = webViewImpl()->mainFrameImpl()->frameView(); |
| 920 | 920 |
| 921 EXPECT_NE(firstItem, webViewImpl()->mainFrameImpl()->frame()->loader().curre
ntItem()); | 921 EXPECT_NE(firstItem, webViewImpl()->mainFrameImpl()->frame()->loader().curre
ntItem()); |
| 922 EXPECT_LT(frameView->frameRect().size().width(), 1000); | 922 EXPECT_LT(frameView->frameRect().size().width(), 1000); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 webViewImpl()->handleInputEvent(pinchUpdate); | 1615 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1616 | 1616 |
| 1617 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1617 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1618 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1618 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1619 | 1619 |
| 1620 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1620 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1621 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1621 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1622 } | 1622 } |
| 1623 | 1623 |
| 1624 } // namespace | 1624 } // namespace |
| OLD | NEW |