Title: [185184] trunk/Source/WebInspectorUI
- Revision
- 185184
- Author
- commit-qu...@webkit.org
- Date
- 2015-06-03 20:42:31 -0700 (Wed, 03 Jun 2015)
Log Message
Web Inspector: if a known CSS property has an unsupported value, only strikethrough the value
https://bugs.webkit.org/show_bug.cgi?id=141262
Patch by Devin Rousso <drou...@apple.com> on 2015-06-03
Reviewed by Timothy Hatcher.
* UserInterface/Models/CSSCompletions.js:
(WebInspector.CSSCompletions.prototype.nameMatchesValidPropertyExactly): Loops through the full property list and returns true only if a property exactly matches the given property name.
(WebInspector.CSSCompletions): Added nameMatchesValidPropertyExactly function.
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(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.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (185183 => 185184)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-06-04 02:55:08 UTC (rev 185183)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-06-04 03:42:31 UTC (rev 185184)
@@ -1,3 +1,16 @@
+2015-06-03 Devin Rousso <drou...@apple.com>
+
+ Web Inspector: if a known CSS property has an unsupported value, only strikethrough the value
+ https://bugs.webkit.org/show_bug.cgi?id=141262
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Models/CSSCompletions.js:
+ (WebInspector.CSSCompletions.prototype.nameMatchesValidPropertyExactly): Loops through the full property list and returns true only if a property exactly matches the given property name.
+ (WebInspector.CSSCompletions): Added nameMatchesValidPropertyExactly function.
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (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.
+
2015-06-03 Nikita Vasilyev <nvasil...@apple.com>
Web Inspector: Search field bottom border doesn't match the rest of the toolbar
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js (185183 => 185184)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js 2015-06-04 02:55:08 UTC (rev 185183)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js 2015-06-04 03:42:31 UTC (rev 185184)
@@ -275,6 +275,16 @@
{
return this._shorthands[longhand] || [];
}
+
+ nameMatchesValidPropertyExactly(name)
+ {
+ for (var property of this._values) {
+ if (property === name)
+ return true;
+ }
+
+ return false;
+ }
};
WebInspector.CSSCompletions.cssNameCompletions = null;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (185183 => 185184)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-06-04 02:55:08 UTC (rev 185183)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-06-04 03:42:31 UTC (rev 185184)
@@ -490,6 +490,10 @@
this._codeMirror.setUniqueBookmark(to, arrowElement);
}
+ var propertyNameIsValid = false;
+ if (WebInspector.CSSCompletions.cssNameCompletions)
+ propertyNameIsValid = WebInspector.CSSCompletions.cssNameCompletions.nameMatchesValidPropertyExactly(property.name);
+
var classNames = ["css-style-declaration-property"];
if (property.overridden)
@@ -503,7 +507,7 @@
if (!property.valid && property.hasOtherVendorNameOrKeyword())
classNames.push("other-vendor");
- else if (!property.valid)
+ else if (!property.valid && !propertyNameIsValid)
classNames.push("invalid");
if (!property.enabled)
@@ -530,6 +534,13 @@
property.addEventListener(WebInspector.CSSProperty.Event.OverriddenStatusChanged, this._propertyOverriddenStatusChanged, this);
this._removeCheckboxPlaceholder(from.line);
+
+ if (!property.valid && propertyNameIsValid) {
+ var start = {line: from.line, ch: from.ch + property.text.indexOf(property.value)};
+ var end = {line: to.line, ch: start.ch + property.value.length};
+
+ this._codeMirror.markText(start, end, {className: "invalid"});
+ }
}
_clearTextMarkers(nonatomic, all)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes