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

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

Issue 202893003: Reapply 169371 "DevTools: defer styles delta calculation to until the end of the task" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Lint Created 6 years, 9 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 { 101 {
102 return adoptPtr(new InspectorCSSAgent(domAgent, pageAgent, resourceAgent )); 102 return adoptPtr(new InspectorCSSAgent(domAgent, pageAgent, resourceAgent ));
103 } 103 }
104 virtual ~InspectorCSSAgent(); 104 virtual ~InspectorCSSAgent();
105 105
106 bool forcePseudoState(Element*, CSSSelector::PseudoType); 106 bool forcePseudoState(Element*, CSSSelector::PseudoType);
107 virtual void setFrontend(InspectorFrontend*) OVERRIDE; 107 virtual void setFrontend(InspectorFrontend*) OVERRIDE;
108 virtual void clearFrontend() OVERRIDE; 108 virtual void clearFrontend() OVERRIDE;
109 virtual void discardAgent() OVERRIDE; 109 virtual void discardAgent() OVERRIDE;
110 virtual void restore() OVERRIDE; 110 virtual void restore() OVERRIDE;
111 virtual void flushPendingFrontendMessages() OVERRIDE;
111 virtual void enable(ErrorString*, PassRefPtr<EnableCallback>) OVERRIDE; 112 virtual void enable(ErrorString*, PassRefPtr<EnableCallback>) OVERRIDE;
112 virtual void disable(ErrorString*) OVERRIDE; 113 virtual void disable(ErrorString*) OVERRIDE;
113 void reset(); 114 void reset();
114 void didCommitLoad(LocalFrame*, DocumentLoader*); 115 void didCommitLoad(LocalFrame*, DocumentLoader*);
115 void mediaQueryResultChanged(); 116 void mediaQueryResultChanged();
116 void willMutateRules(); 117 void willMutateRules();
117 void didMutateRules(CSSStyleSheet*); 118 void didMutateRules(CSSStyleSheet*);
118 void willMutateStyle(); 119 void willMutateStyle();
119 void didMutateStyle(CSSStyleDeclaration*, bool); 120 void didMutateStyle(CSSStyleDeclaration*, bool);
120 121
121 public:
122 void activeStyleSheetsUpdated(Document*); 122 void activeStyleSheetsUpdated(Document*);
123 void documentDetached(Document*);
123 void frameDetachedFromParent(LocalFrame*); 124 void frameDetachedFromParent(LocalFrame*);
124 125
125 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&) OVERRIDE; 126 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; 127 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; 128 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; 129 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; 130 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str ing* result) OVERRIDE;
130 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con st String& text) OVERRIDE; 131 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con st String& text) OVERRIDE;
131 virtual void setPropertyText(ErrorString*, const RefPtr<JSONObject>& styleId , int propertyIndex, const String& text, bool overwrite, RefPtr<TypeBuilder::CSS ::CSSStyle>& result) OVERRIDE; 132 virtual void setPropertyText(ErrorString*, const RefPtr<JSONObject>& styleId , int propertyIndex, const String& text, bool overwrite, RefPtr<TypeBuilder::CSS ::CSSStyle>& result) OVERRIDE;
132 virtual void setRuleSelector(ErrorString*, const RefPtr<JSONObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) OVERRIDE; 133 virtual void setRuleSelector(ErrorString*, const RefPtr<JSONObject>& ruleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) OVERRIDE;
(...skipping 19 matching lines...) Expand all
152 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; 153 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState;
153 154
154 void wasEnabled(PassRefPtr<EnableCallback>); 155 void wasEnabled(PassRefPtr<EnableCallback>);
155 void resetNonPersistentData(); 156 void resetNonPersistentData();
156 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); 157 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
157 Element* elementForId(ErrorString*, int nodeId); 158 Element* elementForId(ErrorString*, int nodeId);
158 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&); 159 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&);
159 void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&); 160 void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&);
160 void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&); 161 void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&);
161 162
162 void updateActiveStyleSheetsForDocument(Document*, StyleSheetsUpdateType); 163 void updateActiveStyleSheets(Document*, StyleSheetsUpdateType);
163 void updateActiveStyleSheets(LocalFrame*, const Vector<CSSStyleSheet*>&, Sty leSheetsUpdateType); 164 void setActiveStyleSheets(Document*, const Vector<CSSStyleSheet*>&, StyleShe etsUpdateType);
164 165
165 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*); 166 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*);
166 167
167 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); 168 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*);
168 String unbindStyleSheet(InspectorStyleSheet*); 169 String unbindStyleSheet(InspectorStyleSheet*);
169 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); 170 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent);
170 InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&); 171 InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&);
171 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty leSheet, Document* ownerDocument); 172 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty leSheet, Document* ownerDocument);
172 bool styleSheetEditInProgress() const { return m_styleSheetsPendingMutation || m_styleDeclarationPendingMutation || m_isSettingStyleSheetText; } 173 bool styleSheetEditInProgress() const { return m_styleSheetsPendingMutation || m_styleDeclarationPendingMutation || m_isSettingStyleSheetText; }
173 174
(...skipping 13 matching lines...) Expand all
187 188
188 void resetPseudoStates(); 189 void resetPseudoStates();
189 190
190 InspectorFrontend::CSS* m_frontend; 191 InspectorFrontend::CSS* m_frontend;
191 InspectorDOMAgent* m_domAgent; 192 InspectorDOMAgent* m_domAgent;
192 InspectorPageAgent* m_pageAgent; 193 InspectorPageAgent* m_pageAgent;
193 InspectorResourceAgent* m_resourceAgent; 194 InspectorResourceAgent* m_resourceAgent;
194 195
195 IdToInspectorStyleSheet m_idToInspectorStyleSheet; 196 IdToInspectorStyleSheet m_idToInspectorStyleSheet;
196 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe ctorStyleSheet; 197 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe ctorStyleSheet;
197 HashMap<LocalFrame*, OwnPtr<HashSet<CSSStyleSheet*> > > m_frameToCSSStyleShe ets; 198 typedef HashMap<Document*, OwnPtr<HashSet<CSSStyleSheet*> > > DocumentStyleS heets;
199 DocumentStyleSheets m_documentToCSSStyleSheets;
200 HashSet<Document*> m_invalidatedDocuments;
198 201
199 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; 202 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet;
200 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe ctorStyleSheet; // "via inspector" stylesheets 203 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe ctorStyleSheet; // "via inspector" stylesheets
201 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; 204 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState;
202 205
203 RefPtr<CSSStyleSheet> m_inspectorUserAgentStyleSheet; 206 RefPtr<CSSStyleSheet> m_inspectorUserAgentStyleSheet;
204 207
205 int m_lastStyleSheetId; 208 int m_lastStyleSheetId;
206 int m_styleSheetsPendingMutation; 209 int m_styleSheetsPendingMutation;
207 bool m_styleDeclarationPendingMutation; 210 bool m_styleDeclarationPendingMutation;
208 bool m_creatingViaInspectorStyleSheet; 211 bool m_creatingViaInspectorStyleSheet;
209 bool m_isSettingStyleSheetText; 212 bool m_isSettingStyleSheetText;
210 213
211 friend class EnableResourceClient; 214 friend class EnableResourceClient;
212 friend class StyleSheetBinder; 215 friend class StyleSheetBinder;
213 }; 216 };
214 217
215 218
216 } // namespace WebCore 219 } // namespace WebCore
217 220
218 #endif // !defined(InspectorCSSAgent_h) 221 #endif // !defined(InspectorCSSAgent_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorBaseAgent.cpp ('k') | Source/core/inspector/InspectorCSSAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698