Changeset 194728 in webkit
- Timestamp:
- Jan 7, 2016 2:36:51 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r194723 r194728 1 2016-01-07 Devin Rousso <dcrousso+webkit@gmail.com> 2 3 Web Inspector: Add border-image properties to Visual sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=152755 5 6 Reviewed by Timothy Hatcher. 7 8 * Localizations/en.lproj/localizedStrings.js: 9 * UserInterface/Main.html: 10 Switched the order of VisualStyleURLInput and VisualStyleUnitSlider 11 to be ordered alphabetically. 12 13 * UserInterface/Views/VisualStyleBackgroundPicker.js: 14 (WebInspector.VisualStyleBackgroundPicker.prototype._keywordSelectMouseDown): 15 16 * UserInterface/Views/VisualStyleDetailsPanel.css: 17 (.sidebar > .panel.details.css-style .visual > .details-section .details-section > .content > .group + .group > .row:first-child): 18 (.sidebar > .panel.details.css-style .visual > .details-section.background .details-section.border .visual-style-property-container.keyword-checkbox.border-image-slice): 19 Since the checkbox is so small, give it less room. 20 21 * UserInterface/Views/VisualStyleDetailsPanel.js: 22 (WebInspector.VisualStyleDetailsPanel.prototype._populateBorderSection.generateBorderImagePropertyEditors): 23 The three properties "border-image-width", "border-image-outset", and 24 "border-image-slice" all have the same syntax, so one function to generate 25 the layout for all three is much simpler. 26 27 (WebInspector.VisualStyleDetailsPanel.prototype._populateBorderSection): 28 Added the border image properties to a seperate group under Background > Border. 29 30 * UserInterface/Views/VisualStyleKeywordPicker.js: 31 (WebInspector.VisualStyleKeywordPicker.prototype._keywordSelectMouseDown): 32 33 * UserInterface/Views/VisualStyleNumberInputBox.js: 34 (WebInspector.VisualStyleNumberInputBox): 35 (WebInspector.VisualStyleNumberInputBox.prototype.set units): 36 Reordered logic to allow a value of ""/null to set the units to the "Number" 37 value if it is allowed for that editor. 38 39 (WebInspector.VisualStyleNumberInputBox.prototype.get synthesizedValue): 40 Instead of relying upon whether the editor has any units, just check to see if 41 the selected units are "Number" and, if not, add them to the value. 42 43 (WebInspector.VisualStyleNumberInputBox.prototype._unitsElementTextContent): 44 45 * UserInterface/Views/VisualStylePropertyCombiner.js: 46 (WebInspector.VisualStylePropertyCombiner): 47 Now has another argument that, when true, assumes the combiner has at least 4 48 numerical values and is of the form (can have units): 49 property-name: value1 [value2 [value3 [value4 [...]]]]; 50 51 (WebInspector.VisualStylePropertyCombiner.prototype.get synthesizedValue): 52 (WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText.updateEditor): 53 (WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText.updateCompatibleEditor): 54 (WebInspector.VisualStylePropertyCombiner.prototype.updateValuesFromText): 55 If the new argument is true, assigns the existing values in the following way: 56 - If there is 1 value, assign it to all of the editors. 57 - If there are 2 values, assign the 1st one to editors 1 and 3 and the 2nd one 58 to editors 2 and 4. 59 - If there are 3 values, assign the 1st one to editor 1, the 2nd one to editors 60 2 and 4, and the 3rd one to editor 3. 61 - If there are 4 or more values, assign them normally. 62 63 * UserInterface/Views/VisualStylePropertyEditor.js: 64 (WebInspector.VisualStylePropertyEditor.prototype.valueIsSupportedKeyword): 65 (WebInspector.VisualStylePropertyEditor.prototype._valueIsSupportedAdvancedKeyword): 66 Removed call to this.value to prevent recursion from VisualStyleNumberInputBox. 67 68 (WebInspector.VisualStylePropertyEditor.prototype.valueIsSupportedUnit): 69 (WebInspector.VisualStylePropertyEditor.prototype._valueIsSupportedAdvancedUnit): 70 Removed call to this.units to prevent recursion from VisualStyleNumberInputBox. 71 1 72 2016-01-07 Devin Rousso <dcrousso+webkit@gmail.com> 2 73 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r194717 r194728 288 288 localizedStrings["Family"] = "Family"; 289 289 localizedStrings["Filename"] = "Filename"; 290 localizedStrings["Fill"] = "Fill"; 290 291 localizedStrings["Fill Mode"] = "Fill Mode"; 291 292 localizedStrings["Filter %s"] = "Filter %s"; … … 468 469 localizedStrings["Outline"] = "Outline"; 469 470 localizedStrings["Output: "] = "Output: "; 471 localizedStrings["Outset"] = "Outset"; 470 472 localizedStrings["Over 1 ms"] = "Over 1 ms"; 471 473 localizedStrings["Over 15 ms"] = "Over 15 ms"; … … 587 589 localizedStrings["Size"] = "Size"; 588 590 localizedStrings["Sizing"] = "Sizing"; 591 localizedStrings["Slice"] = "Slice"; 589 592 localizedStrings["Small Icons"] = "Small Icons"; 590 593 localizedStrings["Socket"] = "Socket"; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r194673 r194728 602 602 <script src="Views/VisualStyleTabbedPropertiesRow.js"></script> 603 603 <script src="Views/VisualStyleTimingEditor.js"></script> 604 <script src="Views/VisualStyleURLInput.js"></script> 604 605 <script src="Views/VisualStyleUnitSlider.js"></script> 605 <script src="Views/VisualStyleURLInput.js"></script>606 606 607 607 <script src="Controllers/Annotator.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleBackgroundPicker.js
r194573 r194728 207 207 if (event.altKey) 208 208 this._addAdvancedValues(); 209 else if (!this._valueIsSupportedAdvancedKeyword( ))209 else if (!this._valueIsSupportedAdvancedKeyword(this.value)) 210 210 this._removeAdvancedValues(); 211 211 } -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.css
r191693 r194728 65 65 } 66 66 67 .sidebar > .panel.details.css-style .visual > .details-section .details-section > .content > .group + .group > .row:first-child { 68 padding-top: 7px; 69 border-top: none; 70 } 71 67 72 .sidebar > .panel.details.css-style .visual > .details-section .details-section > .content .group > .row:last-child { 68 73 padding-bottom: 3px; … … 98 103 } 99 104 105 .sidebar > .panel.details.css-style .visual > .details-section .details-section > .content .group > .row + .row.visual-style-tabbed-properties-row, 100 106 .sidebar > .panel.details.css-style .visual > .details-section.background .details-section.background-style .visual-style-property-container.comma-separated-keyword-editor.background { 101 107 margin-top: 3px; 102 108 } 109 110 .sidebar > .panel.details.css-style .visual > .details-section.background .details-section.border .visual-style-property-container.keyword-checkbox.border-image-slice { 111 flex: 1; 112 } -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js
r194673 r194728 963 963 this._addMetricsMouseListeners(group.properties.borderRightWidth, highlightMode); 964 964 965 let borderGroup = new WebInspector.DetailsSectionGroup([borderTabController, borderAllGroup, borderTopGroup, borderRightGroup, borderBottomGroup, borderLeftGroup]); 966 967 let borderImageSourceRow = new WebInspector.DetailsSectionRow; 968 969 properties.borderImageSource = new WebInspector.VisualStyleURLInput("border-image-source", WebInspector.UIString("Image"), this._keywords.defaults.concat(["None"])); 970 971 borderImageSourceRow.element.appendChild(properties.borderImageSource.element); 972 973 let borderImageRepeatRow = new WebInspector.DetailsSectionRow; 974 975 let borderImageSliceFill = new WebInspector.VisualStyleKeywordCheckbox("border-image-slice", WebInspector.UIString("Fill"), "Fill"); 976 borderImageSliceFill.optionalProperty = true; 977 properties.borderImageRepeat = new WebInspector.VisualStyleKeywordPicker("border-image-repeat", WebInspector.UIString("Repeat"), this._keywords.defaults.concat(["Stretch", "Repeat", "Round", "Space"])); 978 979 borderImageRepeatRow.element.appendChild(borderImageSliceFill.element); 980 borderImageRepeatRow.element.appendChild(properties.borderImageRepeat.element); 981 982 function generateBorderImagePropertyEditors(propertyName, keywords, units) { 983 let vertical = new WebInspector.DetailsSectionRow; 984 985 let top = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Top"), keywords, units); 986 top.masterProperty = true; 987 let bottom = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Bottom"), keywords, units); 988 bottom.masterProperty = true; 989 990 vertical.element.appendChild(top.element); 991 vertical.element.appendChild(bottom.element); 992 993 let horizontal = new WebInspector.DetailsSectionRow; 994 995 let left = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Left"), keywords, units); 996 left.masterProperty = true; 997 let right = new WebInspector.VisualStyleNumberInputBox(propertyName, WebInspector.UIString("Right"), keywords, units); 998 right.masterProperty = true; 999 1000 horizontal.element.appendChild(left.element); 1001 horizontal.element.appendChild(right.element); 1002 1003 return {group: new WebInspector.DetailsSectionGroup([vertical, horizontal]), properties: [top, bottom, left, right]}; 1004 } 1005 1006 let nonKeywordUnits = [WebInspector.UIString("Number")]; 1007 1008 let borderImageUnits = this._units.defaults; 1009 borderImageUnits.basic = nonKeywordUnits.concat(borderImageUnits.basic); 1010 let borderImageWidth = generateBorderImagePropertyEditors("border-image-width", this._keywords.boxModel, borderImageUnits); 1011 properties.borderImageWidth = new WebInspector.VisualStylePropertyCombiner("border-image-width", borderImageWidth.properties, true); 1012 1013 let borderOutsetUnits = this._units.defaultsSansPercent; 1014 borderOutsetUnits.basic = nonKeywordUnits.concat(borderOutsetUnits.basic); 1015 let borderImageOutset = generateBorderImagePropertyEditors("border-image-outset", this._keywords.defaults, borderOutsetUnits); 1016 properties.borderImageOutset = new WebInspector.VisualStylePropertyCombiner("border-image-outset", borderImageOutset.properties, true); 1017 1018 let borderImageSlice = generateBorderImagePropertyEditors("border-image-slice", this._keywords.defaults, ["%"].concat(nonKeywordUnits)); 1019 borderImageSlice.properties.push(borderImageSliceFill); 1020 properties.borderImageSlice = new WebInspector.VisualStylePropertyCombiner("border-image-slice", borderImageSlice.properties, true); 1021 1022 let borderImagePropertiesTabController = new WebInspector.VisualStyleTabbedPropertiesRow({ 1023 "width": {title: WebInspector.UIString("Width"), element: borderImageWidth.group.element, properties: [properties.borderImageWidth]}, 1024 "outset": {title: WebInspector.UIString("Outset"), element: borderImageOutset.group.element, properties: [properties.borderImageOutset]}, 1025 "slice": {title: WebInspector.UIString("Slice"), element: borderImageSlice.group.element, properties: [properties.borderImageSlice]} 1026 }); 1027 1028 let borderImageGroup = new WebInspector.DetailsSectionGroup([borderImageSourceRow, borderImageRepeatRow, borderImagePropertiesTabController, borderImageWidth.group, borderImageOutset.group, borderImageSlice.group]); 1029 965 1030 group.autocompleteCompatibleProperties = [properties.borderColor, properties.borderTopColor, properties.borderBottomColor, properties.borderLeftColor, properties.borderRightColor]; 966 1031 967 let borderGroup = new WebInspector.DetailsSectionGroup([borderTabController, borderAllGroup, borderTopGroup, borderRightGroup, borderBottomGroup, borderLeftGroup]); 968 this._populateSection(group, [borderGroup]); 1032 this._populateSection(group, [borderGroup, borderImageGroup]); 969 1033 } 970 1034 -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleKeywordPicker.js
r191493 r194728 130 130 if (event.altKey) 131 131 this._addAdvancedValues(); 132 else if (!this._valueIsSupportedAdvancedKeyword( ))132 else if (!this._valueIsSupportedAdvancedKeyword(this.value)) 133 133 this._removeAdvancedValues(); 134 134 } -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js
r189845 r194728 28 28 constructor(propertyNames, text, possibleValues, possibleUnits, allowNegativeValues, layoutReversed) 29 29 { 30 super(propertyNames, text, possibleValues, possibleUnits || [WebInspector.UIString("Number")], "number-input-box", layoutReversed); 31 32 this._hasUnits = !!possibleUnits; 30 let unitlessNumberUnit = WebInspector.UIString("Number"); 31 32 super(propertyNames, text, possibleValues, possibleUnits || [unitlessNumberUnit], "number-input-box", layoutReversed); 33 34 this._unitlessNumberUnit = unitlessNumberUnit; 35 36 this._hasUnits = this._possibleUnits.basic.some((unit) => unit !== unitlessNumberUnit); 33 37 this._allowNegativeValues = !!allowNegativeValues || false; 34 38 … … 90 94 this._valueNumberInputElement.value = null; 91 95 this._valueNumberInputElement.setAttribute("placeholder", 0); 92 if (this._hasUnits && this.valueIsSupportedUnit("px"))93 this._unitsElementTextContent = this._keywordSelectElement.value = "px";96 if (this._hasUnits) 97 this._unitsElementTextContent = this._keywordSelectElement.value = this.valueIsSupportedUnit("px") ? "px" : this._possibleUnits.basic[0]; 94 98 } 95 99 … … 160 164 set units(unit) 161 165 { 162 if (this._unchangedOptionElement.selected) 163 return; 164 165 if (!unit || unit === this.units) 166 return; 167 168 if (!this.valueIsSupportedUnit(unit)) 166 if (this._unchangedOptionElement.selected || unit === this.units) 167 return; 168 169 if (!unit && !this._possibleUnits.basic.includes(this._unitlessNumberUnit) && !this.valueIsSupportedUnit(unit)) 169 170 return; 170 171 … … 173 174 174 175 this._setNumberInputIsEditable(true); 175 this._keywordSelectElement.value = unit ;176 this._keywordSelectElement.value = unit || this._unitlessNumberUnit; 176 177 this._unitsElementTextContent = unit; 177 178 } … … 204 205 205 206 let keyword = this._keywordSelectElement.value; 206 return this.valueIsSupportedUnit(keyword) ? value + ( this._hasUnits ? keyword : "") : keyword;207 return this.valueIsSupportedUnit(keyword) ? value + (keyword === this._unitlessNumberUnit ? "" : keyword) : keyword; 207 208 } 208 209 … … 229 230 return; 230 231 231 this._unitsElement.textContent = text ;232 this._unitsElement.textContent = text === this._unitlessNumberUnit ? "" : text; 232 233 this._markUnitsContainerIfInputHasValue(); 233 234 } … … 324 325 if (event.altKey) 325 326 this._addAdvancedUnits(); 326 else if (!this._valueIsSupportedAdvancedUnit( ))327 else if (!this._valueIsSupportedAdvancedUnit(this._keywordSelectElement.value)) 327 328 this._removeAdvancedUnits(); 328 329 } -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js
r191493 r194728 26 26 WebInspector.VisualStylePropertyCombiner = class VisualStylePropertyCombiner extends WebInspector.Object 27 27 { 28 constructor(propertyName, propertyEditors )28 constructor(propertyName, propertyEditors, spreadNumberValues) 29 29 { 30 30 super(); … … 34 34 this._propertyMissing = false; 35 35 this._propertyEditors = propertyEditors || []; 36 this._spreadNumberValues = !!spreadNumberValues && this._propertyEditors.length >= 4; 36 37 37 38 for (let editor of this._propertyEditors) { … … 61 62 continue; 62 63 63 if (editor.masterProperty && editor.valueIsSupportedKeyword( )) {64 if (editor.masterProperty && editor.valueIsSupportedKeyword(editor.value)) { 64 65 this._markEditors(editor, true); 65 66 return editorValue; … … 118 119 editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = false; 119 120 121 function updateEditor(editor, value) { 122 let updatedValues = editor.getValuesFromText(value || "", propertyMissing); 123 if (!updatedValues) 124 return; 125 126 editor.updateEditorValues(updatedValues); 127 editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = true; 128 } 129 130 if (this._spreadNumberValues) { 131 let numberValues = styleText.match(/\d+[\w%]*/g); 132 let count = numberValues && numberValues.length; 133 if (count === 1) { 134 for (let editor of this._propertyEditors) 135 updateEditor(editor, numberValues[0]); 136 } else if (count === 2) { 137 for (let i = 0; i < count; ++i) { 138 updateEditor(this._propertyEditors[i], numberValues[i]); 139 updateEditor(this._propertyEditors[i + 2], numberValues[i]); 140 } 141 } else if (count === 3) { 142 updateEditor(this._propertyEditors[0], numberValues[0]); 143 updateEditor(this._propertyEditors[1], numberValues[1]); 144 updateEditor(this._propertyEditors[2], numberValues[2]); 145 updateEditor(this._propertyEditors[3], numberValues[1]); 146 } 147 } 148 120 149 function updateCompatibleEditor(value) { 121 150 for (let editor of this._propertyEditors) { … … 126 155 continue; 127 156 128 let updatedValues = editor.getValuesFromText(value || "", propertyMissing); 129 if (updatedValues) 130 editor.updateEditorValues(updatedValues); 131 editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol] = true; 132 157 updateEditor(editor, value); 133 158 if (value) 134 159 return; -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js
r191493 r194728 380 380 return false; 381 381 382 value = value || this.value;383 382 if (Object.keys(this._possibleValues.basic).includes(value)) 384 383 return true; … … 392 391 return false; 393 392 394 unit = unit || this.units;395 393 if (this._possibleUnits.basic.includes(unit)) 396 394 return true; … … 420 418 _valueIsSupportedAdvancedKeyword(value) 421 419 { 422 return this._possibleValues.advanced && Object.keys(this._possibleValues.advanced).includes(value || this.value);420 return this._possibleValues.advanced && Object.keys(this._possibleValues.advanced).includes(value); 423 421 } 424 422 425 423 _valueIsSupportedAdvancedUnit(unit) 426 424 { 427 return this._possibleUnits.advanced && this._possibleUnits.advanced.includes(unit || this.units);425 return this._possibleUnits.advanced && this._possibleUnits.advanced.includes(unit); 428 426 } 429 427
Note: See TracChangeset
for help on using the changeset viewer.