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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2730573003: Moved FrameHost::m_visualViewport to Page (Closed)
Patch Set: Fixed some compile errors on mac and android Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 marginLeft); 2253 marginLeft);
2254 } 2254 }
2255 2255
2256 float Internals::pageScaleFactor(ExceptionState& exceptionState) { 2256 float Internals::pageScaleFactor(ExceptionState& exceptionState) {
2257 if (!m_document->page()) { 2257 if (!m_document->page()) {
2258 exceptionState.throwDOMException( 2258 exceptionState.throwDOMException(
2259 InvalidAccessError, "The document's page cannot be retrieved."); 2259 InvalidAccessError, "The document's page cannot be retrieved.");
2260 return 0; 2260 return 0;
2261 } 2261 }
2262 Page* page = m_document->page(); 2262 Page* page = m_document->page();
2263 return page->frameHost().visualViewport().pageScale(); 2263 return page->visualViewport().pageScale();
2264 } 2264 }
2265 2265
2266 void Internals::setPageScaleFactor(float scaleFactor, 2266 void Internals::setPageScaleFactor(float scaleFactor,
2267 ExceptionState& exceptionState) { 2267 ExceptionState& exceptionState) {
2268 if (scaleFactor <= 0) 2268 if (scaleFactor <= 0)
2269 return; 2269 return;
2270 if (!m_document->page()) { 2270 if (!m_document->page()) {
2271 exceptionState.throwDOMException( 2271 exceptionState.throwDOMException(
2272 InvalidAccessError, "The document's page cannot be retrieved."); 2272 InvalidAccessError, "The document's page cannot be retrieved.");
2273 return; 2273 return;
2274 } 2274 }
2275 Page* page = m_document->page(); 2275 Page* page = m_document->page();
2276 page->frameHost().visualViewport().setScale(scaleFactor); 2276 page->visualViewport().setScale(scaleFactor);
2277 } 2277 }
2278 2278
2279 void Internals::setPageScaleFactorLimits(float minScaleFactor, 2279 void Internals::setPageScaleFactorLimits(float minScaleFactor,
2280 float maxScaleFactor, 2280 float maxScaleFactor,
2281 ExceptionState& exceptionState) { 2281 ExceptionState& exceptionState) {
2282 if (!m_document->page()) { 2282 if (!m_document->page()) {
2283 exceptionState.throwDOMException( 2283 exceptionState.throwDOMException(
2284 InvalidAccessError, "The document's page cannot be retrieved."); 2284 InvalidAccessError, "The document's page cannot be retrieved.");
2285 return; 2285 return;
2286 } 2286 }
2287 2287
2288 Page* page = m_document->page(); 2288 Page* page = m_document->page();
2289 page->setDefaultPageScaleLimits(minScaleFactor, maxScaleFactor); 2289 page->setDefaultPageScaleLimits(minScaleFactor, maxScaleFactor);
2290 } 2290 }
2291 2291
2292 bool Internals::magnifyScaleAroundAnchor(float scaleFactor, float x, float y) { 2292 bool Internals::magnifyScaleAroundAnchor(float scaleFactor, float x, float y) {
2293 if (!frame()) 2293 if (!frame())
2294 return false; 2294 return false;
2295 2295
2296 return frame()->host()->visualViewport().magnifyScaleAroundAnchor( 2296 return frame()->page()->visualViewport().magnifyScaleAroundAnchor(
2297 scaleFactor, FloatPoint(x, y)); 2297 scaleFactor, FloatPoint(x, y));
2298 } 2298 }
2299 2299
2300 void Internals::setIsCursorVisible(Document* document, 2300 void Internals::setIsCursorVisible(Document* document,
2301 bool isVisible, 2301 bool isVisible,
2302 ExceptionState& exceptionState) { 2302 ExceptionState& exceptionState) {
2303 DCHECK(document); 2303 DCHECK(document);
2304 if (!document->page()) { 2304 if (!document->page()) {
2305 exceptionState.throwDOMException(InvalidAccessError, 2305 exceptionState.throwDOMException(InvalidAccessError,
2306 "No context document can be obtained."); 2306 "No context document can be obtained.");
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 // Clean layout is required for extracting plain text from selection. 3065 // Clean layout is required for extracting plain text from selection.
3066 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 3066 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
3067 3067
3068 return frame()->selection().selectedTextForClipboard(); 3068 return frame()->selection().selectedTextForClipboard();
3069 } 3069 }
3070 3070
3071 void Internals::setVisualViewportOffset(int x, int y) { 3071 void Internals::setVisualViewportOffset(int x, int y) {
3072 if (!frame()) 3072 if (!frame())
3073 return; 3073 return;
3074 3074
3075 frame()->host()->visualViewport().setLocation(FloatPoint(x, y)); 3075 frame()->page()->visualViewport().setLocation(FloatPoint(x, y));
3076 } 3076 }
3077 3077
3078 int Internals::visualViewportHeight() { 3078 int Internals::visualViewportHeight() {
3079 if (!frame()) 3079 if (!frame())
3080 return 0; 3080 return 0;
3081 3081
3082 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size()) 3082 return expandedIntSize(frame()->page()->visualViewport().visibleRect().size())
3083 .height(); 3083 .height();
3084 } 3084 }
3085 3085
3086 int Internals::visualViewportWidth() { 3086 int Internals::visualViewportWidth() {
3087 if (!frame()) 3087 if (!frame())
3088 return 0; 3088 return 0;
3089 3089
3090 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size()) 3090 return expandedIntSize(frame()->page()->visualViewport().visibleRect().size())
3091 .width(); 3091 .width();
3092 } 3092 }
3093 3093
3094 float Internals::visualViewportScrollX() { 3094 float Internals::visualViewportScrollX() {
3095 if (!frame()) 3095 if (!frame())
3096 return 0; 3096 return 0;
3097 3097
3098 return frame()->view()->getScrollableArea()->getScrollOffset().width(); 3098 return frame()->view()->getScrollableArea()->getScrollOffset().width();
3099 } 3099 }
3100 3100
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 3226
3227 void Internals::crash() { 3227 void Internals::crash() {
3228 CHECK(false) << "Intentional crash"; 3228 CHECK(false) << "Intentional crash";
3229 } 3229 }
3230 3230
3231 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3231 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3232 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3232 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3233 } 3233 }
3234 3234
3235 } // namespace blink 3235 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/DummyPageHolder.cpp ('k') | third_party/WebKit/Source/web/DevToolsEmulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698