зеркало из 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-control-character-visibility",
|
||||
"-moz-default-appearance",
|
||||
"-moz-theme",
|
||||
"display",
|
||||
"font-optical-sizing",
|
||||
"inline-size",
|
||||
|
|
|
@ -28,7 +28,6 @@ needs-focus == listbox-nonnative-when-styled.html listbox-nonnative-when-styled-
|
|||
!= 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/482955-1.xhtml chrome://reftest/content/native-theme/482955-1-ref.xhtml
|
||||
|
||||
== 492155-1.html about:blank
|
||||
|
|
|
@ -446,6 +446,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleOffsetPathFunction", servo = "crate::values::computed::motion::OffsetPathFunction" },
|
||||
{ gecko = "StyleGenericOffsetPath", servo = "crate::values::generics::motion::OffsetPath" },
|
||||
{ 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 = "StyleOffsetRotate", servo = "crate::values::computed::motion::OffsetRotate" },
|
||||
{ gecko = "StylePathCommand", servo = "crate::values::specified::svg_path::PathCommand" },
|
||||
|
|
|
@ -3059,6 +3059,7 @@ LogicalSide nsStyleText::TextEmphasisSide(WritingMode aWM) const {
|
|||
|
||||
nsStyleUI::nsStyleUI()
|
||||
: mInert(StyleInert::None),
|
||||
mMozTheme(StyleMozTheme::Auto),
|
||||
mUserInput(StyleUserInput::Auto),
|
||||
mUserModify(StyleUserModify::ReadOnly),
|
||||
mUserFocus(StyleUserFocus::None),
|
||||
|
@ -3073,6 +3074,7 @@ nsStyleUI::nsStyleUI()
|
|||
|
||||
nsStyleUI::nsStyleUI(const nsStyleUI& aSource)
|
||||
: mInert(aSource.mInert),
|
||||
mMozTheme(aSource.mMozTheme),
|
||||
mUserInput(aSource.mUserInput),
|
||||
mUserModify(aSource.mUserModify),
|
||||
mUserFocus(aSource.mUserFocus),
|
||||
|
@ -3138,6 +3140,7 @@ nsChangeHint nsStyleUI::CalcDifference(const nsStyleUI& aNewData) const {
|
|||
if (mCaretColor != aNewData.mCaretColor ||
|
||||
mAccentColor != aNewData.mAccentColor ||
|
||||
mScrollbarColor != aNewData.mScrollbarColor ||
|
||||
mMozTheme != aNewData.mMozTheme ||
|
||||
mColorScheme != aNewData.mColorScheme) {
|
||||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
|
|
|
@ -1756,6 +1756,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI {
|
|||
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleUI*);
|
||||
|
||||
mozilla::StyleInert mInert;
|
||||
mozilla::StyleMozTheme mMozTheme;
|
||||
|
||||
private:
|
||||
mozilla::StyleUserInput mUserInput;
|
||||
|
|
|
@ -94,6 +94,7 @@ const char* gInaccessibleProperties[] = {
|
|||
"-x-span",
|
||||
"-x-text-scale",
|
||||
"-moz-default-appearance",
|
||||
"-moz-theme",
|
||||
"-moz-inert",
|
||||
"-moz-script-level", // parsed by UA sheets only
|
||||
"-moz-math-variant",
|
||||
|
|
|
@ -482,6 +482,7 @@ class Longhand(Property):
|
|||
"LineBreak",
|
||||
"LineClamp",
|
||||
"MasonryAutoFlow",
|
||||
"ui::MozTheme",
|
||||
"BoolInteger",
|
||||
"text::MozControlCharacterVisibility",
|
||||
"MathDepth",
|
||||
|
|
|
@ -111,3 +111,13 @@ ${helpers.predefined_type(
|
|||
boxed=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::generics::ui as generics;
|
||||
|
||||
pub use crate::values::specified::ui::CursorKind;
|
||||
pub use crate::values::specified::ui::{BoolInteger, UserSelect};
|
||||
pub use crate::values::specified::ui::{CursorKind, BoolInteger, UserSelect, MozTheme};
|
||||
|
||||
/// A computed value for the `cursor` property.
|
||||
pub type Cursor = generics::GenericCursor<CursorImage>;
|
||||
|
|
|
@ -230,3 +230,28 @@ pub enum CursorKind {
|
|||
ZoomOut,
|
||||
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",
|
||||
"FontFamily",
|
||||
"FontFamilyNameSyntax",
|
||||
"MozTheme",
|
||||
"OverflowWrap",
|
||||
"OffsetPath",
|
||||
"OffsetPathFunction",
|
||||
|
|
|
@ -2479,18 +2479,13 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
|||
NS_OBJC_END_TRY_BLOCK_RETURN(Nothing());
|
||||
}
|
||||
|
||||
static bool IsWidgetNonNative(StyleAppearance aAppearance) {
|
||||
return nsNativeTheme::IsWidgetScrollbarPart(aAppearance) ||
|
||||
aAppearance == StyleAppearance::FocusOutline;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance, const nsRect& aRect,
|
||||
const nsRect& aDirtyRect, DrawOverflow aDrawOverflow) {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
if (IsWidgetNonNative(aAppearance)) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return ThemeCocoa::DrawWidgetBackground(aContext, aFrame, aAppearance, aRect, aDirtyRect,
|
||||
aDrawOverflow);
|
||||
}
|
||||
|
@ -2718,7 +2713,7 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
|||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance, const nsRect& aRect) {
|
||||
if (IsWidgetNonNative(aAppearance)) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return ThemeCocoa::CreateWebRenderCommandsForWidget(aBuilder, aResources, aSc, aManager, aFrame,
|
||||
aAppearance, aRect);
|
||||
}
|
||||
|
@ -2916,7 +2911,7 @@ bool nsNativeThemeCocoa::GetWidgetPadding(nsDeviceContext* aContext, nsIFrame* a
|
|||
|
||||
bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance, nsRect* aOverflowRect) {
|
||||
if (IsWidgetNonNative(aAppearance)) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return ThemeCocoa::GetWidgetOverflow(aContext, aFrame, aAppearance, aOverflowRect);
|
||||
}
|
||||
nsIntMargin overflow;
|
||||
|
@ -2977,7 +2972,7 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPre
|
|||
StyleAppearance aAppearance) {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
if (IsWidgetNonNative(aAppearance)) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return ThemeCocoa::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
|
@ -3176,7 +3171,7 @@ nsNativeThemeCocoa::ThemeChanged() {
|
|||
|
||||
bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (IsWidgetNonNative(aAppearance)) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return ThemeCocoa::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
// 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,
|
||||
StyleAppearance aAppearance)
|
||||
-> NonNative {
|
||||
if (IsWidgetScrollbarPart(aAppearance) ||
|
||||
aAppearance == StyleAppearance::FocusOutline) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return NonNative::Always;
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1090,7 @@ auto nsNativeThemeGTK::IsWidgetNonNative(nsIFrame* aFrame,
|
|||
LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
||||
nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
|
@ -1316,7 +1315,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
|
|
|
@ -573,3 +573,11 @@ bool nsNativeTheme::IsWidgetScrollbarPart(StyleAppearance aAppearance) {
|
|||
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 IsWidgetScrollbarPart(mozilla::StyleAppearance);
|
||||
static bool IsWidgetAlwaysNonNative(nsIFrame*, mozilla::StyleAppearance);
|
||||
|
||||
private:
|
||||
uint32_t mAnimatedContentTimeout;
|
||||
|
|
|
@ -67,8 +67,7 @@ nsNativeThemeWin::~nsNativeThemeWin() { nsUXThemeData::Invalidate(); }
|
|||
auto nsNativeThemeWin::IsWidgetNonNative(nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance)
|
||||
-> NonNative {
|
||||
if (IsWidgetScrollbarPart(aAppearance) ||
|
||||
aAppearance == StyleAppearance::FocusOutline) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return NonNative::Always;
|
||||
}
|
||||
|
||||
|
@ -1397,7 +1396,7 @@ bool nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
|||
LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
||||
nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
||||
if (IsWidgetAlwaysNonNative(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
|
||||
// specific widgets.
|
||||
|
||||
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return Theme::ThemeSupportsWidget(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче