style: Refactor :-moz-lwtheme pseudo-classes to get invalidated correctly

Use the same document state mechanism we have for :moz-locale-dir. Also,
simplify the setup of the later to be the same as :dir(), allowing the
matching code to be less repetitive.

This should fix some flakiness in chrome mochitests, but we have no existing
tests for these pseudo-classes more generally and since they're just
chrome-only I'm not super-excited about adding more.

Differential Revision: https://phabricator.services.mozilla.com/D130735
This commit is contained in:
Emilio Cobos Álvarez 2023-05-31 11:37:50 +02:00 committed by Oriol Brufau
parent 5b68241958
commit a0e29d7032
3 changed files with 35 additions and 40 deletions

View file

@ -137,9 +137,17 @@ bitflags! {
/// dom/base/Document.h.
#[derive(MallocSizeOf)]
pub struct DocumentState: u64 {
/// RTL locale: specific to the XUL localedir attribute
const NS_DOCUMENT_STATE_RTL_LOCALE = 1 << 0;
/// Window activation status
const NS_DOCUMENT_STATE_WINDOW_INACTIVE = 1 << 1;
const WINDOW_INACTIVE = 1 << 0;
/// RTL locale: specific to the XUL localedir attribute
const RTL_LOCALE = 1 << 1;
/// LTR locale: specific to the XUL localedir attribute
const LTR_LOCALE = 1 << 2;
/// LWTheme status
const LWTHEME = 1 << 3;
/// LWTheme status
const LWTHEME_BRIGHTTEXT = 1 << 4;
/// LWTheme status
const LWTHEME_DARKTEXT = 1 << 5;
}
}