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

Unified Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 351303003: [DevTools] Switch from DIP to CSS pixels in device mode. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/devtools/front_end/MediaQueryInspector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorPageAgent.cpp
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 7df66fff537faf4b7c98ff3d6454b99637d17882..451c012ffe32676aa4b71dab7a61c74323b981cd 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -963,6 +963,7 @@ void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
m_inspectorResourceContentLoader->stop();
}
m_frontend->frameNavigated(buildObjectForFrame(loader->frame()));
+ viewportChanged();
}
void InspectorPageAgent::frameAttachedToParent(LocalFrame* frame)
@@ -1137,12 +1138,29 @@ void InspectorPageAgent::didLayout(RenderObject*)
if (!m_enabled)
return;
m_overlay->update();
+ viewportChanged();
}
void InspectorPageAgent::didScroll()
{
if (m_enabled)
m_overlay->update();
+ viewportChanged();
+}
+
+void InspectorPageAgent::viewportChanged()
+{
+ if (!m_enabled)
+ return;
+ IntSize contentsSize = m_page->deprecatedLocalMainFrame()->view()->contentsSize();
+ IntRect viewRect = m_page->deprecatedLocalMainFrame()->view()->visibleContentRect();
+ RefPtr<TypeBuilder::Page::Viewport> viewport = TypeBuilder::Page::Viewport::create()
+ .setScrollX(viewRect.x())
+ .setScrollY(viewRect.y())
+ .setContentsWidth(contentsSize.width())
+ .setContentsHeight(contentsSize.height())
+ .setPageScaleFactor(m_page->pageScaleFactor());
+ m_frontend->viewportChanged(viewport);
}
void InspectorPageAgent::didResizeMainFrame()
@@ -1152,6 +1170,7 @@ void InspectorPageAgent::didResizeMainFrame()
m_overlay->showAndHideViewSize(m_state->getBoolean(PageAgentState::showGridOnResize));
#endif
m_frontend->frameResized();
+ viewportChanged();
}
void InspectorPageAgent::didRecalculateStyle(int)
@@ -1160,6 +1179,13 @@ void InspectorPageAgent::didRecalculateStyle(int)
m_overlay->update();
}
+void InspectorPageAgent::deviceOrPageScaleFactorChanged()
+{
+ if (m_enabled)
+ m_overlay->update();
+ viewportChanged();
+}
+
void InspectorPageAgent::scriptsEnabled(bool isEnabled)
{
if (m_ignoreScriptsEnabledNotification)
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/devtools/front_end/MediaQueryInspector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698