Bug 1966427 - Don't use native splitter drawing on GTK. r=desktop-theme-reviewers,dao
GTK4 paned widgets (see gtk4-demo) are only a thin line. For now this does the windows thing as that's low-risk, which looks basically the same as we have now for most themes. We can make it look nicer in the future if needed. Differential Revision: https://phabricator.services.mozilla.com/D249394
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
5d938d8488
commit
8f772fe1b2
@@ -103,15 +103,12 @@
|
||||
|
||||
/* Content area */
|
||||
|
||||
/* stylelint-disable-next-line media-query-no-invalid */
|
||||
@media not -moz-pref("sidebar.revamp") {
|
||||
.sidebar-splitter {
|
||||
appearance: none;
|
||||
width: 6px;
|
||||
background-color: -moz-dialog;
|
||||
border: 1px ThreeDShadow;
|
||||
border-style: none solid;
|
||||
}
|
||||
.sidebar-splitter {
|
||||
appearance: none;
|
||||
width: 6px;
|
||||
background-color: -moz-dialog;
|
||||
border: 1px ThreeDShadow;
|
||||
border-style: none solid;
|
||||
}
|
||||
|
||||
/* Tabstrip */
|
||||
|
||||
@@ -1547,9 +1547,6 @@ pub enum Appearance {
|
||||
/// The down button of a spin control.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
SpinnerDownbutton,
|
||||
/// A splitter. Can be horizontal or vertical.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Splitter,
|
||||
/// A status bar in a main application window.
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
Statusbar,
|
||||
|
||||
@@ -14,16 +14,11 @@ splitter {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: ew-resize;
|
||||
|
||||
@media (-moz-platform: linux) {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: splitter;
|
||||
}
|
||||
@media (-moz-platform: macos) {
|
||||
min-width: 9px;
|
||||
min-height: 9px;
|
||||
}
|
||||
@media (-moz-platform: windows) {
|
||||
@media (-moz-platform: windows) or (-moz-platform: linux) {
|
||||
border-width: 0 1px;
|
||||
border-style: solid;
|
||||
border-inline-start-color: ThreeDHighlight;
|
||||
@@ -52,7 +47,7 @@ splitter[state="collapsed"][substate="before"]:-moz-locale-dir(rtl) {
|
||||
splitter[orient="vertical"] {
|
||||
cursor: ns-resize;
|
||||
|
||||
@media (-moz-platform: windows) {
|
||||
@media (-moz-platform: windows) or (-moz-platform: linux) {
|
||||
border-width: 1px 0;
|
||||
border-top-color: ThreeDHighlight;
|
||||
border-bottom-color: ThreeDShadow;
|
||||
|
||||
@@ -150,18 +150,6 @@ static GtkWidget* CreateTreeHeaderCellWidget() {
|
||||
return gtk_tree_view_column_get_button(middleTreeViewColumn);
|
||||
}
|
||||
|
||||
static GtkWidget* CreateHPanedWidget() {
|
||||
GtkWidget* widget = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
|
||||
AddToWindowContainer(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
static GtkWidget* CreateVPanedWidget() {
|
||||
GtkWidget* widget = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
|
||||
AddToWindowContainer(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
static GtkWidget* CreateNotebookWidget() {
|
||||
GtkWidget* widget = gtk_notebook_new();
|
||||
AddToWindowContainer(widget);
|
||||
@@ -462,10 +450,6 @@ static GtkWidget* CreateWidget(WidgetNodeType aAppearance) {
|
||||
return CreateTreeViewWidget();
|
||||
case MOZ_GTK_TREE_HEADER_CELL:
|
||||
return CreateTreeHeaderCellWidget();
|
||||
case MOZ_GTK_SPLITTER_HORIZONTAL:
|
||||
return CreateHPanedWidget();
|
||||
case MOZ_GTK_SPLITTER_VERTICAL:
|
||||
return CreateVPanedWidget();
|
||||
case MOZ_GTK_NOTEBOOK:
|
||||
return CreateNotebookWidget();
|
||||
case MOZ_GTK_HEADERBAR_WINDOW:
|
||||
@@ -779,12 +763,6 @@ static GtkStyleContext* GetCssNodeStyleInternal(WidgetNodeType aNodeType) {
|
||||
case MOZ_GTK_FRAME_BORDER:
|
||||
style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
|
||||
break;
|
||||
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
|
||||
break;
|
||||
case MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL:
|
||||
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_VERTICAL);
|
||||
break;
|
||||
case MOZ_GTK_TAB_TOP: {
|
||||
// TODO - create from CSS node
|
||||
style = CreateSubStyleWithClass(MOZ_GTK_NOTEBOOK, GTK_STYLE_CLASS_TOP);
|
||||
@@ -866,14 +844,6 @@ static GtkStyleContext* GetWidgetStyleInternal(WidgetNodeType aNodeType) {
|
||||
break;
|
||||
case MOZ_GTK_FRAME_BORDER:
|
||||
return GetWidgetRootStyle(MOZ_GTK_FRAME);
|
||||
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
|
||||
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
||||
break;
|
||||
case MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL:
|
||||
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_VERTICAL,
|
||||
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
||||
break;
|
||||
case MOZ_GTK_TAB_TOP:
|
||||
style = CreateSubStyleWithClass(MOZ_GTK_NOTEBOOK, GTK_STYLE_CLASS_TOP);
|
||||
gtk_style_context_add_region(style, GTK_STYLE_REGION_TAB,
|
||||
|
||||
@@ -153,17 +153,6 @@ void moz_gtk_refresh() {
|
||||
ResetWidgetCache();
|
||||
}
|
||||
|
||||
gint moz_gtk_splitter_get_metrics(gint orientation, gint* size) {
|
||||
GtkStyleContext* style;
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
|
||||
style = GetStyleContext(MOZ_GTK_SPLITTER_HORIZONTAL);
|
||||
} else {
|
||||
style = GetStyleContext(MOZ_GTK_SPLITTER_VERTICAL);
|
||||
}
|
||||
gtk_style_context_get_style(style, "handle_size", size, NULL);
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static void CalculateToolbarButtonMetrics(WidgetNodeType aAppearance,
|
||||
ToolbarButtonGTKMetrics* aMetrics,
|
||||
gint* aMaxInlineMargin) {
|
||||
@@ -326,24 +315,6 @@ static gint moz_gtk_window_decoration_paint(cairo_t* cr,
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint moz_gtk_hpaned_paint(cairo_t* cr, GdkRectangle* rect,
|
||||
GtkWidgetState* state) {
|
||||
GtkStyleContext* style =
|
||||
GetStyleContext(MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL, state->image_scale,
|
||||
GTK_TEXT_DIR_LTR, GetStateFlagsFromGtkWidgetState(state));
|
||||
gtk_render_handle(style, cr, rect->x, rect->y, rect->width, rect->height);
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint moz_gtk_vpaned_paint(cairo_t* cr, GdkRectangle* rect,
|
||||
GtkWidgetState* state) {
|
||||
GtkStyleContext* style =
|
||||
GetStyleContext(MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL, state->image_scale,
|
||||
GTK_TEXT_DIR_LTR, GetStateFlagsFromGtkWidgetState(state));
|
||||
gtk_render_handle(style, cr, rect->x, rect->y, rect->width, rect->height);
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint moz_gtk_resizer_paint(cairo_t* cr, GdkRectangle* rect,
|
||||
GtkWidgetState* state,
|
||||
GtkTextDirection direction) {
|
||||
@@ -624,8 +595,6 @@ gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
|
||||
w = GetWidget(MOZ_GTK_FRAME);
|
||||
break;
|
||||
/* These widgets have no borders, since they are not containers. */
|
||||
case MOZ_GTK_SPLITTER_HORIZONTAL:
|
||||
case MOZ_GTK_SPLITTER_VERTICAL:
|
||||
case MOZ_GTK_HEADER_BAR:
|
||||
case MOZ_GTK_HEADER_BAR_MAXIMIZED:
|
||||
/* These widgets have no borders.*/
|
||||
@@ -721,10 +690,6 @@ gint moz_gtk_widget_paint(WidgetNodeType widget, cairo_t* cr,
|
||||
widget);
|
||||
case MOZ_GTK_TABPANELS:
|
||||
return moz_gtk_tabpanels_paint(cr, rect, state, direction);
|
||||
case MOZ_GTK_SPLITTER_HORIZONTAL:
|
||||
return moz_gtk_vpaned_paint(cr, rect, state);
|
||||
case MOZ_GTK_SPLITTER_VERTICAL:
|
||||
return moz_gtk_hpaned_paint(cr, rect, state);
|
||||
case MOZ_GTK_WINDOW_DECORATION:
|
||||
return moz_gtk_window_decoration_paint(cr, rect, state, direction);
|
||||
default:
|
||||
|
||||
@@ -164,14 +164,6 @@ enum WidgetNodeType : int {
|
||||
MOZ_GTK_MENUITEM,
|
||||
/* Menubar menuitem for foreground colors. */
|
||||
MOZ_GTK_MENUBARITEM,
|
||||
/* GtkVPaned base class */
|
||||
MOZ_GTK_SPLITTER_HORIZONTAL,
|
||||
/* GtkHPaned base class */
|
||||
MOZ_GTK_SPLITTER_VERTICAL,
|
||||
/* Paints a GtkVPaned separator */
|
||||
MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL,
|
||||
/* Paints a GtkHPaned separator */
|
||||
MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL,
|
||||
/* Paints the background of a window, dialog or page. */
|
||||
MOZ_GTK_WINDOW,
|
||||
/* Used only as a container for MOZ_GTK_HEADER_BAR. */
|
||||
|
||||
@@ -220,12 +220,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||
if (IsFirstTab(aFrame)) *aWidgetFlags |= MOZ_GTK_TAB_FIRST;
|
||||
}
|
||||
} break;
|
||||
case StyleAppearance::Splitter:
|
||||
if (IsHorizontal(aFrame))
|
||||
aGtkWidgetType = MOZ_GTK_SPLITTER_VERTICAL;
|
||||
else
|
||||
aGtkWidgetType = MOZ_GTK_SPLITTER_HORIZONTAL;
|
||||
break;
|
||||
case StyleAppearance::MozWindowDecorations:
|
||||
aGtkWidgetType = MOZ_GTK_WINDOW_DECORATION;
|
||||
break;
|
||||
@@ -772,22 +766,7 @@ LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
||||
if (IsWidgetAlwaysNonNative(aFrame, aAppearance)) {
|
||||
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
CSSIntSize result;
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Splitter: {
|
||||
if (IsHorizontal(aFrame)) {
|
||||
moz_gtk_splitter_get_metrics(GTK_ORIENTATION_HORIZONTAL, &result.width);
|
||||
} else {
|
||||
moz_gtk_splitter_get_metrics(GTK_ORIENTATION_VERTICAL, &result.height);
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return LayoutDeviceIntSize::Round(CSSSize(result) *
|
||||
GetWidgetScaleFactor(aFrame));
|
||||
return {};
|
||||
}
|
||||
|
||||
bool nsNativeThemeGTK::WidgetAttributeChangeRequiresRepaint(
|
||||
@@ -825,7 +804,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case StyleAppearance::Tab:
|
||||
// case StyleAppearance::Tabpanel:
|
||||
case StyleAppearance::Tabpanels:
|
||||
case StyleAppearance::Splitter:
|
||||
case StyleAppearance::MozWindowTitlebar:
|
||||
case StyleAppearance::MozWindowTitlebarMaximized:
|
||||
case StyleAppearance::MozWindowDecorations:
|
||||
|
||||
Reference in New Issue
Block a user