[Webkit-unassigned] [Bug 50820] [GTK] Port to GtkStyleContext

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 14 01:57:39 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=50820





--- Comment #2 from Carlos Garcia Campos <cgarcia at igalia.com>  2010-12-14 01:57:38 PST ---
Created an attachment (id=76518)
 --> (https://bugs.webkit.org/attachment.cgi?id=76518&action=review)
Fork RenderThemeGtk and ScrollbarThemeGtk

I'm splitting the patch as requested by Martin to make it easier for reviewers, please don't expect individual patches to work (not even build), they are only for review. The idea is to merge this as a single patch to make sure it builds and works and it won't break any future bisection. I'm also commenting here the changes made in every file.

This first patch forksRenderThemeGtk and ScrollbarThemeGtk moving the code that is specific to gtk2 from RenderThemeGtk and ScrollbarThemeGtk to RenderThemeGtk2 and ScrollbarThemeGtk2 leaving the common code in the original files.

RenderThemeGtk: paintStockIcon has been splitted into getStockIcon, that has different implementations in gtk2 and gtk3, and paintStockIcon() which is common. Some methods that were static and private to RenderThemeGtk are now static methods of the class so that they can be used in RenderThemeGtk2 and RenderThemeGtk3. Some public methods returning or using gtk enums are using integers now, because we don't have forward declarations for enums. 

RenderThemeGtk2: m_themeParts and m_themePartsHaveRGBAColormap have been removed. Mozilla code uses a global static GtkThemeParts struct, hwoever, we are allocating a new structure everytime a new RenderThemeGtk instance is created, but that new struct is not used because moz_gtk_use_theme_parts() is only called the first time. So we can allocate the GtkThemeParts only once the first time, move the HaveRGBAColormap to the struct and add an accessor to gtkdrawing to get the global struct. If using heap allocation is a problem we can use a stack allocated struct in gtkdrawing. getIndicatorMetrics() was basicly a wrapper for moz_gtk_checkbox_get_metrics() and only used by WidgetRenderingContextGtk2 that already knows about mozilla code, so it has been removed and moz_gtk_checkbox_get_metrics() is used directly when needed. The rest of the code in this file is copy-pasted from RenderThemeGtk.

ScrollbarThemeGtk: It uses a private static HashSet to store the registered scrollbars, since both ScrollbarThemeGtk2 and ScrollbarThemeGtk3 need to use it, I've added a private accessor ScrollbarThemeGtk::getScrollbars(). Boolean attributes (m_troughUnderSteppers, m_hasForwardButtonStartPart, m_hasBackButtonEndPart) are now gboolean instead of bool, because they are used directly (well, the mem dir actually) as arguments of gtk_style_context_get_style(), in ScrollbarThemeGtk3, that expects gboolean (an integer) and using bool causes mem overflows. 

WidgetRenderingContextGtk2: It uses the new accessor moz_gtk_get_theme_parts() to use the global GtkThemeParts struct and moz_gtk_checkbox_get_metrics() instead of RenderThemeGtk::getIndicatorMetrics().

gtk2drawing: moz_gtk_get_theme_parts() has been added.

gtkdrawing.h: non gtk2 stuff has been removed and haveRGBAColormap was moved from RenderThemeGtk to the GtkThemeParts struct.

ScrollbarThemeGtk2: All the code is copy-pasted from ScrollbarThemeGtk, just changed a bit to use the new accessor getScrollbars().

Removed files are not included in the patch: WidgetRenderingContextGtk3.cpp and gtk3drawing.c

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list