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

Unified Diff: third_party/WebKit/Source/web/DevToolsEmulator.cpp

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split off size override, address reviewer comments. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/DevToolsEmulator.cpp
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
index 848f4e121489e3eb3daee48891475e134128abbc..3f8202d546f48667ed092084bfb0bb77e93b61be 100644
--- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp
+++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
@@ -223,6 +223,7 @@ void DevToolsEmulator::enableDeviceEmulation(const WebDeviceEmulationParams& par
// TODO(dgozman): mainFrameImpl() is null when it's remote. Figure out how
// we end up with enabling emulation in this case.
if (m_webViewImpl->mainFrameImpl()) {
+ m_webViewImpl->mainFrameImpl()->frameView()->layout();
if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document())
document->mediaQueryAffectingValueChanged();
}
@@ -239,9 +240,10 @@ void DevToolsEmulator::disableDeviceEmulation()
disableMobileEmulation();
m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f);
m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f);
- m_webViewImpl->setPageScaleFactor(1.f);
+ m_webViewImpl->resetScaleStateImmediately();
// mainFrameImpl() could be null during cleanup or remote <-> local swap.
if (m_webViewImpl->mainFrameImpl()) {
+ m_webViewImpl->mainFrameImpl()->frameView()->layout();
if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document())
document->mediaQueryAffectingValueChanged();
}
@@ -282,10 +284,6 @@ void DevToolsEmulator::enableMobileEmulation()
m_originalDefaultMinimumPageScaleFactor = m_webViewImpl->defaultMinimumPageScaleFactor();
m_originalDefaultMaximumPageScaleFactor = m_webViewImpl->defaultMaximumPageScaleFactor();
m_webViewImpl->setDefaultPageScaleLimits(0.25f, 5);
- // TODO(dgozman): mainFrameImpl() is null when it's remote. Figure out how
- // we end up with enabling emulation in this case.
- if (m_webViewImpl->mainFrameImpl())
- m_webViewImpl->mainFrameImpl()->frameView()->layout();
}
void DevToolsEmulator::disableMobileEmulation()
@@ -314,9 +312,6 @@ void DevToolsEmulator::disableMobileEmulation()
m_webViewImpl->setDefaultPageScaleLimits(
m_originalDefaultMinimumPageScaleFactor,
m_originalDefaultMaximumPageScaleFactor);
- // mainFrameImpl() could be null during cleanup or remote <-> local swap.
- if (m_webViewImpl->mainFrameImpl())
- m_webViewImpl->mainFrameImpl()->frameView()->layout();
}
void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled)
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp ('k') | third_party/WebKit/Source/web/InspectorEmulationAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698