[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 15:41:49 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b41d529f93419e9606b77c3db80b91b340d92d05
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 10 16:13:39 2010 +0000

    2010-11-10  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: Move CSSStyleDeclaration from DOMAgent.js into CSSStyleModel.js
            https://bugs.webkit.org/show_bug.cgi?id=49312
    
            No new tests, as it's just code motion.
    
            * inspector/front-end/CSSStyleModel.js:
            (WebInspector.CSSStyleDeclaration):
            (WebInspector.CSSStyleDeclaration.parsePayload):
            (WebInspector.CSSStyleDeclaration.prototype.get allProperties):
            (WebInspector.CSSStyleDeclaration.prototype.getLiveProperty):
            (WebInspector.CSSStyleDeclaration.prototype.getPropertyValue):
            (WebInspector.CSSStyleDeclaration.prototype.getPropertyPriority):
            (WebInspector.CSSStyleDeclaration.prototype.getPropertyShorthand):
            (WebInspector.CSSStyleDeclaration.prototype.isPropertyImplicit):
            (WebInspector.CSSStyleDeclaration.prototype.styleTextWithShorthands):
            (WebInspector.CSSStyleDeclaration.prototype.getLonghandProperties):
            (WebInspector.CSSStyleDeclaration.prototype.getShorthandValue):
            (WebInspector.CSSStyleDeclaration.prototype.getShorthandPriority):
            (WebInspector.CSSStyleDeclaration.prototype.appendProperty):
            (WebInspector.CSSStyleDeclaration.prototype.propertyAt):
            (WebInspector.CSSRule):
            (WebInspector.CSSRule.parsePayload):
            (WebInspector.CSSRule.prototype.get isUserAgent):
            (WebInspector.CSSRule.prototype.get isUser):
            (WebInspector.CSSRule.prototype.get isViaInspector):
            (WebInspector.CSSRule.prototype.get isRegular):
            (WebInspector.CSSProperty):
            (WebInspector.CSSProperty.parsePayload):
            (WebInspector.CSSProperty.prototype.get propertyText):
            (WebInspector.CSSProperty.prototype.get isLive):
            (WebInspector.CSSProperty.prototype.get active):
            (WebInspector.CSSProperty.prototype.get styleBased):
            (WebInspector.CSSProperty.prototype.get inactive):
            (WebInspector.CSSProperty.prototype.get disabled):
            (WebInspector.CSSProperty.prototype.setText):
            (WebInspector.CSSProperty.prototype.setValue):
            (WebInspector.CSSProperty.prototype.setDisabled.callback):
            (WebInspector.CSSProperty.prototype.setDisabled):
            * inspector/front-end/DOMAgent.js:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71740 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6367c3a..04a8f3f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2010-11-10  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: Move CSSStyleDeclaration from DOMAgent.js into CSSStyleModel.js
+        https://bugs.webkit.org/show_bug.cgi?id=49312
+
+        No new tests, as it's just code motion.
+
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleDeclaration):
+        (WebInspector.CSSStyleDeclaration.parsePayload):
+        (WebInspector.CSSStyleDeclaration.prototype.get allProperties):
+        (WebInspector.CSSStyleDeclaration.prototype.getLiveProperty):
+        (WebInspector.CSSStyleDeclaration.prototype.getPropertyValue):
+        (WebInspector.CSSStyleDeclaration.prototype.getPropertyPriority):
+        (WebInspector.CSSStyleDeclaration.prototype.getPropertyShorthand):
+        (WebInspector.CSSStyleDeclaration.prototype.isPropertyImplicit):
+        (WebInspector.CSSStyleDeclaration.prototype.styleTextWithShorthands):
+        (WebInspector.CSSStyleDeclaration.prototype.getLonghandProperties):
+        (WebInspector.CSSStyleDeclaration.prototype.getShorthandValue):
+        (WebInspector.CSSStyleDeclaration.prototype.getShorthandPriority):
+        (WebInspector.CSSStyleDeclaration.prototype.appendProperty):
+        (WebInspector.CSSStyleDeclaration.prototype.propertyAt):
+        (WebInspector.CSSRule):
+        (WebInspector.CSSRule.parsePayload):
+        (WebInspector.CSSRule.prototype.get isUserAgent):
+        (WebInspector.CSSRule.prototype.get isUser):
+        (WebInspector.CSSRule.prototype.get isViaInspector):
+        (WebInspector.CSSRule.prototype.get isRegular):
+        (WebInspector.CSSProperty):
+        (WebInspector.CSSProperty.parsePayload):
+        (WebInspector.CSSProperty.prototype.get propertyText):
+        (WebInspector.CSSProperty.prototype.get isLive):
+        (WebInspector.CSSProperty.prototype.get active):
+        (WebInspector.CSSProperty.prototype.get styleBased):
+        (WebInspector.CSSProperty.prototype.get inactive):
+        (WebInspector.CSSProperty.prototype.get disabled):
+        (WebInspector.CSSProperty.prototype.setText):
+        (WebInspector.CSSProperty.prototype.setValue):
+        (WebInspector.CSSProperty.prototype.setDisabled.callback):
+        (WebInspector.CSSProperty.prototype.setDisabled):
+        * inspector/front-end/DOMAgent.js:
+
 2010-11-10  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r71733.
