[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 02:23:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9102f86a0f5d0fd2295e108df6df95669b235b72
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 16 09:32:43 2010 +0000

    2010-03-16  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: migrate to native styles inspector in
            order to inspect styles from foreighn domains.
    
            https://bugs.webkit.org/show_bug.cgi?id=36117
    
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::getStyles):
            (WebCore::InspectorBackend::getInlineStyle):
            (WebCore::InspectorBackend::getComputedStyle):
            (WebCore::InspectorBackend::applyStyleText):
            (WebCore::InspectorBackend::setStyleText):
            (WebCore::InspectorBackend::setStyleProperty):
            (WebCore::InspectorBackend::toggleStyleEnabled):
            (WebCore::InspectorBackend::setRuleSelector):
            (WebCore::InspectorBackend::addRule):
            * inspector/InspectorBackend.h:
            * inspector/InspectorBackend.idl:
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::InspectorDOMAgent):
            (WebCore::InspectorDOMAgent::getStyles):
            (WebCore::InspectorDOMAgent::getInlineStyle):
            (WebCore::InspectorDOMAgent::getComputedStyle):
            (WebCore::InspectorDOMAgent::getMatchedCSSRules):
            (WebCore::InspectorDOMAgent::getAttributeStyles):
            (WebCore::InspectorDOMAgent::applyStyleText):
            (WebCore::InspectorDOMAgent::setStyleText):
            (WebCore::InspectorDOMAgent::setStyleProperty):
            (WebCore::InspectorDOMAgent::toggleStyleEnabled):
            (WebCore::InspectorDOMAgent::setRuleSelector):
            (WebCore::InspectorDOMAgent::addRule):
            (WebCore::InspectorDOMAgent::bindStyle):
            (WebCore::InspectorDOMAgent::bindRule):
            (WebCore::InspectorDOMAgent::buildObjectForStyle):
            (WebCore::InspectorDOMAgent::populateObjectWithStyleProperties):
            (WebCore::InspectorDOMAgent::buildObjectForRule):
            (WebCore::InspectorDOMAgent::uniqueStyleProperties):
            (WebCore::InspectorDOMAgent::longhandProperties):
            (WebCore::InspectorDOMAgent::shorthandPriority):
            (WebCore::InspectorDOMAgent::ruleAffectsNode):
            (WebCore::InspectorDOMAgent::toArray):
            * inspector/InspectorDOMAgent.h:
            * inspector/InspectorFrontend.cpp:
            (WebCore::InspectorFrontend::didGetEventListenersForNode):
            (WebCore::InspectorFrontend::didGetStyles):
            (WebCore::InspectorFrontend::didGetComputedStyle):
            (WebCore::InspectorFrontend::didGetInlineStyle):
            (WebCore::InspectorFrontend::didApplyStyleText):
            (WebCore::InspectorFrontend::didSetStyleText):
            (WebCore::InspectorFrontend::didSetStyleProperty):
            (WebCore::InspectorFrontend::didToggleStyleEnabled):
            (WebCore::InspectorFrontend::didSetRuleSelector):
            (WebCore::InspectorFrontend::didAddRule):
            * inspector/InspectorFrontend.h:
            * inspector/front-end/DOMAgent.js:
            (WebInspector.CSSStyleDeclaration):
            * inspector/front-end/ElementsTreeOutline.js:
            * inspector/front-end/InjectedScript.js:
            * inspector/front-end/MetricsSidebarPane.js:
            (WebInspector.MetricsSidebarPane.prototype.update):
            (WebInspector.MetricsSidebarPane.prototype.editingCommitted):
            * inspector/front-end/StylesSidebarPane.js:
            (WebInspector.StylesSidebarPane.prototype.update):
            (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.callback):
            (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
            (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted.callback):
            (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted):
            (WebInspector.StylePropertyTreeElement.prototype):
            (WebInspector.StylePropertyTreeElement.prototype.):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/inspector/styles-iframe.html b/LayoutTests/inspector/styles-iframe.html
index 83cef91..058d017 100755
--- a/LayoutTests/inspector/styles-iframe.html
+++ b/LayoutTests/inspector/styles-iframe.html
@@ -58,10 +58,12 @@ function frontend_dumpStylesContinuation(testController)
     // 1. Get styles for body, store them in mainStyles var.
     var body = WebInspector.domAgent.document.body;
     var mainStyles = null;
-    function mainFrameCallback(styles) {
+    function mainFrameCallback(styles)
+    {
         mainStyles = styles;
     }
-    InjectedScriptAccess.get(body.injectedScriptId).getStyles(body.id, false, mainFrameCallback);
+
+    InspectorBackend.getStyles(WebInspector.Callback.wrap(mainFrameCallback), body.id, false);
 
     // 2. Find iframe node
     var innerMapping = WebInspector.domAgent._idToDOMNode;
@@ -77,10 +79,12 @@ function frontend_dumpStylesContinuation(testController)
     }
 
     // 3. Get styles for iframe's body, return them together with main styles.
-    function iframeCallback(styles) {
+    function iframeCallback(styles)
+    {
         testController.notifyDone([mainStyles, styles]);
     }
-    InjectedScriptAccess.get(iframeBody.injectedScriptId).getStyles(iframeBody.id, false, iframeCallback);
+
+    InspectorBackend.getStyles(WebInspector.Callback.wrap(iframeCallback), iframeBody.id, false);
 }
 
 </script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3ab2d3a..a72ec71 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,76 @@
+2010-03-16  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: migrate to native styles inspector in
+        order to inspect styles from foreighn domains.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36117
+
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::getStyles):
+        (WebCore::InspectorBackend::getInlineStyle):
+        (WebCore::InspectorBackend::getComputedStyle):
+        (WebCore::InspectorBackend::applyStyleText):
+        (WebCore::InspectorBackend::setStyleText):
+        (WebCore::InspectorBackend::setStyleProperty):
+        (WebCore::InspectorBackend::toggleStyleEnabled):
+        (WebCore::InspectorBackend::setRuleSelector):
+        (WebCore::InspectorBackend::addRule):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorBackend.idl:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::InspectorDOMAgent):
+        (WebCore::InspectorDOMAgent::getStyles):
+        (WebCore::InspectorDOMAgent::getInlineStyle):
+        (WebCore::InspectorDOMAgent::getComputedStyle):
+        (WebCore::InspectorDOMAgent::getMatchedCSSRules):
+        (WebCore::InspectorDOMAgent::getAttributeStyles):
+        (WebCore::InspectorDOMAgent::applyStyleText):
+        (WebCore::InspectorDOMAgent::setStyleText):
+        (WebCore::InspectorDOMAgent::setStyleProperty):
+        (WebCore::InspectorDOMAgent::toggleStyleEnabled):
+        (WebCore::InspectorDOMAgent::setRuleSelector):
+        (WebCore::InspectorDOMAgent::addRule):
+        (WebCore::InspectorDOMAgent::bindStyle):
+        (WebCore::InspectorDOMAgent::bindRule):
+        (WebCore::InspectorDOMAgent::buildObjectForStyle):
+        (WebCore::InspectorDOMAgent::populateObjectWithStyleProperties):
+        (WebCore::InspectorDOMAgent::buildObjectForRule):
+        (WebCore::InspectorDOMAgent::uniqueStyleProperties):
+        (WebCore::InspectorDOMAgent::longhandProperties):
+        (WebCore::InspectorDOMAgent::shorthandPriority):
+        (WebCore::InspectorDOMAgent::ruleAffectsNode):
+        (WebCore::InspectorDOMAgent::toArray):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorFrontend.cpp:
+        (WebCore::InspectorFrontend::didGetEventListenersForNode):
+        (WebCore::InspectorFrontend::didGetStyles):
+        (WebCore::InspectorFrontend::didGetComputedStyle):
+        (WebCore::InspectorFrontend::didGetInlineStyle):
+        (WebCore::InspectorFrontend::didApplyStyleText):
+        (WebCore::InspectorFrontend::didSetStyleText):
+        (WebCore::InspectorFrontend::didSetStyleProperty):
+        (WebCore::InspectorFrontend::didToggleStyleEnabled):
+        (WebCore::InspectorFrontend::didSetRuleSelector):
+        (WebCore::InspectorFrontend::didAddRule):
+        * inspector/InspectorFrontend.h:
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.CSSStyleDeclaration):
+        * inspector/front-end/ElementsTreeOutline.js:
+        * inspector/front-end/InjectedScript.js:
+        * inspector/front-end/MetricsSidebarPane.js:
+        (WebInspector.MetricsSidebarPane.prototype.update):
+        (WebInspector.MetricsSidebarPane.prototype.editingCommitted):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype.update):
+        (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.callback):
+        (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
+        (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted.callback):
+        (WebInspector.BlankStylePropertiesSection.prototype.editingSelectorCommitted):
+        (WebInspector.StylePropertyTreeElement.prototype):
+        (WebInspector.StylePropertyTreeElement.prototype.):
+
 2010-03-16  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index 9ccb7ac..3d0d944 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -33,6 +33,7 @@
 
 #include "PlatformString.h"
 #include "ScriptState.h"
+#include <runtime/JSValue.h>
 #include <runtime/Protect.h>
 #include <wtf/PassRefPtr.h>
 
@@ -58,6 +59,8 @@ public:
     PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
     static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
 
+    static ScriptValue undefined() { return ScriptValue(JSC::jsUndefined()); }
+
 private:
     JSC::ProtectedJSValue m_value;
 };
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 1713f80..8241205 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -127,6 +127,8 @@ public:
     PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
     static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
 
