Title: [191493] trunk/Source/WebInspectorUI
Revision
191493
Author
[email protected]
Date
2015-10-23 01:10:24 -0700 (Fri, 23 Oct 2015)

Log Message

Web Inspector: Visual sidebar should support multiple backgrounds
https://bugs.webkit.org/show_bug.cgi?id=148310

Patch by Devin Rousso <[email protected]> on 2015-10-23
Reviewed by Timothy Hatcher.

Changes the layout of the Background - Style section in the Visual sidebar
to be a list instead of a single editable field for a background-image URL.
Allows for comma-separated background properties (both shorthand and
longhand) and displays them all in a single list for editing.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/VisualStyleColorPicker.js:
(WebInspector.VisualStyleColorPicker):
* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css:
(.visual-style-property-container.comma-separated-keyword-editor):
* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
(WebInspector.VisualStyleCommaSeparatedKeywordEditor):
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype._generateTextFromLonghandProperties.propertyValue):
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype._generateTextFromLonghandProperties):
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.modifyPropertyText):
Comma separated properties will now try to assemble a value from related longhand
properties so that a single shorthand property with commas may be used.

* UserInterface/Views/VisualStyleDetailsPanel.css:
(.sidebar > .panel.details.css-style .visual > .details-section.background .details-section.background-style .visual-style-property-container.comma-separated-keyword-editor.background):
* UserInterface/Views/VisualStyleDetailsPanel.js:
(WebInspector.VisualStyleDetailsPanel.prototype._populateBackgroundStyleSection):
(WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection):
(WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection):
(WebInspector.VisualStyleDetailsPanel.prototype._noRemainingCommaSeparatedEditorItems):
(WebInspector.VisualStyleDetailsPanel.prototype._selectedCommaSeparatedEditorItemValueChanged):
(WebInspector.VisualStyleDetailsPanel.prototype._commaSeparatedEditorTreeItemSelected):
(WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.noRemainingTreeItems): Deleted.
(WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.selectedBoxShadowItemValueChanged): Deleted.
(WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.boxShadowItemSelected): Deleted.
(WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.noRemainingTreeItems): Deleted.
(WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.selectedtransitionItemValueChanged): Deleted.
(WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.transitionItemSelected): Deleted.
Made the "background-image" property into a comma separated editor.

* UserInterface/Views/VisualStyleFontFamilyListEditor.js:
(WebInspector.VisualStyleFontFamilyListEditor):
* UserInterface/Views/VisualStyleKeywordIconList.js:
(WebInspector.VisualStyleKeywordIconList.prototype.set value):
(WebInspector.VisualStyleKeywordIconList.prototype._handleKeywordChanged):
(WebInspector.VisualStyleKeywordIconList):
* UserInterface/Views/VisualStyleKeywordPicker.js:
(WebInspector.VisualStyleKeywordPicker.prototype.updateEditorValues):
(WebInspector.VisualStyleKeywordPicker.prototype._setValue):
* UserInterface/Views/VisualStyleNumberInputBox.js:
(WebInspector.VisualStyleNumberInputBox.prototype.set value):
* UserInterface/Views/VisualStylePropertyCombiner.js:
(WebInspector.VisualStylePropertyCombiner):
(WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText.updateCompatibleEditor):
(WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText):
* UserInterface/Views/VisualStylePropertyEditor.js:
(WebInspector.VisualStylePropertyEditor):
(WebInspector.VisualStylePropertyEditor.prototype.update):
(WebInspector.VisualStylePropertyEditor.prototype.getValuesFromText):
(WebInspector.VisualStylePropertyEditor.prototype.get propertyMissing):
(WebInspector.VisualStylePropertyEditor.prototype._valueDidChange):
Moved "propertyMissing" into a member variable for better access.

