| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 static const char deviceOffsetY[] = "deviceOffsetY"; | 98 static const char deviceOffsetY[] = "deviceOffsetY"; |
| 99 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter"; | 99 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter"; |
| 100 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPai
ntingEnabled"; | 100 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPai
ntingEnabled"; |
| 101 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects"; | 101 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects"; |
| 102 static const char pageAgentShowDebugBorders[] = "pageAgentShowDebugBorders"; | 102 static const char pageAgentShowDebugBorders[] = "pageAgentShowDebugBorders"; |
| 103 static const char pageAgentShowScrollBottleneckRects[] = "pageAgentShowScrollBot
tleneckRects"; | 103 static const char pageAgentShowScrollBottleneckRects[] = "pageAgentShowScrollBot
tleneckRects"; |
| 104 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; | 104 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; |
| 105 static const char pageAgentEmulatedMedia[] = "pageAgentEmulatedMedia"; | 105 static const char pageAgentEmulatedMedia[] = "pageAgentEmulatedMedia"; |
| 106 static const char showSizeOnResize[] = "showSizeOnResize"; | 106 static const char showSizeOnResize[] = "showSizeOnResize"; |
| 107 static const char showGridOnResize[] = "showGridOnResize"; | 107 static const char showGridOnResize[] = "showGridOnResize"; |
| 108 static const char viewportChangedEventEnabled[] = "viewportChangedEventEnabled"; |
| 108 } | 109 } |
| 109 | 110 |
| 110 namespace { | 111 namespace { |
| 111 | 112 |
| 112 KURL urlWithoutFragment(const KURL& url) | 113 KURL urlWithoutFragment(const KURL& url) |
| 113 { | 114 { |
| 114 KURL result = url; | 115 KURL result = url; |
| 115 result.removeFragmentIdentifier(); | 116 result.removeFragmentIdentifier(); |
| 116 return result; | 117 return result; |
| 117 } | 118 } |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height); | 811 m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height); |
| 811 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, devic
eScaleFactor); | 812 m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, devic
eScaleFactor); |
| 812 m_state->setBoolean(PageAgentState::pageAgentEmulateViewport, emulateViewpor
t); | 813 m_state->setBoolean(PageAgentState::pageAgentEmulateViewport, emulateViewpor
t); |
| 813 m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow); | 814 m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow); |
| 814 m_state->setDouble(PageAgentState::deviceScale, scale); | 815 m_state->setDouble(PageAgentState::deviceScale, scale); |
| 815 m_state->setDouble(PageAgentState::deviceOffsetX, offsetX); | 816 m_state->setDouble(PageAgentState::deviceOffsetX, offsetX); |
| 816 m_state->setDouble(PageAgentState::deviceOffsetY, offsetY); | 817 m_state->setDouble(PageAgentState::deviceOffsetY, offsetY); |
| 817 updateViewMetricsFromState(); | 818 updateViewMetricsFromState(); |
| 818 } | 819 } |
| 819 | 820 |
| 821 void InspectorPageAgent::setViewportChangedEventEnabled(ErrorString*, bool enabl
ed) |
| 822 { |
| 823 if (m_state->getBoolean(PageAgentState::viewportChangedEventEnabled) != enab
led) { |
| 824 m_state->setBoolean(PageAgentState::viewportChangedEventEnabled, enabled
); |
| 825 if (enabled) |
| 826 viewportChanged(); |
| 827 } |
| 828 } |
| 829 |
| 820 void InspectorPageAgent::clearDeviceMetricsOverride(ErrorString*) | 830 void InspectorPageAgent::clearDeviceMetricsOverride(ErrorString*) |
| 821 { | 831 { |
| 822 if (m_state->getBoolean(PageAgentState::deviceMetricsOverrideEnabled)) { | 832 if (m_state->getBoolean(PageAgentState::deviceMetricsOverrideEnabled)) { |
| 823 m_state->setBoolean(PageAgentState::deviceMetricsOverrideEnabled, false)
; | 833 m_state->setBoolean(PageAgentState::deviceMetricsOverrideEnabled, false)
; |
| 824 updateViewMetricsFromState(); | 834 updateViewMetricsFromState(); |
| 825 } | 835 } |
| 826 } | 836 } |
| 827 | 837 |
| 828 void InspectorPageAgent::resetScrollAndPageScaleFactor(ErrorString*) | 838 void InspectorPageAgent::resetScrollAndPageScaleFactor(ErrorString*) |
| 829 { | 839 { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1169 |
| 1160 void InspectorPageAgent::didScroll() | 1170 void InspectorPageAgent::didScroll() |
| 1161 { | 1171 { |
| 1162 if (m_enabled) | 1172 if (m_enabled) |
| 1163 m_overlay->update(); | 1173 m_overlay->update(); |
| 1164 viewportChanged(); | 1174 viewportChanged(); |
| 1165 } | 1175 } |
| 1166 | 1176 |
| 1167 void InspectorPageAgent::viewportChanged() | 1177 void InspectorPageAgent::viewportChanged() |
| 1168 { | 1178 { |
| 1169 if (!m_enabled) | 1179 if (!m_enabled || !m_state->getBoolean(PageAgentState::viewportChangedEventE
nabled)) |
| 1170 return; | 1180 return; |
| 1171 IntSize contentsSize = m_page->deprecatedLocalMainFrame()->view()->contentsS
ize(); | 1181 IntSize contentsSize = m_page->deprecatedLocalMainFrame()->view()->contentsS
ize(); |
| 1172 IntRect viewRect = m_page->deprecatedLocalMainFrame()->view()->visibleConten
tRect(); | 1182 IntRect viewRect = m_page->deprecatedLocalMainFrame()->view()->visibleConten
tRect(); |
| 1173 RefPtr<TypeBuilder::Page::Viewport> viewport = TypeBuilder::Page::Viewport::
create() | 1183 RefPtr<TypeBuilder::Page::Viewport> viewport = TypeBuilder::Page::Viewport::
create() |
| 1174 .setScrollX(viewRect.x()) | 1184 .setScrollX(viewRect.x()) |
| 1175 .setScrollY(viewRect.y()) | 1185 .setScrollY(viewRect.y()) |
| 1176 .setContentsWidth(contentsSize.width()) | 1186 .setContentsWidth(contentsSize.width()) |
| 1177 .setContentsHeight(contentsSize.height()) | 1187 .setContentsHeight(contentsSize.height()) |
| 1178 .setPageScaleFactor(m_page->pageScaleFactor()); | 1188 .setPageScaleFactor(m_page->pageScaleFactor()); |
| 1179 m_frontend->viewportChanged(viewport); | 1189 m_frontend->viewportChanged(viewport); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 bool InspectorPageAgent::getEditedResourceContent(const String& url, String* con
tent) | 1437 bool InspectorPageAgent::getEditedResourceContent(const String& url, String* con
tent) |
| 1428 { | 1438 { |
| 1429 if (!m_editedResourceContent.contains(url)) | 1439 if (!m_editedResourceContent.contains(url)) |
| 1430 return false; | 1440 return false; |
| 1431 *content = m_editedResourceContent.get(url); | 1441 *content = m_editedResourceContent.get(url); |
| 1432 return true; | 1442 return true; |
| 1433 } | 1443 } |
| 1434 | 1444 |
| 1435 } // namespace WebCore | 1445 } // namespace WebCore |
| 1436 | 1446 |
| OLD | NEW |