+    static ScriptValue undefined() { return ScriptValue(v8::Undefined()); }
+
     void clear()
     {
         if (m_value.IsEmpty())
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index f522d43..5a3fd69 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -356,6 +356,60 @@ void InspectorBackend::removeNode(long callId, long nodeId)
     frontend->didRemoveNode(callId, nodeId);
 }
 
+void InspectorBackend::getStyles(long callId, long nodeId, bool authorOnly)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->getStyles(callId, nodeId, authorOnly);
+}
+
+void InspectorBackend::getInlineStyle(long callId, long nodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->getInlineStyle(callId, nodeId);
+}
+
+void InspectorBackend::getComputedStyle(long callId, long nodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->getComputedStyle(callId, nodeId);
+}
+
+void InspectorBackend::applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->applyStyleText(callId, styleId, styleText, propertyName);
+}
+
+void InspectorBackend::setStyleText(long callId, long styleId, const String& cssText)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->setStyleText(callId, styleId, cssText);
+}
+
+void InspectorBackend::setStyleProperty(long callId, long styleId, const String& name, const String& value)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->setStyleProperty(callId, styleId, name, value);
+}
+
+void InspectorBackend::toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->toggleStyleEnabled(callId, styleId, propertyName, disabled);
+}
+
+void InspectorBackend::setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->setRuleSelector(callId, ruleId, selector, selectedNodeId);
+}
+
+void InspectorBackend::addRule(long callId, const String& selector, long selectedNodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->addRule(callId, selector, selectedNodeId);
+}
+
 void InspectorBackend::highlightDOMNode(long nodeId)
 {
     if (Node* node = nodeForId(nodeId))
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 6b81a96..93dc27c 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -104,6 +104,7 @@ public:
     void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async);
     void addScriptToEvaluateOnLoad(const String& source);
     void removeAllScriptsToEvaluateOnLoad();
+
     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);
@@ -111,6 +112,17 @@ public:
     void getEventListenersForNode(long callId, long nodeId);
     void copyNode(long nodeId);
     void removeNode(long callId, long nodeId);
+
+    void getStyles(long callId, long nodeId, bool authOnly);
+    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);
+
     void highlightDOMNode(long nodeId);
     void hideDOMNodeHighlight();
 
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 726f889..b0be6d2 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -90,6 +90,16 @@ module core {
         void highlightDOMNode(in long nodeId);
         void hideDOMNodeHighlight();
 
+        void getStyles(in long callId, in long nodeId, in boolean authOnly);
+        void getInlineStyle(in long callId, in long nodeId);
+        void getComputedStyle(in long callId, in long nodeId);
+        void applyStyleText(in long callId, in long styleId, in DOMString styleText, in DOMString propertyName);
+        void setStyleText(in long callId, in long styleId, in DOMString styleText);
+        void setStyleProperty(in long callId, in long styleId, in DOMString name, in DOMString value);
+        void toggleStyleEnabled(in long callId, in long styleId, in DOMString propertyName, in boolean disabled);
+        void setRuleSelector(in long callId, in long ruleId, in DOMString selector, in long selectedNodeId);
+        void addRule(in long callId, in DOMString selector, in long selectedNodeId);
+
         void getCookies(in long callId);
         void deleteCookie(in DOMString cookieName, in DOMString domain);
 
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index 0387f30..fc1a063 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -34,9 +34,16 @@
 #if ENABLE(INSPECTOR)
 
 #include "AtomicString.h"
+#include "CSSMutableStyleDeclaration.h"
+#include "CSSRule.h"
+#include "CSSRuleList.h"
+#include "CSSStyleDeclaration.h"
+#include "CSSStyleRule.h"
+#include "CSSStyleSheet.h"
 #include "ContainerNode.h"
 #include "Cookie.h"
 #include "CookieJar.h"
+#include "CString.h"
 #include "DOMWindow.h"
 #include "Document.h"
 #include "DocumentType.h"
@@ -45,6 +52,7 @@
 #include "EventNames.h"
 #include "EventTarget.h"
 #include "HTMLFrameOwnerElement.h"
+#include "HTMLHeadElement.h"
 #include "InspectorFrontend.h"
 #include "markup.h"
 #include "MutationEvent.h"
@@ -53,8 +61,10 @@
 #include "PlatformString.h"
 #include "ScriptEventListener.h"
 #include "ScriptObject.h"
+#include "StyleSheetList.h"
 #include "Text.h"
 
+#include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 
@@ -64,6 +74,8 @@ InspectorDOMAgent::InspectorDOMAgent(InspectorFrontend* frontend)
     : EventListener(InspectorDOMAgentType)
     , m_frontend(frontend)
     , m_lastNodeId(1)
+    , m_lastStyleId(1)
+    , m_lastRuleId(1)
 {
 }
 
@@ -671,6 +683,460 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
     m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element));
 }
 