* UserInterface/Views/VisualStyleURLInput.js:
(WebInspector.VisualStyleURLInput):
(WebInspector.VisualStyleURLInput.prototype.get synthesizedValue):
(WebInspector.VisualStyleURLInput.prototype.parseValue):
Added support for specific keywords to be used in the input field.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (191492 => 191493)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-10-23 08:10:24 UTC (rev 191493)
@@ -1,3 +1,74 @@
+2015-10-23  Devin Rousso  <[email protected]>
+
+        Web Inspector: Visual sidebar should support multiple backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=148310
+
+        Reviewed by Timothy Hatcher.
+
+        Changes the layout of the Background - Style section in the Visual sidebar
+        to be a list instead of a single editable field for a background-image URL.
+        Allows for comma-separated background properties (both shorthand and
+        longhand) and displays them all in a single list for editing.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Views/VisualStyleColorPicker.js:
+        (WebInspector.VisualStyleColorPicker):
+        * UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css:
+        (.visual-style-property-container.comma-separated-keyword-editor):
+        * UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor):
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype._generateTextFromLonghandProperties.propertyValue):
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype._generateTextFromLonghandProperties):
+        (WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.modifyPropertyText):
+        Comma separated properties will now try to assemble a value from related longhand
+        properties so that a single shorthand property with commas may be used.
+
+        * UserInterface/Views/VisualStyleDetailsPanel.css:
+        (.sidebar > .panel.details.css-style .visual > .details-section.background .details-section.background-style .visual-style-property-container.comma-separated-keyword-editor.background):
+        * UserInterface/Views/VisualStyleDetailsPanel.js:
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateBackgroundStyleSection):
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection):
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection):
+        (WebInspector.VisualStyleDetailsPanel.prototype._noRemainingCommaSeparatedEditorItems):
+        (WebInspector.VisualStyleDetailsPanel.prototype._selectedCommaSeparatedEditorItemValueChanged):
+        (WebInspector.VisualStyleDetailsPanel.prototype._commaSeparatedEditorTreeItemSelected):
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.noRemainingTreeItems): Deleted.
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.selectedBoxShadowItemValueChanged): Deleted.
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateBoxShadowSection.boxShadowItemSelected): Deleted.
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.noRemainingTreeItems): Deleted.
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.selectedtransitionItemValueChanged): Deleted.
+        (WebInspector.VisualStyleDetailsPanel.prototype._populateTransitionSection.transitionItemSelected): Deleted.
+        Made the "background-image" property into a comma separated editor.
+
+        * UserInterface/Views/VisualStyleFontFamilyListEditor.js:
+        (WebInspector.VisualStyleFontFamilyListEditor):
+        * UserInterface/Views/VisualStyleKeywordIconList.js:
+        (WebInspector.VisualStyleKeywordIconList.prototype.set value):
+        (WebInspector.VisualStyleKeywordIconList.prototype._handleKeywordChanged):
+        (WebInspector.VisualStyleKeywordIconList):
+        * UserInterface/Views/VisualStyleKeywordPicker.js:
+        (WebInspector.VisualStyleKeywordPicker.prototype.updateEditorValues):
+        (WebInspector.VisualStyleKeywordPicker.prototype._setValue):
+        * UserInterface/Views/VisualStyleNumberInputBox.js:
+        (WebInspector.VisualStyleNumberInputBox.prototype.set value):
+        * UserInterface/Views/VisualStylePropertyCombiner.js:
+        (WebInspector.VisualStylePropertyCombiner):
+        (WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText.updateCompatibleEditor):
+        (WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText):
+        * UserInterface/Views/VisualStylePropertyEditor.js:
+        (WebInspector.VisualStylePropertyEditor):
+        (WebInspector.VisualStylePropertyEditor.prototype.update):
+        (WebInspector.VisualStylePropertyEditor.prototype.getValuesFromText):
+        (WebInspector.VisualStylePropertyEditor.prototype.get propertyMissing):
+        (WebInspector.VisualStylePropertyEditor.prototype._valueDidChange):
+        Moved "propertyMissing" into a member variable for better access.
+
+        * UserInterface/Views/VisualStyleURLInput.js:
+        (WebInspector.VisualStyleURLInput):
+        (WebInspector.VisualStyleURLInput.prototype.get synthesizedValue):
+        (WebInspector.VisualStyleURLInput.prototype.parseValue):
+        Added support for specific keywords to be used in the input field.
+
 2015-10-22  Timothy Hatcher  <[email protected]>
 
         Web Inspector: Remove generateColoredImagesForCSS and its clients

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -127,6 +127,7 @@
 localizedStrings["Click to restart the animation"] = "Click to restart the animation";
 localizedStrings["Click to select a color. Shift-click to switch color formats."] = "Click to select a color. Shift-click to switch color formats.";
 localizedStrings["Clickable"] = "Clickable";
