Title: [170456] trunk/Source/WebInspectorUI
Revision
170456
Author
jonowe...@apple.com
Date
2014-06-25 18:34:53 -0700 (Wed, 25 Jun 2014)

Log Message

Web Inspector: Rules panel's strikethrough gets confused at -webkit-align-items: flex-start;
https://bugs.webkit.org/show_bug.cgi?id=133515

Reviewed by Timothy Hatcher.

The CSS style declaration text editor uses the author's shortest instance of prefix whitespace
to create an indentation baseline for the style editor. This needs to consider the possibility
that there is no whitespace prefixing one of the rules. Also clarified a FIXME line.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js: Account for zero-length whitespace.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (170455 => 170456)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-06-26 01:22:08 UTC (rev 170455)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-06-26 01:34:53 UTC (rev 170456)
@@ -1,3 +1,16 @@
+2014-06-25  Jono Wells  <jonowe...@apple.com>
+
+        Web Inspector: Rules panel's strikethrough gets confused at -webkit-align-items: flex-start;
+        https://bugs.webkit.org/show_bug.cgi?id=133515
+
+        Reviewed by Timothy Hatcher.
+
+        The CSS style declaration text editor uses the author's shortest instance of prefix whitespace
+        to create an indentation baseline for the style editor. This needs to consider the possibility
+        that there is no whitespace prefixing one of the rules. Also clarified a FIXME line.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js: Account for zero-length whitespace.
+
 2014-06-25  Dana Burkart  <dburk...@apple.com>
 
         Add support for 5-tuple versioning.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (170455 => 170456)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2014-06-26 01:22:08 UTC (rev 170455)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2014-06-26 01:34:53 UTC (rev 170456)
@@ -867,19 +867,26 @@
                 var lineCount = this._codeMirror.lineCount();
                 for (var i = 0; i < lineCount; ++i) {
                     var lineContent = this._codeMirror.getLine(i);
-
                     var prefixWhitespaceMatch = lineContent.match(/^\s+/);
-                    if (!prefixWhitespaceMatch)
-                        continue;
 
+                    // If there is no prefix whitespace, then the prefix whitespace of all
+                    // other lines will be retained as is. Update markers and return.
+                    if (!prefixWhitespaceMatch) {
+                        this._linePrefixWhitespace = "";
+                        this._updateTextMarkers(true);
+                        return;
+                    }
+
                     linesToStrip.push(i);
 
                     // Only remember the shortest whitespace so we don't loose any of the
                     // original author's whitespace if their indentation lengths differed.
                     // Using the shortest also makes the adjustment work in _updateTextMarkers.
 
-                    // FIXME: This messes up if there is a mix of spaces and tabs. One tab
-                    // will be shorter than 4 or 8 spaces, but will look the same visually.
+                    // FIXME: This messes up if there is a mix of spaces and tabs. A tab
+                    // is treated the same as a space when prefix whitespace is omitted,
+                    // so if the shortest prefixed whitespace is, say, two tab characters,
+                    // lines that begin with four spaces will only have a two space indent.
                     if (!this._linePrefixWhitespace || prefixWhitespaceMatch[0].length < this._linePrefixWhitespace.length)
                         this._linePrefixWhitespace = prefixWhitespaceMatch[0];
                 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to