RESOLVED FIXED Bug 151533
[GTK] RenderThemeGtk::platformActiveSelectionBackgroundColor, et. al. should not clobber state of cached GtkStyleContexts
https://bugs.webkit.org/show_bug.cgi?id=151533
Summary [GTK] RenderThemeGtk::platformActiveSelectionBackgroundColor, et. al. should ...
Michael Catanzaro
Reported 2015-11-21 11:27:59 PST
platformActiveSelectionBackgroundColor(), platformInactiveSelectionBackgroundColor(), etc. are const functions intended only to return a color used for painting, but they also change the state of the cached GtkStyleContexts we use for GTK_TYPE_ENTRY and GTK_TYPE_TREE_VIEW. This could cause theme colors returned by those GtkStyleContexts to change unexpectedly. At first I thought this was a regression I introduced in r192723, but it was actually introduced about a year ago.
Attachments
Patch (2.60 KB, patch)
2015-11-21 11:50 PST, Michael Catanzaro
no flags
Patch (2.99 KB, patch)
2015-11-21 12:48 PST, Michael Catanzaro
no flags
Patch (41.70 KB, patch)
2015-12-09 10:47 PST, Michael Catanzaro
no flags
Patch (41.94 KB, patch)
2015-12-10 01:18 PST, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2015-11-21 11:48:10 PST
(In reply to comment #0) > This could cause theme colors returned by those GtkStyleContexts to change unexpectedly. This didn't cause any regression only because every place using these style contexts explicitly sets the state of the style contexts before use. In fact, the GtkTreeView style context is not used anywhere else, and the GtkEntry style context is only used in paintTextField, which does set the state before use (and then reverts it using save/restore), so this cannot have broken anything in practice. But it's a landmine waiting for the next programmer to trip it.
Michael Catanzaro
Comment 2 2015-11-21 11:50:38 PST
Michael Catanzaro
Comment 3 2015-11-21 12:48:03 PST
WebKit Commit Bot
Comment 4 2015-11-22 00:50:46 PST
Comment on attachment 266031 [details] Patch Clearing flags on attachment: 266031 Committed r192727: <http://trac.webkit.org/changeset/192727>
WebKit Commit Bot
Comment 5 2015-11-22 00:50:49 PST
All reviewed patches have been landed. Closing bug.
Carlos Garcia Campos
Comment 6 2015-11-22 02:49:01 PST
Reverted r192727 for reason: It made the selections transparent again and broke /webkit2/WebKitWebView/snapshot Committed r192731: <http://trac.webkit.org/changeset/192731>
Michael Catanzaro
Comment 7 2015-11-23 17:57:05 PST
(In reply to comment #1) > (In reply to comment #0) > > This could cause theme colors returned by those GtkStyleContexts to change unexpectedly. > > This didn't cause any regression only because every place using these style > contexts explicitly sets the state of the style contexts before use. In > fact, the GtkTreeView style context is not used anywhere else, and the > GtkEntry style context is only used in paintTextField, which does set the > state before use (and then reverts it using save/restore), so this cannot > have broken anything in practice. I missed that this function is sometimes called with the GtkButton style context, so I see that this patch could affect the results of RenderThemeGtk::paintButton and RenderThemeGtk::paintMenuList (presumably for the better). But I frankly have no clue how it broke selections. I need to investigate closer.
Michael Catanzaro
Comment 8 2015-12-03 02:17:00 PST
(In reply to comment #7) > I missed that this function is sometimes called with the GtkButton style > context, so I see that this patch could affect the results of > RenderThemeGtk::paintButton This might be causing GNOME #758968
Michael Catanzaro
Comment 9 2015-12-09 10:47:27 PST
Carlos Garcia Campos
Comment 10 2015-12-10 00:20:32 PST
Comment on attachment 267022 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=267022&action=review Ok, let's try it out. > Source/WebCore/rendering/RenderThemeGtk.cpp:398 > - GtkStyleContext* context = 0; > + GRefPtr<GtkStyleContext> context = nullptr; GRefPtr is already nullptr initialized.
Michael Catanzaro
Comment 11 2015-12-10 01:18:19 PST
WebKit Commit Bot
Comment 12 2015-12-10 02:15:57 PST
Comment on attachment 267078 [details] Patch Clearing flags on attachment: 267078 Committed r193896: <http://trac.webkit.org/changeset/193896>
WebKit Commit Bot
Comment 13 2015-12-10 02:16:01 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.