Title: [188730] trunk/Source/WebInspectorUI
Revision
188730
Author
drou...@apple.com
Date
2015-08-20 18:37:40 -0700 (Thu, 20 Aug 2015)

Log Message

Web Inspector: Visual editor adds extra spaces to styles with no properties
https://bugs.webkit.org/show_bug.cgi?id=148242

Reviewed by Timothy Hatcher.

* UserInterface/Models/CSSStyleDeclaration.js:
(WebInspector.CSSStyleDeclaration.prototype.set text):
Now trims the text and, if the resulting string has no length or the style is inline,
replaces the text to be set with the trimmed text.

* UserInterface/Views/VisualStylePropertyCombiner.js:
(WebInspector.VisualStylePropertyCombiner.prototype.modifyPropertyText):
Removed unnecessary trim.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (188729 => 188730)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-08-21 01:36:18 UTC (rev 188729)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-08-21 01:37:40 UTC (rev 188730)
@@ -1,5 +1,21 @@
 2015-08-20  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: Visual editor adds extra spaces to styles with no properties
+        https://bugs.webkit.org/show_bug.cgi?id=148242
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/CSSStyleDeclaration.js:
+        (WebInspector.CSSStyleDeclaration.prototype.set text):
+        Now trims the text and, if the resulting string has no length or the style is inline,
+        replaces the text to be set with the trimmed text.
+
+        * UserInterface/Views/VisualStylePropertyCombiner.js:
+        (WebInspector.VisualStylePropertyCombiner.prototype.modifyPropertyText):
+        Removed unnecessary trim.
+
+2015-08-20  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: Font size between computed and set value is off in visual styles popups
         https://bugs.webkit.org/show_bug.cgi?id=148226
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (188729 => 188730)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2015-08-21 01:36:18 UTC (rev 188729)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2015-08-21 01:37:40 UTC (rev 188730)
@@ -186,7 +186,14 @@
         if (this._text === text)
             return;
 
-        var modified = text !== this._initialText;
+        let trimmedText = text.trim();
+        if (this._text === trimmedText)
+            return;
+
+        if (!trimmedText.length || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
+            text = trimmedText;
+
+        let modified = text !== this._initialText;
         if (modified !== this._hasModifiedInitialText) {
             this._hasModifiedInitialText = modified;
             this.dispatchEventToListeners(WebInspector.CSSStyleDeclaration.Event.InitialTextModified);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js (188729 => 188730)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js	2015-08-21 01:36:18 UTC (rev 188729)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js	2015-08-21 01:37:40 UTC (rev 188730)
@@ -77,7 +77,6 @@
 
     modifyPropertyText(text, value)
     {
-        let trimmedText = text.trimRight();
         if (this._textContainsNameRegExp.test(text))
             text = text.replace(this._replacementRegExp, value !== null ? "$1$2: " + value + ";" : "$1");
         else if (value !== null)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to