From 60ef90b3554b0b79ea55772e8fc1c764590d2689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 May 2025 12:29:22 +0000 Subject: [PATCH] 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 --- browser/themes/osx/browser.css | 22 --- browser/themes/shared/tabbrowser/tabs.css | 4 +- .../components/style/values/specified/box.rs | 6 - toolkit/themes/linux/global/jar.mn | 1 - toolkit/themes/osx/global/jar.mn | 1 - toolkit/themes/osx/global/tabbox.css | 64 ------ toolkit/themes/shared/desktop-jar.inc.mn | 1 + .../shared/in-content/common-shared.css | 11 -- .../{linux/global => shared}/tabbox.css | 1 - toolkit/themes/windows/global/jar.mn | 1 - toolkit/themes/windows/global/tabbox.css | 55 ------ widget/cocoa/nsNativeThemeCocoa.h | 6 +- widget/cocoa/nsNativeThemeCocoa.mm | 58 +----- widget/windows/nsNativeThemeWin.cpp | 183 ------------------ 14 files changed, 6 insertions(+), 408 deletions(-) delete mode 100644 toolkit/themes/osx/global/tabbox.css rename toolkit/themes/{linux/global => shared}/tabbox.css (99%) delete mode 100644 toolkit/themes/windows/global/tabbox.css diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 9f795cd5b67b..29be501ded23 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -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 */ diff --git a/browser/themes/shared/tabbrowser/tabs.css b/browser/themes/shared/tabbrowser/tabs.css index 01b3fe46c2ed..d7d9a40e8c47 100644 --- a/browser/themes/shared/tabbrowser/tabs.css +++ b/browser/themes/shared/tabbrowser/tabs.css @@ -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: ""; diff --git a/servo/components/style/values/specified/box.rs b/servo/components/style/values/specified/box.rs index e385a96ebc87..29133e275ce4 100644 --- a/servo/components/style/values/specified/box.rs +++ b/servo/components/style/values/specified/box.rs @@ -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, diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn index 3ec3333f59f6..1a897380f3ad 100644 --- a/toolkit/themes/linux/global/jar.mn +++ b/toolkit/themes/linux/global/jar.mn @@ -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) diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn index c991bd1749c6..f04a47fb7962 100644 --- a/toolkit/themes/osx/global/jar.mn +++ b/toolkit/themes/osx/global/jar.mn @@ -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) diff --git a/toolkit/themes/osx/global/tabbox.css b/toolkit/themes/osx/global/tabbox.css deleted file mode 100644 index aff23fa58145..000000000000 --- a/toolkit/themes/osx/global/tabbox.css +++ /dev/null @@ -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; -} diff --git a/toolkit/themes/shared/desktop-jar.inc.mn b/toolkit/themes/shared/desktop-jar.inc.mn index e4538da31782..9f41a9206d65 100644 --- a/toolkit/themes/shared/desktop-jar.inc.mn +++ b/toolkit/themes/shared/desktop-jar.inc.mn @@ -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) diff --git a/toolkit/themes/shared/in-content/common-shared.css b/toolkit/themes/shared/in-content/common-shared.css index 5717d70180de..1294f66f8cf8 100644 --- a/toolkit/themes/shared/in-content/common-shared.css +++ b/toolkit/themes/shared/in-content/common-shared.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); diff --git a/toolkit/themes/linux/global/tabbox.css b/toolkit/themes/shared/tabbox.css similarity index 99% rename from toolkit/themes/linux/global/tabbox.css rename to toolkit/themes/shared/tabbox.css index 310ee849478d..853bbb1e0ace 100644 --- a/toolkit/themes/linux/global/tabbox.css +++ b/toolkit/themes/shared/tabbox.css @@ -8,7 +8,6 @@ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - /* ::::: tabs ::::: */ tabs { diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn index 2eb1f89b9bbc..e9573cbb65fa 100644 --- a/toolkit/themes/windows/global/jar.mn +++ b/toolkit/themes/windows/global/jar.mn @@ -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 diff --git a/toolkit/themes/windows/global/tabbox.css b/toolkit/themes/windows/global/tabbox.css deleted file mode 100644 index e911e1bcd06c..000000000000 --- a/toolkit/themes/windows/global/tabbox.css +++ /dev/null @@ -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; -} diff --git a/widget/cocoa/nsNativeThemeCocoa.h b/widget/cocoa/nsNativeThemeCocoa.h index ada696bae0e7..8f41c3547f80 100644 --- a/widget/cocoa/nsNativeThemeCocoa.h +++ b/widget/cocoa/nsNativeThemeCocoa.h @@ -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 T Params() const { diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 4e25107d5270..f49bed53cc04 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -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::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::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(); - 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(kMaxFocusRingWidth), static_cast(kMaxFocusRingWidth), static_cast(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: diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index cef577e51300..ff759a343ce3 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -490,9 +490,6 @@ mozilla::Maybe 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;