+void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
+{
+    Node* node = nodeForId(nodeId);
+    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
+        m_frontend->didGetStyles(callId, ScriptValue::undefined());
+        return;
+    }
+    Element* element = static_cast<Element*>(node);
+
+    DOMWindow* defaultView = node->ownerDocument()->defaultView();
+    RefPtr<CSSStyleDeclaration> computedStyle = defaultView->getComputedStyle(element, "");
+
+    ScriptObject result = m_frontend->newScriptObject();
+    result.set("inlineStyle", buildObjectForStyle(element->style(), true));
+    result.set("computedStyle", buildObjectForStyle(computedStyle.get(), false));
+    result.set("matchedCSSRules", getMatchedCSSRules(element, authorOnly));
+    result.set("styleAttributes", getAttributeStyles(element));
+    m_frontend->didGetStyles(callId, result);
+}
+
+void InspectorDOMAgent::getInlineStyle(long callId, long nodeId)
+{
+    Node* node = nodeForId(nodeId);
+    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
+        m_frontend->didGetInlineStyle(callId, ScriptValue::undefined());
+        return;
+    }
+    Element* element = static_cast<Element*>(node);
+    m_frontend->didGetInlineStyle(callId, buildObjectForStyle(element->style(), true));
+}
+
+void InspectorDOMAgent::getComputedStyle(long callId, long nodeId)
+{
+    Node* node = nodeForId(nodeId);
+    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
+        m_frontend->didGetComputedStyle(callId, ScriptValue::undefined());
+        return;
+    }
+    Element* element = static_cast<Element*>(node);
+
+    DOMWindow* defaultView = node->ownerDocument()->defaultView();
+    RefPtr<CSSStyleDeclaration> computedStyle = defaultView->getComputedStyle(element, "");
+    m_frontend->didGetComputedStyle(callId, buildObjectForStyle(computedStyle.get(), false));
+}
+
+ScriptArray InspectorDOMAgent::getMatchedCSSRules(Element* element, bool authorOnly)
+{
+    DOMWindow* defaultView = element->ownerDocument()->defaultView();
+    RefPtr<CSSRuleList> matchedRules = defaultView->getMatchedCSSRules(element, "", authorOnly);
+    ScriptArray matchedCSSRules = m_frontend->newScriptArray();
+    for (unsigned i = 0; matchedRules.get() && i < matchedRules->length(); ++i) {
+        CSSRule* rule = matchedRules->item(i);
+        if (rule->type() == CSSRule::STYLE_RULE)
+            matchedCSSRules.set(i, buildObjectForRule(static_cast<CSSStyleRule*>(rule)));
+    }
+    return matchedCSSRules;
+}
+
+ScriptObject InspectorDOMAgent::getAttributeStyles(Element* element)
+{
+    ScriptObject styleAttributes = m_frontend->newScriptObject();
+    NamedNodeMap* attributes = element->attributes();
+    for (unsigned i = 0; attributes && i < attributes->length(); ++i) {
+        Attribute* attribute = attributes->attributeItem(i);
+        if (attribute->style()) {
+            String attributeName = attribute->localName();
+            styleAttributes.set(attributeName.utf8().data(), buildObjectForStyle(attribute->style(), true));
+        }
+    }
+    return styleAttributes;
+}
+
+void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName)
+{
+    IdToStyleMap::iterator it = m_idToStyle.find(styleId);
+    if (it == m_idToStyle.end()) {
+        m_frontend->didApplyStyleText(callId, false, ScriptValue::undefined(), m_frontend->newScriptArray());
+        return;
+    }
+
+    CSSStyleDeclaration* style = it->second.get();
+    int styleTextLength = styleText.length();
+
+    // Create a new element to parse the user input CSS.
+    ExceptionCode ec = 0;
+    RefPtr<Element> parseElement = mainFrameDocument()->createElement("span", ec);
+    if (!ec)
+        parseElement->setAttribute("style", styleText, ec);
+    if (ec) {
+        m_frontend->didApplyStyleText(callId, false, ScriptValue::undefined(), m_frontend->newScriptArray());
+        return;
+    }
+
+    CSSStyleDeclaration* tempStyle = parseElement->style();
+    if ((tempStyle && tempStyle->length()) || !styleTextLength) {
+        ExceptionCode ec = 0;
+        // The input was parsable or the user deleted everything, so remove the
+        // original property from the real style declaration. If this represents
+        // a shorthand remove all the longhand properties.
+        if (style->getPropertyShorthand(propertyName).isEmpty()) {
+            Vector<String> longhandProps = longhandProperties(style, propertyName);
+            for (unsigned i = 0; i < longhandProps.size(); ++i)
+                style->removeProperty(longhandProps[i], ec);
+        } else
+            style->removeProperty(propertyName, ec);
+        if (ec) {
+            m_frontend->didApplyStyleText(callId, false, ScriptValue::undefined(), m_frontend->newScriptArray());
+            return;
+        }
+    }
+
+    // Notify caller that the property was successfully deleted.
+    if (!styleTextLength) {
+        ScriptArray changedProperties = m_frontend->newScriptArray();
+        changedProperties.set(0, propertyName);
+        m_frontend->didApplyStyleText(callId, true, ScriptValue::undefined(), changedProperties);
+        return;
+    }
+
+    if (!tempStyle->length()) {
+        m_frontend->didApplyStyleText(callId, false, ScriptValue::undefined(), m_frontend->newScriptArray());
+        return;
+    }
+
+    // Iterate of the properties on the test element's style declaration and
+    // add them to the real style declaration. We take care to move shorthands.
+    HashSet<String> foundShorthands;
+    Vector<String> changedProperties;
+
+    Vector<String> uniqueProperties = uniqueStyleProperties(tempStyle);
+    for (unsigned i = 0; i < uniqueProperties.size(); ++i) {
+        String name = uniqueProperties[i];
+        String shorthand = tempStyle->getPropertyShorthand(name);
+
+        if (!shorthand.isEmpty() && foundShorthands.contains(shorthand))
+            continue;
+
+        String value;
+        String priority;
+        if (!shorthand.isEmpty()) {
+            value = tempStyle->getPropertyValue(shorthand);
+            priority = shorthandPriority(tempStyle, shorthand);
+            foundShorthands.add(shorthand);
+            name = shorthand;
+        } else {
+            value = tempStyle->getPropertyValue(name);
+            priority = tempStyle->getPropertyPriority(name);
+        }
+
+        // Set the property on the real style declaration.
+        ExceptionCode ec = 0;
+        style->setProperty(name, value, priority, ec);
+        changedProperties.append(name);
+    }
+    m_frontend->didApplyStyleText(callId, true, buildObjectForStyle(style, true), toArray(changedProperties));
+}
+
+void InspectorDOMAgent::setStyleText(long callId, long styleId, const String& cssText)
+{
+    IdToStyleMap::iterator it = m_idToStyle.find(styleId);
+    if (it == m_idToStyle.end()) {
+        m_frontend->didSetStyleText(callId, false);
+        return;
+    }
+    CSSStyleDeclaration* style = it->second.get();
+    ExceptionCode ec = 0;
+    style->setCssText(cssText, ec);
+    m_frontend->didSetStyleText(callId, !ec);
+}
+
+void InspectorDOMAgent::setStyleProperty(long callId, long styleId, const String& name, const String& value)
+{
+    IdToStyleMap::iterator it = m_idToStyle.find(styleId);
+    if (it == m_idToStyle.end()) {
+        m_frontend->didSetStyleProperty(callId, false);
+        return;
+    }
+
+    CSSStyleDeclaration* style = it->second.get();
+    ExceptionCode ec = 0;
+    style->setProperty(name, value, ec);
+    m_frontend->didSetStyleProperty(callId, !ec);
+}
+
+void InspectorDOMAgent::toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled)
+{
+    IdToStyleMap::iterator it = m_idToStyle.find(styleId);
+    if (it == m_idToStyle.end()) {
+        m_frontend->didToggleStyleEnabled(callId, ScriptValue::undefined());
+        return;
+    }
+    CSSStyleDeclaration* style = it->second.get();
+
+    IdToStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId);
+    if (disabledIt == m_idToDisabledStyle.end())
+        disabledIt = m_idToDisabledStyle.set(styleId, CSSMutableStyleDeclaration::create()).first;
+    CSSStyleDeclaration* disabledStyle = disabledIt->second.get();
+
+    // TODO: make sure this works with shorthands right.
+    ExceptionCode ec = 0;
+    if (disabled) {
+        disabledStyle->setProperty(propertyName, style->getPropertyValue(propertyName), style->getPropertyPriority(propertyName), ec);
+        if (!ec)
+            style->removeProperty(propertyName, ec);
+    } else {
+        style->setProperty(propertyName, disabledStyle->getPropertyValue(propertyName), disabledStyle->getPropertyPriority(propertyName), ec);
+        if (!ec)
+            disabledStyle->removeProperty(propertyName, ec);
+    }
+    if (ec) {
+        m_frontend->didToggleStyleEnabled(callId, ScriptValue::undefined());
+        return;
+    }
+    m_frontend->didToggleStyleEnabled(callId, buildObjectForStyle(style, true));
+}
+
+void InspectorDOMAgent::setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId)
+{
+    IdToRuleMap::iterator it = m_idToRule.find(ruleId);
+    if (it == m_idToRule.end()) {
+        m_frontend->didSetRuleSelector(callId, ScriptValue::undefined(), false);
+        return;
+    }
+
+    CSSStyleRule* rule = it->second.get();
+    Node* node = nodeForId(selectedNodeId);
+
+    CSSStyleSheet* styleSheet = rule->parentStyleSheet();
+    ExceptionCode ec = 0;
+    styleSheet->addRule(selector, rule->style()->cssText(), ec);
+    if (ec) {
+        m_frontend->didSetRuleSelector(callId, ScriptValue::undefined(), false);
+        return;
+    }
+
+    CSSStyleRule* newRule = static_cast<CSSStyleRule*>(styleSheet->item(styleSheet->length() - 1));
+    for (unsigned i = 0; i < styleSheet->length(); ++i) {
+        if (styleSheet->item(i) == rule) {
+            styleSheet->deleteRule(i, ec);
+            break;
+        }
+    }
+
+    if (ec) {
+        m_frontend->didSetRuleSelector(callId, ScriptValue::undefined(), false);
+        return;
+    }
+
+    m_frontend->didSetRuleSelector(callId, buildObjectForRule(newRule), ruleAffectsNode(newRule, node));
+}
+
+void InspectorDOMAgent::addRule(long callId, const String& selector, long selectedNodeId)
+{
+    Node* node = nodeForId(selectedNodeId);
+    if (!node) {
+        m_frontend->didAddRule(callId, ScriptValue::undefined(), false);
+        return;
+    }
+
+    if (!m_inspectorStyleSheet.get()) {
+        Document* ownerDocument = node->ownerDocument();
+        ExceptionCode ec = 0;
+        RefPtr<Element> styleElement = ownerDocument->createElement("style", ec);
+        if (!ec)
+            styleElement->setAttribute("type", "text/css", ec);
+        if (!ec)
+            ownerDocument->head()->appendChild(styleElement, ec);
+        if (ec) {
+            m_frontend->didAddRule(callId, ScriptValue::undefined(), false);
+            return;
+        }
+        StyleSheetList* styleSheets = ownerDocument->styleSheets();
+        StyleSheet* styleSheet = styleSheets->item(styleSheets->length() - 1);
+        if (!styleSheet->isCSSStyleSheet()) {
+            m_frontend->didAddRule(callId, ScriptValue::undefined(), false);
+            return;
+        }
+        m_inspectorStyleSheet = static_cast<CSSStyleSheet*>(styleSheet);
+    }
+
+    ExceptionCode ec = 0;
+    m_inspectorStyleSheet->addRule(selector, "", ec);
+    if (ec) {
+        m_frontend->didAddRule(callId, ScriptValue::undefined(), false);
+        return;
+    }
+
+    CSSStyleRule* newRule = static_cast<CSSStyleRule*>(m_inspectorStyleSheet->item(m_inspectorStyleSheet->length() - 1));
+    m_frontend->didAddRule(callId, buildObjectForRule(newRule), ruleAffectsNode(newRule, node));
+}
+
+long InspectorDOMAgent::bindStyle(CSSStyleDeclaration* style)
+{
+    long id = m_styleToId.get(style);
+    if (!id) {
+        id = m_lastStyleId++;
+        m_idToStyle.set(id, style);
+        m_styleToId.set(style, id);
+    }
+    return id;
+}
+
+long InspectorDOMAgent::bindRule(CSSStyleRule* rule)
+{
+    long id = m_ruleToId.get(rule);
+    if (!id) {
+        id = m_lastRuleId++;
+        m_idToRule.set(id, rule);
+        m_ruleToId.set(rule, id);
+    }
+    return id;
+}
+
+ScriptObject InspectorDOMAgent::buildObjectForStyle(CSSStyleDeclaration* style, bool bind)
+{
+    ScriptObject result = m_frontend->newScriptObject();
+    if (bind) {
+        long styleId = bindStyle(style);
+        result.set("id", styleId);
+
+        IdToStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId);
+        if (disabledIt != m_idToDisabledStyle.end()) {
+            ScriptObject disabledStyle = m_frontend->newScriptObject();
+            populateObjectWithStyleProperties(disabledIt->second.get(), disabledStyle);
+            result.set("disabled", disabledStyle);
+        }
+    }
+    result.set("width", style->getPropertyValue("width"));
+    result.set("height", style->getPropertyValue("height"));
+    populateObjectWithStyleProperties(style, result);
+    return result;
+}
+
+void InspectorDOMAgent::populateObjectWithStyleProperties(CSSStyleDeclaration* style, ScriptObject& result)
+{
+    ScriptArray properties = m_frontend->newScriptArray();
+    ScriptObject shorthandValues = m_frontend->newScriptObject();
+    result.set("properties", properties);
+    result.set("shorthandValues", shorthandValues);
+
+    HashSet<String> foundShorthands;
+    for (unsigned i = 0; i < style->length(); ++i) {
+        ScriptObject property = m_frontend->newScriptObject();
+        String name = style->item(i);
+        property.set("name", name);
+        property.set("priority", style->getPropertyPriority(name));
+        property.set("implicit", style->isPropertyImplicit(name));
+        String shorthand =  style->getPropertyShorthand(name);
+        property.set("shorthand", shorthand);
+        if (!shorthand.isEmpty() && !foundShorthands.contains(shorthand)) {
+            foundShorthands.add(shorthand);
+            shorthandValues.set(shorthand, style->getPropertyValue(shorthand));
+        }
+        property.set("value", style->getPropertyValue(name));
+        properties.set(i, property);
+    }
+    result.set("uniqueStyleProperties", toArray(uniqueStyleProperties(style)));
+}
+
+ScriptObject InspectorDOMAgent::buildObjectForRule(CSSStyleRule* rule)
+{
+    CSSStyleSheet* parentStyleSheet = rule->parentStyleSheet();
+
+    ScriptObject result = m_frontend->newScriptObject();
+    result.set("selectorText", rule->selectorText());
+    if (parentStyleSheet) {
+        ScriptObject parentStyleSheetValue = m_frontend->newScriptObject();
+        result.set("parentStyleSheet", parentStyleSheetValue);
+        parentStyleSheetValue.set("href", parentStyleSheet->href());
+    }
+    bool isUserAgent = parentStyleSheet && !parentStyleSheet->ownerNode() && parentStyleSheet->href().isEmpty();
+    bool isUser = parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document";
+    result.set("isUserAgent", isUserAgent);
+    result.set("isUser", isUser);
+    result.set("isViaInspector", rule->parentStyleSheet() == m_inspectorStyleSheet.get());
+
+    // Bind editable scripts only.
+    bool bind = !isUserAgent && !isUser;
+    result.set("style", buildObjectForStyle(rule->style(), bind));
+
+    if (bind)
+        result.set("id", bindRule(rule));
+    return result;
+}
+
+Vector<String> InspectorDOMAgent::uniqueStyleProperties(CSSStyleDeclaration* style)
+{
+    Vector<String> properties;
+    HashSet<String> foundProperties;
+
+    for (unsigned i = 0; i < style->length(); ++i) {
+        String property = style->item(i);
+        if (foundProperties.contains(property))
+            continue;
+        foundProperties.add(property);
+        properties.append(property);
+    }
+    return properties;
+}
+
+Vector<String> InspectorDOMAgent::longhandProperties(CSSStyleDeclaration* style, const String& shorthandProperty)
+{
+    Vector<String> properties;
+    HashSet<String> foundProperties;
+
+    for (unsigned i = 0; i < style->length(); ++i) {
+        String individualProperty = style->item(i);
+        if (foundProperties.contains(individualProperty) || style->getPropertyShorthand(individualProperty) != shorthandProperty)
+            continue;
+        foundProperties.add(individualProperty);
+        properties.append(individualProperty);
+    }
+
+    return properties;
+}
+
+String InspectorDOMAgent::shorthandPriority(CSSStyleDeclaration* style, const String& shorthandProperty)
+{
+    String priority = style->getPropertyPriority(shorthandProperty);
+    if (priority.isEmpty()) {
+        for (unsigned i = 0; i < style->length(); ++i) {
+            String individualProperty = style->item(i);
+            if (style->getPropertyShorthand(individualProperty) != shorthandProperty)
+                continue;
+            priority = style->getPropertyPriority(individualProperty);
+            break;
+        }
+    }
+    return priority;
+}
+
+bool InspectorDOMAgent::ruleAffectsNode(CSSStyleRule* rule, Node* node)
+{
+    if (!node)
+        return false;
+    ExceptionCode ec = 0;
+    RefPtr<NodeList> nodes = node->ownerDocument()->querySelectorAll(rule->selectorText(), ec);
+    if (ec)
+        return false;
+    for (unsigned i = 0; i < nodes->length(); ++i) {
+        if (nodes->item(i) == node)
+            return true;
+    }
+    return false;
+}
+
+ScriptArray InspectorDOMAgent::toArray(const Vector<String>& data)
+{
+    ScriptArray result = m_frontend->newScriptArray();
+    for (unsigned i = 0; i < data.size(); ++i)
+        result.set(i, data[i]);
+    return result;
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h
index d7334b7..0cdbcc3 100644
--- a/WebCore/inspector/InspectorDOMAgent.h
+++ b/WebCore/inspector/InspectorDOMAgent.h
@@ -45,6 +45,10 @@
 
 namespace WebCore {
     class ContainerNode;
+    class CSSRule;
+    class CSSStyleDeclaration;
+    class CSSStyleRule;
+    class CSSStyleSheet;
     class Element;
     class Event;
     class Document;
@@ -87,13 +91,24 @@ 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 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 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();
@@ -113,16 +128,18 @@ namespace WebCore {
 
         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();
 
+        ScriptArray getMatchedCSSRules(Element* element, bool authorOnly);
+        ScriptObject getAttributeStyles(Element* element);
         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 +153,18 @@ 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);
+        ScriptObject buildObjectForRule(CSSStyleRule*);
+        Vector<String> uniqueStyleProperties(CSSStyleDeclaration*);
+        Vector<String> longhandProperties(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 +175,20 @@ 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;
+        IdToStyleMap m_idToDisabledStyle;
+        RefPtr<CSSStyleSheet> m_inspectorStyleSheet;
+
+        long m_lastStyleId;
+        long m_lastRuleId;
         ListHashSet<RefPtr<Document> > m_documents;
     };
 
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index af5620f..54a4414 100755
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -465,7 +465,7 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success)
     function.call();
 }
 
