Changeset 185282 in webkit
- Timestamp:
- Jun 5, 2015 6:23:12 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r185279 r185282 1 2015-06-05 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Fixing code style and adding more limitations for bug 141262 4 https://bugs.webkit.org/show_bug.cgi?id=145668 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Models/CSSCompletions.js: 9 (WebInspector.CSSCompletions.prototype.isValidPropertyName): Loops through the full property list and returns true only if a property exactly matches the given property name. 10 (WebInspector.CSSCompletions): Added isValidPropertyName function. 11 * UserInterface/Views/CSSStyleDeclarationTextEditor.js: 12 (WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded): Added logic to limit the invalid class marker to only the property value if the property name is an actual property and to prevent invalid style from being applied incorrectly. 13 1 14 2015-06-05 Devin Rousso <drousso@apple.com> 2 15 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
r185184 r185282 277 277 } 278 278 279 nameMatchesValidPropertyExactly(name) 280 { 281 for (var property of this._values) { 282 if (property === name) 283 return true; 284 } 285 286 return false; 279 isValidPropertyName(name) 280 { 281 return this._values.includes(name); 287 282 } 288 283 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
r185279 r185282 507 507 var propertyNameIsValid = false; 508 508 if (WebInspector.CSSCompletions.cssNameCompletions) 509 propertyNameIsValid = WebInspector.CSSCompletions.cssNameCompletions. nameMatchesValidPropertyExactly(property.name);509 propertyNameIsValid = WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.name); 510 510 511 511 var classNames = ["css-style-declaration-property"]; … … 550 550 this._removeCheckboxPlaceholder(from.line); 551 551 552 if (!property.valid && propertyNameIsValid) { 553 var start = {line: from.line, ch: from.ch + property.text.indexOf(property.value)}; 552 if (!property.valid && propertyNameIsValid && !property.text.trim().endsWith(":")) { 553 // The property.text.trim().endsWith(":") is for the situation when a property only has a name and colon and the user leaves the value blank (it looks weird to have an invalid marker through just the colon). 554 // Creating the synthesizedText is necessary for if the user adds multiple spaces before the value, causing the markText to mark one of the spaces instead. 555 var synthesizedText = property.name + ": " + property.value + ";"; 556 var start = {line: from.line, ch: from.ch + synthesizedText.indexOf(property.value)}; 554 557 var end = {line: to.line, ch: start.ch + property.value.length}; 555 558
Note: See TracChangeset
for help on using the changeset viewer.