зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1686613 - Add a non-native-theme media query. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D102457
This commit is contained in:
Родитель
d058b30aa2
Коммит
e3b4492853
|
@ -613,6 +613,7 @@ bool Gecko_IsMainThread();
|
|||
mozilla::StyleDisplayMode Gecko_MediaFeatures_GetDisplayMode(
|
||||
const mozilla::dom::Document*);
|
||||
|
||||
bool Gecko_MediaFeatures_ShouldAvoidNativeTheme(const mozilla::dom::Document*);
|
||||
uint32_t Gecko_MediaFeatures_GetColorDepth(const mozilla::dom::Document*);
|
||||
uint32_t Gecko_MediaFeatures_GetMonochromeBitsPerPixel(
|
||||
const mozilla::dom::Document*);
|
||||
|
|
|
@ -96,6 +96,10 @@ bool Gecko_MediaFeatures_IsResourceDocument(const Document* aDocument) {
|
|||
return aDocument->IsResourceDoc();
|
||||
}
|
||||
|
||||
bool Gecko_MediaFeatures_ShouldAvoidNativeTheme(const Document* aDocument) {
|
||||
return aDocument->ShouldAvoidNativeTheme();
|
||||
}
|
||||
|
||||
static nsDeviceContext* GetDeviceContextFor(const Document* aDocument) {
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
if (!pc) {
|
||||
|
|
|
@ -47,6 +47,7 @@ function testToggle(toggle) {
|
|||
const TOGGLES = [
|
||||
"-moz-is-glyph",
|
||||
"-moz-print-preview",
|
||||
"-moz-non-native-content-theme",
|
||||
"-moz-scrollbar-start-backward",
|
||||
"-moz-scrollbar-start-forward",
|
||||
"-moz-scrollbar-end-backward",
|
||||
|
|
|
@ -543,6 +543,16 @@ fn eval_moz_print_preview(
|
|||
query_value.map_or(is_print_preview, |v| v == is_print_preview)
|
||||
}
|
||||
|
||||
fn eval_moz_non_native_content_theme(
|
||||
device: &Device,
|
||||
query_value: Option<bool>,
|
||||
_: Option<RangeOrOperator>,
|
||||
) -> bool {
|
||||
let non_native_theme =
|
||||
unsafe { bindings::Gecko_MediaFeatures_ShouldAvoidNativeTheme(device.document()) };
|
||||
query_value.map_or(non_native_theme, |v| v == non_native_theme)
|
||||
}
|
||||
|
||||
fn eval_moz_is_resource_document(
|
||||
device: &Device,
|
||||
query_value: Option<bool>,
|
||||
|
@ -610,7 +620,7 @@ macro_rules! system_metric_feature {
|
|||
/// to support new types in these entries and (2) ensuring that either
|
||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||
/// would be returned by the evaluator function could change.
|
||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 55] = [
|
||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 56] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
|
@ -814,6 +824,12 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 55] = [
|
|||
Evaluator::BoolInteger(eval_moz_print_preview),
|
||||
ParsingRequirements::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
feature!(
|
||||
atom!("-moz-non-native-content-theme"),
|
||||
AllowsRanges::No,
|
||||
Evaluator::BoolInteger(eval_moz_non_native_content_theme),
|
||||
ParsingRequirements::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
system_metric_feature!(atom!("-moz-scrollbar-start-backward")),
|
||||
system_metric_feature!(atom!("-moz-scrollbar-start-forward")),
|
||||
system_metric_feature!(atom!("-moz-scrollbar-end-backward")),
|
||||
|
|
|
@ -50,6 +50,7 @@ STATIC_ATOMS = [
|
|||
Atom("_moz_is_glyph", "-moz-is-glyph"),
|
||||
Atom("_moz_original_size", "_moz_original_size"),
|
||||
Atom("_moz_print_preview", "-moz-print-preview"),
|
||||
Atom("_moz_non_native_content_theme", "-moz-non-native-content-theme"),
|
||||
Atom("menuactive", "_moz-menuactive"),
|
||||
Atom("_poundDefault", "#default"),
|
||||
Atom("_asterisk", "*"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче