OLD | NEW |
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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show); | 751 m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show); |
752 m_client->setShowPaintRects(show); | 752 m_client->setShowPaintRects(show); |
753 | 753 |
754 if (!show && mainFrame() && mainFrame()->view()) | 754 if (!show && mainFrame() && mainFrame()->view()) |
755 mainFrame()->view()->invalidate(); | 755 mainFrame()->view()->invalidate(); |
756 } | 756 } |
757 | 757 |
758 void InspectorPageAgent::setShowDebugBorders(ErrorString* errorString, bool show
) | 758 void InspectorPageAgent::setShowDebugBorders(ErrorString* errorString, bool show
) |
759 { | 759 { |
760 m_state->setBoolean(PageAgentState::pageAgentShowDebugBorders, show); | 760 m_state->setBoolean(PageAgentState::pageAgentShowDebugBorders, show); |
761 if (show && !forceCompositingMode(errorString)) | 761 if (show && !compositingEnabled(errorString)) |
762 return; | 762 return; |
763 m_client->setShowDebugBorders(show); | 763 m_client->setShowDebugBorders(show); |
764 } | 764 } |
765 | 765 |
766 void InspectorPageAgent::setShowFPSCounter(ErrorString* errorString, bool show) | 766 void InspectorPageAgent::setShowFPSCounter(ErrorString* errorString, bool show) |
767 { | 767 { |
768 // FIXME: allow metrics override, fps counter and continuous painting at the
same time: crbug.com/299837. | 768 // FIXME: allow metrics override, fps counter and continuous painting at the
same time: crbug.com/299837. |
769 m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show); | 769 m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show); |
770 if (show && !forceCompositingMode(errorString)) | 770 if (show && !compositingEnabled(errorString)) |
771 return; | 771 return; |
772 m_client->setShowFPSCounter(show && !m_deviceMetricsOverridden); | 772 m_client->setShowFPSCounter(show && !m_deviceMetricsOverridden); |
773 } | 773 } |
774 | 774 |
775 void InspectorPageAgent::setContinuousPaintingEnabled(ErrorString* errorString,
bool enabled) | 775 void InspectorPageAgent::setContinuousPaintingEnabled(ErrorString* errorString,
bool enabled) |
776 { | 776 { |
777 m_state->setBoolean(PageAgentState::pageAgentContinuousPaintingEnabled, enab
led); | 777 m_state->setBoolean(PageAgentState::pageAgentContinuousPaintingEnabled, enab
led); |
778 if (enabled && !forceCompositingMode(errorString)) | 778 if (enabled && !compositingEnabled(errorString)) |
779 return; | 779 return; |
780 m_client->setContinuousPaintingEnabled(enabled && !m_deviceMetricsOverridden
); | 780 m_client->setContinuousPaintingEnabled(enabled && !m_deviceMetricsOverridden
); |
781 } | 781 } |
782 | 782 |
783 void InspectorPageAgent::setShowScrollBottleneckRects(ErrorString* errorString,
bool show) | 783 void InspectorPageAgent::setShowScrollBottleneckRects(ErrorString* errorString,
bool show) |
784 { | 784 { |
785 m_state->setBoolean(PageAgentState::pageAgentShowScrollBottleneckRects, show
); | 785 m_state->setBoolean(PageAgentState::pageAgentShowScrollBottleneckRects, show
); |
786 if (show && !forceCompositingMode(errorString)) | 786 if (show && !compositingEnabled(errorString)) |
787 return; | 787 return; |
788 m_client->setShowScrollBottleneckRects(show); | 788 m_client->setShowScrollBottleneckRects(show); |
789 } | 789 } |
790 | 790 |
791 void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandl
er::Result::Enum* status) | 791 void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandl
er::Result::Enum* status) |
792 { | 792 { |
793 bool disabledByScriptController = false; | 793 bool disabledByScriptController = false; |
794 bool disabledInSettings = false; | 794 bool disabledInSettings = false; |
795 LocalFrame* frame = mainFrame(); | 795 LocalFrame* frame = mainFrame(); |
796 if (frame) { | 796 if (frame) { |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 return true; | 1244 return true; |
1245 } | 1245 } |
1246 | 1246 |
1247 void InspectorPageAgent::applyEmulatedMedia(String* media) | 1247 void InspectorPageAgent::applyEmulatedMedia(String* media) |
1248 { | 1248 { |
1249 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM
edia); | 1249 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM
edia); |
1250 if (!emulatedMedia.isEmpty()) | 1250 if (!emulatedMedia.isEmpty()) |
1251 *media = emulatedMedia; | 1251 *media = emulatedMedia; |
1252 } | 1252 } |
1253 | 1253 |
1254 bool InspectorPageAgent::forceCompositingMode(ErrorString* errorString) | 1254 bool InspectorPageAgent::compositingEnabled(ErrorString* errorString) |
1255 { | 1255 { |
1256 Settings& settings = m_page->settings(); | 1256 if (!m_page->settings().acceleratedCompositingEnabled()) { |
1257 if (!settings.acceleratedCompositingEnabled()) { | |
1258 if (errorString) | 1257 if (errorString) |
1259 *errorString = "Compositing mode is not supported"; | 1258 *errorString = "Compositing mode is not supported"; |
1260 return false; | 1259 return false; |
1261 } | 1260 } |
1262 if (settings.forceCompositingMode()) | |
1263 return true; | |
1264 settings.setForceCompositingMode(true); | |
1265 LocalFrame* mainFrame = m_page->mainFrame(); | |
1266 if (mainFrame) | |
1267 mainFrame->view()->updateCompositingLayersAfterStyleChange(); | |
1268 return true; | 1261 return true; |
1269 } | 1262 } |
1270 | 1263 |
1271 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) | 1264 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) |
1272 { | 1265 { |
1273 m_state->setBoolean(PageAgentState::showSizeOnResize, show); | 1266 m_state->setBoolean(PageAgentState::showSizeOnResize, show); |
1274 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid)
; | 1267 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid)
; |
1275 } | 1268 } |
1276 | 1269 |
1277 } // namespace WebCore | 1270 } // namespace WebCore |
1278 | 1271 |
OLD | NEW |