| 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 "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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); | 1319 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); |
| 1320 pinchViewport.move(FloatPoint(0, 100)); | 1320 pinchViewport.move(FloatPoint(0, 100)); |
| 1321 | 1321 |
| 1322 EXPECT_EQ(100, pinchViewport.location().y()); | 1322 EXPECT_EQ(100, pinchViewport.location().y()); |
| 1323 | 1323 |
| 1324 webViewImpl()->resizePinchViewport(IntSize(100, 200)); | 1324 webViewImpl()->resizePinchViewport(IntSize(100, 200)); |
| 1325 | 1325 |
| 1326 EXPECT_EQ(0, pinchViewport.location().y()); | 1326 EXPECT_EQ(0, pinchViewport.location().y()); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 TEST_F(PinchViewportTest, ElementBoundsInRootViewSpaceAccountsForViewport) | 1329 TEST_F(PinchViewportTest, ElementBoundsInViewportSpaceAccountsForViewport) |
| 1330 { | 1330 { |
| 1331 initializeWithAndroidSettings(); | 1331 initializeWithAndroidSettings(); |
| 1332 | 1332 |
| 1333 webViewImpl()->resize(IntSize(500, 800)); | 1333 webViewImpl()->resize(IntSize(500, 800)); |
| 1334 | 1334 |
| 1335 registerMockedHttpURLLoad("pinch-viewport-input-field.html"); | 1335 registerMockedHttpURLLoad("pinch-viewport-input-field.html"); |
| 1336 navigateTo(m_baseURL + "pinch-viewport-input-field.html"); | 1336 navigateTo(m_baseURL + "pinch-viewport-input-field.html"); |
| 1337 | 1337 |
| 1338 webViewImpl()->setInitialFocus(false); | 1338 webViewImpl()->setInitialFocus(false); |
| 1339 Element* inputElement = webViewImpl()->focusedElement(); | 1339 Element* inputElement = webViewImpl()->focusedElement(); |
| 1340 | 1340 |
| 1341 IntRect bounds = inputElement->renderer()->absoluteBoundingBoxRect(); | 1341 IntRect bounds = inputElement->renderer()->absoluteBoundingBoxRect(); |
| 1342 | 1342 |
| 1343 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); | 1343 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); |
| 1344 IntPoint scrollDelta(250, 400); | 1344 IntPoint scrollDelta(250, 400); |
| 1345 pinchViewport.setScale(2); | 1345 pinchViewport.setScale(2); |
| 1346 pinchViewport.setLocation(scrollDelta); | 1346 pinchViewport.setLocation(scrollDelta); |
| 1347 | 1347 |
| 1348 IntRect boundsInViewport = inputElement->boundsInRootViewSpace(); | 1348 IntRect boundsInViewport = inputElement->boundsInViewportSpace(); |
| 1349 | 1349 |
| 1350 EXPECT_POINT_EQ(IntPoint(bounds.location() - scrollDelta), | 1350 EXPECT_POINT_EQ(IntPoint(bounds.location() - scrollDelta), |
| 1351 boundsInViewport.location()); | 1351 boundsInViewport.location()); |
| 1352 EXPECT_SIZE_EQ(bounds.size(), boundsInViewport.size()); | 1352 EXPECT_SIZE_EQ(bounds.size(), boundsInViewport.size()); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 // Test that the various window.scroll and document.body.scroll properties and | 1355 // Test that the various window.scroll and document.body.scroll properties and |
| 1356 // methods work unchanged from the pre-virtual viewport mode. | 1356 // methods work unchanged from the pre-virtual viewport mode. |
| 1357 TEST_F(PinchViewportTest, bodyAndWindowScrollPropertiesAccountForViewport) | 1357 TEST_F(PinchViewportTest, bodyAndWindowScrollPropertiesAccountForViewport) |
| 1358 { | 1358 { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 navigateTo(m_baseURL + "content-width-1000-min-scale.html"); | 1442 navigateTo(m_baseURL + "content-width-1000-min-scale.html"); |
| 1443 | 1443 |
| 1444 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl(); | 1444 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl(); |
| 1445 localFrame->createFrameView(); | 1445 localFrame->createFrameView(); |
| 1446 | 1446 |
| 1447 FrameView& frameView = *localFrame->frameView(); | 1447 FrameView& frameView = *localFrame->frameView(); |
| 1448 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); | 1448 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 } // namespace | 1451 } // namespace |
| OLD | NEW |