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

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

Issue 445023005: DevTools: reduce ResourceAgent dependency on PageAgent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 #include "core/css/CSSStyleSheet.h" 37 #include "core/css/CSSStyleSheet.h"
38 #include "core/css/CSSSupportsRule.h" 38 #include "core/css/CSSSupportsRule.h"
39 #include "core/css/StylePropertySet.h" 39 #include "core/css/StylePropertySet.h"
40 #include "core/css/StyleRule.h" 40 #include "core/css/StyleRule.h"
41 #include "core/css/StyleSheetContents.h" 41 #include "core/css/StyleSheetContents.h"
42 #include "core/dom/Document.h" 42 #include "core/dom/Document.h"
43 #include "core/dom/Element.h" 43 #include "core/dom/Element.h"
44 #include "core/html/HTMLStyleElement.h" 44 #include "core/html/HTMLStyleElement.h"
45 #include "core/html/parser/HTMLParserIdioms.h" 45 #include "core/html/parser/HTMLParserIdioms.h"
46 #include "core/inspector/ContentSearchUtils.h" 46 #include "core/inspector/ContentSearchUtils.h"
47 #include "core/inspector/EditedResourcesContentManager.h"
47 #include "core/inspector/InspectorCSSAgent.h" 48 #include "core/inspector/InspectorCSSAgent.h"
48 #include "core/inspector/InspectorPageAgent.h" 49 #include "core/inspector/InspectorPageAgent.h"
49 #include "core/inspector/InspectorResourceAgent.h" 50 #include "core/inspector/InspectorResourceAgent.h"
50 #include "core/svg/SVGStyleElement.h" 51 #include "core/svg/SVGStyleElement.h"
51 #include "wtf/OwnPtr.h" 52 #include "wtf/OwnPtr.h"
52 #include "wtf/PassOwnPtr.h" 53 #include "wtf/PassOwnPtr.h"
53 #include "wtf/text/StringBuilder.h" 54 #include "wtf/text/StringBuilder.h"
54 #include "wtf/text/TextPosition.h" 55 #include "wtf/text/TextPosition.h"
55 56
56 using blink::TypeBuilder::Array; 57 using blink::TypeBuilder::Array;
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) { 945 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) {
945 *ruleId = InspectorCSSId(id(), i); 946 *ruleId = InspectorCSSId(id(), i);
946 *propertyIndex = propertyData.size(); 947 *propertyIndex = propertyData.size();
947 *overwrite = false; 948 *overwrite = false;
948 return true; 949 return true;
949 } 950 }
950 } 951 }
951 return false; 952 return false;
952 } 953 }
953 954
954 PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(Inspecto rPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleShe etOrigin::Enum origin, const String& documentURL, Listener* listener) 955 PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(Inspecto rPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, EditedResourcesCon tentManager* editedResourcesContentManager, const String& id, PassRefPtrWillBeRa wPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum ori gin, const String& documentURL, Listener* listener)
955 { 956 {
956 return adoptRefWillBeNoop(new InspectorStyleSheet(pageAgent, resourceAgent, id, pageStyleSheet, origin, documentURL, listener)); 957 return adoptRefWillBeNoop(new InspectorStyleSheet(pageAgent, resourceAgent, editedResourcesContentManager, id, pageStyleSheet, origin, documentURL, listener ));
957 } 958 }
958 959
959 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto rResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyle Sheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const St ring& documentURL, Listener* listener) 960 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto rResourceAgent* resourceAgent, EditedResourcesContentManager* editedResourcesCon tentManager, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSh eet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, Listener* listener)
960 : InspectorStyleSheetBase(id, listener) 961 : InspectorStyleSheetBase(id, listener)
961 , m_pageAgent(pageAgent) 962 , m_pageAgent(pageAgent)
962 , m_resourceAgent(resourceAgent) 963 , m_resourceAgent(resourceAgent)
964 , m_editedResourcesContentManager(editedResourcesContentManager)
963 , m_pageStyleSheet(pageStyleSheet) 965 , m_pageStyleSheet(pageStyleSheet)
964 , m_origin(origin) 966 , m_origin(origin)
965 , m_documentURL(documentURL) 967 , m_documentURL(documentURL)
966 { 968 {
967 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get())); 969 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get()));
968 } 970 }
969 971
970 InspectorStyleSheet::~InspectorStyleSheet() 972 InspectorStyleSheet::~InspectorStyleSheet()
971 { 973 {
972 } 974 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 m_parsedStyleSheet->setText(sheetText); 1141 m_parsedStyleSheet->setText(sheetText);
1140 m_flatRules.clear(); 1142 m_flatRules.clear();
1141 fireStyleSheetChanged(); 1143 fireStyleSheetChanged();
1142 return true; 1144 return true;
1143 } 1145 }
1144 1146
1145 void InspectorStyleSheet::updateText(const String& newText) 1147 void InspectorStyleSheet::updateText(const String& newText)
1146 { 1148 {
1147 Element* element = ownerStyleElement(); 1149 Element* element = ownerStyleElement();
1148 if (!element) 1150 if (!element)
1149 m_pageAgent->addEditedResourceContent(finalURL(), newText); 1151 m_editedResourcesContentManager->add(finalURL(), newText);
1150 m_parsedStyleSheet->setText(newText); 1152 m_parsedStyleSheet->setText(newText);
1151 } 1153 }
1152 1154
1153 1155
1154 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const 1156 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const
1155 { 1157 {
1156 ASSERT(!id.isEmpty()); 1158 ASSERT(!id.isEmpty());
1157 ensureFlatRules(); 1159 ensureFlatRules();
1158 return InspectorCSSAgent::asCSSStyleRule(id.ordinal() >= m_flatRules.size() ? 0 : m_flatRules.at(id.ordinal()).get()); 1160 return InspectorCSSAgent::asCSSStyleRule(id.ordinal() >= m_flatRules.size() ? 0 : m_flatRules.at(id.ordinal()).get());
1159 } 1161 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 void InspectorStyleSheetForInlineStyle::trace(Visitor* visitor) 1713 void InspectorStyleSheetForInlineStyle::trace(Visitor* visitor)
1712 { 1714 {
1713 visitor->trace(m_element); 1715 visitor->trace(m_element);
1714 visitor->trace(m_ruleSourceData); 1716 visitor->trace(m_ruleSourceData);
1715 visitor->trace(m_inspectorStyle); 1717 visitor->trace(m_inspectorStyle);
1716 InspectorStyleSheetBase::trace(visitor); 1718 InspectorStyleSheetBase::trace(visitor);
1717 } 1719 }
1718 1720
1719 } // namespace blink 1721 } // namespace blink
1720 1722
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698