Chromium Code Reviews| 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 IntRect boundsInViewport = inputElement->boundsInViewport(); |
| 1402 boundsInViewport.scale(1.f / 2); | |
|
bokan
2015/11/24 20:59:24
Please instead create an expectedBounds = bounds,
oshima
2015/11/24 23:42:10
Done.
| |
| 1402 | 1403 |
| 1403 EXPECT_POINT_EQ(IntPoint(bounds.location() - scrollDelta), | 1404 EXPECT_POINT_EQ(IntPoint(bounds.location() - scrollDelta), |
| 1404 boundsInViewport.location()); | 1405 boundsInViewport.location()); |
| 1405 EXPECT_SIZE_EQ(bounds.size(), boundsInViewport.size()); | 1406 EXPECT_SIZE_EQ(bounds.size(), boundsInViewport.size()); |
| 1406 } | 1407 } |
| 1407 | 1408 |
| 1408 // Tests that when a new frame is created, it is created with the intended | 1409 // 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). | 1410 // size (i.e. viewport at minimum scale, 100x200 / 0.5). |
| 1410 TEST_P(ParameterizedVisualViewportTest, TestMainFrameInitializationSizing) | 1411 TEST_P(ParameterizedVisualViewportTest, TestMainFrameInitializationSizing) |
| 1411 { | 1412 { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1606 webViewImpl()->handleInputEvent(pinchUpdate); | 1607 webViewImpl()->handleInputEvent(pinchUpdate); |
| 1607 | 1608 |
| 1608 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport(); | 1609 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport(); |
| 1609 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); | 1610 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| 1610 | 1611 |
| 1611 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); | 1612 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); |
| 1612 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); | 1613 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); |
| 1613 } | 1614 } |
| 1614 | 1615 |
| 1615 } // namespace | 1616 } // namespace |
| OLD | NEW |