diff --git a/WebCore/inspector/front-end/CSSStyleModel.js b/WebCore/inspector/front-end/CSSStyleModel.js
index 542a3b3..0a7dabb 100644
--- a/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/WebCore/inspector/front-end/CSSStyleModel.js
@@ -147,3 +147,293 @@ WebInspector.CSSStyleModel.prototype = {
         InspectorBackend.setStyleText(styleId, cssText);
     }
 }
+
+WebInspector.CSSStyleDeclaration = function(payload)
+{
+    this.id = payload.styleId;
+    this.properties = payload.properties;
+    this._shorthandValues = payload.shorthandValues;
+    this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
+    this._allProperties = []; // ALL properties: [ CSSProperty ]
+    this._longhandProperties = {}; // shorthandName -> [ CSSProperty ]
+    this.__disabledProperties = {}; // DISABLED properties: { index -> CSSProperty }
+    var payloadPropertyCount = payload.cssProperties.length;
+
+    var propertyIndex = 0;
+    for (var i = 0; i < payloadPropertyCount; ++i) {
+        var property = new WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
+        this._allProperties.push(property);
+        if (property.disabled)
+            this.__disabledProperties[i] = property;
+        if (!property.active && !property.styleBased)
+            continue;
+        var name = property.name;
+        this[propertyIndex] = name;
+        this._livePropertyMap[name] = property;
+
+        // Index longhand properties.
+        if (property.shorthand) { // only for parsed
+            var longhands = this._longhandProperties[property.shorthand];
+            if (!longhands) {
+                longhands = [];
+                this._longhandProperties[property.shorthand] = longhands;
+            }
+            longhands.push(property);
+        }
+        ++propertyIndex;
+    }
+    this.length = propertyIndex;
+}
+
+WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
+{
+    return new WebInspector.CSSStyleDeclaration(payload);
+}
+
+WebInspector.CSSStyleDeclaration.prototype = {
+    get allProperties()
+    {
+        return this._allProperties;
+    },
+
+    getLiveProperty: function(name)
+    {
+        return this._livePropertyMap[name];
+    },
+
+    getPropertyValue: function(name)
+    {
+        var property = this._livePropertyMap[name];
+        return property ? property.value : "";
+    },
+
+    getPropertyPriority: function(name)
+    {
+        var property = this._livePropertyMap[name];
+        return property ? property.priority : "";
+    },
+
+    getPropertyShorthand: function(name)
+    {
+        var property = this._livePropertyMap[name];
+        return property ? property.shorthand : "";
+    },
+
+    isPropertyImplicit: function(name)
+    {
+        var property = this._livePropertyMap[name];
+        return property ? property.implicit : "";
+    },
+
+    styleTextWithShorthands: function()
+    {
+        var cssText = "";
+        var foundProperties = {};
+        for (var i = 0; i < this.length; ++i) {
+            var individualProperty = this[i];
+            var shorthandProperty = this.getPropertyShorthand(individualProperty);
+            var propertyName = (shorthandProperty || individualProperty);
+
+            if (propertyName in foundProperties)
+                continue;
+
+            if (shorthandProperty) {
+                var value = this.getShorthandValue(shorthandProperty);
+                var priority = this.getShorthandPriority(shorthandProperty);
+            } else {
+                var value = this.getPropertyValue(individualProperty);
+                var priority = this.getPropertyPriority(individualProperty);
+            }
+
+            foundProperties[propertyName] = true;
+
+            cssText += propertyName + ": " + value;
+            if (priority)
+                cssText += " !" + priority;
+            cssText += "; ";
+        }
+
+        return cssText;
+    },
+
+    getLonghandProperties: function(name)
+    {
+        return this._longhandProperties[name] || [];
+    },
+
+    getShorthandValue: function(shorthandProperty)
+    {
+        var property = this.getLiveProperty(shorthandProperty);
+        return property ? property.value : this._shorthandValues[shorthandProperty];
+    },
+
+    getShorthandPriority: function(shorthandProperty)
+    {
+        var priority = this.getPropertyPriority(shorthandProperty);
+        if (priority)
+            return priority;
+
+        var longhands = this._longhandProperties[shorthandProperty];
+        return longhands ? this.getPropertyPriority(longhands[0]) : null;
+    },
+
+    appendProperty: function(propertyName, propertyValue, userCallback)
+    {
+        function setPropertyCallback(userCallback, success, stylePayload)
+        {
+            if (!success)
+                userCallback(null);
+            else
+                userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+        }
+
+        // FIXME(apavlov): this should be migrated to the new InspectorCSSAgent API once it is enabled.
+        InspectorBackend.applyStyleText(this.id, propertyName + ": " + propertyValue + ";", propertyName, setPropertyCallback.bind(this, userCallback));
+    },
+
+    propertyAt: function(index)
+    {
+        return (index < this.allProperties.length) ? this.allProperties[index] : null;
+    }
+}
+
+WebInspector.CSSRule = function(payload)
+{
+    this.id = payload.ruleId;
+    this.selectorText = payload.selectorText;
+    this.sourceLine = payload.sourceLine;
+    this.sourceURL = payload.sourceURL;
+    this.origin = payload.origin;
+    this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
+    this.style.parentRule = this;
+}
+
+WebInspector.CSSRule.parsePayload = function(payload)
+{
+    return new WebInspector.CSSRule(payload);
+}
+
+WebInspector.CSSRule.prototype = {
+    get isUserAgent()
+    {
+        return this.origin === "user-agent";
+    },
+
+    get isUser()
+    {
+        return this.origin === "user";
+    },
+
+    get isViaInspector()
+    {
+        return this.origin === "inspector";
+    },
+
+    get isRegular()
+    {
+        return this.origin === "";
+    }
+}
+
+WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text)
+{
+    this.ownerStyle = ownerStyle;
+    this.index = index;
+    this.name = name;
+    this.value = value;
+    this.priority = priority;
+    this.status = status;
+    this.parsedOk = parsedOk;
+    this.implicit = implicit;
+    this.shorthand = shorthand;
+    this.text = text;
+}
+
+WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
+{
+    var result = new WebInspector.CSSProperty(
+        ownerStyle, index, payload.name, payload.value, payload.priority, payload.status, payload.parsedOk, payload.implicit, payload.shorthandName, payload.text);
+    return result;
+}
+
+WebInspector.CSSProperty.prototype = {
+    get propertyText()
+    {
+        if (this.text !== undefined)
+            return this.text;
+
+        return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
+    },
+
+    get isLive()
+    {
+        return this.active || this.styleBased;
+    },
+
+    get active()
+    {
+        return this.status === "active";
+    },
+
+    get styleBased()
+    {
+        return this.status === "style";
+    },
+
+    get inactive()
+    {
+        return this.status === "inactive";
+    },
+
+    get disabled()
+    {
+        return this.status === "disabled";
+    },
+
+    // Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
+    setText: function(propertyText, userCallback)
+    {
+        function callback(userCallback, success, stylePayload)
+        {
+            if (!userCallback)
+                return;
+            if (!success)
+                userCallback(null);
+            else {
+                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+                userCallback(style);
+            }
+        }
+
+        if (!this.ownerStyle)
+            throw "No ownerStyle for property";
+        InspectorBackend.applyStyleText(this.ownerStyle.id, propertyText, this.name, callback.bind(this, userCallback));
+    },
+
+    setValue: function(newValue, userCallback)
+    {
+        var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
+        this.setText(text, userCallback);
+    },
+
+    setDisabled: function(disabled, userCallback)
+    {
+        if (!this.ownerStyle && userCallback)
+            userCallback(null);
+        if (disabled === this.disabled && userCallback)
+            userCallback(this.ownerStyle);
+
+        function callback(userCallback, stylePayload)
+        {
+            if (!userCallback)
+                return;
+            if (!stylePayload)
+                userCallback(null);
+            else {
+                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+                userCallback(style);
+            }
+        }
+        InspectorBackend.toggleStyleEnabled(this.ownerStyle.id, this.name, disabled, callback.bind(this, userCallback));
+    }
+}
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 470e775..37bf549 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -524,296 +524,6 @@ WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callb
     InspectorBackend.getEventListenersForNode(node.id, callback);
 }
 
-WebInspector.CSSStyleDeclaration = function(payload)
-{
-    this.id = payload.styleId;
-    this.properties = payload.properties;
-    this._shorthandValues = payload.shorthandValues;
-    this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
-    this._allProperties = []; // ALL properties: [ CSSProperty ]
-    this._longhandProperties = {}; // shorthandName -> [ CSSProperty ]
-    this.__disabledProperties = {}; // DISABLED properties: { index -> CSSProperty }
-    var payloadPropertyCount = payload.cssProperties.length;
-
-    var propertyIndex = 0;
-    for (var i = 0; i < payloadPropertyCount; ++i) {
-        var property = new WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
-        this._allProperties.push(property);
-        if (property.disabled)
-            this.__disabledProperties[i] = property;
-        if (!property.active && !property.styleBased)
-            continue;
-        var name = property.name;
-        this[propertyIndex] = name;
-        this._livePropertyMap[name] = property;
-
-        // Index longhand properties.
-        if (property.shorthand) { // only for parsed
-            var longhands = this._longhandProperties[property.shorthand];
-            if (!longhands) {
-                longhands = [];
-                this._longhandProperties[property.shorthand] = longhands;
-            }
-            longhands.push(property);
-        }
-        ++propertyIndex;
-    }
-    this.length = propertyIndex;
-}
-
-WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
-{
-    return new WebInspector.CSSStyleDeclaration(payload);
-}
-
-WebInspector.CSSStyleDeclaration.prototype = {
-    get allProperties()
-    {
-        return this._allProperties;
-    },
-
-    getLiveProperty: function(name)
-    {
-        return this._livePropertyMap[name];
-    },
-
-    getPropertyValue: function(name)
-    {
-        var property = this._livePropertyMap[name];
-        return property ? property.value : "";
-    },
-
-    getPropertyPriority: function(name)
-    {
-        var property = this._livePropertyMap[name];
-        return property ? property.priority : "";
-    },
-
-    getPropertyShorthand: function(name)
-    {
-        var property = this._livePropertyMap[name];
-        return property ? property.shorthand : "";
-    },
-
-    isPropertyImplicit: function(name)
-    {
-        var property = this._livePropertyMap[name];
-        return property ? property.implicit : "";
-    },
-
-    styleTextWithShorthands: function()
-    {
-        var cssText = "";
-        var foundProperties = {};
-        for (var i = 0; i < this.length; ++i) {
-            var individualProperty = this[i];
-            var shorthandProperty = this.getPropertyShorthand(individualProperty);
-            var propertyName = (shorthandProperty || individualProperty);
-
-            if (propertyName in foundProperties)
-                continue;
-
-            if (shorthandProperty) {
-                var value = this.getShorthandValue(shorthandProperty);
-                var priority = this.getShorthandPriority(shorthandProperty);
-            } else {
-                var value = this.getPropertyValue(individualProperty);
-                var priority = this.getPropertyPriority(individualProperty);
-            }
-
-            foundProperties[propertyName] = true;
-
-            cssText += propertyName + ": " + value;
-            if (priority)
-                cssText += " !" + priority;
-            cssText += "; ";
-        }
-
-        return cssText;
-    },
-
-    getLonghandProperties: function(name)
-    {
-        return this._longhandProperties[name] || [];
-    },
-
-    getShorthandValue: function(shorthandProperty)
-    {
-        var property = this.getLiveProperty(shorthandProperty);
-        return property ? property.value : this._shorthandValues[shorthandProperty];
-    },
-
-    getShorthandPriority: function(shorthandProperty)
-    {
-        var priority = this.getPropertyPriority(shorthandProperty);
-        if (priority)
-            return priority;
-
-        var longhands = this._longhandProperties[shorthandProperty];
-        return longhands ? this.getPropertyPriority(longhands[0]) : null;
-    },
-
-    appendProperty: function(propertyName, propertyValue, userCallback)
-    {
-        function setPropertyCallback(userCallback, success, stylePayload)
-        {
-            if (!success)
-                userCallback(null);
-            else
-                userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
-        }
-
-        // FIXME(apavlov): this should be migrated to the new InspectorCSSAgent API once it is enabled.
-        InspectorBackend.applyStyleText(this.id, propertyName + ": " + propertyValue + ";", propertyName, setPropertyCallback.bind(this, userCallback));
-    },
-
-    propertyAt: function(index)
-    {
-        return (index < this.allProperties.length) ? this.allProperties[index] : null;
-    }
-}
-
-WebInspector.CSSRule = function(payload)
-{
-    this.id = payload.ruleId;
-    this.selectorText = payload.selectorText;
-    this.sourceLine = payload.sourceLine;
-    this.sourceURL = payload.sourceURL;
-    this.origin = payload.origin;
-    this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
-    this.style.parentRule = this;
-}
-
-WebInspector.CSSRule.parsePayload = function(payload)
-{
-    return new WebInspector.CSSRule(payload);
-}
-
-WebInspector.CSSRule.prototype = {
-    get isUserAgent()
-    {
-        return this.origin === "user-agent";
-    },
-
-    get isUser()
-    {
-        return this.origin === "user";
-    },
-
-    get isViaInspector()
-    {
-        return this.origin === "inspector";
-    },
-
-    get isRegular()
-    {
-        return this.origin === "";
-    }
-}
-
-WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text)
-{
-    this.ownerStyle = ownerStyle;
-    this.index = index;
-    this.name = name;
-    this.value = value;
-    this.priority = priority;
-    this.status = status;
-    this.parsedOk = parsedOk;
-    this.implicit = implicit;
-    this.shorthand = shorthand;
-    this.text = text;
-}
-
-WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
-{
-    var result = new WebInspector.CSSProperty(
-        ownerStyle, index, payload.name, payload.value, payload.priority, payload.status, payload.parsedOk, payload.implicit, payload.shorthandName, payload.text);
-    return result;
-}
-
-WebInspector.CSSProperty.prototype = {
-    get propertyText()
-    {
-        if (this.text !== undefined)
-            return this.text;
-
-        return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
-    },
-
-    get isLive()
-    {
-        return this.active || this.styleBased;
-    },
-
-    get active()
-    {
-        return this.status === "active";
-    },
-
-    get styleBased()
-    {
-        return this.status === "style";
-    },
-
-    get inactive()
-    {
-        return this.status === "inactive";
-    },
-
-    get disabled()
-    {
-        return this.status === "disabled";
-    },
-
-    // Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
-    setText: function(propertyText, userCallback)
-    {
-        function callback(userCallback, success, stylePayload)
-        {
-            if (!userCallback)
-                return;
-            if (!success)
-                userCallback(null);
-            else {
-                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
-                userCallback(style);
-            }
-        }
-
-        if (!this.ownerStyle)
-            throw "No ownerStyle for property";
-        InspectorBackend.applyStyleText(this.ownerStyle.id, propertyText, this.name, callback.bind(this, userCallback));
-    },
-
-    setValue: function(newValue, userCallback)
-    {
-        var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
-        this.setText(text, userCallback);
-    },
-
-    setDisabled: function(disabled, userCallback)
-    {
-        if (!this.ownerStyle && userCallback)
-            userCallback(null);
-        if (disabled === this.disabled && userCallback)
-            userCallback(this.ownerStyle);
-
-        function callback(userCallback, stylePayload)
-        {
-            if (!userCallback)
-                return;
-            if (!stylePayload)
-                userCallback(null);
-            else {
-                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
-                userCallback(style);
-            }
-        }
-        InspectorBackend.toggleStyleEnabled(this.ownerStyle.id, this.name, disabled, callback.bind(this, userCallback));
-    }
-}
-
 WebInspector.attributesUpdated = function()
 {
     this.domAgent._attributesUpdated.apply(this.domAgent, arguments);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list