Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: Source/web/tests/PinchViewportTest.cpp

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 webViewImpl()->setPageScaleFactor(2); 1629 webViewImpl()->setPageScaleFactor(2);
1630 webViewImpl()->setPinchViewportOffset(WebFloatPoint(200, 230)); 1630 webViewImpl()->setPinchViewportOffset(WebFloatPoint(200, 230));
1631 frameView.setScrollPosition(DoublePoint(400, 1100)); 1631 frameView.setScrollPosition(DoublePoint(400, 1100));
1632 1632
1633 // Because of where the pinch viewport is located, this should hit the botto m right 1633 // Because of where the pinch viewport is located, this should hit the botto m right
1634 // target (target 4). 1634 // target (target 4).
1635 WebAXObject hitNode = webDoc.accessibilityObject().hitTest(WebPoint(154, 165 )); 1635 WebAXObject hitNode = webDoc.accessibilityObject().hitTest(WebPoint(154, 165 ));
1636 EXPECT_EQ(std::string("Target4"), hitNode.title().utf8()); 1636 EXPECT_EQ(std::string("Target4"), hitNode.title().utf8());
1637 } 1637 }
1638 1638
1639 // Tests that the maximum scroll offset of the viewport can be fractional.
1640 TEST_F(PinchViewportTest, TestCoordinateTransforms)
1641 {
1642 initializeWithAndroidSettings();
1643 webViewImpl()->resize(IntSize(800, 600));
1644 registerMockedHttpURLLoad("content-width-1000.html");
1645 navigateTo(m_baseURL + "content-width-1000.html");
1646
1647 PinchViewport& pinchViewport = webViewImpl()->page()->frameHost().pinchViewp ort();
1648 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1649
1650 // At scale = 1 the transform should be a no-op.
1651 pinchViewport.setScale(1);
1652 EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.viewportToRootFram e(FloatPoint(314, 273)));
1653 EXPECT_FLOAT_POINT_EQ(FloatPoint(314, 273), pinchViewport.rootFrameToViewpor t(FloatPoint(314, 273)));
1654
1655 // At scale = 2.
1656 pinchViewport.setScale(2);
1657 EXPECT_FLOAT_POINT_EQ(FloatPoint(55, 75), pinchViewport.viewportToRootFrame( FloatPoint(110, 150)));
1658 EXPECT_FLOAT_POINT_EQ(FloatPoint(110, 150), pinchViewport.rootFrameToViewpor t(FloatPoint(55, 75)));
1659
1660 // At scale = 2 and with the pinch viewport offset.
1661 pinchViewport.setLocation(FloatPoint(10, 12));
1662 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100)));
1663 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62)));
1664
1665 // Test points that will cause non-integer values.
1666 EXPECT_FLOAT_POINT_EQ(FloatPoint(50.5, 62.4), pinchViewport.viewportToRootFr ame(FloatPoint(81, 100.8)));
1667 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4)));
1668
1669
1670 // Scrolling the main frame should have no effect.
1671 frameView.scrollTo(DoublePoint(100, 120));
1672 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100)));
1673 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62)));
1674 }
1675
1639 } // namespace 1676 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698