Files
react-native-devtools-frontend/front_end/inline_editor/cssShadowEditor.css
T
Mathias Bynens 42f585a5ad Fix -theme-preserve styles
Previously, many CSS rules were written as:

    -theme-preserve {
      foo: bar;
    }

Note that the selector is `-theme-preserve`, which in theory matches
any <-theme-preserve> elements — but we don’t use any such elements,
and it’s an invalid custom element name [1] anyway.

The only reason these selectors are used is to mark a CSS rule as
unaffected by DevTools theming; `_patchProperty` in `UIUtils.js` checks
if the selector contains `'-theme-'`.

stylelint-config-standard complains about this selector for good
reason, so we should use something else. A simple fix is to use a class
selector instead:

    .-theme-preserve {
      foo: bar;
    }

There is one gotcha: `-theme-preserve` gets applied as an actual class
name to some <input> elements in the memory timeline under the
Performance panel. To prevent those elements from getting all the
`-theme-preserve` styles, this patch changes the class name for that
specific case to `-theme-preserve-input`.

This works great: stylelint is now happy, and `_patchProperty` in
`UIUtils.js` still works correctly, since it only checks if the
selector contains `-theme-` anywhere.

[1]: https://mothereff.in/custom-element-name#-theme-preserve

Bug: chromium:1083142
Change-Id: I923f12de6d581e9fef71a9a58bda184e40dee796
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2252017
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-19 13:07:31 +00:00

114 lines
2.3 KiB
CSS

/*
* Copyright 2016 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
:host {
user-select: none;
padding: 4px 12px 12px 12px;
border: 1px solid transparent;
}
.shadow-editor-field:last-of-type {
margin-bottom: 8px;
}
.shadow-editor-field {
height: 24px;
margin-top: 8px;
font-size: 12px;
flex-shrink: 0;
}
.shadow-editor-flex-field {
display: flex;
align-items: center;
flex-direction: row;
}
.shadow-editor-field.shadow-editor-blur-field {
margin-top: 40px;
}
.shadow-editor-2D-slider {
position: absolute;
height: 88px;
width: 88px;
border: 1px solid rgb(0 0 0 / 14.000000000000002%);
border-radius: 2px;
}
.shadow-editor-label {
display: inline-block;
width: 52px;
height: 24px;
line-height: 24px;
margin-right: 8px;
text-align: right;
}
.shadow-editor-button-left,
.shadow-editor-button-right {
width: 74px;
height: 24px;
padding: 3px 7px;
line-height: 16px;
border: 1px solid rgb(0 0 0 / 14.000000000000002%);
color: #333;
background-color: #fff;
text-align: center;
font-weight: 500;
}
.shadow-editor-button-left {
border-radius: 2px 0 0 2px;
}
.shadow-editor-button-right {
border-radius: 0 2px 2px 0;
border-left-width: 0;
}
.shadow-editor-button-left:hover,
.shadow-editor-button-right:hover {
box-shadow: 0 1px 1px rgb(0 0 0 / 10%);
}
.shadow-editor-button-left:focus,
.shadow-editor-button-right:focus {
background-color: #eee;
}
.shadow-editor-button-left.enabled,
.shadow-editor-button-right.enabled,
.-theme-preserve {
background-color: #4285f4;
color: #fff;
}
.shadow-editor-button-left.enabled:focus,
.shadow-editor-button-right.enabled:focus,
.-theme-preserve {
background-color: #3b78e7;
}
.shadow-editor-text-input {
width: 52px;
margin-right: 8px;
text-align: right;
box-shadow: var(--focus-ring-inactive-shadow);
}
@media (forced-colors: active) {
.shadow-editor-button-left:hover,
.shadow-editor-button-right:hover .shadow-editor-button-left.enabled,
.shadow-editor-button-right.enabled,
.shadow-editor-button-left.enabled:focus,
.shadow-editor-button-right.enabled:focus {
forced-color-adjust: none;
background-color: Highlight;
color: HighlightText;
}
}