WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 221370
Web Inspector: Elements: show badges for CSS Grid container elements
https://bugs.webkit.org/show_bug.cgi?id=221370
Summary
Web Inspector: Elements: show badges for CSS Grid container elements
Nikita Vasilyev
Reported
2021-02-03 18:10:52 PST
Elements with `display: grid` or `display: inline-grid` should have a "grid" badge: <div class="wrapper"> [grid] Clicking [grid] should toggle the grid overlay. <
rdar://problem/67881277
>
Attachments
WIP
(8.78 KB, patch)
2021-02-10 22:38 PST
,
Nikita Vasilyev
nvasilyev
: review-
nvasilyev
: commit-queue-
Details
Formatted Diff
Diff
Patch
(10.51 KB, patch)
2021-02-16 15:33 PST
,
Nikita Vasilyev
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
[Video] With patch applied
(17.69 MB, video/quicktime)
2021-02-16 15:35 PST
,
Nikita Vasilyev
no flags
Details
[Image] Selected element, gray badge
(27.42 KB, image/png)
2021-02-17 17:14 PST
,
Nikita Vasilyev
no flags
Details
Patch
(13.84 KB, patch)
2021-02-17 17:42 PST
,
Nikita Vasilyev
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
[Video] With patch applied
(9.67 MB, video/quicktime)
2021-02-17 17:45 PST
,
Nikita Vasilyev
no flags
Details
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Nikita Vasilyev
Comment 1
2021-02-10 22:38:01 PST
Created
attachment 419947
[details]
WIP
Nikita Vasilyev
Comment 2
2021-02-16 15:33:55 PST
Created
attachment 420549
[details]
Patch
Nikita Vasilyev
Comment 3
2021-02-16 15:35:03 PST
Created
attachment 420550
[details]
[Video] With patch applied
Devin Rousso
Comment 4
2021-02-16 15:57:59 PST
Comment on
attachment 420549
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=420549&action=review
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:26 > +.tree-outline.dom .badge-css-grid {
I think this should be more specific like `.tree-outline.dom li > .badge-css-grid` so that there's less of a chance of a selector clash.
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:36 > + margin-left: 3px;
Is the DOM tree always LTR? If not, I think this should be `margin-inline-start`.
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:42 > + color: white;
dark mode?
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:48 > + background-color: transparent; > + border-color: transparent;
Why are we removing the border and background when the element is selected? This looks really weird IMO (especially when unfocused, as it's like the badge disappears and there's this random text left there).
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:53 > + color: white;
ditto (:+42)
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:450 > + if (this.representedObject.layoutContextType === WI.DOMNode.LayoutContextType.Grid) { > + WI.overlayManager.addEventListener(WI.OverlayManager.Event.GridOverlayShown, this._updateGridBadgeStatus, this); > + WI.overlayManager.addEventListener(WI.OverlayManager.Event.GridOverlayHidden, this._updateGridBadgeStatus, this); > + }
You probably need to add/remove these event listeners inside `_handleLayoutContextTypeChanged` in case a node that initially wasn't a grid context later becomes one.
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:2015 > + if (!WI.settings.experimentalEnableLayoutPanel.value)
this should use a different setting (or this setting should be renamed to be more generic) as it has nothing to do with the Layout panel
> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:2047 > + WI.overlayManager.toggleGridOverlay(this.representedObject);
IMO we should maintain some state on `WI.DOMNode` that indicates what overlays are currently shown and use that to determine whether to `showGridOverlay` or `hideGridOverlay`. `toggle*` functions are not great IMO because it's very easy for them to get out of sync.
Nikita Vasilyev
Comment 5
2021-02-17 12:27:53 PST
Comment on
attachment 420549
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=420549&action=review
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:36 >> + margin-left: 3px; > > Is the DOM tree always LTR? If not, I think this should be `margin-inline-start`.
It is always LTR.
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:42 >> + color: white; > > dark mode?
I attached a video. It's white text on blue background on both light and dark modes.
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:48 >> + border-color: transparent; > > Why are we removing the border and background when the element is selected? This looks really weird IMO (especially when unfocused, as it's like the badge disappears and there's this random text left there).
I agree this can be improved. I'll reiterate on this.
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:450 >> + } > > You probably need to add/remove these event listeners inside `_handleLayoutContextTypeChanged` in case a node that initially wasn't a grid context later becomes one.
Oh, good catch.
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:2047 >> + WI.overlayManager.toggleGridOverlay(this.representedObject); > > IMO we should maintain some state on `WI.DOMNode` that indicates what overlays are currently shown and use that to determine whether to `showGridOverlay` or `hideGridOverlay`. `toggle*` functions are not great IMO because it's very easy for them to get out of sync.
WI.OverlayManager seems more appropriate for this. It already has ` _gridOverlayForNodeMap`. I don't see the case when it gets out of sync but wouldn't with the state being on `WI.DOMNode`.
Nikita Vasilyev
Comment 6
2021-02-17 17:02:29 PST
Comment on
attachment 420549
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=420549&action=review
>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:26 >> +.tree-outline.dom .badge-css-grid { > > I think this should be more specific like `.tree-outline.dom li > .badge-css-grid` so that there's less of a chance of a selector clash.
`.tree-outline.dom li > .badge-css-grid` won't work — it would have to be `.tree-outline.dom li > span > .badge-css-grid`. I'm not a fan of overcomplicating selectors. It would agree with you if one badge could be inside of another. It isn't the case here.
Nikita Vasilyev
Comment 7
2021-02-17 17:14:13 PST
Created
attachment 420763
[details]
[Image] Selected element, gray badge View in context:
https://bugs.webkit.org/attachment.cgi?id=420549&action=review
>>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css:48 >>> + border-color: transparent; >> >> Why are we removing the border and background when the element is selected? This looks really weird IMO (especially when unfocused, as it's like the badge disappears and there's this random text left there). > > I agree this can be improved. I'll reiterate on this.
In my very first iteration, non-activated badges looked the same on selected and non-selected elements. Is that what you're suggesting? It looks a bit foreign on macOS.
Nikita Vasilyev
Comment 8
2021-02-17 17:42:02 PST
Created
attachment 420767
[details]
Patch
Nikita Vasilyev
Comment 9
2021-02-17 17:45:23 PST
Created
attachment 420768
[details]
[Video] With patch applied I added borders for badges when the element is selected. Note that badges may end up looking different after
Bug 221923
: Web Inspector: Display color swatch inside of "grid" element badge.
Blaze Burg
Comment 10
2021-02-18 11:25:33 PST
Comment on
attachment 420767
[details]
Patch r=me. The code changes look good to me. At this point it's tweaking color styles. As we discussed, the gray on gray on gray scheme for inactive badge in an inactive window has low contrast and doesn't look like a button. To be consistent with our other button UI (especially scope bar), the background color shouldn't change when the DOMTreeElement selection color goes from blue to gray upon losing keyboard focus or window focus. I'm open to considering a wholesale change to dim our custom buttons when losing window focus. Even if it's a good idea, it should not be considered as part of this button patch.
Nikita Vasilyev
Comment 11
2021-02-18 11:37:34 PST
Comment on
attachment 420767
[details]
Patch I'll iterate on the colors in '
Bug 221923
: Web Inspector: Display color swatch inside of "grid" element badge' or even before that.
EWS
Comment 12
2021-02-18 12:51:57 PST
Committed
r273097
: <
https://commits.webkit.org/r273097
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 420767
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug