| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 static CSSStyleRule* asCSSStyleRule(CSSRule*); | 96 static CSSStyleRule* asCSSStyleRule(CSSRule*); |
| 97 static CSSMediaRule* asCSSMediaRule(CSSRule*); | 97 static CSSMediaRule* asCSSMediaRule(CSSRule*); |
| 98 | 98 |
| 99 static PassOwnPtrWillBeRawPtr<InspectorCSSAgent> create(InspectorDOMAgent* d
omAgent, InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, I
nspectorResourceContentLoader* resourceContentLoader) | 99 static PassOwnPtrWillBeRawPtr<InspectorCSSAgent> create(InspectorDOMAgent* d
omAgent, InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, I
nspectorResourceContentLoader* resourceContentLoader) |
| 100 { | 100 { |
| 101 return adoptPtrWillBeNoop(new InspectorCSSAgent(domAgent, pageAgent, res
ourceAgent, resourceContentLoader)); | 101 return adoptPtrWillBeNoop(new InspectorCSSAgent(domAgent, pageAgent, res
ourceAgent, resourceContentLoader)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 static void collectAllDocumentStyleSheets(Document*, WillBeHeapVector<RawPtr
WillBeMember<CSSStyleSheet> >&); | 104 static void collectAllDocumentStyleSheets(Document*, WillBeHeapVector<RawPtr
WillBeMember<CSSStyleSheet> >&); |
| 105 | 105 |
| 106 virtual ~InspectorCSSAgent(); | 106 ~InspectorCSSAgent() override; |
| 107 DECLARE_VIRTUAL_TRACE(); | 107 DECLARE_VIRTUAL_TRACE(); |
| 108 | 108 |
| 109 bool forcePseudoState(Element*, CSSSelector::PseudoType); | 109 bool forcePseudoState(Element*, CSSSelector::PseudoType); |
| 110 void discardAgent() override; | 110 void discardAgent() override; |
| 111 void didCommitLoadForLocalFrame(LocalFrame*) override; | 111 void didCommitLoadForLocalFrame(LocalFrame*) override; |
| 112 void restore() override; | 112 void restore() override; |
| 113 void flushPendingProtocolNotifications() override; | 113 void flushPendingProtocolNotifications() override; |
| 114 void disable(ErrorString*) override; | 114 void disable(ErrorString*) override; |
| 115 void reset(); | 115 void reset(); |
| 116 void mediaQueryResultChanged(); | 116 void mediaQueryResultChanged(); |
| 117 void setCSSPropertyValue(ErrorString*, Element*, CSSPropertyID, const String
&); | 117 void setCSSPropertyValue(ErrorString*, Element*, CSSPropertyID, const String
&); |
| 118 | 118 |
| 119 void activeStyleSheetsUpdated(Document*); | 119 void activeStyleSheetsUpdated(Document*); |
| 120 void documentDetached(Document*); | 120 void documentDetached(Document*); |
| 121 | 121 |
| 122 void addEditedStyleSheet(const String& url, const String& content); | 122 void addEditedStyleSheet(const String& url, const String& content); |
| 123 bool getEditedStyleSheet(const String& url, String* content); | 123 bool getEditedStyleSheet(const String& url, String* content); |
| 124 | 124 |
| 125 void addEditedStyleElement(int backendNodeId, const String& content); | 125 void addEditedStyleElement(int backendNodeId, const String& content); |
| 126 bool getEditedStyleElement(int backendNodeId, String* content); | 126 bool getEditedStyleElement(int backendNodeId, String* content); |
| 127 | 127 |
| 128 void enable(ErrorString*, PassRefPtrWillBeRawPtr<EnableCallback>) override; | 128 void enable(ErrorString*, PassRefPtrWillBeRawPtr<EnableCallback>) override; |
| 129 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&) override; | 129 void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::A
rray<TypeBuilder::CSS::CSSComputedStyleProperty>>&) override; |
| 130 virtual void getPlatformFontsForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::PlatformFontUsage>>&) override; | 130 void getPlatformFontsForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::A
rray<TypeBuilder::CSS::PlatformFontUsage>>&) override; |
| 131 virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBui
lder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attribute
s) override; | 131 void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::CS
S::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attributes) overr
ide; |
| 132 virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* e
xcludePseudo, const bool* excludeInherited, RefPtr<TypeBuilder::Array<TypeBuilde
r::CSS::RuleMatch> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CS
S::PseudoIdMatches> >&, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedSty
leEntry> >& inheritedEntries) override; | 132 void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* excludePs
eudo, const bool* excludeInherited, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::
RuleMatch>>& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Pseudo
IdMatches>>&, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>>&
inheritedEntries) override; |
| 133 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str
ing* result) override; | 133 void getStyleSheetText(ErrorString*, const String& styleSheetId, String* res
ult) override; |
| 134 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con
st String& text) override; | 134 void setStyleSheetText(ErrorString*, const String& styleSheetId, const Strin
g& text) override; |
| 135 virtual void setRuleSelector(ErrorString*, const String& styleSheetId, const
RefPtr<JSONObject>& range, const String& selector, RefPtr<TypeBuilder::CSS::CSS
Rule>& result) override; | 135 void setRuleSelector(ErrorString*, const String& styleSheetId, const RefPtr<
JSONObject>& range, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& r
esult) override; |
| 136 virtual void setStyleText(ErrorString*, const String& styleSheetId, const Re
fPtr<JSONObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSStyle>&
result) override; | 136 void setStyleText(ErrorString*, const String& styleSheetId, const RefPtr<JSO
NObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSStyle>& result)
override; |
| 137 virtual void setMediaText(ErrorString*, const String& styleSheetId, const Re
fPtr<JSONObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSMedia>&
result) override; | 137 void setMediaText(ErrorString*, const String& styleSheetId, const RefPtr<JSO
NObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSMedia>& result)
override; |
| 138 virtual void createStyleSheet(ErrorString*, const String& frameId, TypeBuild
er::CSS::StyleSheetId* outStyleSheetId) override; | 138 void createStyleSheet(ErrorString*, const String& frameId, TypeBuilder::CSS:
:StyleSheetId* outStyleSheetId) override; |
| 139 virtual void addRule(ErrorString*, const String& styleSheetId, const String&
ruleText, const RefPtr<JSONObject>& location, RefPtr<TypeBuilder::CSS::CSSRule>
& result) override; | 139 void addRule(ErrorString*, const String& styleSheetId, const String& ruleTex
t, const RefPtr<JSONObject>& location, RefPtr<TypeBuilder::CSS::CSSRule>& result
) override; |
| 140 virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<JSONArr
ay>& forcedPseudoClasses) override; | 140 void forcePseudoState(ErrorString*, int nodeId, const RefPtr<JSONArray>& for
cedPseudoClasses) override; |
| 141 virtual void getMediaQueries(ErrorString*, RefPtr<TypeBuilder::Array<TypeBui
lder::CSS::CSSMedia> >& medias) override; | 141 void getMediaQueries(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::CS
S::CSSMedia>>& medias) override; |
| 142 virtual void setEffectivePropertyValueForNode(ErrorString*, int nodeId, cons
t String& propertyName, const String& value) override; | 142 void setEffectivePropertyValueForNode(ErrorString*, int nodeId, const String
& propertyName, const String& value) override; |
| 143 bool collectMediaQueriesFromRule(CSSRule*, TypeBuilder::Array<TypeBuilder::C
SS::CSSMedia>* mediaArray); | 143 bool collectMediaQueriesFromRule(CSSRule*, TypeBuilder::Array<TypeBuilder::C
SS::CSSMedia>* mediaArray); |
| 144 bool collectMediaQueriesFromStyleSheet(CSSStyleSheet*, TypeBuilder::Array<Ty
peBuilder::CSS::CSSMedia>* mediaArray); | 144 bool collectMediaQueriesFromStyleSheet(CSSStyleSheet*, TypeBuilder::Array<Ty
peBuilder::CSS::CSSMedia>* mediaArray); |
| 145 PassRefPtr<TypeBuilder::CSS::CSSMedia> buildMediaObject(const MediaList*, Me
diaListSource, const String&, CSSStyleSheet*); | 145 PassRefPtr<TypeBuilder::CSS::CSSMedia> buildMediaObject(const MediaList*, Me
diaListSource, const String&, CSSStyleSheet*); |
| 146 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> > buildMediaListCh
ain(CSSRule*); | 146 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> > buildMediaListCh
ain(CSSRule*); |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 class StyleSheetAction; | 149 class StyleSheetAction; |
| 150 class SetStyleSheetTextAction; | 150 class SetStyleSheetTextAction; |
| 151 class ModifyRuleAction; | 151 class ModifyRuleAction; |
| 152 class SetElementStyleAction; | 152 class SetElementStyleAction; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 178 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); | 178 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); |
| 179 InspectorStyleSheet* assertInspectorStyleSheetForId(ErrorString*, const Stri
ng&); | 179 InspectorStyleSheet* assertInspectorStyleSheetForId(ErrorString*, const Stri
ng&); |
| 180 InspectorStyleSheetBase* assertStyleSheetForId(ErrorString*, const String&); | 180 InspectorStyleSheetBase* assertStyleSheetForId(ErrorString*, const String&); |
| 181 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); | 181 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); |
| 182 | 182 |
| 183 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*); | 183 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*); |
| 184 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, Element*, PseudoId); | 184 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, Element*, PseudoId); |
| 185 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); | 185 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); |
| 186 | 186 |
| 187 // InspectorDOMAgent::DOMListener implementation | 187 // InspectorDOMAgent::DOMListener implementation |
| 188 virtual void didRemoveDocument(Document*) override; | 188 void didRemoveDocument(Document*) override; |
| 189 virtual void didRemoveDOMNode(Node*) override; | 189 void didRemoveDOMNode(Node*) override; |
| 190 virtual void didModifyDOMAttr(Element*) override; | 190 void didModifyDOMAttr(Element*) override; |
| 191 | 191 |
| 192 // InspectorStyleSheet::Listener implementation | 192 // InspectorStyleSheet::Listener implementation |
| 193 virtual void styleSheetChanged(InspectorStyleSheetBase*) override; | 193 void styleSheetChanged(InspectorStyleSheetBase*) override; |
| 194 virtual void willReparseStyleSheet() override; | 194 void willReparseStyleSheet() override; |
| 195 virtual void didReparseStyleSheet() override; | 195 void didReparseStyleSheet() override; |
| 196 | 196 |
| 197 void resetPseudoStates(); | 197 void resetPseudoStates(); |
| 198 | 198 |
| 199 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; | 199 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; |
| 200 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; | 200 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; |
| 201 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent; | 201 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent; |
| 202 RawPtrWillBeMember<InspectorResourceContentLoader> m_resourceContentLoader; | 202 RawPtrWillBeMember<InspectorResourceContentLoader> m_resourceContentLoader; |
| 203 | 203 |
| 204 IdToInspectorStyleSheet m_idToInspectorStyleSheet; | 204 IdToInspectorStyleSheet m_idToInspectorStyleSheet; |
| 205 IdToInspectorStyleSheetForInlineStyle m_idToInspectorStyleSheetForInlineStyl
e; | 205 IdToInspectorStyleSheetForInlineStyle m_idToInspectorStyleSheetForInlineStyl
e; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 220 bool m_isSettingStyleSheetText; | 220 bool m_isSettingStyleSheetText; |
| 221 | 221 |
| 222 friend class InspectorResourceContentLoaderCallback; | 222 friend class InspectorResourceContentLoaderCallback; |
| 223 friend class StyleSheetBinder; | 223 friend class StyleSheetBinder; |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 | 226 |
| 227 } // namespace blink | 227 } // namespace blink |
| 228 | 228 |
| 229 #endif // !defined(InspectorCSSAgent_h) | 229 #endif // !defined(InspectorCSSAgent_h) |
| OLD | NEW |