Title: [202589] trunk/Source/WebInspectorUI
Revision
202589
Author
nvasil...@apple.com
Date
2016-06-28 14:33:10 -0700 (Tue, 28 Jun 2016)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (202588 => 202589)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-06-28 21:30:20 UTC (rev 202588)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-06-28 21:33:10 UTC (rev 202589)
@@ -1,3 +1,24 @@
+2016-06-28  Nikita Vasilyev  <nvasil...@apple.com>
+
+        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.
+
 2016-06-28  Brian Burg  <bb...@apple.com>
 
         Web Inspector: QuickConsole should update its selection when RuntimeManager.defaultExecutionContextIdentifier changes

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (202588 => 202589)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2016-06-28 21:30:20 UTC (rev 202588)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js	2016-06-28 21:33:10 UTC (rev 202589)
@@ -186,11 +186,11 @@
         if (this._text === text)
             return;
 
-        let trimmedText = text.trim();
+        let trimmedText = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace + text.trim();
         if (this._text === trimmedText)
             return;
 
-        if (!trimmedText.length || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
+        if (trimmedText === WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace || this._type === WebInspector.CSSStyleDeclaration.Type.Inline)
             text = trimmedText;
 
         let modified = text !== this._initialText;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (202588 => 202589)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-28 21:30:20 UTC (rev 202588)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-28 21:33:10 UTC (rev 202589)
@@ -42,8 +42,6 @@
         this._filterResultPropertyNames = null;
         this._sortProperties = false;
 
-        this._prefixWhitespace = "\n";
-        this._suffixWhitespace = "\n";
         this._linePrefixWhitespace = "";
 
         this._delegate = delegate || null;
@@ -695,7 +693,7 @@
     _formattedContent()
     {
         // Start with the prefix whitespace we stripped.
-        var content = this._prefixWhitespace;
+        var content = WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace;
 
         // Get each line and add the line prefix whitespace and newlines.
         var lineCount = this._codeMirror.lineCount();
@@ -707,7 +705,7 @@
         }
 
         // Add the suffix whitespace we stripped.
-        content += this._suffixWhitespace;
+        content += WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace;
 
         // This regular _expression_ replacement removes extra newlines
         // in between properties while preserving leading whitespace
@@ -789,10 +787,8 @@
                 var to = {line: styleTextRange.endLine, ch: styleTextRange.endColumn};
 
                 // Adjust the line position for the missing prefix line.
-                if (this._prefixWhitespace) {
-                    --from.line;
-                    --to.line;
-                }
+                from.line--;
+                to.line--;
 
                 // Adjust the column for the stripped line prefix whitespace.
                 from.ch -= this._linePrefixWhitespace.length;
@@ -1666,6 +1662,8 @@
     Blurred: "css-style-declaration-text-editor-blurred"
 };
 
+WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace = "\n";
+WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace = "\n";
 WebInspector.CSSStyleDeclarationTextEditor.StyleClassName = "css-style-text-editor";
 WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName = "read-only";
 WebInspector.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName = "checkbox-placeholder";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to