Title: [275558] trunk/Source/WebCore
Revision
275558
Author
[email protected]
Date
2021-04-06 15:09:10 -0700 (Tue, 06 Apr 2021)

Log Message

Web Inspector: Grid overlay line numbers should not include implicit tracks in negative line number calculations.
https://bugs.webkit.org/show_bug.cgi?id=224200

Reviewed by BJ Burg.

Use the `authoredTrackColumnSizes`/`authoredTrackRowSizes` to determine if the line is an explicit grid line or
implicit grid line (starting with the patch for bug 224199 those vectors will only contain the explicit lines).
Only explicit lines should have a negative number for addressing the line, and those numbers should start with
the last explicit line. Because each track is bounded by two lines, there will always be one more explicit line
than there is explicit track, including the case where there are no explicit tracks, which will still have a
single explicit line numbered `-1`.

Additionally, line numbers are now separated by an em-space to improve legibility, where previously the bullet
looked like a multiplication symbol between two numbers.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildGridOverlay):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275557 => 275558)


--- trunk/Source/WebCore/ChangeLog	2021-04-06 21:45:45 UTC (rev 275557)
+++ trunk/Source/WebCore/ChangeLog	2021-04-06 22:09:10 UTC (rev 275558)
@@ -1,3 +1,23 @@
+2021-04-06  Patrick Angle  <[email protected]>
+
+        Web Inspector: Grid overlay line numbers should not include implicit tracks in negative line number calculations.
+        https://bugs.webkit.org/show_bug.cgi?id=224200
+
+        Reviewed by BJ Burg.
+
+        Use the `authoredTrackColumnSizes`/`authoredTrackRowSizes` to determine if the line is an explicit grid line or
+        implicit grid line (starting with the patch for bug 224199 those vectors will only contain the explicit lines).
+        Only explicit lines should have a negative number for addressing the line, and those numbers should start with
+        the last explicit line. Because each track is bounded by two lines, there will always be one more explicit line
+        than there is explicit track, including the case where there are no explicit tracks, which will still have a
+        single explicit line numbered `-1`.
+
+        Additionally, line numbers are now separated by an em-space to improve legibility, where previously the bullet
+        looked like a multiplication symbol between two numbers.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::buildGridOverlay):
+
 2021-04-06  Mike Gorse  <[email protected]>
 
         Build fails when video is disabled

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (275557 => 275558)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-04-06 21:45:45 UTC (rev 275557)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-04-06 22:09:10 UTC (rev 275558)
@@ -92,6 +92,7 @@
 static constexpr UChar ellipsis = 0x2026;
 static constexpr UChar multiplicationSign = 0x00D7;
 static constexpr UChar thinSpace = 0x2009;
+static constexpr UChar emSpace = 0x2003;
 
 static void truncateWithEllipsis(String& string, size_t length)
 {
@@ -1806,8 +1807,11 @@
             previousColumnEndLine = columnStartLine;
 
         StringBuilder lineLabel;
-        if (gridOverlay.config.showLineNumbers)
-            lineLabel.append(i + 1, thinSpace, bullet, thinSpace, -static_cast<int>(columnPositions.size() - i));
+        if (gridOverlay.config.showLineNumbers) {
+            lineLabel.append(i + 1);
+            if (i <= authoredTrackColumnSizes.size())
+                lineLabel.append(emSpace, -static_cast<int>(authoredTrackColumnSizes.size() - i + 1));
+        }
         if (gridOverlay.config.showLineNames && columnLineNames.contains(i)) {
             for (auto lineName : columnLineNames.get(i)) {
                 if (!lineLabel.isEmpty())
@@ -1900,8 +1904,11 @@
             previousRowEndLine = rowStartLine;
 
         StringBuilder lineLabel;
-        if (gridOverlay.config.showLineNumbers)
-            lineLabel.append(i + 1, thinSpace, bullet, thinSpace, -static_cast<int>(rowPositions.size() - i));
+        if (gridOverlay.config.showLineNumbers) {
+            lineLabel.append(i + 1);
+            if (i <= authoredTrackRowSizes.size())
+                lineLabel.append(emSpace, -static_cast<int>(authoredTrackRowSizes.size() - i + 1));
+        }
         if (gridOverlay.config.showLineNames && rowLineNames.contains(i)) {
             for (auto lineName : rowLineNames.get(i)) {
                 if (!lineLabel.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to