Changeset 196146 in webkit
- Timestamp:
- Feb 4, 2016 1:51:26 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r196098 r196146 1 2016-02-04 Devin Rousso <dcrousso+webkit@gmail.com> 2 3 Web Inspector: Show error icons if invalid values already exist for properties in the Visual sidebar 4 https://bugs.webkit.org/show_bug.cgi?id=153702 5 <rdar://problem/24424025> 6 7 Reviewed by Timothy Hatcher. 8 9 When CSS properties have invalid values, instead of displaying the computed 10 value for that property in the Visual sidebar, show an error icon with the 11 the invalid value. 12 13 * Localizations/en.lproj/localizedStrings.js: 14 15 * UserInterface/Views/VisualStyleNumberInputBox.css: 16 (.visual-style-property-container > .visual-style-property-value-container > .number-input-container > .number-input-value): 17 (.visual-style-property-container > .visual-style-property-value-container > .visual-style-special-property-placeholder[hidden] ~ .number-input-container > .number-input-value): 18 By default, do not allow any pointer events to interact with the input element. 19 Instead, only allow interaction when the placeholder element is hidden to ensure 20 that the user cannot add a value when the computed value is displayed. 21 22 * UserInterface/Views/VisualStyleNumberInputBox.js: 23 (WebInspector.VisualStyleNumberInputBox.prototype.set specialPropertyPlaceholderElementText): 24 Reset the selected keyword to "Unchanged" since this is either a warning 25 message or the computed value. 26 27 * UserInterface/Views/VisualStylePropertyEditor.css: 28 (.visual-style-property-container > .visual-style-property-editor-warning.missing-dependency): 29 (.visual-style-property-container > .visual-style-property-editor-warning.invalid-value): 30 (.visual-style-property-container > .visual-style-property-editor-warning): 31 32 * UserInterface/Views/VisualStylePropertyEditor.js: 33 (WebInspector.VisualStylePropertyEditor): 34 Replaced document.createElement with [element].createChild for simplicity. 35 36 (WebInspector.VisualStylePropertyEditor.prototype.update): 37 Before assigning the value of the property to the editor, check to see if 38 the property is valid. If not, display an Error icon and message stating 39 that the current value is invalid. 40 41 (WebInspector.VisualStylePropertyEditor.prototype.updateEditorValues): 42 (WebInspector.VisualStylePropertyEditor.prototype.set specialPropertyPlaceholderElementText): 43 Unhides the special placeholder element with the given text as its content. 44 45 (WebInspector.VisualStylePropertyEditor.prototype._valueDidChange): 46 (WebInspector.VisualStylePropertyEditor.prototype._checkDependencies): 47 (WebInspector.VisualStylePropertyEditor.prototype.addDependency): 48 1 49 2016-02-03 Joseph Pecoraro <pecoraro@apple.com> 2 50 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r195999 r196146 653 653 localizedStrings["The property '%s' is not supported."] = "The property '%s' is not supported."; 654 654 localizedStrings["The selector '%s' is invalid.\nClick to revert to the previous selector."] = "The selector '%s' is invalid.\nClick to revert to the previous selector."; 655 localizedStrings["The value '%s' is not supported for this property."] = "The value '%s' is not supported for this property."; 655 656 localizedStrings["The value '%s' is not supported for this property.\nClick to delete and open autocomplete."] = "The value '%s' is not supported for this property.\nClick to delete and open autocomplete."; 656 657 localizedStrings["The value '%s' needs units.\nClick to add 'px' to the value."] = "The value '%s' needs units.\nClick to add 'px' to the value."; -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.css
r188628 r196146 67 67 border: none; 68 68 outline: none; 69 pointer-events: none; 70 } 71 72 .visual-style-property-container > .visual-style-property-value-container > .visual-style-special-property-placeholder[hidden] ~ .number-input-container > .number-input-value { 69 73 pointer-events: all; 70 74 } -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js
r194875 r196146 212 212 // Protected 213 213 214 set specialPropertyPlaceholderElementText(text) 215 { 216 this._unchangedOptionElement.selected = true; 217 218 // FIXME: <https://webkit.org/b/147064> Getter and setter on super are called with wrong "this" object 219 WebInspector.VisualStylePropertyEditor.prototype.__lookupSetter__("specialPropertyPlaceholderElementText").call(this, text); 220 } 221 214 222 parseValue(text) 215 223 { -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.css
r194876 r196146 56 56 height: 10px; 57 57 margin-right: 4px; 58 content: "";59 background-image: url(../Images/Warning.svg);60 58 } 61 59 … … 67 65 .visual-style-property-container > .visual-style-property-editor-warning.missing-dependency { 68 66 display: block; 67 content: url(../Images/Warning.svg); 68 } 69 70 .visual-style-property-container > .visual-style-property-editor-warning.invalid-value { 71 display: block; 72 content: url(../Images/Error.svg); 69 73 } 70 74 -
trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js
r194737 r196146 70 70 71 71 if (label && label.length) { 72 let titleContainer = document.createElement("div"); 73 titleContainer.classList.add("visual-style-property-title"); 74 75 this._titleElement = document.createElement("span"); 76 this._titleElement.appendChild(document.createTextNode(label)); 72 let titleContainer = this._element.createChild("div", "visual-style-property-title"); 73 74 this._titleElement = titleContainer.createChild("span"); 75 this._titleElement.append(label); 77 76 this._titleElement.addEventListener("mouseover", this._titleElementMouseOver.bind(this)); 78 77 this._titleElement.addEventListener("mouseout", this._titleElementMouseOut.bind(this)); 79 78 this._titleElement.addEventListener("click", this._titleElementClick.bind(this)); 80 titleContainer.appendChild(this._titleElement);81 82 this._element.appendChild(titleContainer);83 79 84 80 this._boundTitleElementPrepareForClick = this._titleElementPrepareForClick.bind(this); 85 81 } 86 82 87 this._contentElement = document.createElement("div"); 88 this._contentElement.classList.add("visual-style-property-value-container"); 89 90 this._specialPropertyPlaceholderElement = document.createElement("span"); 91 this._specialPropertyPlaceholderElement.classList.add("visual-style-special-property-placeholder"); 83 this._contentElement = this._element.createChild("div", "visual-style-property-value-container"); 84 85 this._specialPropertyPlaceholderElement = this._contentElement.createChild("span", "visual-style-special-property-placeholder"); 92 86 this._specialPropertyPlaceholderElement.hidden = true; 93 this._contentElement.appendChild(this._specialPropertyPlaceholderElement); 94 95 this._element.appendChild(this._contentElement); 87 88 this._warningElement = this._element.createChild("div", "visual-style-property-editor-warning"); 96 89 97 90 this._updatedValues = {}; … … 297 290 this._representedProperty = property; 298 291 292 if (!propertyMissing && !property.valid) { 293 this._warningElement.classList.add("invalid-value"); 294 this._warningElement.title = WebInspector.UIString("The value '%s' is not supported for this property.").format(propertyText); 295 this.specialPropertyPlaceholderElementText = propertyText; 296 return; 297 } 298 299 299 let newValues = this.getValuesFromText(propertyText, propertyMissing); 300 300 if (this._updatedValues.placeholder && this._updatedValues.placeholder !== newValues.placeholder) … … 306 306 if (propertyValuesConflict) { 307 307 this._updatedValues.conflictingValues = true; 308 this. _specialPropertyPlaceholderElement.textContent = WebInspector.UIString("(multiple)");308 this.specialPropertyPlaceholderElementText = WebInspector.UIString("(multiple)"); 309 309 break; 310 310 } … … 326 326 this.disabled = false; 327 327 328 this._warningElement.classList.remove("invalid-value"); 328 329 this._checkDependencies(); 329 330 } … … 410 411 for (let property of propertyNames) 411 412 this._dependencies.set(property, propertyValues); 412 413 if (!this._warningElement) {414 this._warningElement = this._element.appendChild(document.createElement("div"));415 this._warningElement.classList.add("visual-style-property-editor-warning");416 }417 413 } 418 414 … … 427 423 { 428 424 return this._specialPropertyPlaceholderElement; 425 } 426 427 set specialPropertyPlaceholderElementText(text) 428 { 429 if (!text || !text.length) 430 return; 431 432 this._specialPropertyPlaceholderElement.hidden = false; 433 this._specialPropertyPlaceholderElement.textContent = text; 429 434 } 430 435 … … 496 501 497 502 this._checkDependencies(); 503 this._warningElement.classList.remove("invalid-value"); 498 504 499 505 this.dispatchEventToListeners(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange); … … 526 532 { 527 533 if (!this._dependencies.size || !this._style || !this.synthesizedValue) { 528 if (this._warningElement) 529 this._warningElement.classList.remove("missing-dependency"); 530 534 this._warningElement.classList.remove("missing-dependency"); 531 535 return; 532 536 }
Note: See TracChangeset
for help on using the changeset viewer.