Changeset 188730 in webkit


Ignore:
Timestamp:
Aug 20, 2015 6:37:40 PM (9 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r188728 r188730  
     12015-08-20  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Visual editor adds extra spaces to styles with no properties
     4        https://bugs.webkit.org/show_bug.cgi?id=148242
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Models/CSSStyleDeclaration.js:
     9        (WebInspector.CSSStyleDeclaration.prototype.set text):
     10        Now trims the text and, if the resulting string has no length or the style is inline,
     11        replaces the text to be set with the trimmed text.
     12
     13        * UserInterface/Views/VisualStylePropertyCombiner.js:
     14        (WebInspector.VisualStylePropertyCombiner.prototype.modifyPropertyText):
     15        Removed unnecessary trim.
     16
    1172015-08-20  Devin Rousso  <drousso@apple.com>
    218
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js

    r188226 r188730  
    187187            return;
    188188
    189         var modified = text !== this._initialText;
     189        let trimmedText = text.trim();
     190        if (this._text === trimmedText)
     191            return;
     192
     193        if (!trimmedText.length || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
     194            text = trimmedText;
     195
     196        let modified = text !== this._initialText;
    190197        if (modified !== this._hasModifiedInitialText) {
    191198            this._hasModifiedInitialText = modified;
  • trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyCombiner.js

    r188630 r188730  
    7878    modifyPropertyText(text, value)
    7979    {
    80         let trimmedText = text.trimRight();
    8180        if (this._textContainsNameRegExp.test(text))
    8281            text = text.replace(this._replacementRegExp, value !== null ? "$1$2: " + value + ";" : "$1");
Note: See TracChangeset for help on using the changeset viewer.