Title: [249596] trunk/Source/WebInspectorUI
Revision
249596
Author
[email protected]
Date
2019-09-06 15:34:03 -0700 (Fri, 06 Sep 2019)

Log Message

Web Inspector: CSS Formatter: links to CSS resources don't map to the right line after pretty printing if the line is after a multiline comment
https://bugs.webkit.org/show_bug.cgi?id=201559

Reviewed by Joseph Pecoraro.

Newlines in multiline comments weren't added as line endings, so they weren't considered
when a source code location updated after pretty printing.

* UserInterface/Workers/Formatter/CSSFormatter.js:
(CSSFormatter.prototype._format):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (249595 => 249596)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-09-06 22:23:35 UTC (rev 249595)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-09-06 22:34:03 UTC (rev 249596)
@@ -1,3 +1,16 @@
+2019-09-06  Devin Rousso  <[email protected]>
+
+        Web Inspector: CSS Formatter: links to CSS resources don't map to the right line after pretty printing if the line is after a multiline comment
+        https://bugs.webkit.org/show_bug.cgi?id=201559
+
+        Reviewed by Joseph Pecoraro.
+
+        Newlines in multiline comments weren't added as line endings, so they weren't considered
+        when a source code location updated after pretty printing.
+
+        * UserInterface/Workers/Formatter/CSSFormatter.js:
+        (CSSFormatter.prototype._format):
+
 2019-09-06  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Better position for Sources tab when enabling the experimental setting

Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/Formatter/CSSFormatter.js (249595 => 249596)


--- trunk/Source/WebInspectorUI/UserInterface/Workers/Formatter/CSSFormatter.js	2019-09-06 22:23:35 UTC (rev 249595)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/Formatter/CSSFormatter.js	2019-09-06 22:34:03 UTC (rev 249596)
@@ -270,8 +270,18 @@
                         this._builder.appendNewline(true);
                 }
 
-                this._builder.appendToken(specialSequenceText, startIndex);
+                specialSequenceText.split(`\n`).forEach((line, i, lines) => {
+                    if (line) {
+                        this._builder.appendToken(line, startIndex);
+                        startIndex += line.length;
+                    }
 
+                    if (i < lines.length - 1) {
+                        this._builder.appendNewline(true);
+                        ++startIndex;
+                    }
+                });
+
                 i = endIndex;
                 c = this._sourceText[i];
 
@@ -298,7 +308,6 @@
 
             if (/\s/.test(c)) {
                 if (c === `\n`) {
-                    this._builder.addOriginalLineEnding(i);
                     if (!this._builder.lastTokenWasNewline) {
                         while (this._builder.lastTokenWasWhitespace)
                             this._builder.removeLastWhitespace();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to