+localizedStrings["Clip"] = "Clip";
 localizedStrings["Close"] = "Close";
 localizedStrings["Close %s timeline view"] = "Close %s timeline view";
 localizedStrings["Close Other Tabs"] = "Close Other Tabs";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleColorPicker.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -51,6 +51,7 @@
 
         this._formatChanged = false;
         this._updateColorSwatch();
+        this._colorProperty = true;
     }
 
     // Public

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css	2015-10-23 08:10:24 UTC (rev 191493)
@@ -24,6 +24,7 @@
  */
 
 .visual-style-property-container.comma-separated-keyword-editor {
+    margin-left: 11px;
     margin-bottom: 5px;
 }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -25,11 +25,12 @@
 
 WebInspector.VisualStyleCommaSeparatedKeywordEditor = class VisualStyleCommaSeparatedKeywordEditor extends WebInspector.VisualStylePropertyEditor
 {
-    constructor(propertyNames, text, insertNewItemsBeforeSelected, layoutReversed)
+    constructor(propertyNames, text, longhandProperties, insertNewItemsBeforeSelected, layoutReversed)
     {
         super(propertyNames, text, null, null, "comma-separated-keyword-editor", layoutReversed);
 
         this._insertNewItemsBeforeSelected = insertNewItemsBeforeSelected || false;
+        this._longhandProperties = longhandProperties || {};
 
         let listElement = document.createElement("ol");
         listElement.classList.add("visual-style-comma-separated-keyword-list");
@@ -115,6 +116,60 @@
 
     // Private
 
+    _generateTextFromLonghandProperties()
+    {
+        let text = "";
+        if (!this._style)
+            return text;
+
+        function propertyValue(existingProperty, propertyName) {
+            if (existingProperty)
+                return existingProperty.value;
+
+            if (propertyName)
+                return this._longhandProperties[propertyName];
+
+            return "";
+        }
+
+        let _onePropertyExists_ = false;
+        let valueLists = [];
+        let valuesCount = 0;
+        for (let propertyName in this._longhandProperties) {
+            let existingProperty = this._style.propertyForName(propertyName, true);
+            if (existingProperty)
+                _onePropertyExists_ = true;
+
+            let matches = propertyValue.call(this, existingProperty, propertyName).split(/\s*,\s*(?![^\(]*\))/);
+            valuesCount = Math.max(valuesCount, matches.length);
+            valueLists.push(matches);
+        }
+
+        if (!onePropertyExists)
+            return text;
+
+        let count = 0;
+        while (count < valuesCount) {
+            if (count > 0)
+                text += ",";
+
+            for (let valueList of valueLists)
+                text += valueList[count > valueList.length - 1 ? valueList.length - 1 : count] + " ";
+
+            ++count;
+        }
+        return text;
+    }
+
+    modifyPropertyText(text, value)
+    {
+        for (let property in this._longhandProperties) {
+            let replacementRegExp = new RegExp(property + "\s*:\s*[^;]*(;|$)");
+            text = text.replace(replacementRegExp, "");
+        }
+        return super.modifyPropertyText(text, value);
+    }
+
     _listElementKeyDown(event)
     {
         let selectedTreeElement = this._commaSeparatedKeywords.selectedTreeElement;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.css (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.css	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.css	2015-10-23 08:10:24 UTC (rev 191493)
@@ -96,3 +96,7 @@
 .sidebar > .panel.details.css-style .visual.disabled > .details-section:not(.visual-style-selector-section) input {
     pointer-events: none;
 }
+
+.sidebar > .panel.details.css-style .visual > .details-section.background .details-section.background-style .visual-style-property-container.comma-separated-keyword-editor.background {
+    margin-top: 3px;
+}

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -737,7 +737,6 @@
         let textShadowStyle = new WebInspector.DetailsSectionRow;
 
         let textShadowColor = new WebInspector.VisualStyleColorPicker("text-shadow", WebInspector.UIString("Color"));
-        textShadowColor.colorProperty = true;
         let textShadowBlur = new WebInspector.VisualStyleNumberInputBox("text-shadow", WebInspector.UIString("Blur"), null, this._units.defaultsSansPercent);
         textShadowBlur.optionalProperty = true;
 
@@ -760,10 +759,10 @@
         let backgroundStyleRow = new WebInspector.DetailsSectionRow;
 
         properties.backgroundColor = new WebInspector.VisualStyleColorPicker("background-color", WebInspector.UIString("Color"));
-        properties.backgroundImage = new WebInspector.VisualStyleURLInput("background-image", WebInspector.UIString("Image"));
+        properties.backgroundClip = new WebInspector.VisualStyleKeywordPicker("background-clip", WebInspector.UIString("Clip"), ["Inherit", "Border Box", "Padding Box", "Content Box"]);
 
         backgroundStyleRow.element.appendChild(properties.backgroundColor.element);
-        backgroundStyleRow.element.appendChild(properties.backgroundImage.element);
+        backgroundStyleRow.element.appendChild(properties.backgroundClip.element);
 
         let backgroundSizeRow = new WebInspector.DetailsSectionRow;
 
@@ -778,27 +777,58 @@
         backgroundSizeRow.element.appendChild(backgroundSizeX.element);
         backgroundSizeRow.element.appendChild(backgroundSizeY.element);
 
-        let backgroundRepeatRow = new WebInspector.DetailsSectionRow;
+        let backgroundRow = new WebInspector.DetailsSectionRow;
 
-        properties.backgroundRepeat = new WebInspector.VisualStyleKeywordPicker("background-repeat", WebInspector.UIString("Repeat"), this._keywords.defaults.concat(["No Repeat", "Repeat", "Repeat X", "Repeat Y"]));
-        properties.backgroundAttachment = new WebInspector.VisualStyleKeywordPicker("background-attachment", WebInspector.UIString("Attach"), this._keywords.defaults.concat(["Fixed", "Local", "Scroll"]));
+        properties.background = "" WebInspector.VisualStyleCommaSeparatedKeywordEditor("background", null, {
+            "background-image": "none",
+            "background-position": "0% 0%",
+            "background-repeat": "repeat",
+            "background-attachment": "scroll",
+        });
 
-        backgroundRepeatRow.element.appendChild(properties.backgroundRepeat.element);
-        backgroundRepeatRow.element.appendChild(properties.backgroundAttachment.element);
+        backgroundRow.element.appendChild(properties.background.element);
 
+        let backgroundImageRow = new WebInspector.DetailsSectionRow;
+
+        let backgroundImage = new WebInspector.VisualStyleURLInput("background-image", WebInspector.UIString("Image"), this._keywords.defaults.concat(["None"]));
+
+        backgroundImageRow.element.appendChild(backgroundImage.element);
+
         let backgroundPositionRow = new WebInspector.DetailsSectionRow;
 
         let backgroundPositionX = new WebInspector.VisualStyleNumberInputBox("background-position", WebInspector.UIString("Position X"), ["Center", "Left", "Right"], this._units.defaults);
+        backgroundPositionX.optionalProperty = true;
         let backgroundPositionY = new WebInspector.VisualStyleNumberInputBox("background-position", WebInspector.UIString("Position Y"), ["Bottom", "Center", "Top"], this._units.defaults);
+        backgroundPositionY.optionalProperty = true;
 
-        properties.backgroundPosition = new WebInspector.VisualStylePropertyCombiner("background-position", [backgroundPositionX, backgroundPositionY]);
-
         backgroundPositionRow.element.appendChild(backgroundPositionX.element);
         backgroundPositionRow.element.appendChild(backgroundPositionY.element);
 
+        let backgroundRepeatRow = new WebInspector.DetailsSectionRow;
+
+        let backgroundRepeat = new WebInspector.VisualStyleKeywordPicker("background-repeat", WebInspector.UIString("Repeat"), this._keywords.defaults.concat(["No Repeat", "Repeat", "Repeat X", "Repeat Y"]));
+        backgroundRepeat.optionalProperty = true;
+        let backgroundAttachment = new WebInspector.VisualStyleKeywordPicker("background-attachment", WebInspector.UIString("Attach"), this._keywords.defaults.concat(["Fixed", "Local", "Scroll"]));
+        backgroundAttachment.optionalProperty = true;
+
+        backgroundRepeatRow.element.appendChild(backgroundRepeat.element);
+        backgroundRepeatRow.element.appendChild(backgroundAttachment.element);
+
+        let backgroundProperties = [backgroundImage, backgroundPositionX, backgroundPositionY, backgroundRepeat, backgroundAttachment];
+        let backgroundPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("background", backgroundProperties);
+
+        let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, backgroundPropertyCombiner, backgroundProperties);
+        properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
+
+        let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.background, backgroundPropertyCombiner);
+        backgroundPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
+
+        let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(backgroundPropertyCombiner);
+        properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
+
         group.autocompleteCompatibleProperties = [properties.backgroundColor];
 
-        let backgroundStyleGroup = new WebInspector.DetailsSectionGroup([backgroundStyleRow, backgroundSizeRow, backgroundRepeatRow, backgroundPositionRow]);
+        let backgroundStyleGroup = new WebInspector.DetailsSectionGroup([backgroundStyleRow, backgroundSizeRow, backgroundRow, backgroundImageRow, backgroundPositionRow, backgroundRepeatRow]);
         this._populateSection(group, [backgroundStyleGroup]);
     }
 
@@ -962,7 +992,6 @@
         let boxShadowRow = new WebInspector.DetailsSectionRow;
 
         properties.boxShadow = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("box-shadow");
-        properties.boxShadow.element.style.marginLeft = "11px";
 
         boxShadowRow.element.appendChild(properties.boxShadow.element);
 
@@ -991,35 +1020,23 @@
         let boxShadowColorRow = new WebInspector.DetailsSectionRow;
 
         let boxShadowColor = new WebInspector.VisualStyleColorPicker("box-shadow", WebInspector.UIString("Color"));
-        boxShadowColor.colorProperty = true;
         let boxShadowInset = new WebInspector.VisualStyleKeywordCheckbox("box-shadow", WebInspector.UIString("Inset"), "Inset");
         boxShadowInset.optionalProperty = true;
 
         boxShadowColorRow.element.appendChild(boxShadowColor.element);
         boxShadowColorRow.element.appendChild(boxShadowInset.element);
 
-        let boxShadowPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("box-shadow", [boxShadowH, boxShadowV, boxShadowBlur, boxShadowSpread, boxShadowColor, boxShadowInset]);
+        let boxShadowProperties = [boxShadowH, boxShadowV, boxShadowBlur, boxShadowSpread, boxShadowColor, boxShadowInset];
+        let boxShadowPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("box-shadow", boxShadowProperties);
 
-        function noRemainingTreeItems() {
-            boxShadowPropertyCombiner.updateValuesFromText("");
-            boxShadowH.disabled = true;
-            boxShadowV.disabled = true;
-            boxShadowBlur.disabled = true;
-            boxShadowSpread.disabled = true;
-            boxShadowColor.disabled = true;
-            boxShadowInset.disabled = true;
-        }
-        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingTreeItems, this);
+        let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, boxShadowPropertyCombiner, boxShadowProperties);
+        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
-        function selectedBoxShadowItemValueChanged() {
-            properties.boxShadow.selectedTreeElementValue = boxShadowPropertyCombiner.synthesizedValue;
-        }
-        boxShadowPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedBoxShadowItemValueChanged, this);
+        let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.boxShadow, boxShadowPropertyCombiner);
+        boxShadowPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
-        function boxShadowItemSelected(event) {
-            boxShadowPropertyCombiner.updateValuesFromText(event.data.text || "");
-        }
-        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, boxShadowItemSelected, this);
+        let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(boxShadowPropertyCombiner);
+        properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.autocompleteCompatibleProperties = [boxShadowColor];
 
