mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Improve LookAndFeel color caching
To be honest, I'm a bit baffled that bug 1773795 caused a performance regression, but I think it's because the standins codepath is not really cached, so system colors that are "spoofed" always go through the massive switch, which could potentially be expensive. To fix, this, rejigger a bit the caches so that we key on both color-scheme and use-standins. Also, while at it, make the set of colors we spoof a single bitflag check, rather than relying on the compiler to do something potentially smart with it. I had to shuffle the order of colors around so that the expression to initialize the bitfield is constexpr (doesn't go over 1 << 64), but other than that this patch should be relatively straight-forward. Differential Revision: https://phabricator.services.mozilla.com/D150100
This commit is contained in:
parent
34c3767560
commit
bb5de5833c
1 changed files with 53 additions and 52 deletions
|
@ -129,54 +129,6 @@ pub enum Color {
|
|||
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
|
||||
#[repr(u8)]
|
||||
pub enum SystemColor {
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
TextSelectDisabledBackground,
|
||||
#[css(skip)]
|
||||
TextSelectAttentionBackground,
|
||||
#[css(skip)]
|
||||
TextSelectAttentionForeground,
|
||||
#[css(skip)]
|
||||
TextHighlightBackground,
|
||||
#[css(skip)]
|
||||
TextHighlightForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputBackground,
|
||||
#[css(skip)]
|
||||
IMERawInputForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextUnderline,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
SpellCheckerUnderline,
|
||||
#[css(skip)]
|
||||
ThemedScrollbar,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarInactive,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumb,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbHover,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbActive,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbInactive,
|
||||
Activeborder,
|
||||
/// Background in the (active) titlebar.
|
||||
Activecaption,
|
||||
|
@ -196,6 +148,10 @@ pub enum SystemColor {
|
|||
#[parse(aliases = "-moz-fieldtext")]
|
||||
Fieldtext,
|
||||
|
||||
/// Combobox widgets
|
||||
MozComboboxtext,
|
||||
MozCombobox,
|
||||
|
||||
Graytext,
|
||||
Highlight,
|
||||
Highlighttext,
|
||||
|
@ -331,16 +287,61 @@ pub enum SystemColor {
|
|||
#[parse(aliases = "-moz-visitedhyperlinktext")]
|
||||
Visitedtext,
|
||||
|
||||
/// Combobox widgets
|
||||
MozComboboxtext,
|
||||
MozCombobox,
|
||||
|
||||
/// Color of tree column headers
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozColheadertext,
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozColheaderhovertext,
|
||||
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
TextSelectDisabledBackground,
|
||||
#[css(skip)]
|
||||
TextSelectAttentionBackground,
|
||||
#[css(skip)]
|
||||
TextSelectAttentionForeground,
|
||||
#[css(skip)]
|
||||
TextHighlightBackground,
|
||||
#[css(skip)]
|
||||
TextHighlightForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputBackground,
|
||||
#[css(skip)]
|
||||
IMERawInputForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextUnderline,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
SpellCheckerUnderline,
|
||||
#[css(skip)]
|
||||
ThemedScrollbar,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarInactive,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumb,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbHover,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbActive,
|
||||
#[css(skip)]
|
||||
ThemedScrollbarThumbInactive,
|
||||
|
||||
#[css(skip)]
|
||||
End, // Just for array-indexing purposes.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue