| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 struct CSSParserString; | 45 struct CSSParserString; |
| 46 class CSSRule; | 46 class CSSRule; |
| 47 class CSSRuleList; | 47 class CSSRuleList; |
| 48 class CSSStyleRule; | 48 class CSSStyleRule; |
| 49 class CSSStyleSheet; | 49 class CSSStyleSheet; |
| 50 class Document; | 50 class Document; |
| 51 class Element; | 51 class Element; |
| 52 class InspectorFrontend; | 52 class InspectorFrontend; |
| 53 class InspectorResourceAgent; | |
| 54 class InstrumentingAgents; | 53 class InstrumentingAgents; |
| 55 class MediaList; | 54 class MediaList; |
| 56 class Node; | 55 class Node; |
| 57 class NodeList; | 56 class NodeList; |
| 58 class PlatformFontUsage; | 57 class PlatformFontUsage; |
| 59 class RenderText; | 58 class RenderText; |
| 60 class StyleResolver; | 59 class StyleResolver; |
| 61 | 60 |
| 62 class InspectorCSSAgent FINAL | 61 class InspectorCSSAgent FINAL |
| 63 : public InspectorBaseAgent<InspectorCSSAgent> | 62 : public InspectorBaseAgent<InspectorCSSAgent> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 90 { | 89 { |
| 91 m_contentSecurityPolicy->setOverrideAllowInlineStyle(false); | 90 m_contentSecurityPolicy->setOverrideAllowInlineStyle(false); |
| 92 } | 91 } |
| 93 | 92 |
| 94 private: | 93 private: |
| 95 ContentSecurityPolicy* m_contentSecurityPolicy; | 94 ContentSecurityPolicy* m_contentSecurityPolicy; |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 static CSSStyleRule* asCSSStyleRule(CSSRule*); | 97 static CSSStyleRule* asCSSStyleRule(CSSRule*); |
| 99 | 98 |
| 100 static PassOwnPtr<InspectorCSSAgent> create(InspectorDOMAgent* domAgent, Ins
pectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent) | 99 static PassOwnPtr<InspectorCSSAgent> create(InspectorDOMAgent* domAgent, Ins
pectorPageAgent* pageAgent) |
| 101 { | 100 { |
| 102 return adoptPtr(new InspectorCSSAgent(domAgent, pageAgent, resourceAgent
)); | 101 return adoptPtr(new InspectorCSSAgent(domAgent, pageAgent)); |
| 103 } | 102 } |
| 104 virtual ~InspectorCSSAgent(); | 103 virtual ~InspectorCSSAgent(); |
| 105 | 104 |
| 106 bool forcePseudoState(Element*, CSSSelector::PseudoType); | 105 bool forcePseudoState(Element*, CSSSelector::PseudoType); |
| 107 virtual void setFrontend(InspectorFrontend*) OVERRIDE; | 106 virtual void setFrontend(InspectorFrontend*) OVERRIDE; |
| 108 virtual void clearFrontend() OVERRIDE; | 107 virtual void clearFrontend() OVERRIDE; |
| 109 virtual void discardAgent() OVERRIDE; | 108 virtual void discardAgent() OVERRIDE; |
| 110 virtual void didCommitLoadForMainFrame() OVERRIDE; | 109 virtual void didCommitLoadForMainFrame() OVERRIDE; |
| 111 virtual void restore() OVERRIDE; | 110 virtual void restore() OVERRIDE; |
| 112 virtual void flushPendingFrontendMessages() OVERRIDE; | 111 virtual void flushPendingFrontendMessages() OVERRIDE; |
| 113 virtual void enable(ErrorString*, PassRefPtr<EnableCallback>) OVERRIDE; | 112 virtual void enable(ErrorString*) OVERRIDE; |
| 114 virtual void disable(ErrorString*) OVERRIDE; | 113 virtual void disable(ErrorString*) OVERRIDE; |
| 115 void reset(); | 114 void reset(); |
| 116 void mediaQueryResultChanged(); | 115 void mediaQueryResultChanged(); |
| 117 void willMutateRules(); | 116 void willMutateRules(); |
| 118 void didMutateRules(CSSStyleSheet*); | 117 void didMutateRules(CSSStyleSheet*); |
| 119 void willMutateStyle(); | 118 void willMutateStyle(); |
| 120 void didMutateStyle(CSSStyleDeclaration*, bool); | 119 void didMutateStyle(CSSStyleDeclaration*, bool); |
| 121 | 120 |
| 122 void activeStyleSheetsUpdated(Document*); | 121 void activeStyleSheetsUpdated(Document*); |
| 123 void documentDetached(Document*); | 122 void documentDetached(Document*); |
| 124 | 123 |
| 125 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&) OVERRIDE; | 124 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&) OVERRIDE; |
| 126 virtual void getPlatformFontsForNode(ErrorString*, int nodeId, String* cssFa
milyName, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage> >&) OVE
RRIDE; | 125 virtual void getPlatformFontsForNode(ErrorString*, int nodeId, String* cssFa
milyName, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage> >&) OVE
RRIDE; |
| 127 virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBui
lder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attribute
s) OVERRIDE; | 126 virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBui
lder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attribute
s) OVERRIDE; |
| 128 virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* i
ncludePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilde
r::CSS::RuleMatch> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CS
S::PseudoIdMatches> >&, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedSty
leEntry> >& inheritedEntries) OVERRIDE; | 127 virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* i
ncludePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilde
r::CSS::RuleMatch> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CS
S::PseudoIdMatches> >&, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedSty
leEntry> >& inheritedEntries) OVERRIDE; |
| 129 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str
ing* result) OVERRIDE; | 128 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str
ing* result) OVERRIDE; |
| 130 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con
st String& text) OVERRIDE; | 129 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con
st String& text) OVERRIDE; |
| 131 | 130 |
| 132 virtual void setPropertyText(ErrorString*, const String& styleSheetId, const
RefPtr<JSONObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSStyl
e>& result) OVERRIDE; | 131 virtual void setPropertyText(ErrorString*, const String& styleSheetId, const
RefPtr<JSONObject>& range, const String& text, RefPtr<TypeBuilder::CSS::CSSStyl
e>& result) OVERRIDE; |
| 133 virtual void setRuleSelector(ErrorString*, const String& styleSheetId, const
RefPtr<JSONObject>& range, const String& selector, RefPtr<TypeBuilder::CSS::CSS
Rule>& result) OVERRIDE; | 132 virtual void setRuleSelector(ErrorString*, const String& styleSheetId, const
RefPtr<JSONObject>& range, const String& selector, RefPtr<TypeBuilder::CSS::CSS
Rule>& result) OVERRIDE; |
| 134 virtual void createStyleSheet(ErrorString*, const String& frameId, TypeBuild
er::CSS::StyleSheetId* outStyleSheetId) OVERRIDE; | 133 virtual void createStyleSheet(ErrorString*, const String& frameId, TypeBuild
er::CSS::StyleSheetId* outStyleSheetId) OVERRIDE; |
| 135 virtual void addRule(ErrorString*, const String& styleSheetId, const String&
selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) OVERRIDE; | 134 virtual void addRule(ErrorString*, const String& styleSheetId, const String&
selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) OVERRIDE; |
| 136 virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<JSONArr
ay>& forcedPseudoClasses) OVERRIDE; | 135 virtual void forcePseudoState(ErrorString*, int nodeId, const RefPtr<JSONArr
ay>& forcedPseudoClasses) OVERRIDE; |
| 137 | 136 |
| 138 PassRefPtr<TypeBuilder::CSS::CSSMedia> buildMediaObject(const MediaList*, Me
diaListSource, const String&, CSSStyleSheet*); | 137 PassRefPtr<TypeBuilder::CSS::CSSMedia> buildMediaObject(const MediaList*, Me
diaListSource, const String&, CSSStyleSheet*); |
| 139 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> > buildMediaListCh
ain(CSSRule*); | 138 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> > buildMediaListCh
ain(CSSRule*); |
| 140 | 139 |
| 140 static void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&
); |
| 141 |
| 141 private: | 142 private: |
| 142 class StyleSheetAction; | 143 class StyleSheetAction; |
| 143 class SetStyleSheetTextAction; | 144 class SetStyleSheetTextAction; |
| 144 class SetPropertyTextAction; | 145 class SetPropertyTextAction; |
| 145 class SetRuleSelectorAction; | 146 class SetRuleSelectorAction; |
| 146 class AddRuleAction; | 147 class AddRuleAction; |
| 147 class EnableResourceClient; | |
| 148 | 148 |
| 149 InspectorCSSAgent(InspectorDOMAgent*, InspectorPageAgent*, InspectorResource
Agent*); | 149 InspectorCSSAgent(InspectorDOMAgent*, InspectorPageAgent*); |
| 150 | 150 |
| 151 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; | 151 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; |
| 152 typedef HashMap<String, RefPtr<InspectorStyleSheetForInlineStyle> > IdToInsp
ectorStyleSheetForInlineStyle; | 152 typedef HashMap<String, RefPtr<InspectorStyleSheetForInlineStyle> > IdToInsp
ectorStyleSheetForInlineStyle; |
| 153 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles | 153 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles |
| 154 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; | 154 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; |
| 155 | 155 |
| 156 void wasEnabled(PassRefPtr<EnableCallback>); | 156 void wasEnabled(); |
| 157 void resetNonPersistentData(); | 157 void resetNonPersistentData(); |
| 158 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); | 158 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); |
| 159 Element* elementForId(ErrorString*, int nodeId); | 159 Element* elementForId(ErrorString*, int nodeId); |
| 160 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&); | 160 void bindAllStyleSheets(); |
| 161 void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&); | 161 static void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&); |
| 162 void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&); | |
| 163 | 162 |
| 164 void updateActiveStyleSheets(Document*, StyleSheetsUpdateType); | 163 void updateActiveStyleSheets(Document*, StyleSheetsUpdateType); |
| 165 void setActiveStyleSheets(Document*, const Vector<CSSStyleSheet*>&, StyleShe
etsUpdateType); | 164 void setActiveStyleSheets(Document*, const Vector<CSSStyleSheet*>&, StyleShe
etsUpdateType); |
| 166 | 165 |
| 167 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*); | 166 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*); |
| 168 | 167 |
| 169 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); | 168 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); |
| 170 String unbindStyleSheet(InspectorStyleSheet*); | 169 String unbindStyleSheet(InspectorStyleSheet*); |
| 171 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); | 170 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); |
| 172 InspectorStyleSheet* assertInspectorStyleSheetForId(ErrorString*, const Stri
ng&); | 171 InspectorStyleSheet* assertInspectorStyleSheetForId(ErrorString*, const Stri
ng&); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 186 // InspectorStyleSheet::Listener implementation | 185 // InspectorStyleSheet::Listener implementation |
| 187 virtual void styleSheetChanged(InspectorStyleSheetBase*) OVERRIDE; | 186 virtual void styleSheetChanged(InspectorStyleSheetBase*) OVERRIDE; |
| 188 virtual void willReparseStyleSheet() OVERRIDE; | 187 virtual void willReparseStyleSheet() OVERRIDE; |
| 189 virtual void didReparseStyleSheet() OVERRIDE; | 188 virtual void didReparseStyleSheet() OVERRIDE; |
| 190 | 189 |
| 191 void resetPseudoStates(); | 190 void resetPseudoStates(); |
| 192 | 191 |
| 193 InspectorFrontend::CSS* m_frontend; | 192 InspectorFrontend::CSS* m_frontend; |
| 194 InspectorDOMAgent* m_domAgent; | 193 InspectorDOMAgent* m_domAgent; |
| 195 InspectorPageAgent* m_pageAgent; | 194 InspectorPageAgent* m_pageAgent; |
| 196 InspectorResourceAgent* m_resourceAgent; | |
| 197 | 195 |
| 198 IdToInspectorStyleSheet m_idToInspectorStyleSheet; | 196 IdToInspectorStyleSheet m_idToInspectorStyleSheet; |
| 199 IdToInspectorStyleSheetForInlineStyle m_idToInspectorStyleSheetForInlineStyl
e; | 197 IdToInspectorStyleSheetForInlineStyle m_idToInspectorStyleSheetForInlineStyl
e; |
| 200 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe
ctorStyleSheet; | 198 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe
ctorStyleSheet; |
| 201 typedef HashMap<Document*, OwnPtr<HashSet<CSSStyleSheet*> > > DocumentStyleS
heets; | 199 typedef HashMap<Document*, OwnPtr<HashSet<CSSStyleSheet*> > > DocumentStyleS
heets; |
| 202 DocumentStyleSheets m_documentToCSSStyleSheets; | 200 DocumentStyleSheets m_documentToCSSStyleSheets; |
| 203 HashSet<Document*> m_invalidatedDocuments; | 201 HashSet<Document*> m_invalidatedDocuments; |
| 204 | 202 |
| 205 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; | 203 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; |
| 206 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe
ctorStyleSheet; // "via inspector" stylesheets | 204 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe
ctorStyleSheet; // "via inspector" stylesheets |
| 207 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; | 205 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; |
| 208 | 206 |
| 209 RefPtrWillBePersistent<CSSStyleSheet> m_inspectorUserAgentStyleSheet; | 207 RefPtrWillBePersistent<CSSStyleSheet> m_inspectorUserAgentStyleSheet; |
| 210 | 208 |
| 211 int m_lastStyleSheetId; | 209 int m_lastStyleSheetId; |
| 212 int m_styleSheetsPendingMutation; | 210 int m_styleSheetsPendingMutation; |
| 213 bool m_styleDeclarationPendingMutation; | 211 bool m_styleDeclarationPendingMutation; |
| 214 bool m_creatingViaInspectorStyleSheet; | 212 bool m_creatingViaInspectorStyleSheet; |
| 215 bool m_isSettingStyleSheetText; | 213 bool m_isSettingStyleSheetText; |
| 216 | 214 |
| 217 friend class EnableResourceClient; | |
| 218 friend class StyleSheetBinder; | 215 friend class StyleSheetBinder; |
| 219 }; | 216 }; |
| 220 | 217 |
| 221 | 218 |
| 222 } // namespace WebCore | 219 } // namespace WebCore |
| 223 | 220 |
| 224 #endif // !defined(InspectorCSSAgent_h) | 221 #endif // !defined(InspectorCSSAgent_h) |
| OLD | NEW |