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 "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/BrowserControls.h" | 8 #include "core/frame/BrowserControls.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 webViewImpl()->resize(IntSize(200, 300)); | 920 webViewImpl()->resize(IntSize(200, 300)); |
| 921 | 921 |
| 922 registerMockedHttpURLLoad("200-by-300.html"); | 922 registerMockedHttpURLLoad("200-by-300.html"); |
| 923 | 923 |
| 924 WebHistoryItem item; | 924 WebHistoryItem item; |
| 925 item.initialize(); | 925 item.initialize(); |
| 926 WebURL destinationURL(URLTestHelpers::toKURL(m_baseURL + "200-by-300.html")); | 926 WebURL destinationURL(URLTestHelpers::toKURL(m_baseURL + "200-by-300.html")); |
| 927 item.setURLString(destinationURL.string()); | 927 item.setURLString(destinationURL.string()); |
| 928 item.setVisualViewportScrollOffset(WebFloatPoint(100, 120)); | 928 item.setVisualViewportScrollOffset(WebFloatPoint(100, 120)); |
| 929 item.setPageScaleFactor(2); | 929 item.setPageScaleFactor(2); |
| 930 item.setDidSaveScrollOrScaleState(true); | |
|
majidvp
2017/02/15 17:37:32
and here.
| |
| 930 | 931 |
| 931 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, | 932 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, |
| 932 WebHistoryDifferentDocumentLoad, | 933 WebHistoryDifferentDocumentLoad, |
| 933 WebCachePolicy::UseProtocolCachePolicy); | 934 WebCachePolicy::UseProtocolCachePolicy); |
| 934 | 935 |
| 935 VisualViewport& visualViewport = | 936 VisualViewport& visualViewport = |
| 936 frame()->page()->frameHost().visualViewport(); | 937 frame()->page()->frameHost().visualViewport(); |
| 937 EXPECT_EQ(2, visualViewport.scale()); | 938 EXPECT_EQ(2, visualViewport.scale()); |
| 938 | 939 |
| 939 EXPECT_FLOAT_POINT_EQ(FloatPoint(100, 120), | 940 EXPECT_FLOAT_POINT_EQ(FloatPoint(100, 120), |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 952 WebHistoryItem item; | 953 WebHistoryItem item; |
| 953 item.initialize(); | 954 item.initialize(); |
| 954 WebURL destinationURL( | 955 WebURL destinationURL( |
| 955 URLTestHelpers::toKURL(m_baseURL + "200-by-300-viewport.html")); | 956 URLTestHelpers::toKURL(m_baseURL + "200-by-300-viewport.html")); |
| 956 item.setURLString(destinationURL.string()); | 957 item.setURLString(destinationURL.string()); |
| 957 // (-1, -1) will be used if the HistoryItem is an older version prior to | 958 // (-1, -1) will be used if the HistoryItem is an older version prior to |
| 958 // having visual viewport scroll offset. | 959 // having visual viewport scroll offset. |
| 959 item.setVisualViewportScrollOffset(WebFloatPoint(-1, -1)); | 960 item.setVisualViewportScrollOffset(WebFloatPoint(-1, -1)); |
| 960 item.setScrollOffset(WebPoint(120, 180)); | 961 item.setScrollOffset(WebPoint(120, 180)); |
| 961 item.setPageScaleFactor(2); | 962 item.setPageScaleFactor(2); |
| 963 item.setDidSaveScrollOrScaleState(true); | |
|
majidvp
2017/02/15 17:37:32
and here.
| |
| 962 | 964 |
| 963 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, | 965 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, |
| 964 WebHistoryDifferentDocumentLoad, | 966 WebHistoryDifferentDocumentLoad, |
| 965 WebCachePolicy::UseProtocolCachePolicy); | 967 WebCachePolicy::UseProtocolCachePolicy); |
| 966 | 968 |
| 967 VisualViewport& visualViewport = | 969 VisualViewport& visualViewport = |
| 968 frame()->page()->frameHost().visualViewport(); | 970 frame()->page()->frameHost().visualViewport(); |
| 969 EXPECT_EQ(2, visualViewport.scale()); | 971 EXPECT_EQ(2, visualViewport.scale()); |
| 970 EXPECT_SIZE_EQ( | 972 EXPECT_SIZE_EQ( |
| 971 ScrollOffset(100, 150), | 973 ScrollOffset(100, 150), |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2472 " body {" | 2474 " body {" |
| 2473 " margin: 0px;" | 2475 " margin: 0px;" |
| 2474 " }" | 2476 " }" |
| 2475 " div { height:110vh; width: 110vw; }" | 2477 " div { height:110vh; width: 110vw; }" |
| 2476 "</style>" | 2478 "</style>" |
| 2477 "<div></div>", | 2479 "<div></div>", |
| 2478 baseURL); | 2480 baseURL); |
| 2479 } | 2481 } |
| 2480 | 2482 |
| 2481 } // namespace | 2483 } // namespace |
| OLD | NEW |