Changeset 202589 in webkit


Ignore:
Timestamp:
Jun 28, 2016 2:33:10 PM (8 years ago)
Author:
Nikita Vasilyev
Message:

REGRESSION (r188730): Web Inspector: Warning icons incorrectly positioned in CSS Rules sidebar
https://bugs.webkit.org/show_bug.cgi?id=157869
<rdar://problem/26356520>

Reviewed by Timothy Hatcher.

Before r188730, CSS text always had a line break as a prefix. r188730 started trimming text.
This patch keeps trimming unnecessary whitespace but brings back required line break prefix.

  • UserInterface/Models/CSSStyleDeclaration.js:

(WebInspector.CSSStyleDeclaration.prototype.set text):

  • UserInterface/Views/CSSStyleDeclarationTextEditor.js:

Make PrefixWhitespace and SuffixWhitespace public.

(WebInspector.CSSStyleDeclarationTextEditor.prototype._formattedContent):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers.update):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers):
Remove an if conditional as it's always true.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r202566 r202589  
     12016-06-28  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        REGRESSION (r188730): Web Inspector: Warning icons incorrectly positioned in CSS Rules sidebar
     4        https://bugs.webkit.org/show_bug.cgi?id=157869
     5        <rdar://problem/26356520>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        Before r188730, CSS text always had a line break as a prefix. r188730 started trimming text.
     10        This patch keeps trimming unnecessary whitespace but brings back required line break prefix.
     11
     12        * UserInterface/Models/CSSStyleDeclaration.js:
     13        (WebInspector.CSSStyleDeclaration.prototype.set text):
     14        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
     15        Make PrefixWhitespace and SuffixWhitespace public.
     16
     17        (WebInspector.CSSStyleDeclarationTextEditor.prototype._formattedContent):
     18        (WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers.update):
     19        (WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers):
     20        Remove an if conditional as it's always true.
     21
    1222016-06-28  Brian Burg  <bburg@apple.com>
    223
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js

    r194717 r202589  
    187187            return;
    188188
    189         let trimmedText = text.trim();
     189        let trimmedText = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace + text.trim();
    190190        if (this._text === trimmedText)
    191191            return;
    192192
    193         if (!trimmedText.length || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
     193        if (trimmedText === WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
    194194            text = trimmedText;
    195195
  • trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js

    r201890 r202589  
    4343        this._sortProperties = false;
    4444
    45         this._prefixWhitespace = "\n";
    46         this._suffixWhitespace = "\n";
    4745        this._linePrefixWhitespace = "";
    4846
     
    696694    {
    697695        // Start with the prefix whitespace we stripped.
    698         var content = this._prefixWhitespace;
     696        var content = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace;
    699697
    700698        // Get each line and add the line prefix whitespace and newlines.
     
    708706
    709707        // Add the suffix whitespace we stripped.
    710         content += this._suffixWhitespace;
     708        content += WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace;
    711709
    712710        // This regular expression replacement removes extra newlines
     
    790788
    791789                // Adjust the line position for the missing prefix line.
    792                 if (this._prefixWhitespace) {
    793                     --from.line;
    794                     --to.line;
    795                 }
     790                from.line--;
     791                to.line--;
    796792
    797793                // Adjust the column for the stripped line prefix whitespace.
     
    16671663};
    16681664
     1665WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace = "\n";
     1666WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace = "\n";
    16691667WebInspector.CSSStyleDeclarationTextEditor.StyleClassName = "css-style-text-editor";
    16701668WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName = "read-only";
Note: See TracChangeset for help on using the changeset viewer.