зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1845636 - Allow browser chrome to enable the non-native theme. r=dshin
I tried to reftest this, but actually the non-native-theme is already enabled on all reftests, so... Differential Revision: https://phabricator.services.mozilla.com/D184740
This commit is contained in:
Родитель
1b71310e85
Коммит
55478c757e
|
@ -226,6 +226,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
||||||
"-moz-context-properties",
|
"-moz-context-properties",
|
||||||
"-moz-control-character-visibility",
|
"-moz-control-character-visibility",
|
||||||
"-moz-default-appearance",
|
"-moz-default-appearance",
|
||||||
|
"-moz-theme",
|
||||||
"display",
|
"display",
|
||||||
"font-optical-sizing",
|
"font-optical-sizing",
|
||||||
"inline-size",
|
"inline-size",
|
||||||
|
|
|
@ -28,7 +28,6 @@ needs-focus == listbox-nonnative-when-styled.html listbox-nonnative-when-styled-
|
||||||
!= 427122-1.html 427122-1-ref.html
|
!= 427122-1.html 427122-1-ref.html
|
||||||
|
|
||||||
== chrome://reftest/content/native-theme/470711-1.xhtml chrome://reftest/content/native-theme/470711-1-ref.xhtml
|
== chrome://reftest/content/native-theme/470711-1.xhtml chrome://reftest/content/native-theme/470711-1-ref.xhtml
|
||||||
|
|
||||||
== chrome://reftest/content/native-theme/482955-1.xhtml chrome://reftest/content/native-theme/482955-1-ref.xhtml
|
== chrome://reftest/content/native-theme/482955-1.xhtml chrome://reftest/content/native-theme/482955-1-ref.xhtml
|
||||||
|
|
||||||
== 492155-1.html about:blank
|
== 492155-1.html about:blank
|
||||||
|
|
|
@ -446,6 +446,7 @@ cbindgen-types = [
|
||||||
{ gecko = "StyleOffsetPathFunction", servo = "crate::values::computed::motion::OffsetPathFunction" },
|
{ gecko = "StyleOffsetPathFunction", servo = "crate::values::computed::motion::OffsetPathFunction" },
|
||||||
{ gecko = "StyleGenericOffsetPath", servo = "crate::values::generics::motion::OffsetPath" },
|
{ gecko = "StyleGenericOffsetPath", servo = "crate::values::generics::motion::OffsetPath" },
|
||||||
{ gecko = "StyleGenericOffsetPathFunction", servo = "crate::values::generics::motion::OffsetPathFunction" },
|
{ gecko = "StyleGenericOffsetPathFunction", servo = "crate::values::generics::motion::OffsetPathFunction" },
|
||||||
|
{ gecko = "StyleMozTheme", servo = "crate::values::computed::ui::MozTheme" },
|
||||||
{ gecko = "StyleOffsetPosition", servo = "crate::values::computed::motion::OffsetPosition" },
|
{ gecko = "StyleOffsetPosition", servo = "crate::values::computed::motion::OffsetPosition" },
|
||||||
{ gecko = "StyleOffsetRotate", servo = "crate::values::computed::motion::OffsetRotate" },
|
{ gecko = "StyleOffsetRotate", servo = "crate::values::computed::motion::OffsetRotate" },
|
||||||
{ gecko = "StylePathCommand", servo = "crate::values::specified::svg_path::PathCommand" },
|
{ gecko = "StylePathCommand", servo = "crate::values::specified::svg_path::PathCommand" },
|
||||||
|
|
|
@ -3059,6 +3059,7 @@ LogicalSide nsStyleText::TextEmphasisSide(WritingMode aWM) const {
|
||||||
|
|
||||||
nsStyleUI::nsStyleUI()
|
nsStyleUI::nsStyleUI()
|
||||||
: mInert(StyleInert::None),
|
: mInert(StyleInert::None),
|
||||||
|
mMozTheme(StyleMozTheme::Auto),
|
||||||
mUserInput(StyleUserInput::Auto),
|
mUserInput(StyleUserInput::Auto),
|
||||||
mUserModify(StyleUserModify::ReadOnly),
|
mUserModify(StyleUserModify::ReadOnly),
|
||||||
mUserFocus(StyleUserFocus::None),
|
mUserFocus(StyleUserFocus::None),
|
||||||
|
@ -3073,6 +3074,7 @@ nsStyleUI::nsStyleUI()
|
||||||
|
|
||||||
nsStyleUI::nsStyleUI(const nsStyleUI& aSource)
|
nsStyleUI::nsStyleUI(const nsStyleUI& aSource)
|
||||||
: mInert(aSource.mInert),
|
: mInert(aSource.mInert),
|
||||||
|
mMozTheme(aSource.mMozTheme),
|
||||||
mUserInput(aSource.mUserInput),
|
mUserInput(aSource.mUserInput),
|
||||||
mUserModify(aSource.mUserModify),
|
mUserModify(aSource.mUserModify),
|
||||||
mUserFocus(aSource.mUserFocus),
|
mUserFocus(aSource.mUserFocus),
|
||||||
|
@ -3138,6 +3140,7 @@ nsChangeHint nsStyleUI::CalcDifference(const nsStyleUI& aNewData) const {
|
||||||
if (mCaretColor != aNewData.mCaretColor ||
|
if (mCaretColor != aNewData.mCaretColor ||
|
||||||
mAccentColor != aNewData.mAccentColor ||
|
mAccentColor != aNewData.mAccentColor ||
|
||||||
mScrollbarColor != aNewData.mScrollbarColor ||
|
mScrollbarColor != aNewData.mScrollbarColor ||
|
||||||
|
mMozTheme != aNewData.mMozTheme ||
|
||||||
mColorScheme != aNewData.mColorScheme) {
|
mColorScheme != aNewData.mColorScheme) {
|
||||||
hint |= nsChangeHint_RepaintFrame;
|
hint |= nsChangeHint_RepaintFrame;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1756,6 +1756,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI {
|
||||||
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleUI*);
|
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleUI*);
|
||||||
|
|
||||||
mozilla::StyleInert mInert;
|
mozilla::StyleInert mInert;
|
||||||
|
mozilla::StyleMozTheme mMozTheme;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mozilla::StyleUserInput mUserInput;
|
mozilla::StyleUserInput mUserInput;
|
||||||
|
|
|
@ -94,6 +94,7 @@ const char* gInaccessibleProperties[] = {
|
||||||
"-x-span",
|
"-x-span",
|
||||||
"-x-text-scale",
|
"-x-text-scale",
|
||||||
"-moz-default-appearance",
|
"-moz-default-appearance",
|
||||||
|
"-moz-theme",
|
||||||
"-moz-inert",
|
"-moz-inert",
|
||||||
"-moz-script-level", // parsed by UA sheets only
|
"-moz-script-level", // parsed by UA sheets only
|
||||||
"-moz-math-variant",
|
"-moz-math-variant",
|
||||||
|
|
|
@ -482,6 +482,7 @@ class Longhand(Property):
|
||||||
"LineBreak",
|
"LineBreak",
|
||||||
"LineClamp",
|
"LineClamp",
|
||||||
"MasonryAutoFlow",
|
"MasonryAutoFlow",
|
||||||
|
"ui::MozTheme",
|
||||||
"BoolInteger",
|
"BoolInteger",
|
||||||
"text::MozControlCharacterVisibility",
|
"text::MozControlCharacterVisibility",
|
||||||
"MathDepth",
|
"MathDepth",
|
||||||
|
|
|
@ -111,3 +111,13 @@ ${helpers.predefined_type(
|
||||||
boxed=True,
|
boxed=True,
|
||||||
ignored_when_colors_disabled=True,
|
ignored_when_colors_disabled=True,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
${helpers.predefined_type(
|
||||||
|
"-moz-theme",
|
||||||
|
"ui::MozTheme",
|
||||||
|
"specified::ui::MozTheme::Auto",
|
||||||
|
engines="gecko",
|
||||||
|
enabled_in="chrome",
|
||||||
|
animation_value_type="discrete",
|
||||||
|
spec="Internal",
|
||||||
|
)}
|
||||||
|
|
|
@ -9,8 +9,7 @@ use crate::values::computed::image::Image;
|
||||||
use crate::values::computed::Number;
|
use crate::values::computed::Number;
|
||||||
use crate::values::generics::ui as generics;
|
use crate::values::generics::ui as generics;
|
||||||
|
|
||||||
pub use crate::values::specified::ui::CursorKind;
|
pub use crate::values::specified::ui::{CursorKind, BoolInteger, UserSelect, MozTheme};
|
||||||
pub use crate::values::specified::ui::{BoolInteger, UserSelect};
|
|
||||||
|
|
||||||
/// A computed value for the `cursor` property.
|
/// A computed value for the `cursor` property.
|
||||||
pub type Cursor = generics::GenericCursor<CursorImage>;
|
pub type Cursor = generics::GenericCursor<CursorImage>;
|
||||||
|
|
|
@ -230,3 +230,28 @@ pub enum CursorKind {
|
||||||
ZoomOut,
|
ZoomOut,
|
||||||
Auto,
|
Auto,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The keywords allowed in the -moz-theme property.
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
Eq,
|
||||||
|
FromPrimitive,
|
||||||
|
MallocSizeOf,
|
||||||
|
Parse,
|
||||||
|
PartialEq,
|
||||||
|
SpecifiedValueInfo,
|
||||||
|
ToComputedValue,
|
||||||
|
ToCss,
|
||||||
|
ToResolvedValue,
|
||||||
|
ToShmem,
|
||||||
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum MozTheme {
|
||||||
|
/// Choose the default (maybe native) rendering.
|
||||||
|
Auto,
|
||||||
|
/// Choose the non-native rendering.
|
||||||
|
NonNative,
|
||||||
|
}
|
||||||
|
|
|
@ -112,6 +112,7 @@ include = [
|
||||||
"GenericFontFamily",
|
"GenericFontFamily",
|
||||||
"FontFamily",
|
"FontFamily",
|
||||||
"FontFamilyNameSyntax",
|
"FontFamilyNameSyntax",
|
||||||
|
"MozTheme",
|
||||||
"OverflowWrap",
|
"OverflowWrap",
|
||||||
"OffsetPath",
|
"OffsetPath",
|
||||||
"OffsetPathFunction",
|
"OffsetPathFunction",
|
||||||
|
|
|
@ -2479,18 +2479,13 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||||
NS_OBJC_END_TRY_BLOCK_RETURN(Nothing());
|
NS_OBJC_END_TRY_BLOCK_RETURN(Nothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsWidgetNonNative(StyleAppearance aAppearance) {
|
|
||||||
return nsNativeTheme::IsWidgetScrollbarPart(aAppearance) ||
|
|
||||||
aAppearance == StyleAppearance::FocusOutline;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance, const nsRect& aRect,
|
StyleAppearance aAppearance, const nsRect& aRect,
|
||||||
const nsRect& aDirtyRect, DrawOverflow aDrawOverflow) {
|
const nsRect& aDirtyRect, DrawOverflow aDrawOverflow) {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
if (IsWidgetNonNative(aAppearance)) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return ThemeCocoa::DrawWidgetBackground(aContext, aFrame, aAppearance, aRect, aDirtyRect,
|
return ThemeCocoa::DrawWidgetBackground(aContext, aFrame, aAppearance, aRect, aDirtyRect,
|
||||||
aDrawOverflow);
|
aDrawOverflow);
|
||||||
}
|
}
|
||||||
|
@ -2718,7 +2713,7 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
||||||
const mozilla::layers::StackingContextHelper& aSc,
|
const mozilla::layers::StackingContextHelper& aSc,
|
||||||
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance, const nsRect& aRect) {
|
StyleAppearance aAppearance, const nsRect& aRect) {
|
||||||
if (IsWidgetNonNative(aAppearance)) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return ThemeCocoa::CreateWebRenderCommandsForWidget(aBuilder, aResources, aSc, aManager, aFrame,
|
return ThemeCocoa::CreateWebRenderCommandsForWidget(aBuilder, aResources, aSc, aManager, aFrame,
|
||||||
aAppearance, aRect);
|
aAppearance, aRect);
|
||||||
}
|
}
|
||||||
|
@ -2916,7 +2911,7 @@ bool nsNativeThemeCocoa::GetWidgetPadding(nsDeviceContext* aContext, nsIFrame* a
|
||||||
|
|
||||||
bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance, nsRect* aOverflowRect) {
|
StyleAppearance aAppearance, nsRect* aOverflowRect) {
|
||||||
if (IsWidgetNonNative(aAppearance)) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return ThemeCocoa::GetWidgetOverflow(aContext, aFrame, aAppearance, aOverflowRect);
|
return ThemeCocoa::GetWidgetOverflow(aContext, aFrame, aAppearance, aOverflowRect);
|
||||||
}
|
}
|
||||||
nsIntMargin overflow;
|
nsIntMargin overflow;
|
||||||
|
@ -2977,7 +2972,7 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPre
|
||||||
StyleAppearance aAppearance) {
|
StyleAppearance aAppearance) {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
if (IsWidgetNonNative(aAppearance)) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return ThemeCocoa::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
return ThemeCocoa::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3176,7 +3171,7 @@ nsNativeThemeCocoa::ThemeChanged() {
|
||||||
|
|
||||||
bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance) {
|
StyleAppearance aAppearance) {
|
||||||
if (IsWidgetNonNative(aAppearance)) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return ThemeCocoa::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
return ThemeCocoa::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
// if this is a dropdown button in a combobox the answer is always no
|
// if this is a dropdown button in a combobox the answer is always no
|
||||||
|
|
|
@ -1053,8 +1053,7 @@ bool nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||||
auto nsNativeThemeGTK::IsWidgetNonNative(nsIFrame* aFrame,
|
auto nsNativeThemeGTK::IsWidgetNonNative(nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance)
|
StyleAppearance aAppearance)
|
||||||
-> NonNative {
|
-> NonNative {
|
||||||
if (IsWidgetScrollbarPart(aAppearance) ||
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
aAppearance == StyleAppearance::FocusOutline) {
|
|
||||||
return NonNative::Always;
|
return NonNative::Always;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,7 +1090,7 @@ auto nsNativeThemeGTK::IsWidgetNonNative(nsIFrame* aFrame,
|
||||||
LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
||||||
nsPresContext* aPresContext, nsIFrame* aFrame,
|
nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance) {
|
StyleAppearance aAppearance) {
|
||||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,7 +1315,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,3 +573,11 @@ bool nsNativeTheme::IsWidgetScrollbarPart(StyleAppearance aAppearance) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
bool nsNativeTheme::IsWidgetAlwaysNonNative(nsIFrame* aFrame,
|
||||||
|
StyleAppearance aAppearance) {
|
||||||
|
return IsWidgetScrollbarPart(aAppearance) ||
|
||||||
|
aAppearance == StyleAppearance::FocusOutline ||
|
||||||
|
(aFrame && aFrame->StyleUI()->mMozTheme == StyleMozTheme::NonNative);
|
||||||
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ class nsNativeTheme : public nsITimerCallback, public nsINamed {
|
||||||
static bool IsDarkBackground(nsIFrame*);
|
static bool IsDarkBackground(nsIFrame*);
|
||||||
|
|
||||||
static bool IsWidgetScrollbarPart(mozilla::StyleAppearance);
|
static bool IsWidgetScrollbarPart(mozilla::StyleAppearance);
|
||||||
|
static bool IsWidgetAlwaysNonNative(nsIFrame*, mozilla::StyleAppearance);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t mAnimatedContentTimeout;
|
uint32_t mAnimatedContentTimeout;
|
||||||
|
|
|
@ -67,8 +67,7 @@ nsNativeThemeWin::~nsNativeThemeWin() { nsUXThemeData::Invalidate(); }
|
||||||
auto nsNativeThemeWin::IsWidgetNonNative(nsIFrame* aFrame,
|
auto nsNativeThemeWin::IsWidgetNonNative(nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance)
|
StyleAppearance aAppearance)
|
||||||
-> NonNative {
|
-> NonNative {
|
||||||
if (IsWidgetScrollbarPart(aAppearance) ||
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
aAppearance == StyleAppearance::FocusOutline) {
|
|
||||||
return NonNative::Always;
|
return NonNative::Always;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,7 +1396,7 @@ bool nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||||
LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
||||||
nsPresContext* aPresContext, nsIFrame* aFrame,
|
nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||||
StyleAppearance aAppearance) {
|
StyleAppearance aAppearance) {
|
||||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1551,7 +1550,7 @@ bool nsNativeThemeWin::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||||
// XXXdwh We can go even further and call the API to ask if support exists for
|
// XXXdwh We can go even further and call the API to ask if support exists for
|
||||||
// specific widgets.
|
// specific widgets.
|
||||||
|
|
||||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||||
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче