Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 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/animation/AnimationTimeline.h" | 38 #include "core/animation/AnimationTimeline.h" |
| 39 #include "core/css/StyleSheetContents.h" | 39 #include "core/css/StyleSheetContents.h" |
| 40 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 41 #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" |
| 49 #include "core/fetch/ResourceFetcher.h" | 48 #include "core/fetch/ResourceFetcher.h" |
| 50 #include "core/fetch/ScriptResource.h" | 49 #include "core/fetch/ScriptResource.h" |
| 51 #include "core/frame/FrameView.h" | 50 #include "core/frame/FrameView.h" |
| (...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 | 1443 |
| 1445 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); | 1444 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); |
| 1446 Document* document = inspectedFrame()->document(); | 1445 Document* document = inspectedFrame()->document(); |
| 1447 if (document) { | 1446 if (document) { |
| 1448 document->mediaQueryAffectingValueChanged(); | 1447 document->mediaQueryAffectingValueChanged(); |
| 1449 document->styleResolverChanged(); | 1448 document->styleResolverChanged(); |
| 1450 document->updateLayout(); | 1449 document->updateLayout(); |
| 1451 } | 1450 } |
| 1452 } | 1451 } |
| 1453 | 1452 |
| 1454 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver) | 1453 bool InspectorPageAgent::shouldApplyViewportStyleOverride() |
| 1455 { | 1454 { |
| 1456 if (!m_deviceMetricsOverridden || !m_emulateMobileEnabled) | 1455 return m_deviceMetricsOverridden && m_emulateMobileEnabled; |
|
dgozman
2015/03/05 10:55:53
Since you are moving the heavy work into resolver
rune
2015/03/05 12:11:50
You mean setting as in add to Settings.in?
If so,
aelias_OOO_until_Jul13
2015/03/05 21:07:27
Yes, I was already thinking myself that that #if O
| |
| 1457 return false; | |
| 1458 | |
| 1459 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(CSSParserContext(UASheetMode, 0)); | |
| 1460 styleSheet->parseString(loadResourceAsASCIIString("viewportAndroid.css")); | |
| 1461 OwnPtrWillBeRawPtr<RuleSet> ruleSet = RuleSet::create(); | |
| 1462 ruleSet->addRulesFromSheet(styleSheet.get(), MediaQueryEvaluator("screen")); | |
| 1463 resolver->viewportStyleResolver()->collectViewportRules(ruleSet.get(), Viewp ortStyleResolver::UserAgentOrigin); | |
| 1464 return true; | |
| 1465 } | 1456 } |
| 1466 | 1457 |
| 1467 void InspectorPageAgent::applyEmulatedMedia(String* media) | 1458 void InspectorPageAgent::applyEmulatedMedia(String* media) |
| 1468 { | 1459 { |
| 1469 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM edia); | 1460 String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedM edia); |
| 1470 if (!emulatedMedia.isEmpty()) | 1461 if (!emulatedMedia.isEmpty()) |
| 1471 *media = emulatedMedia; | 1462 *media = emulatedMedia; |
| 1472 } | 1463 } |
| 1473 | 1464 |
| 1474 bool InspectorPageAgent::compositingEnabled(ErrorString* errorString) | 1465 bool InspectorPageAgent::compositingEnabled(ErrorString* errorString) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1507 visitor->trace(m_page); | 1498 visitor->trace(m_page); |
| 1508 visitor->trace(m_injectedScriptManager); | 1499 visitor->trace(m_injectedScriptManager); |
| 1509 visitor->trace(m_debuggerAgent); | 1500 visitor->trace(m_debuggerAgent); |
| 1510 visitor->trace(m_cssAgent); | 1501 visitor->trace(m_cssAgent); |
| 1511 visitor->trace(m_inspectorResourceContentLoader); | 1502 visitor->trace(m_inspectorResourceContentLoader); |
| 1512 InspectorBaseAgent::trace(visitor); | 1503 InspectorBaseAgent::trace(visitor); |
| 1513 } | 1504 } |
| 1514 | 1505 |
| 1515 } // namespace blink | 1506 } // namespace blink |
| 1516 | 1507 |
| OLD | NEW |