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 19 matching lines...) Expand all Loading... |
30 #include "InspectorBaseAgent.h" | 30 #include "InspectorBaseAgent.h" |
31 #include "InspectorDOMAgent.h" | 31 #include "InspectorDOMAgent.h" |
32 #include "InspectorStyleSheet.h" | 32 #include "InspectorStyleSheet.h" |
33 #include "InspectorValues.h" | 33 #include "InspectorValues.h" |
34 #include "SecurityContext.h" | 34 #include "SecurityContext.h" |
35 | 35 |
36 #include <wtf/HashMap.h> | 36 #include <wtf/HashMap.h> |
37 #include <wtf/HashSet.h> | 37 #include <wtf/HashSet.h> |
38 #include <wtf/PassRefPtr.h> | 38 #include <wtf/PassRefPtr.h> |
39 #include <wtf/RefPtr.h> | 39 #include <wtf/RefPtr.h> |
| 40 #include <wtf/Vector.h> |
40 #include <wtf/text/WTFString.h> | 41 #include <wtf/text/WTFString.h> |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 class CSSRule; | 45 class CSSRule; |
45 class CSSRuleList; | 46 class CSSRuleList; |
46 class CSSStyleDeclaration; | 47 class CSSStyleDeclaration; |
47 class CSSStyleRule; | 48 class CSSStyleRule; |
48 class CSSStyleSheet; | 49 class CSSStyleSheet; |
49 class Document; | 50 class Document; |
50 class DocumentStyleSheetCollection; | 51 class DocumentStyleSheetCollection; |
51 class Element; | 52 class Element; |
52 class InspectorCSSOMWrappers; | 53 class InspectorCSSOMWrappers; |
53 class InspectorFrontend; | 54 class InspectorFrontend; |
54 class InstrumentingAgents; | 55 class InstrumentingAgents; |
55 class NameNodeMap; | 56 class NameNodeMap; |
56 class Node; | 57 class Node; |
57 class NodeList; | 58 class NodeList; |
58 class SelectorProfile; | 59 class SelectorProfile; |
59 class StyleResolver; | 60 class StyleResolver; |
60 class StyleRule; | 61 class StyleRule; |
| 62 class StyleSheetVisitor; |
61 class UpdateRegionLayoutTask; | 63 class UpdateRegionLayoutTask; |
62 | 64 |
63 | 65 |
64 class InspectorCSSAgent | 66 class InspectorCSSAgent |
65 : public InspectorBaseAgent<InspectorCSSAgent> | 67 : public InspectorBaseAgent<InspectorCSSAgent> |
66 , public InspectorDOMAgent::DOMListener | 68 , public InspectorDOMAgent::DOMListener |
67 , public InspectorBackendDispatcher::CSSCommandHandler | 69 , public InspectorBackendDispatcher::CSSCommandHandler |
68 , public InspectorStyleSheet::Listener { | 70 , public InspectorStyleSheet::Listener { |
69 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); | 71 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); |
70 public: | 72 public: |
(...skipping 28 matching lines...) Expand all Loading... |
99 virtual void discardAgent(); | 101 virtual void discardAgent(); |
100 virtual void restore(); | 102 virtual void restore(); |
101 virtual void enable(ErrorString*); | 103 virtual void enable(ErrorString*); |
102 virtual void disable(ErrorString*); | 104 virtual void disable(ErrorString*); |
103 void reset(); | 105 void reset(); |
104 void mediaQueryResultChanged(); | 106 void mediaQueryResultChanged(); |
105 void didCreateNamedFlow(Document*, NamedFlow*); | 107 void didCreateNamedFlow(Document*, NamedFlow*); |
106 void willRemoveNamedFlow(Document*, NamedFlow*); | 108 void willRemoveNamedFlow(Document*, NamedFlow*); |
107 void didUpdateRegionLayout(Document*, NamedFlow*); | 109 void didUpdateRegionLayout(Document*, NamedFlow*); |
108 void regionLayoutUpdated(NamedFlow*, int documentNodeId); | 110 void regionLayoutUpdated(NamedFlow*, int documentNodeId); |
| 111 void activeStyleSheetsUpdated(const Vector<RefPtr<StyleSheet> >& newSheets); |
109 | 112 |
110 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&); | 113 virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBu
ilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&); |
111 virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBui
lder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attribute
s); | 114 virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBui
lder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attribute
s); |
112 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> >& pseudoIdMatches, RefPtr<TypeBuilder::Array<TypeBuilder::C
SS::InheritedStyleEntry> >& inheritedEntries); | 115 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> >& pseudoIdMatches, RefPtr<TypeBuilder::Array<TypeBuilder::C
SS::InheritedStyleEntry> >& inheritedEntries); |
113 virtual void getAllStyleSheets(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
uilder::CSS::CSSStyleSheetHeader> >& styleSheetInfos); | 116 virtual void getAllStyleSheets(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
uilder::CSS::CSSStyleSheetHeader> >& styleSheetInfos); |
114 virtual void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<
TypeBuilder::CSS::CSSStyleSheetBody>& result); | 117 virtual void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<
TypeBuilder::CSS::CSSStyleSheetBody>& result); |
115 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str
ing* result); | 118 virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, Str
ing* result); |
116 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con
st String& text); | 119 virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, con
st String& text); |
117 virtual void setStyleText(ErrorString*, const RefPtr<InspectorObject>& style
Id, const String& text, RefPtr<TypeBuilder::CSS::CSSStyle>& result); | 120 virtual void setStyleText(ErrorString*, const RefPtr<InspectorObject>& style
Id, const String& text, RefPtr<TypeBuilder::CSS::CSSStyle>& result); |
118 virtual void setPropertyText(ErrorString*, const RefPtr<InspectorObject>& st
yleId, int propertyIndex, const String& text, bool overwrite, RefPtr<TypeBuilder
::CSS::CSSStyle>& result); | 121 virtual void setPropertyText(ErrorString*, const RefPtr<InspectorObject>& st
yleId, int propertyIndex, const String& text, bool overwrite, RefPtr<TypeBuilder
::CSS::CSSStyle>& result); |
(...skipping 27 matching lines...) Expand all Loading... |
146 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; | 149 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; |
147 typedef HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > CSSStyleSheetT
oInspectorStyleSheet; | 150 typedef HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > CSSStyleSheetT
oInspectorStyleSheet; |
148 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles | 151 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles |
149 typedef HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > DocumentToVi
aInspectorStyleSheet; // "via inspector" stylesheets | 152 typedef HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > DocumentToVi
aInspectorStyleSheet; // "via inspector" stylesheets |
150 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; | 153 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; |
151 | 154 |
152 void resetNonPersistentData(); | 155 void resetNonPersistentData(); |
153 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); | 156 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); |
154 Element* elementForId(ErrorString*, int nodeId); | 157 Element* elementForId(ErrorString*, int nodeId); |
155 int documentNodeWithRequestedFlowsId(Document*); | 158 int documentNodeWithRequestedFlowsId(Document*); |
156 void collectStyleSheets(CSSStyleSheet*, TypeBuilder::Array<WebCore::TypeBuil
der::CSS::CSSStyleSheetHeader>*); | 159 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&); |
| 160 void collectStyleSheets(CSSStyleSheet*, Vector<InspectorStyleSheet*>&); |
157 | 161 |
158 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); | 162 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); |
| 163 String unbindStyleSheet(InspectorStyleSheet*); |
159 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); | 164 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); |
160 InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&); | 165 InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&); |
161 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); | 166 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); |
162 | 167 |
163 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Styl
eResolver*); | 168 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Styl
eResolver*); |
164 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRule
List(CSSRuleList*, StyleResolver*); | 169 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRule
List(CSSRuleList*, StyleResolver*); |
165 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, StyleResolver*, Element*); | 170 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, StyleResolver*, Element*); |
166 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); | 171 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); |
167 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > buildArrayForRegio
ns(ErrorString*, PassRefPtr<NodeList>, int documentNodeId); | 172 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > buildArrayForRegio
ns(ErrorString*, PassRefPtr<NodeList>, int documentNodeId); |
168 PassRefPtr<TypeBuilder::CSS::NamedFlow> buildObjectForNamedFlow(ErrorString*
, NamedFlow*, int documentNodeId); | 173 PassRefPtr<TypeBuilder::CSS::NamedFlow> buildObjectForNamedFlow(ErrorString*
, NamedFlow*, int documentNodeId); |
(...skipping 13 matching lines...) Expand all Loading... |
182 | 187 |
183 IdToInspectorStyleSheet m_idToInspectorStyleSheet; | 188 IdToInspectorStyleSheet m_idToInspectorStyleSheet; |
184 CSSStyleSheetToInspectorStyleSheet m_cssStyleSheetToInspectorStyleSheet; | 189 CSSStyleSheetToInspectorStyleSheet m_cssStyleSheetToInspectorStyleSheet; |
185 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; | 190 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; |
186 DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet; | 191 DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet; |
187 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; | 192 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; |
188 HashSet<int> m_namedFlowCollectionsRequested; | 193 HashSet<int> m_namedFlowCollectionsRequested; |
189 OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask; | 194 OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask; |
190 | 195 |
191 int m_lastStyleSheetId; | 196 int m_lastStyleSheetId; |
| 197 bool m_creatingViaInspectorStyleSheet; |
192 | 198 |
193 OwnPtr<SelectorProfile> m_currentSelectorProfile; | 199 OwnPtr<SelectorProfile> m_currentSelectorProfile; |
| 200 |
| 201 friend class StyleSheetBinder; |
194 }; | 202 }; |
195 | 203 |
196 | 204 |
197 } // namespace WebCore | 205 } // namespace WebCore |
198 | 206 |
199 #endif // !defined(InspectorCSSAgent_h) | 207 #endif // !defined(InspectorCSSAgent_h) |
OLD | NEW |