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

Log Message

Web Inspector: Grid overlay track size labels should show implicit `auto` value and no computed size
https://bugs.webkit.org/show_bug.cgi?id=224199

Reviewed by BJ Burg.

Previously, implicit `auto` track sizes were only shown if there were some number of explicit track sizes for
that track direction (rows/columns). To resolve this, `authoredGridTrackSizes` now only returns explicit
authored track sizes, and buildGridOverlay then infers `auto` for all remaining tracks. This will also help
resolve bug 224200 by providing a way to distinguish explicit and implicit tracks.

After discussion, this patch also removes the computed size of tracks from labels, as that information is
available in the box model diagram for children elements and having that information in these labels further
cramped often limited space for overlay labels.

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

Modified Paths

Diff

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


--- trunk/Source/WebCore/ChangeLog	2021-04-06 22:09:10 UTC (rev 275558)
+++ trunk/Source/WebCore/ChangeLog	2021-04-06 22:09:25 UTC (rev 275559)
@@ -1,5 +1,25 @@
 2021-04-06  Patrick Angle  <[email protected]>
 
+        Web Inspector: Grid overlay track size labels should show implicit `auto` value and no computed size
+        https://bugs.webkit.org/show_bug.cgi?id=224199
+
+        Reviewed by BJ Burg.
+
+        Previously, implicit `auto` track sizes were only shown if there were some number of explicit track sizes for
+        that track direction (rows/columns). To resolve this, `authoredGridTrackSizes` now only returns explicit
+        authored track sizes, and buildGridOverlay then infers `auto` for all remaining tracks. This will also help
+        resolve bug 224200 by providing a way to distinguish explicit and implicit tracks.
+
+        After discussion, this patch also removes the computed size of tracks from labels, as that information is
+        available in the box model diagram for children elements and having that information in these labels further
+        cramped often limited space for overlay labels.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::authoredGridTrackSizes):
+        (WebCore::InspectorOverlay::buildGridOverlay):
+
+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
 

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


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-04-06 22:09:10 UTC (rev 275558)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2021-04-06 22:09:25 UTC (rev 275559)
@@ -1551,10 +1551,6 @@
 
         handleValueIgnoringLineNames(currentValue);
     }
-
-    // Remaining tracks will be `auto`.
-    while (trackSizes.size() < expectedTrackCount)
-        trackSizes.append("auto"_s);
     
     return trackSizes;
 }
@@ -1786,22 +1782,9 @@
             previousColumnEndLine = columnEndLine;
             
             if (gridOverlay.config.showTrackSizes) {
-                auto trackSizeLabel = String::number(roundf(width));
-                trackSizeLabel.append("px"_s);
-
-                String authoredTrackSize;
-                if (i < authoredTrackColumnSizes.size()) {
-                    auto authoredTrackSize = authoredTrackColumnSizes[i];
-                    if (authoredTrackSize.length() && authoredTrackSize != trackSizeLabel) {
-                        trackSizeLabel.append(thinSpace);
-                        trackSizeLabel.append(bullet);
-                        trackSizeLabel.append(thinSpace);
-                        trackSizeLabel.append(authoredTrackSize);
-                    }
-                }
-
+                auto authoredTrackSize = i < authoredTrackColumnSizes.size() ? authoredTrackColumnSizes[i] : "auto"_s;
                 FloatLine trackTopLine = { columnStartLine.start(), columnEndLine.start() };
-                gridHighlightOverlay.labels.append(buildLabel(trackSizeLabel, trackTopLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Up, GridTrackSizingDirection::ForColumns), LabelArrowEdgePosition::Middle));
+                gridHighlightOverlay.labels.append(buildLabel(authoredTrackSize, trackTopLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Up, GridTrackSizingDirection::ForColumns), LabelArrowEdgePosition::Middle));
             }
         } else
             previousColumnEndLine = columnStartLine;
@@ -1883,22 +1866,9 @@
             previousRowEndLine = rowEndLine;
 
             if (gridOverlay.config.showTrackSizes) {
-                auto trackSizeLabel = String::number(roundf(height));
-                trackSizeLabel.append("px"_s);
-
-                String authoredTrackSize;
-                if (i < authoredTrackRowSizes.size()) {
-                    auto authoredTrackSize = authoredTrackRowSizes[i];
-                    if (authoredTrackSize.length() && authoredTrackSize != trackSizeLabel) {
-                        trackSizeLabel.append(thinSpace);
-                        trackSizeLabel.append(bullet);
-                        trackSizeLabel.append(thinSpace);
-                        trackSizeLabel.append(authoredTrackSize);
-                    }
-                }
-
+                auto authoredTrackSize = i < authoredTrackRowSizes.size() ? authoredTrackRowSizes[i] : "auto"_s;
                 FloatLine trackLeftLine = { rowStartLine.start(), rowEndLine.start() };
-                gridHighlightOverlay.labels.append(buildLabel(trackSizeLabel, trackLeftLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Left, GridTrackSizingDirection::ForRows), LabelArrowEdgePosition::Middle));
+                gridHighlightOverlay.labels.append(buildLabel(authoredTrackSize, trackLeftLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Left, GridTrackSizingDirection::ForRows), LabelArrowEdgePosition::Middle));
             }
         } else
             previousRowEndLine = rowStartLine;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to