Skip to content

Commit

Permalink
Web Inspector: At some narrow-ish widths objects and disclosure trian…
Browse files Browse the repository at this point in the history
…gles in console output disappear

rdar://121861970
https://bugs.webkit.org/show_bug.cgi?id=274630

Reviewed by Devin Rousso and Patrick Angle.

The object display, including the disclosure triangles, are instances
of ObjectTreeBaseTreeElement's subclasses, which have the
`.object-tree` class name as DOM elements. This commit improves the
styles of these elements by making them always `display: inline` since
it worked best with the text truncating feature that the elements have.

While making the `.object-tree` elements `display: inline`, the tree
element was rendered incorrectly when displayed as an indexed item,
with a preceding array index or a label like "key" or "value".
The fix is to use a `display: flex` for the entry row instead, so
the `.index-name` (the label) and the `.index-value` (containing the
`.object-tree`) are always side by side instead of the `.index-value`
being wrapped and shown on a second line.

This commit also make it so that lines that are cut off in the object
tree elements always consistently show ellipses at the end. In addition,
we take out the existing unnecessary right padding on the tree elements
to make the cut off point vertically aligned.

* Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css:
(.console-top-level-message .object-tree): Deleted.
(.console-top-level-message .object-tree .object-tree): Deleted.
* Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.css:
(.object-tree):
  - Always use `display: inline` for the object tree element. It works
    well with the text-truncating styles the element has.

* Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.css:
(.tree-outline.object > .item):
(.tree-outline.object):
  - Remove the unnecessary right padding.

* Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.css:
(.object-tree-array-index > .titles > .title):
  - Use `display: flex` so that the name and the value elements are
    always side by side instead of the value wrapped to a second line
    when it gets wide.

(.object-tree-array-index .index-name): Deleted.
(.object-tree-array-index > .titles > .title > .index-name):
  - Use `min-width` instead of `width` to go with the `display: flex`
    in the parent.
  - Refine the selector to make it more precise; there might be nested
    object trees inside, and we don't actually want this style to
    control those `.index-name` elements beyond the one controlled by
    the current object tree.

(.object-tree-array-index > .titles > .title > .index-value):
  - Make ellipses show up for these lines.

(.tree-outline .item.object-tree-array-index):
  - Move the `left` style into the
    `.object-tree-array-index > .titles > .title` selector instead so
    that we expand the element's viewable area rather than moving the
    element. (Moving the element resulted in the right edge being
    shifted to the left and made the cut off point not align vertically
    with the parent's right margin.)

(.tree-outline .item.object-tree-array-index:not(.object-tree-map-entry)):
  - The map entry element does not need the left expansion like the
    array entry. Undo the `margin-left` style.

(.object-tree-property + ol .object-tree-array-index): Deleted.
  - This is no longer required.

* Source/WebInspectorUI/UserInterface/Views/LocalRemoteObjectContentView.css:
(.content-view.local-remote-object):
* Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.css:
(.popover .debugger-popover-content > .body):
  - The object trees within these containers were allowed to overflow
    horizontally and were scrollable to the right. The `display: inline`
    change would make them not scrollable anymore. So, we make these
    containers that expect the object tree child to be scrollable
    `display: flex`, and we must commit to doing the same to all
    such containers of scrollable object trees in the future.

* Source/WebInspectorUI/UserInterface/Views/ObjectTreeMapEntryTreeElement.css:
(.object-tree-array-index.object-tree-map-entry > .titles > .title > .index-name):
  - Use `min-width` instead of `width` to go with the `display: flex`
    in the parent.

Canonical link: https://commits.webkit.org/279894@main
  • Loading branch information
the-chenergy authored and JonWBedard committed Jun 11, 2024
1 parent 52423d2 commit 7a3f0bd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,6 @@
content: ' ';
}

.console-top-level-message .object-tree {
display: block;
}

.console-top-level-message .object-tree .object-tree {
display: inline-block;
}

.console-message .timestamp {
float: right;
margin-inline-start: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
.content-view.local-remote-object {
padding: 10px;
overflow: auto;
display: flex;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,24 @@

.tree-outline .item.object-tree-array-index {
position: relative;
left: -12px;
margin-top: 2px;
margin-bottom: 1px;
}

.tree-outline .item.object-tree-array-index:not(.object-tree-map-entry) {
inset-inline-start: -12px;
margin-inline-end: -12px;
}

.object-tree .object-tree-array-index > .icon {
display: none;
}

.object-tree-array-index .index-name {
.object-tree-array-index > .titles > .title {
display: flex;
}

.object-tree-array-index > .titles > .title > .index-name {
font-family: -webkit-system-font, sans-serif;
font-size: 11px;
font-variant-numeric: tabular-nums;
Expand All @@ -45,20 +53,21 @@
top: -1px;

display: inline-block;
width: 30px;
text-align: right;
min-width: 30px;
text-align: end;
}

.object-tree-array-index > .titles > .title > .index-value {
overflow: hidden;
margin-inline-start: 8px;
text-overflow: ellipsis;
}

/* An array inside an array we should reduce the padding-start. */
.object-tree-array-index .index-value .object-tree .tree-outline.object {
padding-inline-start: 6px;
}

/* An array inside an ObjectTreePropertyTreeElement needs more left shift */
.object-tree-property + ol .object-tree-array-index {
left: -18px;
}

/* A node inside an array we should reduce the padding-start. */
.object-tree-array-index .index-value .formatted-node .tree-outline.dom {
padding-inline-start: 0px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*/

.object-tree-array-index.object-tree-map-entry > .titles > .title > .index-name {
width: 40px;
text-align: right;
min-width: 40px;
text-align: end;
}

.object-tree-map-entry.key:not(:first-child) {
Expand Down
10 changes: 8 additions & 2 deletions Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

.object-tree {
position: relative;
display: inline-block;
display: inline;
color: var(--text-color);
font-family: Menlo, monospace;
font-size: 11px;
Expand Down Expand Up @@ -84,12 +84,18 @@

.tree-outline.object {
margin: 0;
padding: 0 6px 2px;
padding-top: 0;
padding-bottom: 2px;
padding-inline: 6px 0;
list-style: none;
min-height: 18px;
outline: none;
}

.tree-outline.object > .item {
padding-inline-end: 0;
}

.object-tree .tree-outline.object.compact {
margin-top: 1px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
padding-top: 2px;
border-top: 1px solid var(--text-color-quaternary);
overflow: auto;
display: flex;
}

.popover .debugger-popover-content.function > .body {
Expand Down

0 comments on commit 7a3f0bd

Please sign in to comment.