Bug 1967551 - Remove native tabbox support. r=desktop-theme-reviewers,mac-reviewers,win-reviewers,tabbrowser-reviewers,gstoll,mstange,dao
Eventually I want to simplify a lot of how the theming code deals with overriding border / padding, and this helps with that. Since bug 1765076 this isn't used anywhere, so I think simplifying this is the right trade-off. Thunderbird also doesn't use it. Differential Revision: https://phabricator.services.mozilla.com/D250314
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
294861d1cd
commit
60ef90b355
@@ -191,28 +191,6 @@
|
||||
|
||||
.tabbrowser-tab {
|
||||
border: none;
|
||||
|
||||
/* FIXME: Are these styles really needed nowadays? */
|
||||
&:is([visuallyselected], [multiselected]) {
|
||||
/* overriding tabbox.css */
|
||||
text-shadow: inherit;
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root:not([lwtheme]) & {
|
||||
/* overriding tabbox.css */
|
||||
color: hsl(240, 5%, 5%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#tabbrowser-tabs {
|
||||
/* overriding tabbox.css */
|
||||
font: message-box;
|
||||
align-items: stretch;
|
||||
margin-bottom: 0;
|
||||
position: static;
|
||||
z-index: auto;
|
||||
}
|
||||
|
||||
/* Bookmark drag and drop styles */
|
||||
|
||||
@@ -119,6 +119,9 @@
|
||||
}
|
||||
|
||||
#tabbrowser-tabs {
|
||||
/* Overriding tabbox.css */
|
||||
border: 0;
|
||||
|
||||
/* Use a bigger flex value than the searchbar to prevent it from
|
||||
* taking all the toolbar space. */
|
||||
flex: 1000 1000;
|
||||
@@ -1572,7 +1575,6 @@ tab-group {
|
||||
flex-direction: column;
|
||||
align-content: flex-start;
|
||||
grid-gap: var(--space-small);
|
||||
padding: 0; /* override tabbox.css on macOS */
|
||||
|
||||
&[overflow]::after {
|
||||
content: "";
|
||||
|
||||
@@ -1550,12 +1550,6 @@ pub enum Appearance {
|
||||
/// A status bar in a main application window.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Statusbar,
|
||||
/// A single tab in a tab widget.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Tab,
|
||||
/// The tab panels container.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Tabpanels,
|
||||
/// A single toolbar button (with no associated dropdown).
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Toolbarbutton,
|
||||
|
||||
@@ -8,7 +8,6 @@ toolkit.jar:
|
||||
skin/classic/global/autocomplete.css
|
||||
skin/classic/global/global.css
|
||||
skin/classic/global/richlistbox.css
|
||||
skin/classic/global/tabbox.css
|
||||
skin/classic/global/toolbar.css
|
||||
|
||||
skin/classic/global/icons/Authentication.png (icons/Authentication.png)
|
||||
|
||||
@@ -10,7 +10,6 @@ toolkit.jar:
|
||||
skin/classic/global/dialog.css
|
||||
skin/classic/global/global.css
|
||||
skin/classic/global/richlistbox.css
|
||||
skin/classic/global/tabbox.css
|
||||
skin/classic/global/toolbar.css
|
||||
skin/classic/global/wizard.css
|
||||
skin/classic/global/arrow/panelarrow-vertical.svg (arrow/panelarrow-vertical.svg)
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
The default style of these tabs is that of an NSTabView with tabs at
|
||||
the top in the "regular" size. These tabs can be used with or without
|
||||
a tabbox element.
|
||||
*/
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
tabbox {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
tabpanels {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: tabpanels;
|
||||
padding: 33px 15px 15px;
|
||||
}
|
||||
|
||||
tabs {
|
||||
align-items: center;
|
||||
font: menu;
|
||||
padding: 0 10px;
|
||||
margin-bottom: -12px;
|
||||
position: relative;
|
||||
/* Needs to sort on top of the tabbox, which is a grid container (and thus
|
||||
* causes pseudo stacking contexts to be created) */
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
tab {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: tab;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
tab:-moz-focusring {
|
||||
/* Tab focus rings need to overlay adjacent tabs. */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
tab:where(:first-of-type) {
|
||||
padding-inline-start: 2px;
|
||||
}
|
||||
|
||||
tab:where(:last-of-type) {
|
||||
padding-inline-end: 2px;
|
||||
}
|
||||
|
||||
tab:where([visuallyselected]:not(:-moz-window-inactive)) {
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.tab-middle {
|
||||
padding: 1px 6px 2px;
|
||||
}
|
||||
|
||||
.tabs-left,
|
||||
.tabs-right {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -43,6 +43,7 @@
|
||||
skin/classic/global/popup.css (../../shared/popup.css)
|
||||
skin/classic/global/popupnotification.css (../../shared/popupnotification.css)
|
||||
skin/classic/global/splitter.css (../../shared/splitter.css)
|
||||
skin/classic/global/tabbox.css (../../shared/tabbox.css)
|
||||
skin/classic/global/toolbarbutton.css (../../shared/toolbarbutton.css)
|
||||
skin/classic/global/tree/tree.css (../../shared/tree/tree.css)
|
||||
skin/classic/global/dirListing/dirListing.css (../../shared/dirListing/dirListing.css)
|
||||
|
||||
@@ -204,31 +204,20 @@ html|hr {
|
||||
/* tabpanels and tabs */
|
||||
|
||||
xul|tabpanels {
|
||||
appearance: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
color-scheme: unset;
|
||||
}
|
||||
|
||||
xul|tabs {
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid var(--in-content-border-color);
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
xul|tab {
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
padding: 2px 20px 0;
|
||||
min-height: 44px;
|
||||
color: inherit;
|
||||
background-color: transparent;
|
||||
border-bottom: 2px solid transparent;
|
||||
transition: background-color 50ms ease 0s;
|
||||
color-scheme: unset;
|
||||
|
||||
&:where(:hover) {
|
||||
border-bottom-color: var(--in-content-border-color);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
|
||||
/* ::::: tabs ::::: */
|
||||
|
||||
tabs {
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
toolkit.jar:
|
||||
skin/classic/global/autocomplete.css
|
||||
skin/classic/global/tabbox.css
|
||||
skin/classic/global/global.css
|
||||
skin/classic/global/printPageSetup.css
|
||||
skin/classic/global/richlistbox.css
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* ===== tabbox.css =================================================
|
||||
== Styles used by XUL tab-related elements.
|
||||
======================================================================= */
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: tabpanels ::::: */
|
||||
|
||||
tabpanels {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: tabpanels;
|
||||
padding: 8px;
|
||||
color: -moz-DialogText;
|
||||
/* These don't have non-native theme support, so force them to light mode to
|
||||
* use the native windows theme. */
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
/* ::::: tab ::::: */
|
||||
|
||||
tab {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: tab;
|
||||
margin-top: 2px;
|
||||
padding: 1px 4px 2px;
|
||||
color: -moz-DialogText;
|
||||
/* These don't have non-native theme support, so force them to light mode to
|
||||
* use the native windows theme. */
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
tab:where([visuallyselected]) {
|
||||
margin-top: 0;
|
||||
padding: 1px 6px 4px;
|
||||
}
|
||||
|
||||
tab:where(:first-of-type[visuallyselected]) {
|
||||
padding-inline: 5px;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
tab:focus-visible > .tab-middle {
|
||||
outline: var(--default-focusring);
|
||||
}
|
||||
|
||||
.tabs-right {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||
eDisclosureButtonOpen
|
||||
};
|
||||
|
||||
enum class SegmentType : uint8_t { eToolbarButton, eTab };
|
||||
enum class SegmentType : uint8_t { eToolbarButton };
|
||||
|
||||
enum class OptimumState : uint8_t { eOptimum, eSubOptimum, eSubSubOptimum };
|
||||
|
||||
@@ -149,7 +149,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||
eScale, // ScaleParams
|
||||
eMultilineTextField, // bool
|
||||
eListBox,
|
||||
eTabPanel,
|
||||
};
|
||||
|
||||
struct WidgetInfo {
|
||||
@@ -199,9 +198,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||
return WidgetInfo(Widget::eMultilineTextField, aParams);
|
||||
}
|
||||
static WidgetInfo ListBox() { return WidgetInfo(Widget::eListBox, false); }
|
||||
static WidgetInfo TabPanel(bool aParams) {
|
||||
return WidgetInfo(Widget::eTabPanel, aParams);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T Params() const {
|
||||
|
||||
@@ -1683,24 +1683,6 @@ void nsNativeThemeCocoa::DrawMeter(CGContextRef cgContext,
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK
|
||||
}
|
||||
|
||||
void nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext,
|
||||
const HIRect& inBoxRect,
|
||||
bool aIsInsideActiveWindow) {
|
||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||
|
||||
HIThemeTabPaneDrawInfo tpdi;
|
||||
|
||||
tpdi.version = 1;
|
||||
tpdi.state = aIsInsideActiveWindow ? kThemeStateActive : kThemeStateInactive;
|
||||
tpdi.direction = kThemeTabNorth;
|
||||
tpdi.size = kHIThemeTabSizeNormal;
|
||||
tpdi.kind = kHIThemeTabKindNormal;
|
||||
|
||||
HIThemeDrawTabPane(&inBoxRect, &tpdi, cgContext, HITHEME_ORIENTATION);
|
||||
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
Maybe<nsNativeThemeCocoa::ScaleParams>
|
||||
nsNativeThemeCocoa::ComputeHTMLScaleParams(nsIFrame* aFrame,
|
||||
ElementState aEventState) {
|
||||
@@ -1806,11 +1788,6 @@ struct SegmentedControlRenderSettings {
|
||||
const NSString* widgetName;
|
||||
};
|
||||
|
||||
static const CGFloat tabHeights[3] = {17, 20, 23};
|
||||
|
||||
static const SegmentedControlRenderSettings tabRenderSettings = {tabHeights,
|
||||
@"tab"};
|
||||
|
||||
static const CGFloat toolbarButtonHeights[3] = {15, 18, 22};
|
||||
|
||||
static const SegmentedControlRenderSettings toolbarButtonRenderSettings = {
|
||||
@@ -1840,8 +1817,6 @@ static SegmentedControlRenderSettings RenderSettingsForSegmentType(
|
||||
switch (aSegmentType) {
|
||||
case nsNativeThemeCocoa::SegmentType::eToolbarButton:
|
||||
return toolbarButtonRenderSettings;
|
||||
case nsNativeThemeCocoa::SegmentType::eTab:
|
||||
return tabRenderSettings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2117,17 +2092,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||
|
||||
case StyleAppearance::Listbox:
|
||||
return Some(WidgetInfo::ListBox());
|
||||
|
||||
case StyleAppearance::Tab: {
|
||||
SegmentParams params =
|
||||
ComputeSegmentParams(aFrame, elementState, SegmentType::eTab);
|
||||
params.pressed = params.pressed && !params.selected;
|
||||
return Some(WidgetInfo::Segment(params));
|
||||
}
|
||||
|
||||
case StyleAppearance::Tabpanels:
|
||||
return Some(WidgetInfo::TabPanel(FrameIsInActiveWindow(aFrame)));
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2319,11 +2283,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case Widget::eTabPanel: {
|
||||
bool isInsideActiveWindow = aWidgetInfo.Params<bool>();
|
||||
DrawTabPanel(cgContext, macRect, isInsideActiveWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the base CTM.
|
||||
@@ -2377,9 +2336,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
||||
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
@@ -2541,8 +2497,7 @@ bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MozMenulistArrowButton:
|
||||
case StyleAppearance::Checkbox:
|
||||
case StyleAppearance::Radio:
|
||||
case StyleAppearance::Tab: {
|
||||
case StyleAppearance::Radio: {
|
||||
overflow.SizeTo(static_cast<int32_t>(kMaxFocusRingWidth),
|
||||
static_cast<int32_t>(kMaxFocusRingWidth),
|
||||
static_cast<int32_t>(kMaxFocusRingWidth),
|
||||
@@ -2651,11 +2606,6 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(
|
||||
break;
|
||||
}
|
||||
|
||||
case StyleAppearance::Tab: {
|
||||
result.SizeTo(0, tabHeights[miniControlSize]);
|
||||
break;
|
||||
}
|
||||
|
||||
case StyleAppearance::RangeThumb: {
|
||||
SInt32 width = 0;
|
||||
SInt32 height = 0;
|
||||
@@ -2690,7 +2640,6 @@ bool nsNativeThemeCocoa::WidgetAttributeChangeRequiresRepaint(
|
||||
case StyleAppearance::MozSidebar:
|
||||
case StyleAppearance::Statusbar:
|
||||
case StyleAppearance::Tooltip:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Menupopup:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::ProgressBar:
|
||||
@@ -2750,10 +2699,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case StyleAppearance::Meter:
|
||||
case StyleAppearance::Meterchunk:
|
||||
case StyleAppearance::Separator:
|
||||
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Tab:
|
||||
|
||||
case StyleAppearance::Range:
|
||||
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||
|
||||
@@ -2810,7 +2755,6 @@ bool nsNativeThemeCocoa::ThemeNeedsComboboxDropmarker() { return false; }
|
||||
bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(
|
||||
StyleAppearance aAppearance) {
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Menupopup:
|
||||
case StyleAppearance::Tooltip:
|
||||
case StyleAppearance::Separator:
|
||||
|
||||
@@ -490,9 +490,6 @@ mozilla::Maybe<UXThemeClass> nsNativeThemeWin::GetThemeClass(
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Progresschunk:
|
||||
return Some(UXThemeClass::Progress);
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
return Some(UXThemeClass::Tab);
|
||||
case StyleAppearance::Range:
|
||||
case StyleAppearance::RangeThumb:
|
||||
return Some(UXThemeClass::Trackbar);
|
||||
@@ -715,32 +712,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||
aState = TS_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Tabpanels: {
|
||||
aPart = TABP_PANELS;
|
||||
aState = TS_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Tab: {
|
||||
aPart = TABP_TAB;
|
||||
if (!aFrame) {
|
||||
aState = TS_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ElementState elementState = GetContentState(aFrame, aAppearance);
|
||||
if (elementState.HasState(ElementState::DISABLED)) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (IsSelectedTab(aFrame)) {
|
||||
aPart = TABP_TAB_SELECTED;
|
||||
aState = TS_ACTIVE; // The selected tab is always "pressed".
|
||||
} else
|
||||
aState = StandardGetState(aFrame, aAppearance, true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::Menulist: {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
bool useDropBorder = content && content->IsHTMLElement();
|
||||
@@ -866,33 +837,6 @@ RENDER_AGAIN:
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aAppearance == StyleAppearance::Tab) {
|
||||
// For left edge and right edge tabs, we need to adjust the widget
|
||||
// rects and clip rects so that the edges don't get drawn.
|
||||
bool isLeft = IsLeftToSelectedTab(aFrame);
|
||||
bool isRight = !isLeft && IsRightToSelectedTab(aFrame);
|
||||
|
||||
if (isLeft || isRight) {
|
||||
// HACK ALERT: There appears to be no way to really obtain this value, so
|
||||
// we're forced to just use the default value for Luna (which also happens
|
||||
// to be correct for all the other skins I've tried).
|
||||
int32_t edgeSize = 2;
|
||||
|
||||
// Armed with the size of the edge, we now need to either shift to the
|
||||
// left or to the right. The clip rect won't include this extra area, so
|
||||
// we know that we're effectively shifting the edge out of view (such that
|
||||
// it won't be painted).
|
||||
if (isLeft)
|
||||
// The right edge should not be drawn. Extend our rect by the edge
|
||||
// size.
|
||||
widgetRect.right += edgeSize;
|
||||
else
|
||||
// The left edge should not be drawn. Move the widget rect's left coord
|
||||
// back.
|
||||
widgetRect.left -= edgeSize;
|
||||
}
|
||||
}
|
||||
|
||||
// widgetRect is the bounding box for a widget, yet the scale track is only
|
||||
// a small portion of this size, so the edges of the scale need to be
|
||||
// adjusted to the real size of the track.
|
||||
@@ -1042,16 +986,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
|
||||
result = GetCachedWidgetBorder(theme, themeClass.value(), aAppearance, part,
|
||||
state);
|
||||
|
||||
// Remove the edges for tabs that are before or after the selected tab,
|
||||
if (aAppearance == StyleAppearance::Tab) {
|
||||
if (IsLeftToSelectedTab(aFrame))
|
||||
// Remove the right edge, since we won't be drawing it.
|
||||
result.right = 0;
|
||||
else if (IsRightToSelectedTab(aFrame))
|
||||
// Remove the left edge, since we won't be drawing it.
|
||||
result.left = 0;
|
||||
}
|
||||
|
||||
if (aFrame && (aAppearance == StyleAppearance::NumberInput ||
|
||||
aAppearance == StyleAppearance::PasswordInput ||
|
||||
aAppearance == StyleAppearance::Textfield ||
|
||||
@@ -1175,7 +1109,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
||||
case StyleAppearance::PasswordInput:
|
||||
case StyleAppearance::Textfield:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Listbox:
|
||||
return {}; // Don't worry about it.
|
||||
default:
|
||||
@@ -1243,7 +1176,6 @@ bool nsNativeThemeWin::WidgetAttributeChangeRequiresRepaint(
|
||||
// Some widget types just never change state.
|
||||
if (aAppearance == StyleAppearance::Progresschunk ||
|
||||
aAppearance == StyleAppearance::ProgressBar ||
|
||||
aAppearance == StyleAppearance::Tabpanels ||
|
||||
aAppearance == StyleAppearance::Separator) {
|
||||
return false;
|
||||
}
|
||||
@@ -1344,8 +1276,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -1361,7 +1291,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
||||
break;
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::NumberInput:
|
||||
case StyleAppearance::PasswordInput:
|
||||
case StyleAppearance::Textfield:
|
||||
@@ -1415,8 +1344,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
// no minimum widget size
|
||||
break;
|
||||
|
||||
@@ -1475,8 +1402,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||
case StyleAppearance::RangeThumb:
|
||||
case StyleAppearance::Progresschunk:
|
||||
case StyleAppearance::ProgressBar:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::Tabpanels:
|
||||
// these don't use DrawFrameControl
|
||||
return NS_OK;
|
||||
default:
|
||||
@@ -1484,100 +1409,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||
}
|
||||
}
|
||||
|
||||
// Draw classic Windows tab
|
||||
// (no system API for this, but DrawEdge can draw all the parts of a tab)
|
||||
static void DrawTab(HDC hdc, const RECT& R, int32_t aPosition, bool aSelected,
|
||||
bool aDrawLeft, bool aDrawRight) {
|
||||
int32_t leftFlag, topFlag, rightFlag, lightFlag, shadeFlag;
|
||||
RECT topRect, sideRect, bottomRect, lightRect, shadeRect;
|
||||
int32_t selectedOffset, lOffset, rOffset;
|
||||
|
||||
selectedOffset = aSelected ? 1 : 0;
|
||||
lOffset = aDrawLeft ? 2 : 0;
|
||||
rOffset = aDrawRight ? 2 : 0;
|
||||
|
||||
// Get info for tab orientation/position (Left, Top, Right, Bottom)
|
||||
switch (aPosition) {
|
||||
case BF_LEFT:
|
||||
leftFlag = BF_TOP;
|
||||
topFlag = BF_LEFT;
|
||||
rightFlag = BF_BOTTOM;
|
||||
lightFlag = BF_DIAGONAL_ENDTOPRIGHT;
|
||||
shadeFlag = BF_DIAGONAL_ENDBOTTOMRIGHT;
|
||||
|
||||
::SetRect(&topRect, R.left, R.top + lOffset, R.right, R.bottom - rOffset);
|
||||
::SetRect(&sideRect, R.left + 2, R.top, R.right - 2 + selectedOffset,
|
||||
R.bottom);
|
||||
::SetRect(&bottomRect, R.right - 2, R.top, R.right, R.bottom);
|
||||
::SetRect(&lightRect, R.left, R.top, R.left + 3, R.top + 3);
|
||||
::SetRect(&shadeRect, R.left + 1, R.bottom - 2, R.left + 2, R.bottom - 1);
|
||||
break;
|
||||
case BF_TOP:
|
||||
leftFlag = BF_LEFT;
|
||||
topFlag = BF_TOP;
|
||||
rightFlag = BF_RIGHT;
|
||||
lightFlag = BF_DIAGONAL_ENDTOPRIGHT;
|
||||
shadeFlag = BF_DIAGONAL_ENDBOTTOMRIGHT;
|
||||
|
||||
::SetRect(&topRect, R.left + lOffset, R.top, R.right - rOffset, R.bottom);
|
||||
::SetRect(&sideRect, R.left, R.top + 2, R.right,
|
||||
R.bottom - 1 + selectedOffset);
|
||||
::SetRect(&bottomRect, R.left, R.bottom - 1, R.right, R.bottom);
|
||||
::SetRect(&lightRect, R.left, R.top, R.left + 3, R.top + 3);
|
||||
::SetRect(&shadeRect, R.right - 2, R.top + 1, R.right - 1, R.top + 2);
|
||||
break;
|
||||
case BF_RIGHT:
|
||||
leftFlag = BF_TOP;
|
||||
topFlag = BF_RIGHT;
|
||||
rightFlag = BF_BOTTOM;
|
||||
lightFlag = BF_DIAGONAL_ENDTOPLEFT;
|
||||
shadeFlag = BF_DIAGONAL_ENDBOTTOMLEFT;
|
||||
|
||||
::SetRect(&topRect, R.left, R.top + lOffset, R.right, R.bottom - rOffset);
|
||||
::SetRect(&sideRect, R.left + 2 - selectedOffset, R.top, R.right - 2,
|
||||
R.bottom);
|
||||
::SetRect(&bottomRect, R.left, R.top, R.left + 2, R.bottom);
|
||||
::SetRect(&lightRect, R.right - 3, R.top, R.right - 1, R.top + 2);
|
||||
::SetRect(&shadeRect, R.right - 2, R.bottom - 3, R.right, R.bottom - 1);
|
||||
break;
|
||||
case BF_BOTTOM:
|
||||
leftFlag = BF_LEFT;
|
||||
topFlag = BF_BOTTOM;
|
||||
rightFlag = BF_RIGHT;
|
||||
lightFlag = BF_DIAGONAL_ENDTOPLEFT;
|
||||
shadeFlag = BF_DIAGONAL_ENDBOTTOMLEFT;
|
||||
|
||||
::SetRect(&topRect, R.left + lOffset, R.top, R.right - rOffset, R.bottom);
|
||||
::SetRect(&sideRect, R.left, R.top + 2 - selectedOffset, R.right,
|
||||
R.bottom - 2);
|
||||
::SetRect(&bottomRect, R.left, R.top, R.right, R.top + 2);
|
||||
::SetRect(&lightRect, R.left, R.bottom - 3, R.left + 2, R.bottom - 1);
|
||||
::SetRect(&shadeRect, R.right - 2, R.bottom - 3, R.right, R.bottom - 1);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
// Background
|
||||
::FillRect(hdc, &R, (HBRUSH)(COLOR_3DFACE + 1));
|
||||
|
||||
// Tab "Top"
|
||||
::DrawEdge(hdc, &topRect, EDGE_RAISED, BF_SOFT | topFlag);
|
||||
|
||||
// Tab "Bottom"
|
||||
if (!aSelected) ::DrawEdge(hdc, &bottomRect, EDGE_RAISED, BF_SOFT | topFlag);
|
||||
|
||||
// Tab "Sides"
|
||||
if (!aDrawLeft) leftFlag = 0;
|
||||
if (!aDrawRight) rightFlag = 0;
|
||||
::DrawEdge(hdc, &sideRect, EDGE_RAISED, BF_SOFT | leftFlag | rightFlag);
|
||||
|
||||
// Tab Diagonal Corners
|
||||
if (aDrawLeft) ::DrawEdge(hdc, &lightRect, EDGE_RAISED, BF_SOFT | lightFlag);
|
||||
|
||||
if (aDrawRight) ::DrawEdge(hdc, &shadeRect, EDGE_RAISED, BF_SOFT | shadeFlag);
|
||||
}
|
||||
|
||||
void nsNativeThemeWin::DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore,
|
||||
int32_t back, HBRUSH defaultBack) {
|
||||
static WORD patBits[8] = {0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55};
|
||||
@@ -1742,20 +1573,6 @@ RENDER_AGAIN:
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw Tab
|
||||
case StyleAppearance::Tab: {
|
||||
DrawTab(hdc, widgetRect, IsBottomTab(aFrame) ? BF_BOTTOM : BF_TOP,
|
||||
IsSelectedTab(aFrame), !IsRightToSelectedTab(aFrame),
|
||||
!IsLeftToSelectedTab(aFrame));
|
||||
|
||||
break;
|
||||
}
|
||||
case StyleAppearance::Tabpanels:
|
||||
::DrawEdge(hdc, &widgetRect, EDGE_RAISED,
|
||||
BF_SOFT | BF_MIDDLE | BF_LEFT | BF_RIGHT | BF_BOTTOM);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user