summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/InspectorDOMAgent.h
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/inspector/InspectorDOMAgent.h
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/inspector/InspectorDOMAgent.h')
-rw-r--r--WebCore/inspector/InspectorDOMAgent.h61
1 files changed, 58 insertions, 3 deletions
diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h
index d7334b7..7211ed2 100644
--- a/WebCore/inspector/InspectorDOMAgent.h
+++ b/WebCore/inspector/InspectorDOMAgent.h
@@ -45,6 +45,11 @@
namespace WebCore {
class ContainerNode;
+ class CSSRule;
+ class CSSRuleList;
+ class CSSStyleDeclaration;
+ class CSSStyleRule;
+ class CSSStyleSheet;
class Element;
class Event;
class Document;
@@ -87,13 +92,27 @@ namespace WebCore {
virtual bool operator==(const EventListener& other);
- // Methods called from the frontend.
+ // Methods called from the frontend for DOM nodes inspection.
void getChildNodes(long callId, long nodeId);
void setAttribute(long callId, long elementId, const String& name, const String& value);
void removeAttribute(long callId, long elementId, const String& name);
+ void removeNode(long callId, long nodeId);
+ void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded);
void setTextNodeValue(long callId, long nodeId, const String& value);
void getEventListenersForNode(long callId, long nodeId);
+ // Methods called from the frontend for CSS styles inspection.
+ void getStyles(long callId, long nodeId, bool authorOnly);
+ void getAllStyles(long callId);
+ void getInlineStyle(long callId, long nodeId);
+ void getComputedStyle(long callId, long nodeId);
+ void applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName);
+ void setStyleText(long callId, long styleId, const String& cssText);
+ void setStyleProperty(long callId, long styleId, const String& name, const String& value);
+ void toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled);
+ void setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId);
+ void addRule(long callId, const String& selector, long selectedNodeId);
+
// Methods called from the InspectorController.
void setDocument(Document* document);
void releaseDanglingNodes();
@@ -107,22 +126,29 @@ namespace WebCore {
long pushNodePathToFrontend(Node* node);
void pushChildNodesToFrontend(long nodeId);
- private:
+ private:
+ typedef std::pair<String, String> PropertyValueAndPriority;
+ typedef HashMap<String, PropertyValueAndPriority> DisabledStyleDeclaration;
+
void startListening(Document* document);
void stopListening(Document* document);
virtual void handleEvent(ScriptExecutionContext*, Event* event);
+ // Node-related methods.
typedef HashMap<RefPtr<Node>, long> NodeToIdMap;
long bind(Node* node, NodeToIdMap* nodesMap);
void unbind(Node* node, NodeToIdMap* nodesMap);
bool pushDocumentToFrontend();
+ ScriptObject buildObjectForAttributeStyles(Element* element);
+ ScriptArray buildArrayForCSSRules(CSSRuleList*);
+ ScriptArray buildArrayForPseudoElements(Element* element, bool authorOnly);
+
ScriptObject buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap);
ScriptArray buildArrayForElementAttributes(Element* element);
ScriptArray buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap);
-
ScriptObject buildObjectForEventListener(const RegisteredEventListener& registeredEventListener, const AtomicString& eventType, Node* node);
// We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently.
@@ -136,6 +162,20 @@ namespace WebCore {
Document* mainFrameDocument() const;
String documentURLString(Document* document) const;
+
+ long bindStyle(CSSStyleDeclaration*);
+ long bindRule(CSSStyleRule*);
+ ScriptObject buildObjectForStyle(CSSStyleDeclaration*, bool bind);
+ void populateObjectWithStyleProperties(CSSStyleDeclaration*, ScriptObject& result);
+ ScriptArray buildArrayForDisabledStyleProperties(DisabledStyleDeclaration&);
+ ScriptObject buildObjectForRule(CSSStyleRule*);
+ ScriptObject buildObjectForStyleSheet(CSSStyleSheet*);
+ Vector<String> longhandProperties(CSSStyleDeclaration*, const String& shorthandProperty);
+ String shorthandValue(CSSStyleDeclaration*, const String& shorthandProperty);
+ String shorthandPriority(CSSStyleDeclaration*, const String& shorthandProperty);
+ bool ruleAffectsNode(CSSStyleRule*, Node*);
+ ScriptArray toArray(const Vector<String>& data);
+
void discardBindings();
InspectorFrontend* m_frontend;
@@ -146,6 +186,21 @@ namespace WebCore {
HashMap<long, NodeToIdMap*> m_idToNodesMap;
HashSet<long> m_childrenRequested;
long m_lastNodeId;
+
+ typedef HashMap<CSSStyleDeclaration*, long> StyleToIdMap;
+ typedef HashMap<long, RefPtr<CSSStyleDeclaration> > IdToStyleMap;
+ StyleToIdMap m_styleToId;
+ IdToStyleMap m_idToStyle;
+ typedef HashMap<CSSStyleRule*, long> RuleToIdMap;
+ typedef HashMap<long, RefPtr<CSSStyleRule> > IdToRuleMap;
+ RuleToIdMap m_ruleToId;
+ IdToRuleMap m_idToRule;
+ typedef HashMap<long, DisabledStyleDeclaration> IdToDisabledStyleMap;
+ IdToDisabledStyleMap m_idToDisabledStyle;
+ RefPtr<CSSStyleSheet> m_inspectorStyleSheet;
+
+ long m_lastStyleId;
+ long m_lastRuleId;
ListHashSet<RefPtr<Document> > m_documents;
};