Title: [96817] trunk/Source/WebCore
Revision
96817
Author
pfeld...@chromium.org
Date
2011-10-06 09:31:58 -0700 (Thu, 06 Oct 2011)

Log Message

Web Inspector: add Styles and Metrics sidebars to the compilation.
https://bugs.webkit.org/show_bug.cgi?id=69529

Reviewed by Yury Semikhatsky.

* inspector/compile-front-end.sh:
* inspector/front-end/CSSCompletions.js:
(WebInspector.CSSCompletions.requestCSSNameCompletions):
* inspector/front-end/CSSKeywordCompletions.js:
(WebInspector.CSSKeywordCompletions.forProperty):
(WebInspector.CSSKeywordCompletions.isColorAwareProperty):
* inspector/front-end/Checkbox.js:
* inspector/front-end/ElementsPanel.js:
* inspector/front-end/MetricsSidebarPane.js:
(WebInspector.MetricsSidebarPane.prototype._updateMetrics):
(WebInspector.MetricsSidebarPane.prototype.startEditing):
(WebInspector.MetricsSidebarPane.prototype._handleKeyDown):
* inspector/front-end/SourceCSSTokenizer.js:
(WebInspector.SourceCSSTokenizer):
* inspector/front-end/SourceCSSTokenizer.re2js:
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype.update):
(WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
(WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
(WebInspector.StylePropertiesSection.prototype.onpopulate):
(WebInspector.StylePropertiesSection.prototype.startEditingSelector):
(WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.successCallback):
(WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
(WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
(WebInspector.BlankStylePropertiesSection.prototype.makeNormal):
(WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL):
(WebInspector.StylePropertyTreeElement.prototype):
* inspector/front-end/externs.js:
(WebInspector.linkifyResourceAsNode):
(Element.prototype.scrollIntoViewIfNeeded):
(Element.prototype.selectionLeftOffset):
* inspector/front-end/inspector.js:
* inspector/front-end/utilities.js:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96816 => 96817)


--- trunk/Source/WebCore/ChangeLog	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/ChangeLog	2011-10-06 16:31:58 UTC (rev 96817)
@@ -1,5 +1,46 @@
 2011-10-06  Pavel Feldman  <pfeld...@google.com>
 
+        Web Inspector: add Styles and Metrics sidebars to the compilation.
+        https://bugs.webkit.org/show_bug.cgi?id=69529
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/CSSCompletions.js:
+        (WebInspector.CSSCompletions.requestCSSNameCompletions):
+        * inspector/front-end/CSSKeywordCompletions.js:
+        (WebInspector.CSSKeywordCompletions.forProperty):
+        (WebInspector.CSSKeywordCompletions.isColorAwareProperty):
+        * inspector/front-end/Checkbox.js:
+        * inspector/front-end/ElementsPanel.js:
+        * inspector/front-end/MetricsSidebarPane.js:
+        (WebInspector.MetricsSidebarPane.prototype._updateMetrics):
+        (WebInspector.MetricsSidebarPane.prototype.startEditing):
+        (WebInspector.MetricsSidebarPane.prototype._handleKeyDown):
+        * inspector/front-end/SourceCSSTokenizer.js:
+        (WebInspector.SourceCSSTokenizer):
+        * inspector/front-end/SourceCSSTokenizer.re2js:
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype.update):
+        (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
+        (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
+        (WebInspector.StylePropertiesSection.prototype.onpopulate):
+        (WebInspector.StylePropertiesSection.prototype.startEditingSelector):
+        (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.successCallback):
+        (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
+        (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
+        (WebInspector.BlankStylePropertiesSection.prototype.makeNormal):
+        (WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL):
+        (WebInspector.StylePropertyTreeElement.prototype):
+        * inspector/front-end/externs.js:
+        (WebInspector.linkifyResourceAsNode):
+        (Element.prototype.scrollIntoViewIfNeeded):
+        (Element.prototype.selectionLeftOffset):
+        * inspector/front-end/inspector.js:
+        * inspector/front-end/utilities.js:
+
+2011-10-06  Pavel Feldman  <pfeld...@google.com>
+
         Web Inspector: extract DOMPresentation, make EventListenersSidebar compile
         https://bugs.webkit.org/show_bug.cgi?id=69527
 

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (96816 => 96817)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2011-10-06 16:31:58 UTC (rev 96817)
@@ -71,7 +71,7 @@
         --js Source/WebCore/inspector/front-end/Resource.js \
         --js Source/WebCore/inspector/front-end/NetworkManager.js \
         --js Source/WebCore/inspector/front-end/UISourceCode.js \
-    --module jsmodule_ui:35:jsmodule_common \
+    --module jsmodule_ui:37:jsmodule_common \
         --js Source/WebCore/inspector/front-end/Checkbox.js \
         --js Source/WebCore/inspector/front-end/Color.js \
         --js Source/WebCore/inspector/front-end/ContextMenu.js \
@@ -120,6 +120,7 @@
         --js Source/WebCore/inspector/front-end/FontView.js \
         --js Source/WebCore/inspector/front-end/ImageView.js \
         --js Source/WebCore/inspector/front-end/_javascript_ContextManager.js \
+        --js Source/WebCore/inspector/front-end/MetricsSidebarPane.js \
         --js Source/WebCore/inspector/front-end/NetworkItemView.js \
         --js Source/WebCore/inspector/front-end/ObjectPopoverHelper.js \
         --js Source/WebCore/inspector/front-end/ObjectPropertiesSection.js \
@@ -132,6 +133,7 @@
         --js Source/WebCore/inspector/front-end/ResourceTimingView.js \
         --js Source/WebCore/inspector/front-end/ResourceView.js \
         --js Source/WebCore/inspector/front-end/SourceFrame.js \
+        --js Source/WebCore/inspector/front-end/StylesSidebarPane.js \
         --js Source/WebCore/inspector/front-end/TimelineAgent.js \
         --js Source/WebCore/inspector/front-end/TimelineManager.js
 
@@ -141,8 +143,6 @@
 #
 # ElementsPanel
 # BreakpointsSidebarPane
-# MetricsSidebarPane
-# StylesSidebarPane
 # DOMBreakpointsSidebarPane
 #
 # [Resources]

Modified: trunk/Source/WebCore/inspector/front-end/CSSCompletions.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/CSSCompletions.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/CSSCompletions.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -40,6 +40,22 @@
     this._acceptEmptyPrefix = acceptEmptyPrefix;
 }
 
+
+/**
+ * @type {WebInspector.CSSCompletions}
+ */
+WebInspector.CSSCompletions.cssNameCompletions = null;
+
+WebInspector.CSSCompletions.requestCSSNameCompletions = function()
+{
+    function propertyNamesCallback(error, names)
+    {
+        if (!error)
+            WebInspector.CSSCompletions.cssNameCompletions = new WebInspector.CSSCompletions(names, false);
+    }
+    CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
+}
+
 WebInspector.CSSCompletions.prototype = {
     startsWith: function(prefix)
     {

Modified: trunk/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -28,28 +28,25 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/**
- * @constructor
- */
-WebInspector.CSSKeywordCompletions = {
-    forProperty: function(propertyName)
-    {
-        var acceptedKeywords = ["initial"];
-        if (propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
-            acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]);
-        if (propertyName in WebInspector.CSSKeywordCompletions._colorAwareProperties)
-            acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
-        if (propertyName in WebInspector.CSSKeywordCompletions.InheritedProperties)
-            acceptedKeywords.push("inherit");
-        return new WebInspector.CSSCompletions(acceptedKeywords, true);
-    },
+WebInspector.CSSKeywordCompletions = {}
 
-    isColorAwareProperty: function(propertyName)
-    {
-        return WebInspector.CSSKeywordCompletions._colorAwareProperties[propertyName] === true;
-    }
-};
+WebInspector.CSSKeywordCompletions.forProperty = function(propertyName)
+{
+    var acceptedKeywords = ["initial"];
+    if (propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
+        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]);
+    if (propertyName in WebInspector.CSSKeywordCompletions._colorAwareProperties)
+        acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
+    if (propertyName in WebInspector.CSSKeywordCompletions.InheritedProperties)
+        acceptedKeywords.push("inherit");
+    return new WebInspector.CSSCompletions(acceptedKeywords, true);
+}
 
+WebInspector.CSSKeywordCompletions.isColorAwareProperty = function(propertyName)
+{
+    return WebInspector.CSSKeywordCompletions._colorAwareProperties[propertyName] === true;
+}
+
 // Taken from http://www.w3.org/TR/CSS21/propidx.html.
 WebInspector.CSSKeywordCompletions.InheritedProperties = [
     "azimuth", "border-collapse", "border-spacing", "caption-side", "color", "cursor", "direction", "elevation",

Modified: trunk/Source/WebCore/inspector/front-end/Checkbox.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/Checkbox.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/Checkbox.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -25,6 +25,7 @@
 
 /**
  * @constructor
+ * @param {string=} tooltip
  */
 WebInspector.Checkbox = function(label, className, tooltip)
 {

Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -377,11 +377,6 @@
         }
     },
 
-    renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector)
-    {
-        // TODO: Implement Shifting the oldSelector, and its contents to a newSelector
-    },
-
     selectedDOMNode: function()
     {
         return this.treeOutline.selectedDOMNode();

Modified: trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -26,6 +26,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarPane}
+ */
 WebInspector.MetricsSidebarPane = function()
 {
     WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
@@ -36,6 +40,9 @@
 }
 
 WebInspector.MetricsSidebarPane.prototype = {
+    /**
+     * @param {WebInspector.DOMNode=} node
+     */
     update: function(node)
     {
         if (node)
@@ -208,7 +215,7 @@
             WebInspector.Color.fromRGBA(0, 0, 0, 0)
         ];
         var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin"), WebInspector.UIString("position")];
-        var previousBox;
+        var previousBox = null;
         this._boxElements = [];
         for (var i = 0; i < boxes.length; ++i) {
             var name = boxes[i];
@@ -280,11 +287,13 @@
         targetElement.addEventListener("keydown", boundKeyDown, false);
 
         this._isEditingMetrics = true;
-        WebInspector.startEditing(targetElement, {
-            context: context,
-            commitHandler: this.editingCommitted.bind(this),
-            cancelHandler: this.editingCancelled.bind(this)
-        });
+
+        var config = new WebInspector.EditingConfig();
+        config.setContext(context);
+        config.setCommitHandler(this.editingCommitted.bind(this));
+        config.setCancelHandler(this.editingCancelled.bind(this));
+        WebInspector.startEditing(targetElement, config);
+
         window.getSelection().setBaseAndExtent(targetElement, 0, targetElement, 1);
     },
 
@@ -309,9 +318,9 @@
         var matches = /(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);
         var replacementString;
         if (matches && matches.length) {
-            prefix = matches[1];
-            suffix = matches[3];
-            number = WebInspector.StylesSidebarPane.alteredFloatNumber(parseFloat(matches[2]), event);
+            var prefix = matches[1];
+            var suffix = matches[3];
+            var number = WebInspector.StylesSidebarPane.alteredFloatNumber(parseFloat(matches[2]), event);
             if (number === null) {
                 // Need to check for null explicitly.
                 return;
@@ -369,7 +378,6 @@
     {
         if (!this.inlineStyle) {
             // Element has no renderer.
-            delete this.originalPropertyValue;
             return this.editingCancelled(element, context); // nothing changed, so cancel
         }
 
@@ -391,8 +399,7 @@
 
         if (computedStyle.getPropertyValue("box-sizing") === "border-box" && (styleProperty === "width" || styleProperty === "height")) {
             if (!userInput.match(/px$/)) {
-                WebInspector.log("For elements with box-sizing: border-box, only absolute content area dimensions can be applied", WebInspector.ConsoleMessage.MessageLevel.Error);
-                WebInspector.showConsole();
+                WebInspector.log("For elements with box-sizing: border-box, only absolute content area dimensions can be applied", WebInspector.ConsoleMessage.MessageLevel.Error, true);
                 return;
             }
 

Modified: trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -49,7 +49,7 @@
 {
     WebInspector.SourceTokenizer.call(this);
 
-    this._propertyKeywords = WebInspector.cssNameCompletions.keySet();
+    this._propertyKeywords = WebInspector.CSSCompletions.cssNameCompletions.keySet();
 
     this._valueKeywords = [
         "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",

Modified: trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -48,7 +48,7 @@
 {
     WebInspector.SourceTokenizer.call(this);
 
-    this._propertyKeywords = WebInspector.cssNameCompletions.keySet();
+    this._propertyKeywords = WebInspector.CSSCompletions.cssNameCompletions.keySet();
 
     this._valueKeywords = [
         "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -27,6 +27,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarPane}
+ */
 WebInspector.StylesSidebarPane = function(computedStylePane)
 {
     WebInspector.SidebarPane.call(this, WebInspector.UIString("Styles"));
@@ -39,7 +43,7 @@
     option.label = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "As authored" : "As Authored");
     this.settingsSelectElement.appendChild(option);
 
-    var option = document.createElement("option");
+    option = document.createElement("option");
     option.value = WebInspector.StylesSidebarPane.ColorFormat.HEX;
     option.label = WebInspector.UIString("Hex Colors");
     this.settingsSelectElement.appendChild(option);
@@ -226,9 +230,13 @@
         else
             node = this.node;
 
-        this._innerUpdate(refresh, null);
+        this._innerUpdate(refresh);
     },
 
+    /**
+     * @param {WebInspector.StylePropertiesSection=} editedSection
+     * @param {function()=} userCallback
+     */
     _innerUpdate: function(refresh, editedSection, userCallback)
     {
         var node = this.node;
@@ -328,7 +336,7 @@
         var usedProperties = {};
         var disabledComputedProperties = {};
         this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
-        this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0);
+        this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0, null);
         var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
         // Trace the computed style.
         this.sections[0][0].rebuildComputedTrace(this.sections[0]);
@@ -598,7 +606,7 @@
                 editable = true;
 
             if (computedStyle)
-                var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties, styleRules);
+                var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties);
             else
                 var section = new WebInspector.StylePropertiesSection(this, styleRule, editable, styleRule.isInherited, lastWasSeparator);
             section.pane = this;
@@ -808,6 +816,10 @@
 
 WebInspector.StylesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
+/**
+ * @constructor
+ * @extends {WebInspector.SidebarPane}
+ */
 WebInspector.ComputedStyleSidebarPane = function()
 {
     WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style"));
@@ -833,6 +845,10 @@
 
 WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
+/**
+ * @constructor
+ * @extends {WebInspector.PropertiesSection}
+ */
 WebInspector.StylePropertiesSection = function(parentPane, styleRule, editable, isInherited, isFirstSection)
 {
     WebInspector.PropertiesSection.call(this, "");
@@ -1038,7 +1054,7 @@
             if (shorthand) {
                 property = style.getLiveProperty(shorthand);
                 if (!property)
-                    property = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.getShorthandValue(shorthand), style.getShorthandPriority(shorthand), "style", true, true, "");
+                    property = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.getShorthandValue(shorthand), style.getShorthandPriority(shorthand), "style", true, true, "", undefined);
             }
 
             var isShorthand = !!(property.isLive && (shorthand || shorthandNames[property.name]));
@@ -1062,6 +1078,9 @@
         return null;
     },
 
+    /**
+     * @param {number=} optionalIndex
+     */
     addNewBlankProperty: function(optionalIndex)
     {
         var style = this.styleRule.style;
@@ -1074,7 +1093,7 @@
         return item;
     },
 
-    _debugShowStyle: function(anchor)
+    _debugShowStyle: function(event)
     {
         var boundHandler;
         function removeStyleBox(element, event)
@@ -1152,11 +1171,12 @@
             return;
 
         this._selectorElement.scrollIntoViewIfNeeded(false);
-        WebInspector.startEditing(this._selectorElement, {
-            context: null,
-            commitHandler: this.editingSelectorCommitted.bind(this),
-            cancelHandler: this.editingSelectorCancelled.bind(this)
-        });
+
+        var config = new WebInspector.EditingConfig();
+        config.setCommitHandler(this.editingSelectorCommitted.bind(this));
+        config.setCancelHandler(this.editingSelectorCancelled.bind(this));
+        WebInspector.startEditing(this._selectorElement, config);
+
         window.getSelection().setBaseAndExtent(element, 0, element, 1);
     },
 
@@ -1187,33 +1207,29 @@
         if (newContent === oldContent)
             return this._moveEditorFromSelector(moveDirection);
 
-        var self = this;
-
         function successCallback(newRule, doesAffectSelectedNode)
         {
             if (!doesAffectSelectedNode) {
-                self.noAffect = true;
-                self.element.addStyleClass("no-affect");
+                this.noAffect = true;
+                this.element.addStyleClass("no-affect");
             } else {
-                delete self.noAffect;
-                self.element.removeStyleClass("no-affect");
+                delete this.noAffect;
+                this.element.removeStyleClass("no-affect");
             }
 
-            self.rule = newRule;
-            self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
+            this.rule = newRule;
+            this.styleRule = { section: this, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
 
             var oldIdentifier = this.identifier;
-            self.identifier = newRule.selectorText + ":" + self.subtitleElement.textContent;
+            this.identifier = newRule.selectorText + ":" + this.subtitleElement.textContent;
 
-            self.pane.update();
+            this.pane.update();
 
-            WebInspector.panels.elements.renameSelector(oldIdentifier, this.identifier, oldContent, newContent);
-
-            self._moveEditorFromSelector(moveDirection);
+            this._moveEditorFromSelector(moveDirection);
         }
 
         var selectedNode = WebInspector.panels.elements.selectedDOMNode();
-        WebInspector.cssModel.setRuleSelector(this.rule.id, selectedNode ? selectedNode.id : 0, newContent, successCallback, moveToNextIfNeeded.bind(this));
+        WebInspector.cssModel.setRuleSelector(this.rule.id, selectedNode ? selectedNode.id : 0, newContent, successCallback.bind(this), this._moveEditorFromSelector.bind(this, moveDirection));
     },
 
     editingSelectorCancelled: function()
@@ -1224,6 +1240,10 @@
 
 WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
 
+/**
+ * @constructor
+ * @extends {WebInspector.PropertiesSection}
+ */
 WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties, disabledComputedProperties)
 {
     WebInspector.PropertiesSection.call(this, "");
@@ -1279,7 +1299,7 @@
         for (var i = 0; i < uniqueProperties.length; ++i) {
             var property = uniqueProperties[i];
             var inherited = this._isPropertyInherited(property.name);
-            var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, false, inherited, false);
+            var item = new WebInspector.StylePropertyTreeElement(null, this.styleRule, style, property, false, inherited, false);
             this.propertiesTreeOutline.appendChild(item);
             this._propertyTreeElements[property.name] = item;
         }
@@ -1326,6 +1346,10 @@
 
 WebInspector.ComputedStylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
 
+/**
+ * @constructor
+ * @extends {WebInspector.StylePropertiesSection}
+ */
 WebInspector.BlankStylePropertiesSection = function(parentPane, defaultSelectorText)
 {
     WebInspector.StylePropertiesSection.call(this, parentPane, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
@@ -1370,12 +1394,16 @@
         this.styleRule = styleRule;
         this.rule = styleRule.rule;
         this.identifier = styleRule.selectorText + ":via inspector";
-        this.__proto__ = WebInspector.StylePropertiesSection.prototype;
     }
 }
 
 WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.StylePropertiesSection.prototype;
 
+/**
+ * @constructor
+ * @extends {TreeElement}
+ * @param {?WebInspector.StylesSidebarPane} parentPane
+ */
 WebInspector.StylePropertyTreeElement = function(parentPane, styleRule, style, property, shorthand, inherited, overloaded)
 {
     this._parentPane = parentPane;
@@ -1533,7 +1561,7 @@
                     hrefUrl = WebInspector.resourceURLForRelatedNode(WebInspector.panels.elements.selectedDOMNode(), hrefUrl);
                 var hasResource = !!WebInspector.resourceForURL(hrefUrl);
                 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI.
-                container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl, url, null, !hasResource));
+                container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl, url, undefined, !hasResource));
                 container.appendChild(document.createTextNode(")"));
                 return container;
             }
@@ -1874,15 +1902,16 @@
         this._parentPane._isEditingStyle = true;
         if (selectElement.parentElement)
             selectElement.parentElement.scrollIntoViewIfNeeded(false);
-        WebInspector.startEditing(selectElement, {
-            context: context,
-            commitHandler: this.editingCommitted.bind(this),
-            cancelHandler: this.editingCancelled.bind(this),
-            customFinishHandler: nameValueFinishHandler.bind(this, context, isEditingName),
-            pasteHandler: isEditingName ? pasteHandler.bind(this, context) : null
-        });
 
-        this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(selectElement, isEditingName ? WebInspector.cssNameCompletions : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent));
+        var config = new WebInspector.EditingConfig();
+        config.setContext(context);
+        config.setCommitHandler(this.editingCommitted.bind(this));
+        config.setCancelHandler(this.editingCancelled.bind(this));
+        config.setCustomFinishHandler(nameValueFinishHandler.bind(this, context, isEditingName));
+        config.setPasteHandler(isEditingName ? pasteHandler.bind(this, context) : null);
+        WebInspector.startEditing(selectElement, config);
+
+        this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(selectElement, isEditingName ? WebInspector.CSSCompletions.cssNameCompletions : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent));
         window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
     },
 
