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

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

Issue 340803002: DevTools: fix for test inspector-protocol/page/enable-disable.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: problem fixed 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector-protocol/page/enable-disable-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 m_state->setBoolean(PageAgentState::pageAgentEnabled, false); 411 m_state->setBoolean(PageAgentState::pageAgentEnabled, false);
412 m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad); 412 m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
413 m_overlay->hide(); 413 m_overlay->hide();
414 m_instrumentingAgents->setInspectorPageAgent(0); 414 m_instrumentingAgents->setInspectorPageAgent(0);
415 m_deviceMetricsOverridden = false; 415 m_deviceMetricsOverridden = false;
416 416
417 setShowPaintRects(0, false); 417 setShowPaintRects(0, false);
418 setShowDebugBorders(0, false); 418 setShowDebugBorders(0, false);
419 setShowFPSCounter(0, false); 419 setShowFPSCounter(0, false);
420 setEmulatedMedia(0, String()); 420 setEmulatedMedia(0, String());
421 setContinuousPaintingEnabled(0, false); 421 if (m_state->getBoolean(PageAgentState::pageAgentContinuousPaintingEnabled))
422 setContinuousPaintingEnabled(0, false);
422 setShowScrollBottleneckRects(0, false); 423 setShowScrollBottleneckRects(0, false);
423 setShowViewportSizeOnResize(0, false, 0); 424 setShowViewportSizeOnResize(0, false, 0);
424 425
425 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled)) { 426 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled)) {
426 updateTouchEventEmulationInPage(false); 427 updateTouchEventEmulationInPage(false);
427 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, false); 428 m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, false);
428 } 429 }
429 430
430 if (!deviceMetricsChanged(false, 0, 0, 0, false, false, 1, false)) 431 if (!deviceMetricsChanged(false, 0, 0, 1, false, false, 1, false))
431 return; 432 return;
432 433
433 // When disabling the agent, reset the override values if necessary. 434 // When disabling the agent, reset the override values if necessary.
434 updateViewMetrics(false, 0, 0, 0, false, false, m_embedderFontScaleFactor, m _embedderTextAutosizingEnabled); 435 updateViewMetrics(false, 0, 0, 1, false, false, m_embedderFontScaleFactor, m _embedderTextAutosizingEnabled);
435 m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0); 436 m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0);
436 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, 0); 437 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, 0);
437 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 0); 438 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 1);
438 m_state->setBoolean(PageAgentState::pageAgentEmulateViewport, false); 439 m_state->setBoolean(PageAgentState::pageAgentEmulateViewport, false);
439 m_state->setBoolean(PageAgentState::pageAgentFitWindow, false); 440 m_state->setBoolean(PageAgentState::pageAgentFitWindow, false);
440 m_state->setDouble(PageAgentState::fontScaleFactor, 1); 441 m_state->setDouble(PageAgentState::fontScaleFactor, 1);
441 m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, false); 442 m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, false);
442 } 443 }
443 444
444 void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& s ource, String* identifier) 445 void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& s ource, String* identifier)
445 { 446 {
446 RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScr iptsToEvaluateOnLoad); 447 RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScr iptsToEvaluateOnLoad);
447 if (!scripts) { 448 if (!scripts) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 updateViewMetricsFromState(); 729 updateViewMetricsFromState();
729 } 730 }
730 } 731 }
731 732
732 bool InspectorPageAgent::deviceMetricsChanged(bool enabled, int width, int heigh t, double deviceScaleFactor, bool emulateViewport, bool fitWindow, double fontSc aleFactor, bool textAutosizing) 733 bool InspectorPageAgent::deviceMetricsChanged(bool enabled, int width, int heigh t, double deviceScaleFactor, bool emulateViewport, bool fitWindow, double fontSc aleFactor, bool textAutosizing)
733 { 734 {
734 bool currentEnabled = m_state->getBoolean(PageAgentState::deviceMetricsOverr ideEnabled); 735 bool currentEnabled = m_state->getBoolean(PageAgentState::deviceMetricsOverr ideEnabled);
735 // These two always fit an int. 736 // These two always fit an int.
736 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAge ntScreenWidthOverride)); 737 int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAge ntScreenWidthOverride));
737 int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAg entScreenHeightOverride)); 738 int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAg entScreenHeightOverride));
738 double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAge ntDeviceScaleFactorOverride, 1); 739 double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAge ntDeviceScaleFactorOverride, 1);
dgozman 2014/06/18 17:04:36 Change this to zero instead.
loislo 2014/06/18 17:12:21 Done.
739 bool currentEmulateViewport = m_state->getBoolean(PageAgentState::pageAgentE mulateViewport); 740 bool currentEmulateViewport = m_state->getBoolean(PageAgentState::pageAgentE mulateViewport);
740 bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWind ow); 741 bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWind ow);
741 double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScale Factor, 1); 742 double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScale Factor, 1);
742 bool currentTextAutosizing = m_state->getBoolean(PageAgentState::pageAgentTe xtAutosizingOverride); 743 bool currentTextAutosizing = m_state->getBoolean(PageAgentState::pageAgentTe xtAutosizingOverride);
743 744
744 return enabled != currentEnabled || width != currentWidth || height != curre ntHeight || deviceScaleFactor != currentDeviceScaleFactor || emulateViewport != currentEmulateViewport || fitWindow != currentFitWindow || fontScaleFactor != cu rrentFontScaleFactor || textAutosizing != currentTextAutosizing; 745 return enabled != currentEnabled
746 || width != currentWidth
747 || height != currentHeight
748 || deviceScaleFactor != currentDeviceScaleFactor
749 || emulateViewport != currentEmulateViewport
750 || fitWindow != currentFitWindow
751 || fontScaleFactor != currentFontScaleFactor
752 || textAutosizing != currentTextAutosizing;
745 } 753 }
746 754
747 void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show) 755 void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
748 { 756 {
749 m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show); 757 m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show);
750 m_client->setShowPaintRects(show); 758 m_client->setShowPaintRects(show);
751 759
752 if (!show && mainFrame() && mainFrame()->view()) 760 if (!show && mainFrame() && mainFrame()->view())
753 mainFrame()->view()->invalidate(); 761 mainFrame()->view()->invalidate();
754 } 762 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 } 1278 }
1271 1279
1272 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1280 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1273 { 1281 {
1274 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1282 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1275 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1283 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1276 } 1284 }
1277 1285
1278 } // namespace WebCore 1286 } // namespace WebCore
1279 1287
OLDNEW
« no previous file with comments | « LayoutTests/inspector-protocol/page/enable-disable-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698