Changeset 273992 in webkit


Ignore:
Timestamp:
Mar 5, 2021 11:54:19 AM (17 months ago)
Author:
Nikita Vasilyev
Message:

Web Inspector: border color of "grid" badge should match color of corresponding outline
https://bugs.webkit.org/show_bug.cgi?id=222747
<rdar://problem/75042342>

Reviewed by BJ Burg.

  • UserInterface/Views/DOMTreeElement.css:

(.tree-outline.dom .badge-css-grid):
Drive-by: decrease the font size and align the badge in the middle of the selected tree element (i.e. keep 1px space
above and below the badge).

(body:not(.window-inactive, .window-docked-inactive) .tree-outline.dom:focus-within li.selected .badge-css-grid):
(@media (prefers-color-scheme: dark) .tree-outline.dom .badge-css-grid):

  • UserInterface/Views/DOMTreeElement.js:

(WI.DOMTreeElement.prototype._updateGridBadgeStatus):
For text and background color, only use the hue of the selected color to keep "grid" text always readable.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r273912 r273992  
     12021-03-05  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: border color of "grid" badge should match color of corresponding outline
     4        https://bugs.webkit.org/show_bug.cgi?id=222747
     5        <rdar://problem/75042342>
     6
     7        Reviewed by BJ Burg.
     8
     9        * UserInterface/Views/DOMTreeElement.css:
     10        (.tree-outline.dom .badge-css-grid):
     11        Drive-by: decrease the font size and align the badge in the middle of the selected tree element (i.e. keep 1px space
     12        above and below the badge).
     13
     14        (body:not(.window-inactive, .window-docked-inactive) .tree-outline.dom:focus-within li.selected .badge-css-grid):
     15        (@media (prefers-color-scheme: dark) .tree-outline.dom .badge-css-grid):
     16        * UserInterface/Views/DOMTreeElement.js:
     17        (WI.DOMTreeElement.prototype._updateGridBadgeStatus):
     18        For text and background color, only use the hue of the selected color to keep "grid" text always readable.
     19
    1202021-03-04  Razvan Caliman  <rcaliman@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.css

    r273097 r273992  
    2828    area. Use the same monospace font as the rest of the DOM tree outline. */
    2929
    30     font-size: 10px;
    31     line-height: 10px;
     30    font-size: 8px;
     31    vertical-align: 1px;
    3232    color: var(--text-color);
    33     background: hsla(0, 0%, 0%, 0.05);
     33    background: hsla(0, 0%, 95%, 0.8);
    3434    border: 1px solid hsla(0, 0%, var(--foreground-lightness), 0.1);
    3535    border-radius: 3px;
    3636    margin-left: 3px;
    3737    padding: 0 2px;
     38    box-shadow: 0 0 1px hsla(0, 0%, 0%, 0.5);
    3839}
    3940
     
    4344}
    4445
    45 .tree-outline.dom li.selected .badge-css-grid {
    46     color: hsla(0, 0%, var(--foreground-lightness), 0.5);
    47     background-color: transparent;
     46body:not(.window-inactive, .window-docked-inactive) .tree-outline.dom:focus-within li.selected .badge-css-grid {
     47    /* Override `li.selected * {color: inherited}` from DOMTreeOutline.css */
     48    color: var(--text-color);
    4849}
    4950
    50 .tree-outline.dom li.selected .badge-css-grid.activated {
    51     background: var(--glyph-color-disabled);
    52     color: white;
    53 }
    54 
    55 body:not(.window-inactive, .window-docked-inactive) .tree-outline.dom:focus-within li.selected .badge-css-grid {
    56     border-color: hsla(0, 0%, 100%, 0.2);
    57 }
    58 
    59 body:not(.window-inactive, .window-docked-inactive) .tree-outline.dom:focus-within li.selected .badge-css-grid.activated {
    60     background: hsla(0, 0%, 100%, 0.3);
    61 }
    6251
    6352@media (prefers-color-scheme: dark) {
    6453    .tree-outline.dom .badge-css-grid {
    65         background: hsla(0, 0%, 100%, 0.05);
     54        background: hsla(0, 0%, 30%, 0.8);
    6655        border-color: hsla(0, 0%, 100%, 0.1);
    6756    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r273097 r273992  
    20582058            return;
    20592059
    2060         this._gridBadgeElement.classList.toggle("activated", WI.overlayManager.isGridOverlayVisible(this.representedObject));
     2060        let isGridVisible = WI.overlayManager.isGridOverlayVisible(this.representedObject);
     2061        this._gridBadgeElement.classList.toggle("activated", isGridVisible);
     2062
     2063        if (isGridVisible) {
     2064            let color = WI.overlayManager.getGridColorForNode(this.representedObject);
     2065            let hue = color.hsl[0];
     2066            this._gridBadgeElement.style.borderColor = color.toString();
     2067            this._gridBadgeElement.style.backgroundColor = `hsl(${hue}, 90%, 95%)`;
     2068            this._gridBadgeElement.style.setProperty("color", `hsl(${hue}, 55%, 40%)`);
     2069        } else
     2070            this._gridBadgeElement.removeAttribute("style");
    20612071    }
    20622072
Note: See TracChangeset for help on using the changeset viewer.