@@ -1893,7 +1922,7 @@
         if (this._handleUpOrDownKeyPressed(event))
             return;
 
-        this._applyFreeFlowStyleTextEdit();
+        this._applyFreeFlowStyleTextEdit(false);
     },
 
     _applyFreeFlowStyleTextEdit: function(now)
@@ -1903,7 +1932,7 @@
 
         function apply()
         {
-            this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent);
+            this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent, false, false, false);
         }
         if (now)
             apply.call(this);
@@ -1976,7 +2005,7 @@
             event.preventDefault();
 
             // Synthesize property text disregarding any comments, custom whitespace etc.
-            this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent);
+            this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent, false, false, false);
         }
         return true;
     },
@@ -2059,7 +2088,7 @@
                 else
                     propertyText = this.nameElement.textContent + ": " + userInput;
             }
-            this.applyStyleText(propertyText, true, true);
+            this.applyStyleText(propertyText, true, true, false);
         } else {
             if (!isDataPasted && !this._newProperty)
                 this.updateTitle();
@@ -2209,6 +2238,10 @@
 
 WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype;
 
+/**
+ * @constructor
+ * @extends {WebInspector.TextPrompt}
+ */
 WebInspector.StylesSidebarPane.CSSPropertyPrompt = function(element, cssCompletions)
 {
     WebInspector.TextPrompt.call(this, element, this._buildPropertyCompletions.bind(this), WebInspector.StylesSidebarPane.StyleValueDelimiters, true);

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -50,6 +50,12 @@
 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(url, linkifier) {}
 
 /**
+ * @param {string=} classes
+ * @param {string=} tooltipText
+ */
+WebInspector.linkifyResourceAsNode = function(url, lineNumber, classes, tooltipText) {}
+
+/**
  * @param {string} url
  * @param {number} lineNumber
  */
@@ -81,9 +87,18 @@
 /** @return {string} */
 JSON.stringify = function(str) {}
 
-Element.prototype.scrollIntoViewIfNeeded = function() {}
+/**
+ * @param {boolean=} param
+ */
+Element.prototype.scrollIntoViewIfNeeded = function(param) {}
 
 /**
+ * @return {number}
+ */
+Element.prototype.selectionLeftOffset = function() {}
+
+
+/**
  * @param {boolean=} onlyFirst
  */
 Array.prototype.remove = function(obj, onlyFirst) {}

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -513,13 +513,7 @@
 
     WebInspector.showPanel(WebInspector.settings.lastActivePanel.get());
 
-    function propertyNamesCallback(error, names)
-    {
-        if (!error)
-            WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
-    }
-    // As a DOMAgent method, this needs to happen after the frontend has loaded and the agent is available.
-    CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
+    WebInspector.CSSCompletions.requestCSSNameCompletions();
 }
 
 WebInspector.addPanel = function(panel)

Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (96816 => 96817)


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2011-10-06 16:22:10 UTC (rev 96816)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2011-10-06 16:31:58 UTC (rev 96817)
@@ -45,6 +45,9 @@
     return bound;
 }
 
+/**
+ * @param {string=} direction
+ */
 Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, direction)
 {
     var startNode;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to