@@ -1034,8 +1051,12 @@
 
         let transitionRow = new WebInspector.DetailsSectionRow;
 
-        properties.transition = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("transition");
-        properties.transition.element.style.marginLeft = "11px";
+        properties.transition = new WebInspector.VisualStyleCommaSeparatedKeywordEditor("transition", null, {
+            "transition-property": "all",
+            "transition-timing-function": "ease",
+            "transition-duration": "0",
+            "transition-delay": "0"
+        });
 
         transitionRow.element.appendChild(properties.transition.element);
 
@@ -1057,32 +1078,44 @@
         transitionDurationRow.element.appendChild(transitionDuration.element);
         transitionDurationRow.element.appendChild(transitionDelay.element);
 
-        let transitionPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("transition", [transitionProperty, transitionTiming, transitionDuration, transitionDelay]);
+        let transitionProperties = [transitionProperty, transitionTiming, transitionDuration, transitionDelay];
+        let transitionPropertyCombiner = new WebInspector.VisualStylePropertyCombiner("transition", transitionProperties);
 
-        function noRemainingTreeItems() {
-            transitionPropertyCombiner.updateValuesFromText("");
-            transitionProperty.disabled = true;
-            transitionTiming.disabled = true;
-            transitionDuration.disabled = true;
-            transitionDelay.disabled = true;
-        }
-        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingTreeItems, this);
+        let noRemainingCommaSeparatedEditorItems = this._noRemainingCommaSeparatedEditorItems.bind(this, transitionPropertyCombiner, transitionProperties);
+        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems, noRemainingCommaSeparatedEditorItems, this);
 
