Web Inspector: Show warning icon for invalid CSS properties and/or values
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 22:17:42 +0000 (22:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 22:17:42 +0000 (22:17 +0000)
commit222a8dc5700ac751ded55145b029c2103bbd01bc
tree1cdcbf3327b6c7a33e9fb1760a653c49789f4683
parent5566fc18eadbbab82fa229fce5e792ade0031aea
Web Inspector: Show warning icon for invalid CSS properties and/or values
https://bugs.webkit.org/show_bug.cgi?id=145657

Patch by Devin Rousso <drousso@apple.com> on 2015-06-24
Reviewed by Timothy Hatcher.

* UserInterface/Models/CSSCompletions.js:
(WebInspector.CSSCompletions.prototype.getClosestPropertyName): Calculates the levenshtein distance between a given property and every existing property name.  Returns the property name with the smallest distance or, in the case of multiple properties having the same distance, the first property in alphabetical order.
(WebInspector.CSSCompletions.prototype.propertyRequiresWebkitPrefix): Retruns if the property name exists only with a '-webkit-' prefix.
(WebInspector.CSSCompletions):
* UserInterface/Views/CSSStyleDeclarationTextEditor.css:
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .invalid-warning-marker):
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .invalid-warning-marker.clickable:hover):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded.duplicatePropertyExistsBelow): Determines if there exists a property below (visually) the given property that has the same name.
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded.generateInvalidMarker): Creates a warning icon marker at the given position with the given title.
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded.instancesOfProperty): Returns the number of properties in the rule that have the same name.
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded): A button with a warning icon is now added to the beginning of an invalid property.  If this button is clicked, the property is replaced with the closest matching property and the autocomplete menu is opened.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Base/Utilities.js
Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js