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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/inspector/InspectorPageAgent.h" | 32 #include "core/inspector/InspectorPageAgent.h" |
33 | 33 |
34 #include "bindings/core/v8/DOMWrapperWorld.h" | 34 #include "bindings/core/v8/DOMWrapperWorld.h" |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/ScriptRegexp.h" | 36 #include "bindings/core/v8/ScriptRegexp.h" |
37 #include "core/HTMLNames.h" | 37 #include "core/HTMLNames.h" |
38 #include "core/UserAgentStyleSheets.h" | |
39 #include "core/css/StyleSheetContents.h" | 38 #include "core/css/StyleSheetContents.h" |
40 #include "core/css/resolver/StyleResolver.h" | 39 #include "core/css/resolver/StyleResolver.h" |
41 #include "core/css/resolver/ViewportStyleResolver.h" | 40 #include "core/css/resolver/ViewportStyleResolver.h" |
42 #include "core/dom/DOMImplementation.h" | 41 #include "core/dom/DOMImplementation.h" |
43 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
44 #include "core/fetch/CSSStyleSheetResource.h" | 43 #include "core/fetch/CSSStyleSheetResource.h" |
45 #include "core/fetch/FontResource.h" | 44 #include "core/fetch/FontResource.h" |
46 #include "core/fetch/ImageResource.h" | 45 #include "core/fetch/ImageResource.h" |
47 #include "core/fetch/MemoryCache.h" | 46 #include "core/fetch/MemoryCache.h" |
48 #include "core/fetch/Resource.h" | 47 #include "core/fetch/Resource.h" |
(...skipping 20 matching lines...) Expand all Loading... |
69 #include "core/inspector/InstrumentingAgents.h" | 68 #include "core/inspector/InstrumentingAgents.h" |
70 #include "core/loader/CookieJar.h" | 69 #include "core/loader/CookieJar.h" |
71 #include "core/loader/DocumentLoader.h" | 70 #include "core/loader/DocumentLoader.h" |
72 #include "core/loader/FrameLoadRequest.h" | 71 #include "core/loader/FrameLoadRequest.h" |
73 #include "core/loader/FrameLoader.h" | 72 #include "core/loader/FrameLoader.h" |
74 #include "core/page/Page.h" | 73 #include "core/page/Page.h" |
75 #include "platform/Cookie.h" | 74 #include "platform/Cookie.h" |
76 #include "platform/JSONValues.h" | 75 #include "platform/JSONValues.h" |
77 #include "platform/UserGestureIndicator.h" | 76 #include "platform/UserGestureIndicator.h" |
78 #include "platform/weborigin/SecurityOrigin.h" | 77 #include "platform/weborigin/SecurityOrigin.h" |
| 78 #include "public/platform/Platform.h" |
| 79 #include "public/platform/WebData.h" |
79 #include "wtf/CurrentTime.h" | 80 #include "wtf/CurrentTime.h" |
80 #include "wtf/ListHashSet.h" | 81 #include "wtf/ListHashSet.h" |
81 #include "wtf/Vector.h" | 82 #include "wtf/Vector.h" |
82 #include "wtf/text/Base64.h" | 83 #include "wtf/text/Base64.h" |
83 #include "wtf/text/TextEncoding.h" | 84 #include "wtf/text/TextEncoding.h" |
84 | 85 |
85 namespace blink { | 86 namespace blink { |
86 | 87 |
87 namespace PageAgentState { | 88 namespace PageAgentState { |
88 static const char pageAgentEnabled[] = "pageAgentEnabled"; | 89 static const char pageAgentEnabled[] = "pageAgentEnabled"; |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 document->updateLayout(); | 1369 document->updateLayout(); |
1369 } | 1370 } |
1370 } | 1371 } |
1371 | 1372 |
1372 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver) | 1373 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver) |
1373 { | 1374 { |
1374 if (!m_deviceMetricsOverridden || !m_emulateMobileEnabled) | 1375 if (!m_deviceMetricsOverridden || !m_emulateMobileEnabled) |
1375 return false; | 1376 return false; |
1376 | 1377 |
1377 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea
te(CSSParserContext(UASheetMode, 0)); | 1378 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea
te(CSSParserContext(UASheetMode, 0)); |
1378 styleSheet->parseString(String(viewportAndroidCss, sizeof(viewportAndroidCss
))); | 1379 const WebData& viewportAndroidCssResource = Platform::current()->loadResourc
e("viewportAndroid.css"); |
| 1380 String viewportAndroidRules = viewportAndroidCssResource.toASCIIString(); |
| 1381 ASSERT(!viewportAndroidRules.isEmpty()); |
| 1382 styleSheet->parseString(viewportAndroidRules); |
1379 OwnPtrWillBeRawPtr<RuleSet> ruleSet = RuleSet::create(); | 1383 OwnPtrWillBeRawPtr<RuleSet> ruleSet = RuleSet::create(); |
1380 ruleSet->addRulesFromSheet(styleSheet.get(), MediaQueryEvaluator("screen")); | 1384 ruleSet->addRulesFromSheet(styleSheet.get(), MediaQueryEvaluator("screen")); |
1381 resolver->viewportStyleResolver()->collectViewportRules(ruleSet.get(), Viewp
ortStyleResolver::UserAgentOrigin); | 1385 resolver->viewportStyleResolver()->collectViewportRules(ruleSet.get(), Viewp
ortStyleResolver::UserAgentOrigin); |
1382 return true; | 1386 return true; |
1383 } | 1387 } |
1384 | 1388 |
1385 void InspectorPageAgent::applyEmulatedMedia(String* media) | 1389 void InspectorPageAgent::applyEmulatedMedia(String* media) |
1386 { | 1390 { |
1387 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM
edia); | 1391 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM
edia); |
1388 if (!emulatedMedia.isEmpty()) | 1392 if (!emulatedMedia.isEmpty()) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 | 1429 |
1426 void InspectorPageAgent::trace(Visitor* visitor) | 1430 void InspectorPageAgent::trace(Visitor* visitor) |
1427 { | 1431 { |
1428 visitor->trace(m_page); | 1432 visitor->trace(m_page); |
1429 visitor->trace(m_injectedScriptManager); | 1433 visitor->trace(m_injectedScriptManager); |
1430 InspectorBaseAgent::trace(visitor); | 1434 InspectorBaseAgent::trace(visitor); |
1431 } | 1435 } |
1432 | 1436 |
1433 } // namespace blink | 1437 } // namespace blink |
1434 | 1438 |
OLD | NEW |