-        function selectedtransitionItemValueChanged() {
-            properties.transition.selectedTreeElementValue = transitionPropertyCombiner.synthesizedValue;
-        }
-        transitionPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedtransitionItemValueChanged, this);
+        let selectedCommaSeparatedEditorItemValueChanged = this._selectedCommaSeparatedEditorItemValueChanged.bind(this, properties.transition, transitionPropertyCombiner);
+        transitionPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange, selectedCommaSeparatedEditorItemValueChanged, this);
 
-        function transitionItemSelected(event) {
-            transitionPropertyCombiner.updateValuesFromText(event.data.text || "");
-        }
-        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, transitionItemSelected, this);
+        let commaSeparatedEditorTreeItemSelected = this._commaSeparatedEditorTreeItemSelected.bind(transitionPropertyCombiner);
+        properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected, commaSeparatedEditorTreeItemSelected, this);
 
         group.autocompleteCompatibleProperties = [transitionProperty];
 
         let transitionGroup = new WebInspector.DetailsSectionGroup([transitionRow, transitionPropertyRow, transitionDurationRow]);
         this._populateSection(group, [transitionGroup]);
     }
+
+    _noRemainingCommaSeparatedEditorItems(propertyCombiner, propertyEditors)
+    {
+        if (!propertyCombiner || !propertyEditors)
+            return;
+
+        propertyCombiner.updateValuesFromText("");
+        for (let editor of propertyEditors)
+            editor.disabled = true;
+    }
+
+    _selectedCommaSeparatedEditorItemValueChanged(propertyEditor, propertyCombiner)
+    {
+        propertyEditor.selectedTreeElementValue = propertyCombiner.synthesizedValue;
+    }
+
+    _commaSeparatedEditorTreeItemSelected(event)
+    {
+        if (typeof this.updateValuesFromText === "function")
+            this.updateValuesFromText(event.data.text || "");
+    }
 };
 
 WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol = Symbol("visual-style-style-disabled");

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleFontFamilyListEditor.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -25,9 +25,9 @@
 
 WebInspector.VisualStyleFontFamilyListEditor = class VisualStyleFontFamilyListEditor extends WebInspector.VisualStyleCommaSeparatedKeywordEditor
 {
-    constructor(propertyNames, text, layoutReversed)
+    constructor(propertyNames, text, longhandProperties, layoutReversed)
     {
-        super(propertyNames, text, true, layoutReversed);
+        super(propertyNames, text, longhandProperties, true, layoutReversed);
 
         this._commaSeparatedKeywords.element.addEventListener("scroll", this._hideCompletions.bind(this));
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordIconList.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -84,7 +84,7 @@
             if (icon.id === this._updatedValues.placeholder)
                 this._computedIcon = icon;
 
-            if (icon.id === value && !this._updatedValues.propertyMissing)
+            if (icon.id === value && !this._propertyMissing)
                 this._selectedIcon = icon;
             else
                 icon.classList.remove("selected", "computed");
@@ -96,7 +96,7 @@
         let iconIsSelected = this._selectedIcon && this._selectedIcon.classList.toggle("selected");
         if (!iconIsSelected) {
             this._selectedIcon = null;
-            this._updatedValues.propertyMissing = true;
+            this._propertyMissing = true;
             this._computedIcon.classList.add("computed");
         }
     }
@@ -110,7 +110,7 @@
 
     _handleKeywordChanged(event)
     {
-        this._updatedValues.propertyMissing = false;
+        this._propertyMissing = false;
         this.value = event.target.id;
         this._valueDidChange();
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -79,7 +79,7 @@
 
     updateEditorValues(updatedValues)
     {   if (!updatedValues.conflictingValues) {
-            let missing = updatedValues.propertyMissing || !updatedValues.value;
+            let missing = this._propertyMissing || !updatedValues.value;
             this._unchangedOptionElement.selected = missing;
             this.specialPropertyPlaceholderElement.hidden = !missing;
         }
@@ -102,7 +102,7 @@
             return;
         }
 
-        if (this._updatedValues.propertyMissing || !this.valueIsSupportedKeyword(value))
+        if (this._propertyMissing || !this.valueIsSupportedKeyword(value))
             return;
 
         if (value === this._keywordSelectElement.value)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -126,7 +126,8 @@
                     continue;
 
                 let updatedValues = editor.getValuesFromText(value || "", propertyMissing);
-                editor.updateEditorValues(updatedValues);
+                if (updatedValues)
+                    editor.updateEditorValues(updatedValues);
                 editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = true;
 
                 if (value)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -95,6 +95,7 @@
 
         this._updatedValues = {};
         this._lastValue = null;
+        this._propertyMissing = false;
 
         if (typeof propertyNames === "string")
             propertyNames = [propertyNames];
@@ -280,13 +281,21 @@
             if (propertyMissing && this._style.nodeStyles)
                 property = this._style.nodeStyles.computedStyle.propertyForName(propertyInfo.name);
 
-            if (!property)
+            let longhandPropertyValue = null;
+            if (typeof this._generateTextFromLonghandProperties === "function")
+                longhandPropertyValue = this._generateTextFromLonghandProperties();
+
+            if (longhandPropertyValue)
+                propertyMissing = false;
+
+            let propertyText = (property && property.value) || longhandPropertyValue;
+            if (!propertyText || !propertyText.length)
                 continue;
 
-            if (!propertyMissing && property.anonymous)
+            if (!propertyMissing && property && property.anonymous)
                 this._representedProperty = property;
 
-            let newValues = this.getValuesFromText(property.value, propertyMissing);
+            let newValues = this.getValuesFromText(propertyText, propertyMissing);
             if (this._updatedValues.placeholder && this._updatedValues.placeholder !== newValues.placeholder)
                 propertyValuesConflict = true;
 
@@ -349,12 +358,13 @@
         if (propertyMissing)
             value = this.valueIsSupportedKeyword(text) ? text : null;
 
-        return {value, units, placeholder, propertyMissing};
+        this._propertyMissing = propertyMissing || false;
+        return {value, units, placeholder};
     }
 
     get propertyMissing()
     {
-        return this._updatedValues && this._updatedValues.propertyMissing;
+        return this._updatedValues && this._propertyMissing;
     }
 
     valueIsCompatible(value)
@@ -462,7 +472,7 @@
         }
 
         this._lastValue = value;
