Bug 51764

Summary: [GTK] Port stock icon painting to GtkStyleContext
Product: WebKit Reporter: Martin Robinson <mrobinson>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, cgarcia, commit-queue, eric, webkit.review.bot, xan.lopez
Priority: P3 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 50820, 51812, 51815, 51828, 51830, 51870, 51874    
Attachments:
Description Flags
Patch
none
Patch with build fixes for GTK+ 3.x
none
Updated patch using Page::scheduleForcedStyleRecalcForAllPages()
xan.lopez: review-
Updated patch according to review
none
Updated patch fixing coding style none

Martin Robinson
Reported 2010-12-30 16:31:29 PST
This bug tracks porting only the stock icon painting to the new GtkStyleContext API. Since this is the first patch which uses GtkStyleContext, it will also include the initial machinary for all GtkStyleContext usage.
Attachments
Patch (11.39 KB, patch)
2010-12-30 17:32 PST, Martin Robinson
no flags
Patch with build fixes for GTK+ 3.x (11.43 KB, patch)
2010-12-31 10:52 PST, Martin Robinson
no flags
Updated patch using Page::scheduleForcedStyleRecalcForAllPages() (11.10 KB, patch)
2011-01-03 02:20 PST, Carlos Garcia Campos
xan.lopez: review-
Updated patch according to review (11.06 KB, patch)
2011-01-04 09:13 PST, Carlos Garcia Campos
no flags
Updated patch fixing coding style (11.06 KB, patch)
2011-01-04 10:28 PST, Carlos Garcia Campos
no flags
Martin Robinson
Comment 1 2010-12-30 17:32:40 PST
Martin Robinson
Comment 2 2010-12-31 09:32:38 PST
Comment on attachment 77700 [details] Patch Removing review flag as there are some GTK+ 3.x issues.
Martin Robinson
Comment 3 2010-12-31 10:52:18 PST
Created attachment 77728 [details] Patch with build fixes for GTK+ 3.x
Carlos Garcia Campos
Comment 4 2011-01-03 00:48:19 PST
+static void gtkStyleChangedCallback(GObject*, GParamSpec*) +{ + StyleContextMap::const_iterator end = styleContextMap().end(); + for (StyleContextMap::const_iterator iter = styleContextMap().begin(); iter != end; ++iter) + gtk_style_context_invalidate(iter->second.get()); + + RenderTheme::themeForPage(0)->platformColorsDidChange(); +} I would use RenderTheme::defaultTheme() instead, it's exactly the same but less confusing. But maybe we can just call Page::scheduleForcedStyleRecalcForAllPages(); to avoid creating a new RenderTheme only to call platformColorsDidChange();
Carlos Garcia Campos
Comment 5 2011-01-03 02:20:07 PST
Created attachment 77798 [details] Updated patch using Page::scheduleForcedStyleRecalcForAllPages()
Xan Lopez
Comment 6 2011-01-04 04:15:29 PST
Comment on attachment 77798 [details] Updated patch using Page::scheduleForcedStyleRecalcForAllPages() View in context: https://bugs.webkit.org/attachment.cgi?id=77798&action=review r- in case we can avoid searching twice. > WebCore/platform/gtk/RenderThemeGtk3.cpp:85 > + GtkWidgetPath could possibly be added to our GOwnPtr stuff at some point. > WebCore/platform/gtk/RenderThemeGtk3.cpp:91 > + return iter->second.get(); Instead of doing contains() + find() I think you could just do one find() and then check that the iter is valid. Seems pointless to search twice?
Carlos Garcia Campos
Comment 7 2011-01-04 09:13:20 PST
Created attachment 77892 [details] Updated patch according to review
Martin Robinson
Comment 8 2011-01-04 09:17:58 PST
Comment on attachment 77892 [details] Updated patch according to review View in context: https://bugs.webkit.org/attachment.cgi?id=77892&action=review > WebCore/platform/gtk/RenderThemeGtk3.cpp:50 > +typedef HashMap<GType, PlatformRefPtr<GtkStyleContext> > StyleContextMap; This must be updated to say GRefPtr for this to land cleanly. PlatformRefPtr was renamed yesterday. > WebCore/platform/gtk/RenderThemeGtk3.cpp:78 > + std::pair<StyleContextMap::iterator, bool>result = styleContextMap().add(widgetType, 0); Missing a space here before 'result'. > WebCore/platform/gtk/RenderThemeGtk3.cpp:85 > + PlatformRefPtr<GtkStyleContext> context = adoptPlatformRef(gtk_style_context_new()); This should be GRefPtr and adoptGRef now. > WebCore/platform/gtk/RenderThemeGtk3.cpp:89 > + result.first->second = context; Wow. Does modifying the iterator actually update the hash table? I think it's much clearer anyway to just do an insertion. > WebCore/platform/gtk/RenderThemeGtk3.cpp:418 > +PlatformRefPtr<GdkPixbuf> RenderThemeGtk::getStockIcon(GType widgetType, const char* iconName, gint direction, gint state, gint iconSize) This must be updated to return GRefPtr now. > WebCore/platform/gtk/RenderThemeGtk3.cpp:437 > + return adoptPlatformRef(icon); Ditto.
Carlos Garcia Campos
Comment 9 2011-01-04 10:28:53 PST
Created attachment 77898 [details] Updated patch fixing coding style PlatformRefPtr is still available in current git master.
Martin Robinson
Comment 10 2011-01-04 10:31:41 PST
Comment on attachment 77898 [details] Updated patch fixing coding style Looks good to me, but I think that Xan has to pull the lever officially since I worked on this.
Xan Lopez
Comment 11 2011-01-04 10:34:08 PST
Comment on attachment 77898 [details] Updated patch fixing coding style *pulls lever*
WebKit Commit Bot
Comment 12 2011-01-04 13:09:38 PST
Comment on attachment 77898 [details] Updated patch fixing coding style Clearing flags on attachment: 77898 Committed r74997: <http://trac.webkit.org/changeset/74997>
WebKit Commit Bot
Comment 13 2011-01-04 13:09:46 PST
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 14 2011-01-04 14:12:24 PST
http://trac.webkit.org/changeset/74997 might have broken Leopard Intel Debug (Tests)
Note You need to log in before you can comment on or make changes to this bug.