Skip to content

Commit 061a011

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[memory] Fix focus ring and background color for heap source links.
Note that we have to use `!important` here, as the `.text-button` rule already uses `padding: 0 !important`. Drive-by-fix: Also add documentation for the `calc(-1 * var(..))` CSS pattern. Fixed: 380790928 Change-Id: I4342f092c60cedcc72952a16e55882b7789096ab Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6041986 Auto-Submit: Benedikt Meurer <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]>
1 parent c0dfa80 commit 061a011

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

docs/styleguide/ux/styles.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ We define three sets of color token types, **reference/palette tokens**,
88
**system tokens**, and **application tokens**.
99

1010
[**Reference or palette
11-
tokens**](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/tokens.css)
11+
tokens**](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/tokens.css)
1212
(e.g. `--ref-palette-X`) are a set of base colors that get updated on [Chrome
1313
color theme change](###) and should not be directly used.
1414

1515
[**System
16-
tokens**](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css)
16+
tokens**](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css)
1717
(e.g. `--sys-color-X`) are a set of semantic tokens (use is often clear from
1818
name e.g. `--sys-color-error-container`). They reference palette tokens and
1919
incorporate light / dark mode switches and should be used in the code directly.
2020
You can view all system tokens in their light and dark variant when running the
2121
component server with `npm run components-server` under *Theme Colors*.
2222

2323
[**Application
24-
tokens**](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/applicationColorTokens.css)
24+
tokens**](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/applicationColorTokens.css)
2525
(e.g. `--app-color-X`) reference palette tokens, and add more semantic meaning
2626
and handle exception cases, where system tokens are not enough. Should be
2727
defined for both light and dark modes. An example CL that adds application
@@ -51,7 +51,7 @@ Chrome's theming differentiates between two *default* color schemes (a blue
5151
**default** and a **grey default**), and a number of **accent** color schemes
5252
(blue, purple, yellow, and so on). In DevTools, the default schemes are defined
5353
as `baseline-grayscale` and `baseline-default` css classes in
54-
[themeColors.css](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css).
54+
[themeColors.css](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css).
5555
The accent color schemes don't require extra color definitions and will adapt
5656
with the reference colors.
5757

@@ -317,10 +317,32 @@ example CL that adds application tokens can be found
317317
### Resources
318318

319319
* [Reference color
320-
tokens](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/tokens.css)
320+
tokens](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/tokens.css)
321321
* [System color
322-
tokens](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css)
322+
tokens](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/themeColors.css)
323323
* [Application color
324-
tokens](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/applicationColorTokens.css)
324+
tokens](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/applicationColorTokens.css)
325325
* [Color definitions in the CDT
326326
Figma](https://www.figma.com/design/A5iQBBNAe5zPFpJvUzUgW8/CDT-design-kit?node-id=337-5217&m=dev)
327+
328+
## Sizes
329+
330+
[**System
331+
tokens**](https://crsrc.org/c/third_party/devtools-frontend/src/front_end/ui/legacy/designTokens.css)
332+
include a set of tokens to be used for sizes, ranging from `--sys-size-1` (which
333+
corresponds to a single pixel) to `--sys-size-41` (which corresponds to the HD
334+
resolution width).
335+
336+
### Usage
337+
338+
#### Negative sizes
339+
340+
Sometimes you might need to negate a size, for example to make up for some
341+
padding or margins. Use the pattern
342+
343+
```css
344+
calc(-1 * var(--sys-size-X));
345+
```
346+
347+
and try to avoid other patterns (like `calc(0px - var(...))`) that have a
348+
similar effect.

front_end/panels/profiler/heapProfiler.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@
118118

119119
.heap-snapshot-view td.object-column span.heap-object-source-link {
120120
float: right;
121+
122+
& > button.text-button.devtools-link {
123+
background-color: inherit;
124+
outline-offset: calc(-1 * var(--sys-size-1));
125+
padding-inline: var(--sys-size-2) !important; /* stylelint-disable-line declaration-no-important */
126+
}
121127
}
122128

123129
.heap-snapshot-view td.object-column span.heap-object-source-link:empty {

0 commit comments

Comments
 (0)