-        this._updatedValues.propertyMissing = !value;
+        this._propertyMissing = !value;
         this._ignoreNextUpdate = true;
         this._specialPropertyPlaceholderElement.hidden = true;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js (191492 => 191493)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js	2015-10-23 07:37:29 UTC (rev 191492)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleURLInput.js	2015-10-23 08:10:24 UTC (rev 191493)
@@ -25,9 +25,9 @@
 
 WebInspector.VisualStyleURLInput = class VisualStyleURLInput extends WebInspector.VisualStylePropertyEditor
 {
-    constructor(propertyNames, text, layoutReversed)
+    constructor(propertyNames, text, possibleValues, layoutReversed)
     {
-        super(propertyNames, text, null, null, "url-input", layoutReversed);
+        super(propertyNames, text, possibleValues, null, "url-input", layoutReversed);
 
         this._urlInputElement = document.createElement("input");
         this._urlInputElement.type = "url";
@@ -53,17 +53,23 @@
 
     get synthesizedValue()
     {
-        var value = this.value;
+        let value = this.value;
         if (!value || !value.length)
             return null;
 
-        return "url(" + this.value + ")";
+        if (this.valueIsSupportedKeyword(value))
+            return value;
+
+        return "url(" + value + ")";
     }
 
     // Protected
 
     parseValue(text)
     {
+        if (this.valueIsSupportedKeyword(text))
+            return [text, text];
+
         return /^(?:url\(\s*)([^\)]*)(?:\s*\)\s*;?)$/.exec(text);
     }
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to