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

Side by Side Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 50043007: DevTools: check for canForceCompositingMode before trying to emulate device metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed comments Created 7 years, 1 month 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 } 653 }
654 654
655 if (fontScaleFactor <= 0) { 655 if (fontScaleFactor <= 0) {
656 *errorString = "fontScaleFactor must be positive"; 656 *errorString = "fontScaleFactor must be positive";
657 return; 657 return;
658 } 658 }
659 659
660 if (!deviceMetricsChanged(width, height, deviceScaleFactor, fitWindow, fontS caleFactor, textAutosizing)) 660 if (!deviceMetricsChanged(width, height, deviceScaleFactor, fitWindow, fontS caleFactor, textAutosizing))
661 return; 661 return;
662 662
663 Settings& settings = m_page->settings();
664 if (width && height && !settings.acceleratedCompositingEnabled()) {
665 if (errorString)
666 *errorString = "Compositing mode is not supported";
667 return;
668 }
669
663 m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, width); 670 m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, width);
664 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height); 671 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height);
665 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, devic eScaleFactor); 672 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, devic eScaleFactor);
666 m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow); 673 m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow);
667 m_state->setDouble(PageAgentState::textAutosizingFontScaleFactorOverride, fo ntScaleFactor); 674 m_state->setDouble(PageAgentState::textAutosizingFontScaleFactorOverride, fo ntScaleFactor);
668 m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, textAut osizing); 675 m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, textAut osizing);
669 676
670 updateViewMetrics(width, height, deviceScaleFactor, fitWindow); 677 updateViewMetrics(width, height, deviceScaleFactor, fitWindow);
671 } 678 }
672 679
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 } 1187 }
1181 } 1188 }
1182 1189
1183 void InspectorPageAgent::applyEmulatedMedia(String* media) 1190 void InspectorPageAgent::applyEmulatedMedia(String* media)
1184 { 1191 {
1185 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM edia); 1192 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM edia);
1186 if (!emulatedMedia.isEmpty()) 1193 if (!emulatedMedia.isEmpty())
1187 *media = emulatedMedia; 1194 *media = emulatedMedia;
1188 } 1195 }
1189 1196
1197 void InspectorPageAgent::canForceCompositingMode(ErrorString* errorString, bool* result)
1198 {
1199 *result = m_page->settings().acceleratedCompositingEnabled();
1200 }
1201
1190 void InspectorPageAgent::setForceCompositingMode(ErrorString* errorString, bool force) 1202 void InspectorPageAgent::setForceCompositingMode(ErrorString* errorString, bool force)
1191 { 1203 {
1192 Settings& settings = m_page->settings(); 1204 Settings& settings = m_page->settings();
1193 if (force && !settings.acceleratedCompositingEnabled()) { 1205 if (force && !settings.acceleratedCompositingEnabled()) {
1194 if (errorString) 1206 if (errorString)
1195 *errorString = "Compositing mode is not supported"; 1207 *errorString = "Compositing mode is not supported";
1196 return; 1208 return;
1197 } 1209 }
1198 m_state->setBoolean(PageAgentState::forceCompositingMode, force); 1210 m_state->setBoolean(PageAgentState::forceCompositingMode, force);
1199 if (settings.forceCompositingMode() == force) 1211 if (settings.forceCompositingMode() == force)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1244 }
1233 1245
1234 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1246 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1235 { 1247 {
1236 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1248 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1237 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1249 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1238 } 1250 }
1239 1251
1240 } // namespace WebCore 1252 } // namespace WebCore
1241 1253
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/devtools/front_end/OverridesSupport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698