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

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

Issue 1211813002: DevTools: allow injecting CSS rules without breaking styles sidebar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments addressed. Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/parser/CSSParserImpl.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(CSSR ule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); 141 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(CSSR ule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex);
142 142
143 bool isInlineStyle() override { return false; } 143 bool isInlineStyle() override { return false; }
144 const CSSRuleVector& flatRules(); 144 const CSSRuleVector& flatRules();
145 145
146 protected: 146 protected:
147 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyle(RefPtrWillBeRa wPtr<CSSStyleDeclaration>) override; 147 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyle(RefPtrWillBeRa wPtr<CSSStyleDeclaration>) override;
148 148
149 private: 149 private:
150 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu m, const String& documentURL, InspectorCSSAgent*); 150 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu m, const String& documentURL, InspectorCSSAgent*);
151 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleAfterSourceRange(const SourceRange &); 151 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAfterSourceRange(const S ourceRange&);
152 RefPtrWillBeRawPtr<CSSRuleSourceData> findRuleByHeaderRange(const SourceRang e&); 152 RefPtrWillBeRawPtr<CSSRuleSourceData> findRuleByHeaderRange(const SourceRang e&);
153 RefPtrWillBeRawPtr<CSSRuleSourceData> findRuleByBodyRange(const SourceRange& ); 153 RefPtrWillBeRawPtr<CSSRuleSourceData> findRuleByBodyRange(const SourceRange& );
154 RefPtrWillBeRawPtr<CSSRule> ruleForSourceData(CSSRuleSourceData*); 154 RefPtrWillBeRawPtr<CSSRule> ruleForSourceData(RefPtrWillBeRawPtr<CSSRuleSour ceData>);
155 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceDataForRule(CSSRule*); 155 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceDataForRule(RefPtrWillBeRawPtr<C SSRule>);
156 CSSStyleRule* insertCSSOMRuleInStyleSheet(CSSRule* insertBefore, const Strin g& ruleText, ExceptionState&); 156 CSSStyleRule* insertCSSOMRuleInStyleSheet(CSSRule* insertBefore, const Strin g& ruleText, ExceptionState&);
157 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, CSSRule* insertBefor e, const String& ruleText, ExceptionState&); 157 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, CSSRule* insertBefor e, const String& ruleText, ExceptionState&);
158 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String& ruleText, ExceptionState&); 158 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String& ruleText, ExceptionState&);
159 String sourceMapURL(); 159 String sourceMapURL();
160 String sourceURL(); 160 String sourceURL();
161 void collectFlatRules(); 161 void remapSourceDataToCSSOMIfNecessary();
162 void mapSourceDataToCSSOM();
162 bool resourceStyleSheetText(String* result); 163 bool resourceStyleSheetText(String* result);
163 bool inlineStyleSheetText(String* result); 164 bool inlineStyleSheetText(String* result);
164 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector>> selectorsFromSour ce(CSSRuleSourceData*, const String&); 165 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector>> selectorsFromSour ce(CSSRuleSourceData*, const String&);
165 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty leRule*); 166 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty leRule*);
166 String url(); 167 String url();
167 bool hasSourceURL(); 168 bool hasSourceURL();
168 bool startsAtZero(); 169 bool startsAtZero();
169 170
170 void replaceText(const SourceRange&, const String& text, SourceRange* newRan ge, String* oldText); 171 void replaceText(const SourceRange&, const String& text, SourceRange* newRan ge, String* oldText);
171 void innerSetText(const String& newText, bool markAsLocallyModified); 172 void innerSetText(const String& newText, bool markAsLocallyModified);
172 Element* ownerStyleElement(); 173 Element* ownerStyleElement();
173 174
174 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent; 175 RawPtrWillBeMember<InspectorCSSAgent> m_cssAgent;
175 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent; 176 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent;
176 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet; 177 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet;
177 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; 178 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin;
178 String m_documentURL; 179 String m_documentURL;
179 OwnPtrWillBeMember<RuleSourceDataList> m_sourceData; 180 OwnPtrWillBeMember<RuleSourceDataList> m_sourceData;
180 String m_text; 181 String m_text;
181 CSSRuleVector m_flatRules; 182 CSSRuleVector m_cssomFlatRules;
183 CSSRuleVector m_parsedFlatRules;
184 typedef HashMap<unsigned, unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWit hZeroKeyHashTraits<unsigned>> IndexMap;
185 IndexMap m_ruleToSourceData;
186 IndexMap m_sourceDataToRule;
182 String m_sourceURL; 187 String m_sourceURL;
183 }; 188 };
184 189
185 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase { 190 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase {
186 public: 191 public:
187 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); 192 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*);
188 193
189 void didModifyElementAttribute(); 194 void didModifyElementAttribute();
190 virtual bool setText(const String&, ExceptionState&) override; 195 virtual bool setText(const String&, ExceptionState&) override;
191 virtual bool getText(String* result) override; 196 virtual bool getText(String* result) override;
(...skipping 11 matching lines...) Expand all
203 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*); 208 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*);
204 const String& elementStyleText(); 209 const String& elementStyleText();
205 210
206 RefPtrWillBeMember<Element> m_element; 211 RefPtrWillBeMember<Element> m_element;
207 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; 212 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle;
208 }; 213 };
209 214
210 } // namespace blink 215 } // namespace blink
211 216
212 #endif // !defined(InspectorStyleSheet_h) 217 #endif // !defined(InspectorStyleSheet_h)
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserImpl.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698