summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-06 09:16:44 -0500
committertrav90 <travawine@protonmail.ch>2018-04-06 09:16:44 -0500
commit17a7b835d547b4b412458c10264bccde9e0767c5 (patch)
treedd672d569b31d78fdef8eb5ea8ebd0d98083e963 /widget
parent08f07544062212ad6d89a68d921e0039d95a6954 (diff)
downloadUXP-17a7b835d547b4b412458c10264bccde9e0767c5.tar
UXP-17a7b835d547b4b412458c10264bccde9e0767c5.tar.gz
UXP-17a7b835d547b4b412458c10264bccde9e0767c5.tar.lz
UXP-17a7b835d547b4b412458c10264bccde9e0767c5.tar.xz
UXP-17a7b835d547b4b412458c10264bccde9e0767c5.zip
[GTK3] Consider textview root node background in addition to text node for -moz-appearance:textfield-multiline
This is necessary for GTK versions > 3.18 because windows no longer clear their backgrounds since https://git.gnome.org/browse/gtk+/commit/?id=580ea227a6bb19ad6c6d4766b3a36dbad24583f3 and Ambiance for 3.20 has a transparent background for the "text" window.
Diffstat (limited to 'widget')
-rw-r--r--widget/gtk/gtk3drawing.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/widget/gtk/gtk3drawing.cpp b/widget/gtk/gtk3drawing.cpp
index 7cd18e44e..1db55dda1 100644
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -873,7 +873,7 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
}
static gint
-moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
+moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* aRect,
GtkWidgetState* state,
GtkTextDirection direction)
{
@@ -890,26 +890,24 @@ moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
GtkStyleContext* style_frame =
ClaimStyleContext(MOZ_GTK_SCROLLED_WINDOW, direction, state_flags);
- gtk_render_frame(style_frame, cr, rect->x, rect->y, rect->width, rect->height);
+ gtk_render_frame(style_frame, cr,
+ aRect->x, aRect->y, aRect->width, aRect->height);
+
+ GdkRectangle rect = *aRect;
+ InsetByBorderPadding(&rect, style_frame);
- GtkBorder border, padding;
- gtk_style_context_get_border(style_frame, state_flags, &border);
- gtk_style_context_get_padding(style_frame, state_flags, &padding);
ReleaseStyleContext(style_frame);
- // There is a separate "text" window, which provides the background behind
- // the text.
GtkStyleContext* style =
- ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT, direction, state_flags);
-
- gint xthickness = border.left + padding.left;
- gint ythickness = border.top + padding.top;
-
- gtk_render_background(style, cr,
- rect->x + xthickness, rect->y + ythickness,
- rect->width - 2 * xthickness,
- rect->height - 2 * ythickness);
-
+ ClaimStyleContext(MOZ_GTK_TEXT_VIEW, direction, state_flags);
+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
+ ReleaseStyleContext(style);
+ // There is a separate "text" window, which usually provides the
+ // background behind the text. However, this is transparent in Ambiance
+ // for GTK 3.20, in which case the MOZ_GTK_TEXT_VIEW background is
+ // visible.
+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT, direction, state_flags);
+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;