| 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/VisualViewport.h" | 7 #include "core/frame/VisualViewport.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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 webViewImpl()->setInitialFocus(false); | 1391 webViewImpl()->setInitialFocus(false); |
| 1392 Element* inputElement = webViewImpl()->focusedElement(); | 1392 Element* inputElement = webViewImpl()->focusedElement(); |
| 1393 | 1393 |
| 1394 IntRect bounds = inputElement->layoutObject()->absoluteBoundingBoxRect(); | 1394 IntRect bounds = inputElement->layoutObject()->absoluteBoundingBoxRect(); |
| 1395 | 1395 |
| 1396 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); | 1396 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport
(); |
| 1397 IntPoint scrollDelta(250, 400); | 1397 IntPoint scrollDelta(250, 400); |
| 1398 visualViewport.setScale(2); | 1398 visualViewport.setScale(2); |
| 1399 visualViewport.setLocation(scrollDelta); | 1399 visualViewport.setLocation(scrollDelta); |
| 1400 | 1400 |
| 1401 IntRect boundsInViewport = inputElement->boundsInViewportSpace(); | 1401 const IntRect boundsInViewport = inputElement->boundsInViewport(); |
| 1402 IntRect expectedBounds = bounds; |
| 1403 expectedBounds.scale(2.f); |
| 1404 IntPoint expectedScrollDelta = scrollDelta; |
| 1405 expectedScrollDelta.scale(2.f, 2.f); |
| 1402 | 1406 |
| 1403 EXPECT_POINT_EQ(IntPoint(bounds.location() - scrollDelta), | 1407 EXPECT_POINT_EQ(IntPoint(expectedBounds.location() - expectedScrollDelta), |
| 1404 boundsInViewport.location()); | 1408 boundsInViewport.location()); |
| 1405 EXPECT_SIZE_EQ(bounds.size(), boundsInViewport.size()); | 1409 EXPECT_SIZE_EQ(expectedBounds.size(), boundsInViewport.size()); |
| 1406 } | 1410 } |
| 1407 | 1411 |
| 1408 // Tests that when a new frame is created, it is created with the intended | 1412 // Tests that when a new frame is created, it is created with the intended |
| 1409 // size (i.e. viewport at minimum scale, 100x200 / 0.5). | 1413 // size (i.e. viewport at minimum scale, 100x200 / 0.5). |
| 1410 TEST_P(ParameterizedVisualViewportTest, TestMainFrameInitializationSizing) | 1414 TEST_P(ParameterizedVisualViewportTest, TestMainFrameInitializationSizing) |
| 1411 { | 1415 { |
| 1412 initializeWithAndroidSettings(); | 1416 initializeWithAndroidSettings(); |
| 1413 | 1417 |
| 1414 webViewImpl()->resize(IntSize(100, 200)); | 1418 webViewImpl()->resize(IntSize(100, 200)); |
| 1415 | 1419 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 webViewImpl()->handleInputEvent(pinchUpdate); | 1612 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1609 | 1613 |
| 1610 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); | 1614 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi
ewport(); |
| 1611 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1615 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1612 | 1616 |
| 1613 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1617 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1614 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1618 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1615 } | 1619 } |
| 1616 | 1620 |
| 1617 } // namespace | 1621 } // namespace |
| OLD | NEW |