зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1833403 - Simplify some appearance code. r=stransky,mac-reviewers,handyman,devtools-reviewers,mstange
I was looking into simplifying our scrollbar styles: * StyleAppearance::Resizer is not used in content, and some of the values were only for <xul:window> which are not supported anymore. * Statusbarpanel and Resizerpanel aren't used. Statusbar is only used once on macOS so we only need to keep it there. Differential Revision: https://phabricator.services.mozilla.com/D178374
This commit is contained in:
Родитель
bc8fc1d998
Коммит
6a17b5fdf8
|
@ -265,8 +265,6 @@ exports.CSS_PROPERTIES = {
|
|||
"radiomenuitem",
|
||||
"range",
|
||||
"range-thumb",
|
||||
"resizer",
|
||||
"resizerpanel",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"scrollbar-horizontal",
|
||||
|
@ -288,7 +286,6 @@ exports.CSS_PROPERTIES = {
|
|||
"spinner-upbutton",
|
||||
"splitter",
|
||||
"statusbar",
|
||||
"statusbarpanel",
|
||||
"tab",
|
||||
"tab-scroll-arrow-back",
|
||||
"tab-scroll-arrow-forward",
|
||||
|
@ -1538,8 +1535,6 @@ exports.CSS_PROPERTIES = {
|
|||
"radiomenuitem",
|
||||
"range",
|
||||
"range-thumb",
|
||||
"resizer",
|
||||
"resizerpanel",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"scrollbar-horizontal",
|
||||
|
@ -1561,7 +1556,6 @@ exports.CSS_PROPERTIES = {
|
|||
"spinner-upbutton",
|
||||
"splitter",
|
||||
"statusbar",
|
||||
"statusbarpanel",
|
||||
"tab",
|
||||
"tab-scroll-arrow-back",
|
||||
"tab-scroll-arrow-forward",
|
||||
|
@ -3592,8 +3586,6 @@ exports.CSS_PROPERTIES = {
|
|||
"radiomenuitem",
|
||||
"range",
|
||||
"range-thumb",
|
||||
"resizer",
|
||||
"resizerpanel",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"scrollbar-horizontal",
|
||||
|
@ -3615,7 +3607,6 @@ exports.CSS_PROPERTIES = {
|
|||
"spinner-upbutton",
|
||||
"splitter",
|
||||
"statusbar",
|
||||
"statusbarpanel",
|
||||
"tab",
|
||||
"tab-scroll-arrow-back",
|
||||
"tab-scroll-arrow-forward",
|
||||
|
|
|
@ -44,21 +44,10 @@ fails-if(Android&&!asyncPan) != 492155-4.html about:blank
|
|||
# RTL mirroring tests
|
||||
== checkbox-not-mirrored-when-rtl.html checkbox-not-mirrored-when-rtl-ref.html
|
||||
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomend.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
random-if(d2d) == chrome://reftest/content/native-theme/resizer-bottomend.xhtml chrome://reftest/content/native-theme/resizer-bottomright.xhtml # bug 581086
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomend.xhtml chrome://reftest/content/native-theme/resizer-bottomend-rtl.xhtml
|
||||
# Disabled on Linux (bug 519152), random on Windows (bug 581086)
|
||||
skip-if(gtkWidget) != chrome://reftest/content/native-theme/resizer-bottomend-rtl.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
skip-if(gtkWidget) random-if(d2d) == chrome://reftest/content/native-theme/resizer-bottomend-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomend-flipped.xhtml
|
||||
skip-if(gtkWidget) == chrome://reftest/content/native-theme/resizer-bottomleft-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomleft.xhtml
|
||||
skip-if(gtkWidget) == chrome://reftest/content/native-theme/resizer-bottomright-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomright.xhtml
|
||||
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomstart.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
random-if(d2d) == chrome://reftest/content/native-theme/resizer-bottomstart.xhtml chrome://reftest/content/native-theme/resizer-bottomleft.xhtml
|
||||
random-if(d2d) == chrome://reftest/content/native-theme/resizer-bottomstart.xhtml chrome://reftest/content/native-theme/resizer-left.xhtml
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomstart.xhtml chrome://reftest/content/native-theme/resizer-bottomstart-rtl.xhtml
|
||||
skip-if(gtkWidget) != chrome://reftest/content/native-theme/resizer-bottomstart-rtl.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
skip-if(gtkWidget) random-if(d2d) == chrome://reftest/content/native-theme/resizer-bottomstart-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomend.xhtml
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomleft.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
== chrome://reftest/content/native-theme/resizer-bottomleft-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomleft.xhtml
|
||||
!= chrome://reftest/content/native-theme/resizer-bottomright.xhtml chrome://reftest/content/native-theme/blank-window.xhtml
|
||||
== chrome://reftest/content/native-theme/resizer-bottomright-rtl.xhtml chrome://reftest/content/native-theme/resizer-bottomright.xhtml
|
||||
|
||||
# Windows-only, depends on native scrollbar metrics
|
||||
skip-if(!winWidget) == scroll-thumb-minimum-size-notheme.html scroll-thumb-minimum-size-notheme-ref.html
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window title="Resizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox>
|
||||
<resizer dir="bottomend" style="-moz-transform: scaleX(-1)"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window title="Resizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" localedir="rtl">
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<resizer dir="bottomend"/>
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window title="Resizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox>
|
||||
<resizer dir="bottomend"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window title="Resizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" localedir="rtl">
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<resizer dir="bottomstart"/>
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window title="Resizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox>
|
||||
<resizer dir="bottomstart"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</window>
|
|
@ -82,10 +82,6 @@ scrollbar, scrollbarbutton, scrollcorner, slider, thumb, resizer {
|
|||
resizer {
|
||||
position: relative;
|
||||
z-index: 2147483647;
|
||||
/* Widget gets decide on its own whether or not the native theme should apply,
|
||||
based on the context/OS theme. If it does not, SVG background will kick in. */
|
||||
appearance: auto;
|
||||
-moz-default-appearance: resizer;
|
||||
|
||||
background: url("chrome://global/skin/icons/resizer.svg") no-repeat;
|
||||
background-size: 100% 100%;
|
||||
|
@ -94,17 +90,12 @@ resizer {
|
|||
height: 15px;
|
||||
}
|
||||
|
||||
/* bottomstart/bottomend is supported in XUL window only */
|
||||
resizer[dir="bottom"][flip],
|
||||
resizer[dir="bottomleft"],
|
||||
resizer[dir="bottomstart"]:-moz-locale-dir(ltr),
|
||||
resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
|
||||
resizer[dir="bottomleft"] {
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
resizer[dir="bottomleft"],
|
||||
resizer[dir="bottomstart"]:-moz-locale-dir(ltr),
|
||||
resizer[dir="bottomend"]:-moz-locale-dir(rtl) {
|
||||
resizer[dir="bottomleft"] {
|
||||
cursor: sw-resize;
|
||||
}
|
||||
|
||||
|
|
|
@ -1516,13 +1516,6 @@ pub enum Appearance {
|
|||
Range,
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
RangeThumb,
|
||||
/// The resizer background area in a status bar for the resizer widget in
|
||||
/// the corner of a window.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
Resizerpanel,
|
||||
/// The resizer itself.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
Resizer,
|
||||
/// The scrollbar slider
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
ScrollbarHorizontal,
|
||||
|
@ -1573,9 +1566,6 @@ pub enum Appearance {
|
|||
/// A status bar in a main application window.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
Statusbar,
|
||||
/// A single pane of a status bar.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
Statusbarpanel,
|
||||
/// A single tab in a tab widget.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
Tab,
|
||||
|
|
|
@ -109,7 +109,6 @@ Maybe<nsITheme::Transparency> ScrollbarDrawingWin::GetScrollbarPartTransparency(
|
|||
case StyleAppearance::ScrollbarHorizontal:
|
||||
case StyleAppearance::ScrollbarVertical:
|
||||
case StyleAppearance::Scrollcorner:
|
||||
case StyleAppearance::Statusbar:
|
||||
// Knowing that scrollbars and statusbars are opaque improves
|
||||
// performance, because we create layers for them. This better be
|
||||
// true across all Windows themes! If it's not true, we should
|
||||
|
|
|
@ -194,7 +194,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
eActiveSourceListSelection, // bool
|
||||
eInactiveSourceListSelection, // bool
|
||||
eTabPanel,
|
||||
eResizer
|
||||
};
|
||||
|
||||
struct WidgetInfo {
|
||||
|
@ -267,7 +266,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
return WidgetInfo(Widget::eInactiveSourceListSelection, aParams);
|
||||
}
|
||||
static WidgetInfo TabPanel(bool aParams) { return WidgetInfo(Widget::eTabPanel, aParams); }
|
||||
static WidgetInfo Resizer(bool aParams) { return WidgetInfo(Widget::eResizer, aParams); }
|
||||
|
||||
template <typename T>
|
||||
T Params() const {
|
||||
|
@ -393,7 +391,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
const SpinButtonParams& aParams);
|
||||
void DrawToolbar(CGContextRef cgContext, const CGRect& inBoxRect, bool aIsMain);
|
||||
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, bool aIsMain);
|
||||
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL);
|
||||
void DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect, bool aIsFocused);
|
||||
void DrawSourceListSelection(CGContextRef aContext, const CGRect& aRect, bool aWindowIsActive,
|
||||
bool aSelectionIsActive);
|
||||
|
|
|
@ -2169,26 +2169,6 @@ void nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inB
|
|||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
static void RenderResizer(CGContextRef cgContext, const HIRect& aRenderRect, void* aData) {
|
||||
HIThemeGrowBoxDrawInfo* drawInfo = (HIThemeGrowBoxDrawInfo*)aData;
|
||||
HIThemeDrawGrowBox(&CGPointZero, drawInfo, cgContext, kHIThemeOrientationNormal);
|
||||
}
|
||||
|
||||
void nsNativeThemeCocoa::DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL) {
|
||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||
|
||||
HIThemeGrowBoxDrawInfo drawInfo;
|
||||
drawInfo.version = 0;
|
||||
drawInfo.state = kThemeStateActive;
|
||||
drawInfo.kind = kHIThemeGrowBoxKindNormal;
|
||||
drawInfo.direction = kThemeGrowRight | kThemeGrowDown;
|
||||
drawInfo.size = kHIThemeGrowBoxSizeNormal;
|
||||
|
||||
RenderTransformedHIThemeControl(cgContext, aRect, RenderResizer, &drawInfo, aIsRTL);
|
||||
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
void nsNativeThemeCocoa::DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect,
|
||||
bool aIsFocused) {
|
||||
mTextFieldCell.enabled = YES;
|
||||
|
@ -2531,9 +2511,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
|||
case StyleAppearance::Tabpanels:
|
||||
return Some(WidgetInfo::TabPanel(FrameIsInActiveWindow(aFrame)));
|
||||
|
||||
case StyleAppearance::Resizer:
|
||||
return Some(WidgetInfo::Resizer(IsFrameRTL(aFrame)));
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2772,11 +2749,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
|
|||
DrawTabPanel(cgContext, macRect, isInsideActiveWindow);
|
||||
break;
|
||||
}
|
||||
case Widget::eResizer: {
|
||||
bool isRTL = aWidgetInfo.Params<bool>();
|
||||
DrawResizer(cgContext, macRect, isRTL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the base CTM.
|
||||
|
@ -2848,7 +2820,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
|||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Resizer:
|
||||
return false;
|
||||
|
||||
default:
|
||||
|
@ -3183,19 +3154,6 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPre
|
|||
case StyleAppearance::MozMenulistArrowButton:
|
||||
return ThemeCocoa::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||
|
||||
case StyleAppearance::Resizer: {
|
||||
HIThemeGrowBoxDrawInfo drawInfo;
|
||||
drawInfo.version = 0;
|
||||
drawInfo.state = kThemeStateActive;
|
||||
drawInfo.kind = kHIThemeGrowBoxKindNormal;
|
||||
drawInfo.direction = kThemeGrowRight | kThemeGrowDown;
|
||||
drawInfo.size = kHIThemeGrowBoxSizeNormal;
|
||||
HIPoint pnt = {0, 0};
|
||||
HIRect bounds;
|
||||
HIThemeGetGrowBoxBounds(&pnt, &drawInfo, &bounds);
|
||||
result.SizeTo(bounds.size.width, bounds.size.height);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3219,8 +3177,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, StyleAppearance aAppear
|
|||
case StyleAppearance::Toolbox:
|
||||
case StyleAppearance::Toolbar:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Tooltip:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Tabpanel:
|
||||
|
@ -3346,20 +3302,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFra
|
|||
case StyleAppearance::Range:
|
||||
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||
|
||||
case StyleAppearance::Resizer: {
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
if (!parentFrame || !parentFrame->IsScrollFrame()) return true;
|
||||
|
||||
// Note that IsWidgetStyled is not called for resizers on Mac. This is
|
||||
// because for scrollable containers, the native resizer looks better
|
||||
// when (non-overlay) scrollbars are present even when the style is
|
||||
// overriden, and the custom transparent resizer looks better when
|
||||
// scrollbars are not present.
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(parentFrame);
|
||||
return (!LookAndFeel::UseOverlayScrollbars() && scrollFrame &&
|
||||
(!scrollFrame->GetScrollbarVisibility().isEmpty()));
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3433,7 +3375,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(StyleAppearance aA
|
|||
case StyleAppearance::Treeline:
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Resizer:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
|
|
@ -315,9 +315,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
|||
case StyleAppearance::Toolbargripper:
|
||||
aGtkWidgetType = MOZ_GTK_GRIPPER;
|
||||
break;
|
||||
case StyleAppearance::Resizer:
|
||||
aGtkWidgetType = MOZ_GTK_RESIZER;
|
||||
break;
|
||||
case StyleAppearance::NumberInput:
|
||||
case StyleAppearance::Textfield:
|
||||
aGtkWidgetType = MOZ_GTK_ENTRY;
|
||||
|
@ -415,10 +412,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
|||
case StyleAppearance::Tooltip:
|
||||
aGtkWidgetType = MOZ_GTK_TOOLTIP;
|
||||
break;
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
aGtkWidgetType = MOZ_GTK_FRAME;
|
||||
break;
|
||||
case StyleAppearance::ProgressBar:
|
||||
aGtkWidgetType = MOZ_GTK_PROGRESSBAR;
|
||||
break;
|
||||
|
@ -1238,10 +1231,6 @@ LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
|||
result.width = 14;
|
||||
result.height = 13;
|
||||
break;
|
||||
case StyleAppearance::Resizer:
|
||||
// same as Windows to make our lives easier
|
||||
result.width = result.height = 15;
|
||||
break;
|
||||
case StyleAppearance::Treetwisty:
|
||||
case StyleAppearance::Treetwistyopen: {
|
||||
gint expander_size;
|
||||
|
@ -1271,9 +1260,6 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame,
|
|||
// Some widget types just never change state.
|
||||
if (aAppearance == StyleAppearance::Toolbox ||
|
||||
aAppearance == StyleAppearance::Toolbar ||
|
||||
aAppearance == StyleAppearance::Statusbar ||
|
||||
aAppearance == StyleAppearance::Statusbarpanel ||
|
||||
aAppearance == StyleAppearance::Resizerpanel ||
|
||||
aAppearance == StyleAppearance::Progresschunk ||
|
||||
aAppearance == StyleAppearance::ProgressBar ||
|
||||
aAppearance == StyleAppearance::Menubar ||
|
||||
|
@ -1360,10 +1346,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
case StyleAppearance::ButtonArrowPrevious:
|
||||
case StyleAppearance::Separator:
|
||||
case StyleAppearance::Toolbargripper:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Resizer:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Treeview:
|
||||
// case StyleAppearance::Treeitem:
|
||||
|
|
|
@ -209,31 +209,6 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
|
|||
return false;
|
||||
}
|
||||
|
||||
// Resizers have some special handling, dependent on whether in a scrollable
|
||||
// container or not. If so, use the scrollable container's to determine
|
||||
// whether the style is overriden instead of the resizer. This allows a
|
||||
// non-native transparent resizer to be used instead. Otherwise, we just
|
||||
// fall through and return false.
|
||||
if (aAppearance == StyleAppearance::Resizer) {
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
if (parentFrame && parentFrame->IsScrollFrame()) {
|
||||
// if the parent is a scrollframe, the resizer should be native themed
|
||||
// only if the scrollable area doesn't override the widget style.
|
||||
//
|
||||
// note that the condition below looks a bit suspect but it's the right
|
||||
// one. If there's no valid appearance, then we should return true, it's
|
||||
// effectively the same as if it had overridden the appearance.
|
||||
parentFrame = parentFrame->GetParent();
|
||||
if (!parentFrame) {
|
||||
return false;
|
||||
}
|
||||
auto parentAppearance =
|
||||
parentFrame->StyleDisplay()->EffectiveAppearance();
|
||||
return parentAppearance == StyleAppearance::None ||
|
||||
IsWidgetStyled(aPresContext, parentFrame, parentAppearance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress bar appearance should be the same for the bar and the container
|
||||
* frame. nsProgressFrame owns the logic and will tell us what we should do.
|
||||
|
|
|
@ -724,11 +724,6 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
|
|||
case StyleAppearance::SpinnerUpbutton:
|
||||
case StyleAppearance::SpinnerDownbutton:
|
||||
return Some(eUXSpin);
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Resizer:
|
||||
return Some(eUXStatus);
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistArrowButton:
|
||||
|
@ -1026,8 +1021,7 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
|||
case StyleAppearance::Toolbox:
|
||||
case StyleAppearance::MozWinMediaToolbox:
|
||||
case StyleAppearance::MozWinCommunicationsToolbox:
|
||||
case StyleAppearance::MozWinBrowsertabbarToolbox:
|
||||
case StyleAppearance::Statusbar: {
|
||||
case StyleAppearance::MozWinBrowsertabbarToolbox: {
|
||||
aState = 0;
|
||||
aPart = RP_BACKGROUND;
|
||||
return NS_OK;
|
||||
|
@ -1048,26 +1042,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Resizer: {
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
aPart = 1;
|
||||
break;
|
||||
case StyleAppearance::Resizerpanel:
|
||||
aPart = 2;
|
||||
break;
|
||||
case StyleAppearance::Resizer:
|
||||
aPart = 3;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Oops, we're missing a case");
|
||||
aPart = 1; // just something valid
|
||||
}
|
||||
aState = TS_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Treeview:
|
||||
case StyleAppearance::Listbox: {
|
||||
aPart = TREEVIEW_BODY;
|
||||
|
@ -1657,8 +1631,7 @@ RENDER_AGAIN:
|
|||
IsFrameRTL(aFrame));
|
||||
}
|
||||
// The following widgets need to be RTL-aware
|
||||
else if (aAppearance == StyleAppearance::Resizer ||
|
||||
aAppearance == StyleAppearance::MozMenulistArrowButton) {
|
||||
else if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
|
||||
DrawThemeBGRTLAware(theme, hdc, part, state, &widgetRect, &clipRect,
|
||||
IsFrameRTL(aFrame));
|
||||
} else if (aAppearance == StyleAppearance::NumberInput ||
|
||||
|
@ -1783,8 +1756,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
|
|||
aAppearance == StyleAppearance::MozWinMediaToolbox ||
|
||||
aAppearance == StyleAppearance::MozWinCommunicationsToolbox ||
|
||||
aAppearance == StyleAppearance::MozWinBrowsertabbarToolbox ||
|
||||
aAppearance == StyleAppearance::Statusbar ||
|
||||
aAppearance == StyleAppearance::Resizer ||
|
||||
aAppearance == StyleAppearance::Tabpanel ||
|
||||
aAppearance == StyleAppearance::Menuitem ||
|
||||
aAppearance == StyleAppearance::Checkmenuitem ||
|
||||
|
@ -2059,7 +2030,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
|||
case StyleAppearance::MozWinCommunicationsToolbox:
|
||||
case StyleAppearance::MozWinBrowsertabbarToolbox:
|
||||
case StyleAppearance::Toolbar:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Tabpanel:
|
||||
|
@ -2116,9 +2086,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
|||
sizeReq = TS_MIN;
|
||||
break;
|
||||
|
||||
case StyleAppearance::Resizer:
|
||||
break;
|
||||
|
||||
case StyleAppearance::RangeThumb: {
|
||||
LayoutDeviceIntSize result(12, 20);
|
||||
if (!IsRangeHorizontal(aFrame)) {
|
||||
|
@ -2233,9 +2200,6 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame,
|
|||
aAppearance == StyleAppearance::MozWinCommunicationsToolbox ||
|
||||
aAppearance == StyleAppearance::MozWinBrowsertabbarToolbox ||
|
||||
aAppearance == StyleAppearance::Toolbar ||
|
||||
aAppearance == StyleAppearance::Statusbar ||
|
||||
aAppearance == StyleAppearance::Statusbarpanel ||
|
||||
aAppearance == StyleAppearance::Resizerpanel ||
|
||||
aAppearance == StyleAppearance::Progresschunk ||
|
||||
aAppearance == StyleAppearance::ProgressBar ||
|
||||
aAppearance == StyleAppearance::Tabpanels ||
|
||||
|
@ -2314,9 +2278,7 @@ bool nsNativeThemeWin::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
else
|
||||
theme = GetTheme(aAppearance);
|
||||
|
||||
if (theme && aAppearance == StyleAppearance::Resizer) return true;
|
||||
|
||||
if ((theme) || (!theme && ClassicThemeSupportsWidget(aFrame, aAppearance)))
|
||||
if (theme || ClassicThemeSupportsWidget(aFrame, aAppearance))
|
||||
// turn off theming for some HTML widgets styled by the page
|
||||
return (!IsWidgetStyled(aPresContext, aFrame, aAppearance));
|
||||
|
||||
|
@ -2424,13 +2386,6 @@ nsITheme::Transparency nsNativeThemeWin::GetWidgetTransparency(
|
|||
bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Resizer: {
|
||||
// The classic native resizer has an opaque grey background which doesn't
|
||||
// match the usually white background of the scrollable container, so
|
||||
// only support the native resizer if not in a scrollframe.
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
return !parentFrame || !parentFrame->IsScrollFrame();
|
||||
}
|
||||
case StyleAppearance::Menubar:
|
||||
case StyleAppearance::Menupopup:
|
||||
// Classic non-flat menus are handled almost entirely through CSS.
|
||||
|
@ -2452,9 +2407,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
|||
case StyleAppearance::SpinnerDownbutton:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Treeview:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::Tab:
|
||||
|
@ -2490,10 +2442,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
|||
case StyleAppearance::Button:
|
||||
result.top = result.left = result.bottom = result.right = 2;
|
||||
break;
|
||||
case StyleAppearance::Statusbar:
|
||||
result.bottom = result.left = result.right = 0;
|
||||
result.top = 2;
|
||||
break;
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Treeview:
|
||||
case StyleAppearance::Menulist:
|
||||
|
@ -2504,14 +2452,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
|||
case StyleAppearance::Textarea:
|
||||
result.top = result.left = result.bottom = result.right = 2;
|
||||
break;
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel: {
|
||||
result.top = 1;
|
||||
result.left = 1;
|
||||
result.bottom = 1;
|
||||
result.right = aFrame->GetNextSibling() ? 3 : 1;
|
||||
break;
|
||||
}
|
||||
case StyleAppearance::ProgressBar:
|
||||
result.top = result.left = result.bottom = result.right = 1;
|
||||
break;
|
||||
|
@ -2608,9 +2548,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
|||
case StyleAppearance::NumberInput:
|
||||
case StyleAppearance::Textfield:
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Tab:
|
||||
|
@ -2618,15 +2555,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
|||
case StyleAppearance::Tabpanels:
|
||||
// no minimum widget size
|
||||
break;
|
||||
case StyleAppearance::Resizer: {
|
||||
NONCLIENTMETRICS nc;
|
||||
nc.cbSize = sizeof(nc);
|
||||
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nc), &nc, 0))
|
||||
result.width = result.height = abs(nc.lfStatusFont.lfHeight) + 4;
|
||||
else
|
||||
result.width = result.height = 15;
|
||||
break;
|
||||
}
|
||||
case StyleAppearance::Menuseparator: {
|
||||
result.width = 0;
|
||||
result.height = 10;
|
||||
|
@ -2804,9 +2732,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
|||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Range:
|
||||
case StyleAppearance::RangeThumb:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Statusbarpanel:
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Tab:
|
||||
|
@ -2878,11 +2803,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Resizer:
|
||||
aPart = DFC_SCROLL;
|
||||
aState =
|
||||
(IsFrameRTL(aFrame)) ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP;
|
||||
return NS_OK;
|
||||
case StyleAppearance::Menuseparator:
|
||||
aPart = 0;
|
||||
aState = 0;
|
||||
|
@ -3137,8 +3057,7 @@ RENDER_AGAIN:
|
|||
case StyleAppearance::Radio:
|
||||
case StyleAppearance::SpinnerUpbutton:
|
||||
case StyleAppearance::SpinnerDownbutton:
|
||||
case StyleAppearance::MozMenulistArrowButton:
|
||||
case StyleAppearance::Resizer: {
|
||||
case StyleAppearance::MozMenulistArrowButton: {
|
||||
int32_t oldTA;
|
||||
// setup DC to make DrawFrameControl draw correctly
|
||||
oldTA = ::SetTextAlign(hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP);
|
||||
|
@ -3187,20 +3106,8 @@ RENDER_AGAIN:
|
|||
::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
|
||||
InflateRect(&widgetRect, -1, -1);
|
||||
[[fallthrough]];
|
||||
case StyleAppearance::Tabpanel:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Resizerpanel: {
|
||||
case StyleAppearance::Tabpanel: {
|
||||
::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_BTNFACE + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
// Draw 3D inset statusbar panel
|
||||
case StyleAppearance::Statusbarpanel: {
|
||||
if (aFrame->GetNextSibling())
|
||||
widgetRect.right -= 2; // space between sibling status panels
|
||||
|
||||
::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
|
||||
|
||||
break;
|
||||
}
|
||||
case StyleAppearance::RangeThumb: {
|
||||
|
|
|
@ -108,8 +108,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) {
|
|||
return L"Trackbar";
|
||||
case eUXSpin:
|
||||
return L"Spin";
|
||||
case eUXStatus:
|
||||
return L"Status";
|
||||
case eUXCombobox:
|
||||
return L"Combobox";
|
||||
case eUXHeader:
|
||||
|
|
|
@ -30,7 +30,6 @@ enum nsUXThemeClass {
|
|||
eUXTab,
|
||||
eUXTrackbar,
|
||||
eUXSpin,
|
||||
eUXStatus,
|
||||
eUXCombobox,
|
||||
eUXHeader,
|
||||
eUXListview,
|
||||
|
|
Загрузка…
Ссылка в новой задаче