Changeset 275559 in webkit


Ignore:
Timestamp:
Apr 6, 2021 3:09:25 PM (3 years ago)
Author:
Patrick Angle
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r275558 r275559  
     12021-04-06  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: Grid overlay track size labels should show implicit `auto` value and no computed size
     4        https://bugs.webkit.org/show_bug.cgi?id=224199
     5
     6        Reviewed by BJ Burg.
     7
     8        Previously, implicit `auto` track sizes were only shown if there were some number of explicit track sizes for
     9        that track direction (rows/columns). To resolve this, `authoredGridTrackSizes` now only returns explicit
     10        authored track sizes, and buildGridOverlay then infers `auto` for all remaining tracks. This will also help
     11        resolve bug 224200 by providing a way to distinguish explicit and implicit tracks.
     12
     13        After discussion, this patch also removes the computed size of tracks from labels, as that information is
     14        available in the box model diagram for children elements and having that information in these labels further
     15        cramped often limited space for overlay labels.
     16
     17        * inspector/InspectorOverlay.cpp:
     18        (WebCore::authoredGridTrackSizes):
     19        (WebCore::InspectorOverlay::buildGridOverlay):
     20
    1212021-04-06  Patrick Angle  <pangle@apple.com>
    222
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r275558 r275559  
    15521552        handleValueIgnoringLineNames(currentValue);
    15531553    }
    1554 
    1555     // Remaining tracks will be `auto`.
    1556     while (trackSizes.size() < expectedTrackCount)
    1557         trackSizes.append("auto"_s);
    15581554   
    15591555    return trackSizes;
     
    17871783           
    17881784            if (gridOverlay.config.showTrackSizes) {
    1789                 auto trackSizeLabel = String::number(roundf(width));
    1790                 trackSizeLabel.append("px"_s);
    1791 
    1792                 String authoredTrackSize;
    1793                 if (i < authoredTrackColumnSizes.size()) {
    1794                     auto authoredTrackSize = authoredTrackColumnSizes[i];
    1795                     if (authoredTrackSize.length() && authoredTrackSize != trackSizeLabel) {
    1796                         trackSizeLabel.append(thinSpace);
    1797                         trackSizeLabel.append(bullet);
    1798                         trackSizeLabel.append(thinSpace);
    1799                         trackSizeLabel.append(authoredTrackSize);
    1800                     }
    1801                 }
    1802 
     1785                auto authoredTrackSize = i < authoredTrackColumnSizes.size() ? authoredTrackColumnSizes[i] : "auto"_s;
    18031786                FloatLine trackTopLine = { columnStartLine.start(), columnEndLine.start() };
    1804                 gridHighlightOverlay.labels.append(buildLabel(trackSizeLabel, trackTopLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Up, GridTrackSizingDirection::ForColumns), LabelArrowEdgePosition::Middle));
     1787                gridHighlightOverlay.labels.append(buildLabel(authoredTrackSize, trackTopLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Up, GridTrackSizingDirection::ForColumns), LabelArrowEdgePosition::Middle));
    18051788            }
    18061789        } else
     
    18841867
    18851868            if (gridOverlay.config.showTrackSizes) {
    1886                 auto trackSizeLabel = String::number(roundf(height));
    1887                 trackSizeLabel.append("px"_s);
    1888 
    1889                 String authoredTrackSize;
    1890                 if (i < authoredTrackRowSizes.size()) {
    1891                     auto authoredTrackSize = authoredTrackRowSizes[i];
    1892                     if (authoredTrackSize.length() && authoredTrackSize != trackSizeLabel) {
    1893                         trackSizeLabel.append(thinSpace);
    1894                         trackSizeLabel.append(bullet);
    1895                         trackSizeLabel.append(thinSpace);
    1896                         trackSizeLabel.append(authoredTrackSize);
    1897                     }
    1898                 }
    1899 
     1869                auto authoredTrackSize = i < authoredTrackRowSizes.size() ? authoredTrackRowSizes[i] : "auto"_s;
    19001870                FloatLine trackLeftLine = { rowStartLine.start(), rowEndLine.start() };
    1901                 gridHighlightOverlay.labels.append(buildLabel(trackSizeLabel, trackLeftLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Left, GridTrackSizingDirection::ForRows), LabelArrowEdgePosition::Middle));
     1871                gridHighlightOverlay.labels.append(buildLabel(authoredTrackSize, trackLeftLine.pointAtRelativeDistance(0.5), translucentLabelBackgroundColor, correctedArrowDirection(LabelArrowDirection::Left, GridTrackSizingDirection::ForRows), LabelArrowEdgePosition::Middle));
    19021872            }
    19031873        } else
Note: See TracChangeset for help on using the changeset viewer.