Changeset 192727 in webkit
- Timestamp:
- Nov 22, 2015 12:50:40 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r192726 r192727 1 2015-11-22 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [GTK] RenderThemeGtk::platformActiveSelectionBackgroundColor, et. al. should not clobber state of cached GtkStyleContexts 4 https://bugs.webkit.org/show_bug.cgi?id=151533 5 6 Reviewed by Carlos Garcia Campos. 7 8 platformActiveSelectionBackgroundColor(), platformInactiveSelectionBackgroundColor(), etc. 9 are const functions intended only to return a color used for painting, but since r174929 10 they also change the state of the cached style contexts we use for GTK_TYPE_ENTRY and 11 GTK_TYPE_TREE_VIEW. That's wrong; those style contexts should not have any state set. This 12 could cause theme colors returned by those GtkStyleContexts to change unexpectedly, 13 depending on whether the state is explicitly set before each use, or whether the theme 14 actually uses the states. 15 16 This didn't cause any regression only because every place using these style contexts 17 explicitly sets the state of the style contexts before use. In fact, the GtkTreeView style 18 context is not used anywhere else, and the GtkEntry style context is only used in 19 paintTextField, which does set the state before use (and then reverts it using 20 save/restore), so this cannot have broken anything in practice. But it's a landmine waiting 21 for the next programmer to trip it. 22 23 Fix this with a gtk_style_context_save()/gtk_style_context_restore() pair. 24 25 * rendering/RenderThemeGtk.cpp: 26 (WebCore::styleColor): 27 1 28 2015-11-21 Myles C. Maxfield <mmaxfield@apple.com> 2 29 -
trunk/Source/WebCore/rendering/RenderThemeGtk.cpp
r192724 r192727 1349 1349 static Color styleColor(GType widgetType, GtkStateFlags state, StyleColorType colorType) 1350 1350 { 1351 1352 1351 GtkStyleContext* context = getStyleContext(widgetType); 1353 // Recent GTK+ versions (> 3.14) require to explicitly set the state before getting the color.1352 gtk_style_context_save(context); 1354 1353 gtk_style_context_set_state(context, state); 1355 1354 … … 1359 1358 else 1360 1359 gtk_style_context_get_color(context, gtk_style_context_get_state(context), &gdkRGBAColor); 1360 1361 gtk_style_context_restore(context); 1361 1362 return gdkRGBAColor; 1362 1363 }
Note: See TracChangeset
for help on using the changeset viewer.