Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2025-08-14 08:55:16 +08:00
commit ae1f9364cd
38 changed files with 85 additions and 1993 deletions

View file

@ -420,6 +420,7 @@ CSS_KEY(no-drag, no_drag)
CSS_KEY(no-drop, no_drop)
CSS_KEY(no-historical-ligatures, no_historical_ligatures)
CSS_KEY(no-open-quote, no_open_quote)
CSS_KEY(no-preference, no_preference)
CSS_KEY(no-repeat, no_repeat)
CSS_KEY(none, none)
CSS_KEY(normal, normal)
@ -471,6 +472,7 @@ CSS_KEY(px, px)
CSS_KEY(rad, rad)
CSS_KEY(read-only, read_only)
CSS_KEY(read-write, read_write)
CSS_KEY(reduce, reduce)
CSS_KEY(relative, relative)
CSS_KEY(repeat, repeat)
CSS_KEY(repeat-x, repeat_x)

View file

@ -47,9 +47,15 @@ static const nsCSSProps::KTableEntry kDisplayModeKeywords[] = {
};
static const nsCSSProps::KTableEntry kPrefersColorSchemeKeywords[] = {
{ eCSSKeyword_light, NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT },
{ eCSSKeyword_dark, NS_STYLE_PREFERS_COLOR_SCHEME_DARK },
{ eCSSKeyword_UNKNOWN, -1 },
{ eCSSKeyword_light, NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT },
{ eCSSKeyword_dark, NS_STYLE_PREFERS_COLOR_SCHEME_DARK },
{ eCSSKeyword_UNKNOWN, -1 },
};
static const nsCSSProps::KTableEntry kPrefersMotionKeywords[] = {
{ eCSSKeyword_no_preference, NS_STYLE_PREFERS_FULL_MOTION },
{ eCSSKeyword_reduce, NS_STYLE_PREFERS_REDUCED_MOTION },
{ eCSSKeyword_UNKNOWN, -1 },
};
#ifdef XP_WIN
@ -81,7 +87,8 @@ const OperatingSystemVersionInfo osVersionStrings[] = {
{ LookAndFeel::eOperatingSystemVersion_WindowsVista, L"windows-vista" },
{ LookAndFeel::eOperatingSystemVersion_Windows7, L"windows-win7" },
{ LookAndFeel::eOperatingSystemVersion_Windows8, L"windows-win8" },
{ LookAndFeel::eOperatingSystemVersion_Windows10, L"windows-win10" }
{ LookAndFeel::eOperatingSystemVersion_Windows10, L"windows-win10" },
{ LookAndFeel::eOperatingSystemVersion_Windows11, L"windows-win11" }
};
#endif
@ -497,6 +504,22 @@ GetPrefersColorScheme(nsPresContext* aPresContext, const nsMediaFeature* aFeatur
return NS_OK;
}
static nsresult
GetPrefersMotion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
switch(Preferences::GetInt("ui.prefersReducedMotion", 0)) {
case 1:
aResult.SetIntValue(NS_STYLE_PREFERS_REDUCED_MOTION,
eCSSUnit_Enumerated);
break;
default:
aResult.Reset();
}
return NS_OK;
}
static nsresult
GetDarkTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
@ -630,6 +653,14 @@ nsMediaFeatures::features[] = {
{ kPrefersColorSchemeKeywords },
GetPrefersColorScheme
},
{
&nsGkAtoms::prefers_reduced_motion,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eEnumerated,
nsMediaFeature::eNoRequirements,
{ kPrefersMotionKeywords },
GetPrefersMotion
},
{
&nsGkAtoms::resolution,
nsMediaFeature::eMinMaxAllowed,

View file

@ -1265,8 +1265,12 @@ enum class StyleDisplay : uint8_t {
#define NS_STYLE_DISPLAY_MODE_FULLSCREEN 3
// prefers-color-scheme
#define NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT 0
#define NS_STYLE_PREFERS_COLOR_SCHEME_DARK 1
#define NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT 0
#define NS_STYLE_PREFERS_COLOR_SCHEME_DARK 1
// prefers-reduced-motion
#define NS_STYLE_PREFERS_FULL_MOTION 0
#define NS_STYLE_PREFERS_REDUCED_MOTION 1
} // namespace mozilla