-void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray)
+void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, const ScriptArray& listenersArray)
 {
     ScriptFunctionCall function(m_webInspector, "dispatch"); 
     function.appendArgument("didGetEventListenersForNode");
@@ -475,6 +475,91 @@ void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, Scri
     function.call();
 }
 
+void InspectorFrontend::didGetStyles(long callId, const ScriptValue& styles)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didGetStyles");
+    function.appendArgument(callId);
+    function.appendArgument(styles);
+    function.call();
+}
+
+void InspectorFrontend::didGetComputedStyle(long callId, const ScriptValue& style)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didGetComputedStyle");
+    function.appendArgument(callId);
+    function.appendArgument(style);
+    function.call();
+}
+
+void InspectorFrontend::didGetInlineStyle(long callId, const ScriptValue& style)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didGetInlineStyle");
+    function.appendArgument(callId);
+    function.appendArgument(style);
+    function.call();
+}
+
+void InspectorFrontend::didApplyStyleText(int callId, bool success, const ScriptValue& style, const ScriptArray& changedProperties)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didApplyStyleText");
+    function.appendArgument(callId);
+    function.appendArgument(success);
+    function.appendArgument(style);
+    function.appendArgument(changedProperties);
+    function.call();
+}
+
+void InspectorFrontend::didSetStyleText(int callId, bool success)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didSetStyleText");
+    function.appendArgument(callId);
+    function.appendArgument(success);
+    function.call();
+}
+
+void InspectorFrontend::didSetStyleProperty(int callId, bool success)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didSetStyleProperty");
+    function.appendArgument(callId);
+    function.appendArgument(success);
+    function.call();
+}
+
+void InspectorFrontend::didToggleStyleEnabled(int callId, const ScriptValue& style)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didToggleStyleEnabled");
+    function.appendArgument(callId);
+    function.appendArgument(style);
+    function.call();
+}
+
+void InspectorFrontend::didSetRuleSelector(int callId, const ScriptValue& rule, bool selectorAffectsNode)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didSetRuleSelector");
+    function.appendArgument(callId);
+    function.appendArgument(rule);
+    function.appendArgument(selectorAffectsNode);
+    function.call();
+}
+
+void InspectorFrontend::didAddRule(int callId, const ScriptValue& rule, bool selectorAffectsNode)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didAddRule");
+    function.appendArgument(callId);
+    function.appendArgument(rule);
+    function.appendArgument(selectorAffectsNode);
+    function.call();
+}
+
 #if ENABLE(WORKERS)
 void InspectorFrontend::didCreateWorker(const InspectorWorkerResource& worker)
 {
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index 861a6f7..61c1a8c 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -125,9 +125,19 @@ namespace WebCore {
         void attributesUpdated(int id, const ScriptArray& attributes);
         void didGetChildNodes(int callId);
         void didApplyDomChange(int callId, bool success);
-        void didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray);
+        void didGetEventListenersForNode(int callId, int nodeId, const ScriptArray& listenersArray);
         void didRemoveNode(int callId, int nodeId);
 
+        void didGetStyles(long callId, const ScriptValue& styles);
+        void didGetInlineStyle(long callId, const ScriptValue& style);
+        void didGetComputedStyle(long callId, const ScriptValue& style);
+        void didApplyStyleText(int callId, bool success, const ScriptValue& style, const ScriptArray& changedProperties);
+        void didSetStyleText(int callId, bool success);
+        void didSetStyleProperty(int callId, bool success);
+        void didToggleStyleEnabled(int callId, const ScriptValue& style);
+        void didSetRuleSelector(int callId, const ScriptValue& rule, bool selectorAffectsNode);
+        void didAddRule(int callId, const ScriptValue& rule, bool selectorAffectsNode);
+
         void timelineProfilerWasStarted();
         void timelineProfilerWasStopped();
         void addRecordToTimeline(const ScriptObject&);
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 834f527..62fed77 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -526,9 +526,26 @@ WebInspector.CSSStyleDeclaration = function(payload)
     this.injectedScriptId = payload.injectedScriptId;
     this.width = payload.width;
     this.height = payload.height;
-    this.__disabledProperties = payload.__disabledProperties;
-    this.__disabledPropertyValues = payload.__disabledPropertyValues;
-    this.__disabledPropertyPriorities = payload.__disabledPropertyPriorities;
+    this.__disabledProperties = {};
+    this.__disabledPropertyValues = {};
+    this.__disabledPropertyPriorities = {};
+    if (payload.disabled) {
+        var disabledProperties = payload.disabled.properties;
+        var shorthandValues = payload.disabled.shorthandValues;
+        for (var name in shorthandValues) {
+            this.__disabledProperties[name] = true;
+            this.__disabledPropertyValues[name] = shorthandValues[name];
+        }
+        for (var i = 0; i < disabledProperties.length; ++i) {
+            var disabledProperty = disabledProperties[i];
+            if (disabledProperty.shorthand)
+                continue;
+            var name = disabledProperty.name;
+            this.__disabledProperties[name] = true;
+            this.__disabledPropertyValues[name] = disabledProperty.value;
+            this.__disabledPropertyPriorities[name] = disabledProperty.priority;
+        }
+    }
     this.uniqueStyleProperties = payload.uniqueStyleProperties;
     this._shorthandValues = payload.shorthandValues;
     this._propertyMap = {};
@@ -697,4 +714,15 @@ WebInspector.didPerformSearch = WebInspector.Callback.processCallback;
 WebInspector.didApplyDomChange = WebInspector.Callback.processCallback;
 WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback;
 WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback;
+WebInspector.didRemoveNode = WebInspector.Callback.processCallback;
 WebInspector.didGetEventListenersForNode = WebInspector.Callback.processCallback;
+
+WebInspector.didGetStyles = WebInspector.Callback.processCallback;
+WebInspector.didGetInlineStyle = WebInspector.Callback.processCallback;
+WebInspector.didGetComputedStyle = WebInspector.Callback.processCallback;
+WebInspector.didApplyStyleText = WebInspector.Callback.processCallback;
+WebInspector.didSetStyleText = WebInspector.Callback.processCallback;
+WebInspector.didSetStyleProperty = WebInspector.Callback.processCallback;
+WebInspector.didToggleStyleEnabled = WebInspector.Callback.processCallback;
+WebInspector.didSetRuleSelector = WebInspector.Callback.processCallback;
+WebInspector.didAddRule = WebInspector.Callback.processCallback;
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index fe7ae53..8ca0b57 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -1242,5 +1242,3 @@ WebInspector.ElementsTreeElement.prototype = {
 }
 
 WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype;
-
-WebInspector.didRemoveNode = WebInspector.Callback.processCallback;
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 8d8fa88..8c7d48e 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -91,378 +91,6 @@ InjectedScript.dispatch = function(methodName, args, callId)
     return result;
 }
 
-InjectedScript.getStyles = function(nodeId, authorOnly)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    var defaultView = node.ownerDocument.defaultView;
-    var matchedRules = defaultView.getMatchedCSSRules(node, "", authorOnly);
-    var matchedCSSRules = [];
-    for (var i = 0; matchedRules && i < matchedRules.length; ++i)
-        matchedCSSRules.push(InjectedScript._serializeRule(matchedRules[i]));
-
-    var styleAttributes = {};
-    var attributes = node.attributes;
-    for (var i = 0; attributes && i < attributes.length; ++i) {
-        if (attributes[i].style)
-            styleAttributes[attributes[i].name] = InjectedScript._serializeStyle(attributes[i].style, true);
-    }
-    var result = {};
-    result.inlineStyle = InjectedScript._serializeStyle(node.style, true);
-    result.computedStyle = InjectedScript._serializeStyle(defaultView.getComputedStyle(node));
-    result.matchedCSSRules = matchedCSSRules;
-    result.styleAttributes = styleAttributes;
-    return result;
-}
-
-InjectedScript.getComputedStyle = function(nodeId)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    return InjectedScript._serializeStyle(node.ownerDocument.defaultView.getComputedStyle(node));
-}
-
-InjectedScript.getInlineStyle = function(nodeId)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    return InjectedScript._serializeStyle(node.style, true);
-}
-
-InjectedScript.applyStyleText = function(styleId, styleText, propertyName)
-{
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
-
-    var styleTextLength = styleText.length;
-
-    // Create a new element to parse the user input CSS.
-    var parseElement = document.createElement("span");
-    parseElement.setAttribute("style", styleText);
-
-    var tempStyle = parseElement.style;
-    if (tempStyle.length || !styleTextLength) {
-        // The input was parsable or the user deleted everything, so remove the
-        // original property from the real style declaration. If this represents
-        // a shorthand remove all the longhand properties.
-        if (style.getPropertyShorthand(propertyName)) {
-            var longhandProperties = InjectedScript._getLonghandProperties(style, propertyName);
-            for (var i = 0; i < longhandProperties.length; ++i)
-                style.removeProperty(longhandProperties[i]);
-        } else
-            style.removeProperty(propertyName);
-    }
-
-    // Notify caller that the property was successfully deleted.
-    if (!styleTextLength)
-        return [null, [propertyName]];
-
-    if (!tempStyle.length)
-        return false;
-
-    // Iterate of the properties on the test element's style declaration and
-    // add them to the real style declaration. We take care to move shorthands.
-    var foundShorthands = {};
-    var changedProperties = [];
-    var uniqueProperties = InjectedScript._getUniqueStyleProperties(tempStyle);
-    for (var i = 0; i < uniqueProperties.length; ++i) {
-        var name = uniqueProperties[i];
-        var shorthand = tempStyle.getPropertyShorthand(name);
-
-        if (shorthand && shorthand in foundShorthands)
-            continue;
-
-        if (shorthand) {
-            var value = InjectedScript._getShorthandValue(tempStyle, shorthand);
-            var priority = InjectedScript._getShorthandPriority(tempStyle, shorthand);
-            foundShorthands[shorthand] = true;
-        } else {
-            var value = tempStyle.getPropertyValue(name);
-            var priority = tempStyle.getPropertyPriority(name);
-        }
-
-        // Set the property on the real style declaration.
-        style.setProperty((shorthand || name), value, priority);
-        changedProperties.push(shorthand || name);
-    }
-    return [InjectedScript._serializeStyle(style, true), changedProperties];
-}
-
-InjectedScript.setStyleText = function(style, cssText)
-{
-    style.cssText = cssText;
-    return true;
-}
-
-InjectedScript.toggleStyleEnabled = function(styleId, propertyName, disabled)
-{
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
-
-    if (disabled) {
-        if (!style.__disabledPropertyValues || !style.__disabledPropertyPriorities) {
-            style.__disabledProperties = {};
-            style.__disabledPropertyValues = {};
-            style.__disabledPropertyPriorities = {};
-        }
-
-        style.__disabledPropertyValues[propertyName] = style.getPropertyValue(propertyName);
-        style.__disabledPropertyPriorities[propertyName] = style.getPropertyPriority(propertyName);
-
-        if (style.getPropertyShorthand(propertyName)) {
-            var longhandProperties = InjectedScript._getLonghandProperties(style, propertyName);
-            for (var i = 0; i < longhandProperties.length; ++i) {
-                style.__disabledProperties[longhandProperties[i]] = true;
-                style.removeProperty(longhandProperties[i]);
-            }
-        } else {
-            style.__disabledProperties[propertyName] = true;
-            style.removeProperty(propertyName);
-        }
-    } else if (style.__disabledProperties && style.__disabledProperties[propertyName]) {
-        var value = style.__disabledPropertyValues[propertyName];
-        var priority = style.__disabledPropertyPriorities[propertyName];
-
-        style.setProperty(propertyName, value, priority);
-        delete style.__disabledProperties[propertyName];
-        delete style.__disabledPropertyValues[propertyName];
-        delete style.__disabledPropertyPriorities[propertyName];
-    }
-    return InjectedScript._serializeStyle(style, true);
-}
-
-InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNodeId)
-{
-    var rule = InjectedScript._styleRules[ruleId];
-    if (!rule)
-        return false;
-
-    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
-
-    try {
-        var stylesheet = rule.parentStyleSheet;
-        stylesheet.addRule(newContent);
-        var newRule = stylesheet.cssRules[stylesheet.cssRules.length - 1];
-        newRule.style.cssText = rule.style.cssText;
-
-        var parentRules = stylesheet.cssRules;
-        for (var i = 0; i < parentRules.length; ++i) {
-            if (parentRules[i] === rule) {
-                rule.parentStyleSheet.removeRule(i);
-                break;
-            }
-        }
-
-        return [InjectedScript._serializeRule(newRule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode)];
-    } catch(e) {
-        // Report invalid syntax.
-        return false;
-    }
-}
-
-InjectedScript.addStyleSelector = function(newContent, selectedNodeId)
-{
-    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
-    if (!selectedNode)
-        return false;
-    var ownerDocument = selectedNode.ownerDocument;
-
-    var stylesheet = ownerDocument.__stylesheet;
-    if (!stylesheet) {
-        var head = ownerDocument.head;
-        var styleElement = ownerDocument.createElement("style");
-        styleElement.type = "text/css";
-        head.appendChild(styleElement);
-        stylesheet = ownerDocument.styleSheets[ownerDocument.styleSheets.length - 1];
-        ownerDocument.__stylesheet = stylesheet;
-    }
-
-    try {
-        stylesheet.addRule(newContent);
-    } catch (e) {
-        // Invalid Syntax for a Selector
-        return false;
-    }
-
-    var rule = stylesheet.cssRules[stylesheet.cssRules.length - 1];
-    rule.__isViaInspector = true;
-
-    return [ InjectedScript._serializeRule(rule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode) ];
-}
-
-InjectedScript._doesSelectorAffectNode = function(selectorText, node)
-{
-    if (!node)
-        return false;
-    var nodes = node.ownerDocument.querySelectorAll(selectorText);
-    for (var i = 0; i < nodes.length; ++i) {
-        if (nodes[i] === node) {
-            return true;
-        }
-    }
-    return false;
-}
-
-InjectedScript.setStyleProperty = function(styleId, name, value)
-{
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
-
-    style.setProperty(name, value, "");
-    return true;
-}
-
-InjectedScript._serializeRule = function(rule)
-{
-    var parentStyleSheet = rule.parentStyleSheet;
-
-    var ruleValue = {};
-    ruleValue.selectorText = rule.selectorText;
-    if (parentStyleSheet) {
-        ruleValue.parentStyleSheet = {};
-        ruleValue.parentStyleSheet.href = parentStyleSheet.href;
-    }
-    ruleValue.isUserAgent = parentStyleSheet && !parentStyleSheet.ownerNode && !parentStyleSheet.href;
-    ruleValue.isUser = parentStyleSheet && parentStyleSheet.ownerNode && parentStyleSheet.ownerNode.nodeName == "#document";
-    ruleValue.isViaInspector = !!rule.__isViaInspector;
-
-    // Bind editable scripts only.
-    var doBind = !ruleValue.isUserAgent && !ruleValue.isUser;
-    ruleValue.style = InjectedScript._serializeStyle(rule.style, doBind);
-
-    if (doBind) {
-        if (!rule.id) {
-            rule.id = InjectedScript._lastStyleRuleId++;
-            InjectedScript._styleRules[rule.id] = rule;
-        }
-        ruleValue.id = rule.id;
-        ruleValue.injectedScriptId = injectedScriptId;
-    }
-    return ruleValue;
-}
-
-InjectedScript._serializeStyle = function(style, doBind)
-{
-    var result = {};
-    result.width = style.width;
-    result.height = style.height;
-    result.__disabledProperties = style.__disabledProperties;
-    result.__disabledPropertyValues = style.__disabledPropertyValues;
-    result.__disabledPropertyPriorities = style.__disabledPropertyPriorities;
-    result.properties = [];
-    result.shorthandValues = {};
-    var foundShorthands = {};
-    for (var i = 0; i < style.length; ++i) {
-        var property = {};
-        var name = style[i];
-        property.name = name;
-        property.priority = style.getPropertyPriority(name);
-        property.implicit = style.isPropertyImplicit(name);
-        var shorthand =  style.getPropertyShorthand(name);
-        property.shorthand = shorthand;
-        if (shorthand && !(shorthand in foundShorthands)) {
-            foundShorthands[shorthand] = true;
-            result.shorthandValues[shorthand] = InjectedScript._getShorthandValue(style, shorthand);
-        }
-        property.value = style.getPropertyValue(name);
-        result.properties.push(property);
-    }
-    result.uniqueStyleProperties = InjectedScript._getUniqueStyleProperties(style);
-
-    if (doBind) {
-        if (!style.id) {
-            style.id = InjectedScript._lastStyleId++;
-            InjectedScript._styles[style.id] = style;
-        }
-        result.id = style.id;
-        result.injectedScriptId = injectedScriptId;
-    }
-    return result;
-}
-
-InjectedScript._getUniqueStyleProperties = function(style)
-{
-    var properties = [];
-    var foundProperties = {};
-
-    for (var i = 0; i < style.length; ++i) {
-        var property = style[i];
-        if (property in foundProperties)
-            continue;
-        foundProperties[property] = true;
-        properties.push(property);
-    }
-
-    return properties;
-}
-
-
-InjectedScript._getLonghandProperties = function(style, shorthandProperty)
-{
-    var properties = [];
-    var foundProperties = {};
-
-    for (var i = 0; i < style.length; ++i) {
-        var individualProperty = style[i];
-        if (individualProperty in foundProperties || style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-            continue;
-        foundProperties[individualProperty] = true;
-        properties.push(individualProperty);
-    }
-
-    return properties;
-}
-
-InjectedScript._getShorthandValue = function(style, shorthandProperty)
-{
-    var value = style.getPropertyValue(shorthandProperty);
-    if (!value) {
-        // Some shorthands (like border) return a null value, so compute a shorthand value.
-        // FIXME: remove this when http://bugs.webkit.org/show_bug.cgi?id=15823 is fixed.
-
-        var foundProperties = {};
-        for (var i = 0; i < style.length; ++i) {
-            var individualProperty = style[i];
-            if (individualProperty in foundProperties || style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-                continue;
-
-            var individualValue = style.getPropertyValue(individualProperty);
-            if (style.isPropertyImplicit(individualProperty) || individualValue === "initial")
-                continue;
-
-            foundProperties[individualProperty] = true;
-
-            if (!value)
-                value = "";
-            else if (value.length)
-                value += " ";
-            value += individualValue;
-        }
-    }
-    return value;
-}
-
-InjectedScript._getShorthandPriority = function(style, shorthandProperty)
-{
-    var priority = style.getPropertyPriority(shorthandProperty);
-    if (!priority) {
-        for (var i = 0; i < style.length; ++i) {
-            var individualProperty = style[i];
-            if (style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-                continue;
-            priority = style.getPropertyPriority(individualProperty);
-            break;
-        }
-    }
-    return priority;
-}
-
 InjectedScript.getPrototypes = function(nodeId)
 {
     var node = InjectedScript._nodeForId(nodeId);
diff --git a/WebCore/inspector/front-end/MetricsSidebarPane.js b/WebCore/inspector/front-end/MetricsSidebarPane.js
index 767da1f..735ce94 100644
--- a/WebCore/inspector/front-end/MetricsSidebarPane.js
+++ b/WebCore/inspector/front-end/MetricsSidebarPane.js
@@ -30,7 +30,6 @@ WebInspector.MetricsSidebarPane = function()
 {
     WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
     this._inlineStyleId = null;
-    this._inlineStyleInjectedScriptId = null;
 }
 
 WebInspector.MetricsSidebarPane.prototype = {
@@ -53,15 +52,14 @@ WebInspector.MetricsSidebarPane.prototype = {
             var style = WebInspector.CSSStyleDeclaration.parseStyle(stylePayload);
             self._update(style);
         };
-        InjectedScriptAccess.get(node.injectedScriptId).getComputedStyle(node.id, callback);
+        InspectorBackend.getComputedStyle(WebInspector.Callback.wrap(callback), node.id);
 
         var inlineStyleCallback = function(stylePayload) {
             if (!stylePayload)
                 return;
             self._inlineStyleId = stylePayload.id;
-            self._inlineStyleInjectedScriptId = stylePayload.injectedScriptId;
         };
-        InjectedScriptAccess.get(node.injectedScriptId).getInlineStyle(node.id, inlineStyleCallback);
+        InspectorBackend.getInlineStyle(WebInspector.Callback.wrap(inlineStyleCallback), node.id);
     },
 
     _update: function(style)
@@ -206,7 +204,8 @@ WebInspector.MetricsSidebarPane.prototype = {
             self.dispatchEventToListeners("metrics edited");
             self.update();
         };
-        InjectedScriptAccess.get(this._inlineStyleInjectedScriptId).setStyleProperty(this._inlineStyleId, context.styleProperty, userInput, callback);
+
+        InspectorBackend.setStyleProperty(WebInspector.Callback.wrap(callback), this._inlineStyleId, context.styleProperty, userInput);
     }
 }
 
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index cabaa8e..88a4de7 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -115,7 +115,7 @@ WebInspector.StylesSidebarPane.prototype = {
             self._update(refresh, body, node, editedSection, forceUpdate);
         }
 
-        InjectedScriptAccess.get(node.injectedScriptId).getStyles(node.id, !WebInspector.settings.showUserAgentStyles, callback);
+        InspectorBackend.getStyles(WebInspector.Callback.wrap(callback), node.id, !WebInspector.settings.showUserAgentStyles);
     },
 
     _update: function(refresh, body, node, editedSection, forceUpdate)
@@ -659,16 +659,14 @@ WebInspector.StylePropertiesSection.prototype = {
             return moveToNextIfNeeded.call(this);
 
         var self = this;
-        function callback(result)
+        function callback(newRulePayload, doesAffectSelectedNode)
         {
-            if (!result) {
+            if (!newRulePayload) {
                 // Invalid Syntax for a Selector
                 moveToNextIfNeeded.call(self);
                 return;
             }
 
-            var newRulePayload = result[0];
-            var doesAffectSelectedNode = result[1];
             if (!doesAffectSelectedNode) {
                 self.noAffect = true;
                 self.element.addStyleClass("no-affect");
@@ -691,7 +689,7 @@ WebInspector.StylePropertiesSection.prototype = {
             moveToNextIfNeeded.call(self);
         }
 
-        InjectedScriptAccess.get(this.rule.injectedScriptId).applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback);
+        InspectorBackend.setRuleSelector(WebInspector.Callback.wrap(callback), this.rule.id, newContent, this.pane.node.id);
     },
 
     editingSelectorCancelled: function()
@@ -718,17 +716,14 @@ WebInspector.BlankStylePropertiesSection.prototype = {
     editingSelectorCommitted: function(element, newContent, oldContent, context)
     {
         var self = this;
-        function callback(result)
+        function callback(rule, doesSelectorAffectSelectedNode)
         {
-            if (!result) {
+            if (!rule) {
                 // Invalid Syntax for a Selector
                 self.editingSelectorCancelled();
                 return;
             }
 
-            var rule = result[0];
-            var doesSelectorAffectSelectedNode = result[1];
-
             var styleRule = WebInspector.CSSStyleDeclaration.parseRule(rule);
             styleRule.rule = rule;
 
@@ -745,7 +740,7 @@ WebInspector.BlankStylePropertiesSection.prototype = {
             self.addNewBlankProperty().startEditing();
         }
 
-        InjectedScriptAccess.get(this.pane.node.injectedScriptId).addStyleSelector(newContent, this.pane.node.id, callback);
+        InspectorBackend.addRule(WebInspector.Callback.wrap(callback), newContent, this.pane.node.id);
     },
 
     editingSelectorCancelled: function()
@@ -1052,7 +1047,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
             self.updateAll(true);
         }
 
-        InjectedScriptAccess.get(this.style.injectedScriptId).toggleStyleEnabled(this.style.id, this.name, disabled, callback);
+        InspectorBackend.toggleStyleEnabled(WebInspector.Callback.wrap(callback), this.style.id, this.name, disabled);
     },
 
     updateState: function()
@@ -1214,7 +1209,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
         } else {
             // Restore the original CSS text before applying user changes. This is needed to prevent
             // new properties from sticking around if the user adds one, then removes it.
-            InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText);
+            InspectorBackend.setStyleText(WebInspector.Callback.wrap(null), this.style.id, this.originalCSSText);
         }
 
         this.applyStyleText(this.listItemElement.textContent);
@@ -1234,7 +1229,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
         if (this._newProperty)
             this.treeOutline.removeChild(this);
         else if (this.originalCSSText) {
-            InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText);
+            InspectorBackend.setStyleText(WebInspector.Callback.wrap(null), this.style.id, this.originalCSSText);
 
             if (this.treeOutline.section && this.treeOutline.section.pane)
                 this.treeOutline.section.pane.dispatchEventToListeners("style edited");
@@ -1320,9 +1315,9 @@ WebInspector.StylePropertyTreeElement.prototype = {
         }
 
         var self = this;
-        function callback(result)
+        function callback(success, newPayload, changedProperties)
         {
-            if (!result) {
+            if (!success) {
                 // The user typed something, but it didn't parse. Just abort and restore
                 // the original title for this property.  If this was a new attribute and
                 // we couldn't parse, then just remove it.
@@ -1335,8 +1330,6 @@ WebInspector.StylePropertyTreeElement.prototype = {
                 return;
             }
 
-            var newPayload = result[0];
-            var changedProperties = result[1];
             elementsPanel.removeStyleChange(section.identifier, self.style, self.name);
 
             if (!styleTextLength) {
@@ -1355,8 +1348,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
             if (updateInterface)
                 self.updateAll(true);
         }
-
-        InjectedScriptAccess.get(this.style.injectedScriptId).applyStyleText(this.style.id, styleText.trim(), this.name, callback);
+        InspectorBackend.applyStyleText(WebInspector.Callback.wrap(callback), this.style.id, styleText.trim(), this.name);
     }
 }
 
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 8892d7b..eb40a28 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -615,6 +615,8 @@ WebInspector.documentMouseOver = function(event)
     const anchor = event.target;
     if (!anchor.hasStyleClass("webkit-html-resource-link"))
         return;
+    if (anchor.href && anchor.href.indexOf("/data:") != -1)
+        return;
     if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href)) {
         if (event.target.originalTitle)
             event.target.title = event.target.originalTitle;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 20d036e..e63fcb5 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-03-16  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: migrate to native styles inspector in order to inspect styles from foreighn domains.
+
+        https://bugs.webkit.org/show_bug.cgi?id=36117
+
+        * src/js/InspectorControllerImpl.js:
+        (devtools.InspectorBackendImpl):
+
 2010-03-15  John Gregg  <johnnyg at google.com>
 
         Reviewed by David Levin.
diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js
index 38325b6..9bcedf4 100644
--- a/WebKit/chromium/src/js/InspectorControllerImpl.js
+++ b/WebKit/chromium/src/js/InspectorControllerImpl.js
@@ -71,6 +71,15 @@ devtools.InspectorBackendImpl = function()
     this.installInspectorControllerDelegate_("startTimelineProfiler");
     this.installInspectorControllerDelegate_("stopTimelineProfiler");
     this.installInspectorControllerDelegate_("storeLastActivePanel");
+
+    this.installInspectorControllerDelegate_("getStyles");
+    this.installInspectorControllerDelegate_("getComputedStyle");
+    this.installInspectorControllerDelegate_("applyStyleText");
+    this.installInspectorControllerDelegate_("setStyleText");
+    this.installInspectorControllerDelegate_("setStyleProperty");
+    this.installInspectorControllerDelegate_("toggleStyleEnabled");
+    this.installInspectorControllerDelegate_("setRuleSelector");
+    this.installInspectorControllerDelegate_("addRule");
 };
 devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list