[GTK3] Introduce MOZ_GTK_TEXT_VIEW_TEXT and move MOZ_GTK_RESIZER to WidgetStyleCache

The style context for MOZ_GTK_TEXT_VIEW is now created by copying from the widget instead of caching a widget and using its context.
No rendering changes are expected, unless themes are animating GtkTextView backgrounds.
This commit is contained in:
trav90 2018-04-06 09:06:33 -05:00 • committed by Roy Tam
commit 3951327f27
4 changed files with 49 additions and 32 deletions

View file

@ -897,8 +897,10 @@ moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
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, direction, state_flags);
ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT, direction, state_flags);
gint xthickness = border.left + padding.left;
gint ythickness = border.top + padding.top;
@ -1337,17 +1339,9 @@ moz_gtk_resizer_paint(cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction)
{
GtkStyleContext* style;
// gtk_render_handle() draws a background, so use GtkTextView and its
// GTK_STYLE_CLASS_VIEW to match the background with textarea elements.
// The resizer is drawn with shaded variants of the background color, and
// so a transparent background would lead to a transparent resizer.
style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW, GTK_TEXT_DIR_LTR,
GetStateFlagsFromGtkWidgetState(state));
// TODO - we need to save/restore style when gtk 3.20 CSS node path
// is used
gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
GtkStyleContext* style =
ClaimStyleContext(MOZ_GTK_RESIZER, GTK_TEXT_DIR_LTR,
GetStateFlagsFromGtkWidgetState(state));
// Workaround unico not respecting the text direction for resizers.
// See bug 1174248.