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

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2917343004: Move LoadHTMLString method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Created 3 years, 6 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
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 "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/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/LocalFrameView.h" 10 #include "core/frame/LocalFrameView.h"
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 int page_width = 640; 2126 int page_width = 640;
2127 int page_height = 480; 2127 int page_height = 480;
2128 float browser_controls_height = 50.0f; 2128 float browser_controls_height = 50.0f;
2129 int smallest_height = page_height - browser_controls_height; 2129 int smallest_height = page_height - browser_controls_height;
2130 2130
2131 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height), 2131 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height),
2132 browser_controls_height, false); 2132 browser_controls_height, false);
2133 2133
2134 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); 2134 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png");
2135 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 2135 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
2136 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), 2136 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(),
2137 "<!DOCTYPE html>" 2137 "<!DOCTYPE html>"
2138 "<style>" 2138 "<style>"
2139 " body {" 2139 " body {"
2140 " background: url('foo.png');" 2140 " background: url('foo.png');"
2141 " background-attachment: fixed;" 2141 " background-attachment: fixed;"
2142 " background-size: cover;" 2142 " background-size: cover;"
2143 " background-repeat: no-repeat;" 2143 " background-repeat: no-repeat;"
2144 " }" 2144 " }"
2145 " div { height:1000px; width: 200px; }" 2145 " div { height:1000px; width: 200px; }"
2146 "</style>" 2146 "</style>"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 int page_width = 640; 2208 int page_width = 640;
2209 int page_height = 480; 2209 int page_height = 480;
2210 float browser_controls_height = 50.0f; 2210 float browser_controls_height = 50.0f;
2211 int smallest_height = page_height - browser_controls_height; 2211 int smallest_height = page_height - browser_controls_height;
2212 2212
2213 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height), 2213 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height),
2214 browser_controls_height, false); 2214 browser_controls_height, false);
2215 2215
2216 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); 2216 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png");
2217 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 2217 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
2218 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), 2218 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(),
2219 "<!DOCTYPE html>" 2219 "<!DOCTYPE html>"
2220 "<style>" 2220 "<style>"
2221 " body {" 2221 " body {"
2222 " margin: 0px;" 2222 " margin: 0px;"
2223 " background: url('foo.png');" 2223 " background: url('foo.png');"
2224 " background-attachment: fixed;" 2224 " background-attachment: fixed;"
2225 " background-size: cover;" 2225 " background-size: cover;"
2226 " background-repeat: no-repeat;" 2226 " background-repeat: no-repeat;"
2227 " }" 2227 " }"
2228 " div { height:1000px; width: 200px; }" 2228 " div { height:1000px; width: 200px; }"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 int page_height = 480; 2317 int page_height = 480;
2318 float browser_controls_height = 50.0f; 2318 float browser_controls_height = 50.0f;
2319 int smallest_height = page_height - browser_controls_height; 2319 int smallest_height = page_height - browser_controls_height;
2320 2320
2321 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height), 2321 web_view_impl->ResizeWithBrowserControls(WebSize(page_width, page_height),
2322 browser_controls_height, false); 2322 browser_controls_height, false);
2323 2323
2324 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png"); 2324 RegisterMockedHttpURLLoad("http://example.com/foo.png", "white-1x1.png");
2325 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 2325 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
2326 // This time the background is the default attachment. 2326 // This time the background is the default attachment.
2327 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrame(), 2327 FrameTestHelpers::LoadHTMLString(web_view_impl->MainFrameImpl(),
2328 "<!DOCTYPE html>" 2328 "<!DOCTYPE html>"
2329 "<style>" 2329 "<style>"
2330 " body {" 2330 " body {"
2331 " margin: 0px;" 2331 " margin: 0px;"
2332 " background: url('foo.png');" 2332 " background: url('foo.png');"
2333 " background-size: cover;" 2333 " background-size: cover;"
2334 " background-repeat: no-repeat;" 2334 " background-repeat: no-repeat;"
2335 " }" 2335 " }"
2336 " div { height:1000px; width: 200px; }" 2336 " div { height:1000px; width: 200px; }"
2337 "</style>" 2337 "</style>"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 } 2439 }
2440 2440
2441 // Make sure we don't crash when the visual viewport's height is 0. This can 2441 // Make sure we don't crash when the visual viewport's height is 0. This can
2442 // happen transiently in autoresize mode and cause a crash. This test passes if 2442 // happen transiently in autoresize mode and cause a crash. This test passes if
2443 // it doesn't crash. 2443 // it doesn't crash.
2444 TEST_P(VisualViewportTest, AutoResizeNoHeightUsesMinimumHeight) { 2444 TEST_P(VisualViewportTest, AutoResizeNoHeightUsesMinimumHeight) {
2445 InitializeWithDesktopSettings(); 2445 InitializeWithDesktopSettings();
2446 WebViewImpl()->ResizeWithBrowserControls(WebSize(0, 0), 0, false); 2446 WebViewImpl()->ResizeWithBrowserControls(WebSize(0, 0), 0, false);
2447 WebViewImpl()->EnableAutoResizeMode(WebSize(25, 25), WebSize(100, 100)); 2447 WebViewImpl()->EnableAutoResizeMode(WebSize(25, 25), WebSize(100, 100));
2448 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/"); 2448 WebURL base_url = URLTestHelpers::ToKURL("http://example.com/");
2449 FrameTestHelpers::LoadHTMLString(WebViewImpl()->MainFrame(), 2449 FrameTestHelpers::LoadHTMLString(WebViewImpl()->MainFrameImpl(),
2450 "<!DOCTYPE html>" 2450 "<!DOCTYPE html>"
2451 "<style>" 2451 "<style>"
2452 " body {" 2452 " body {"
2453 " margin: 0px;" 2453 " margin: 0px;"
2454 " }" 2454 " }"
2455 " div { height:110vh; width: 110vw; }" 2455 " div { height:110vh; width: 110vw; }"
2456 "</style>" 2456 "</style>"
2457 "<div></div>", 2457 "<div></div>",
2458 base_url); 2458 base_url);
2459 } 2459 }
2460 2460
2461 } // namespace 2461 } // namespace
2462 } // namespace blink 2462 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698