bug 1234158 rename GtkThemeWidgetType enum to WidgetNodeType as it will differentiate GTK CSS nodes r=Stránský a=ritu
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 14 Apr 2016 17:47:20 +1200
changeset 332964 788b1166ae593282a05e5dbbb86af6bf8be1c59b
parent 332963 40994e384c130872bb8430268780726d4416cf40
child 332965 cb42beedc07e7fd7a13b76081cf3252543626f05
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStr, ritu
bugs1234158
milestone48.0a2
bug 1234158 rename GtkThemeWidgetType enum to WidgetNodeType as it will differentiate GTK CSS nodes r=Stránský a=ritu
widget/gtk/gtk2drawing.c
widget/gtk/gtk3drawing.cpp
widget/gtk/gtkdrawing.h
widget/gtk/nsNativeThemeGTK.cpp
widget/gtk/nsNativeThemeGTK.h
--- a/widget/gtk/gtk2drawing.c
+++ b/widget/gtk/gtk2drawing.c
@@ -1278,17 +1278,17 @@ moz_gtk_scrollbar_button_paint(GdkDrawab
     gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
                     scrollbar, detail, arrow_type, TRUE, arrow_rect.x,
                     arrow_rect.y, arrow_rect.width, arrow_rect.height);
 
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
-moz_gtk_scrollbar_trough_paint(GtkThemeWidgetType widget,
+moz_gtk_scrollbar_trough_paint(WidgetNodeType widget,
                                GdkDrawable* drawable, GdkRectangle* rect,
                                GdkRectangle* cliprect, GtkWidgetState* state,
                                GtkTextDirection direction)
 {
     GtkStyle* style;
     GtkScrollbar *scrollbar;
 
     ensure_scrollbar_widget();
@@ -1316,17 +1316,17 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
                         GTK_WIDGET(scrollbar), "trough",
                         rect->x, rect->y, rect->width, rect->height);
     }
 
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
-moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget,
+moz_gtk_scrollbar_thumb_paint(WidgetNodeType widget,
                               GdkDrawable* drawable, GdkRectangle* rect,
                               GdkRectangle* cliprect, GtkWidgetState* state,
                               GtkTextDirection direction)
 {
     GtkStateType state_type = (state->inHover || state->active) ?
         GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
     GtkShadowType shadow_type = GTK_SHADOW_OUT;
     GtkStyle* style;
@@ -2223,17 +2223,17 @@ moz_gtk_progressbar_paint(GdkDrawable* d
                   rect->width, rect->height);
 
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect,
                              GdkRectangle* cliprect, GtkTextDirection direction,
-                             GtkThemeWidgetType widget)
+                             WidgetNodeType widget)
 {
     GtkStyle* style;
 
     ensure_progress_widget();
     gtk_widget_set_direction(gProgressWidget, direction);
 
     style = gProgressWidget->style;
 
@@ -2735,17 +2735,17 @@ moz_gtk_window_paint(GdkDrawable* drawab
     gtk_style_apply_default_background(style, drawable, TRUE,
                                        GTK_STATE_NORMAL,
                                        cliprect, rect->x, rect->y,
                                        rect->width, rect->height);
     return MOZ_GTK_SUCCESS;
 }
 
 gint
-moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
                           gint* right, gint* bottom, GtkTextDirection direction,
                           gboolean inhtml)
 {
     GtkWidget* w;
 
     switch (widget) {
     case MOZ_GTK_BUTTON:
     case MOZ_GTK_TOOLBAR_BUTTON:
@@ -3060,17 +3060,17 @@ moz_gtk_get_tab_scroll_arrow_size(gint* 
                          NULL);
 
     *height = *width = arrow_size;
 
     return MOZ_GTK_SUCCESS;
 }
 
 void
-moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType, gint* width, gint* height)
+moz_gtk_get_arrow_size(WidgetNodeType widgetType, gint* width, gint* height)
 {
     GtkWidget* widget;
     switch (widgetType) {
         case MOZ_GTK_DROPDOWN:
             ensure_combo_box_widgets();
             widget = gComboBoxArrowWidget;
             break;
         default:
@@ -3215,17 +3215,17 @@ moz_gtk_images_in_buttons()
     ensure_button_widget();
     settings = gtk_widget_get_settings(gButtonWidget);
 
     g_object_get(settings, "gtk-button-images", &result, NULL);
     return result;
 }
 
 gint
-moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
+moz_gtk_widget_paint(WidgetNodeType widget, GdkDrawable* drawable,
                      GdkRectangle* rect, GdkRectangle* cliprect,
                      GtkWidgetState* state, gint flags,
                      GtkTextDirection direction)
 {
     switch (widget) {
     case MOZ_GTK_BUTTON:
     case MOZ_GTK_TOOLBAR_BUTTON:
         if (state->depressed) {
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -1172,17 +1172,17 @@ moz_gtk_scrollbar_button_paint(cairo_t *
                      arrow_size);
   
     gtk_style_context_restore(style);
 
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
-moz_gtk_scrollbar_trough_paint(GtkThemeWidgetType widget,
+moz_gtk_scrollbar_trough_paint(WidgetNodeType widget,
                                cairo_t *cr, GdkRectangle* rect,
                                GtkWidgetState* state,
                                GtkScrollbarTrackFlags flags,
                                GtkTextDirection direction)
 {
     GtkStyleContext* style;
     GtkScrollbar *scrollbar;
 
@@ -1211,17 +1211,17 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
         gtk_render_focus(style, cr,
                          rect->x, rect->y, rect->width, rect->height);
     }
     gtk_style_context_restore(style);
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
-moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget,
+moz_gtk_scrollbar_thumb_paint(WidgetNodeType widget,
                               cairo_t *cr, GdkRectangle* rect,
                               GtkWidgetState* state,
                               GtkTextDirection direction)
 {
     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
     GtkStyleContext* style;
     GtkScrollbar *scrollbar;
     GtkBorder margin;
@@ -2028,17 +2028,17 @@ moz_gtk_progressbar_paint(cairo_t *cr, G
     gtk_style_context_restore(style);
 
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 moz_gtk_progress_chunk_paint(cairo_t *cr, GdkRectangle* rect,
                              GtkTextDirection direction,
-                             GtkThemeWidgetType widget)
+                             WidgetNodeType widget)
 {
     GtkStyleContext* style;
 
     ensure_progress_widget();
     gtk_widget_set_direction(gProgressWidget, direction);
 
     style = gtk_widget_get_style_context(gProgressWidget);
     gtk_style_context_save(style);
@@ -2685,17 +2685,17 @@ moz_gtk_add_style_padding(GtkStyleContex
 
     *left += padding.left;
     *right += padding.right;
     *top += padding.top;
     *bottom += padding.bottom;
 }
 
 gint
-moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
                           gint* right, gint* bottom, GtkTextDirection direction,
                           gboolean inhtml)
 {
     GtkWidget* w;
     GtkStyleContext* style;
     *left = *top = *right = *bottom = 0;
 
     switch (widget) {
@@ -2997,17 +2997,17 @@ moz_gtk_get_tab_scroll_arrow_size(gint* 
                                 NULL);
 
     *height = *width = arrow_size;
 
     return MOZ_GTK_SUCCESS;
 }
 
 void
-moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType, gint* width, gint* height)
+moz_gtk_get_arrow_size(WidgetNodeType widgetType, gint* width, gint* height)
 {
     GtkWidget* widget;
     switch (widgetType) {
         case MOZ_GTK_DROPDOWN:
             ensure_combo_box_widgets();
             widget = gComboBoxArrowWidget;
             break;
         default:
@@ -3196,17 +3196,17 @@ moz_gtk_images_in_buttons()
     settings = gtk_widget_get_settings(gButtonWidget);
 
     g_object_get(settings, "gtk-button-images", &result, NULL);
     return result;
 }
 
 /* cairo_t *cr argument has to be a system-cairo. */
 gint
-moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr,
+moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
                      GdkRectangle* rect,
                      GtkWidgetState* state, gint flags,
                      GtkTextDirection direction)
 {
     /* A workaround for https://bugzilla.gnome.org/show_bug.cgi?id=694086
      */
     cairo_new_path(cr);
 
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -185,17 +185,17 @@ typedef enum {
   /* Paints a GtkVPaned separator */
   MOZ_GTK_SPLITTER_HORIZONTAL,
   /* Paints a GtkHPaned separator */
   MOZ_GTK_SPLITTER_VERTICAL,
   /* Paints the background of a window, dialog or page. */
   MOZ_GTK_WINDOW,
   /* Paints a GtkInfoBar, for notifications. */
   MOZ_GTK_INFO_BAR
-} GtkThemeWidgetType;
+} WidgetNodeType;
 
 /*** General library functions ***/
 /**
  * Initializes the drawing library.  You must call this function
  * prior to using any other functionality.
  * returns: MOZ_GTK_SUCCESS if there were no errors
  *          MOZ_GTK_UNSAFE_THEME if the current theme engine is known
  *                               to crash with gtkdrawing.
@@ -231,27 +231,27 @@ GdkColormap* moz_gtk_widget_get_colormap
 /**
  * Paint a widget in the current theme.
  * widget:    a constant giving the widget to paint
  * drawable:  the drawable to paint to;
  *            it's colormap must be moz_gtk_widget_get_colormap().
  * rect:      the bounding rectangle for the widget
  * cliprect:  a clipprect rectangle for this painting operation
  * state:     the state of the widget.  ignored for some widgets.
- * flags:     widget-dependant flags; see the GtkThemeWidgetType definition.
+ * flags:     widget-dependant flags; see the WidgetNodeType definition.
  * direction: the text direction, to draw the widget correctly LTR and RTL.
  */
 gint
-moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
+moz_gtk_widget_paint(WidgetNodeType widget, GdkDrawable* drawable,
                      GdkRectangle* rect, GdkRectangle* cliprect,
                      GtkWidgetState* state, gint flags,
                      GtkTextDirection direction);
 #else
 gint
-moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr,
+moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
                      GdkRectangle* rect,
                      GtkWidgetState* state, gint flags,
                      GtkTextDirection direction);
 #endif
 
 
 /*** Widget metrics ***/
 /**
@@ -259,17 +259,17 @@ moz_gtk_widget_paint(GtkThemeWidgetType 
  * left/right:  [OUT] the widget's left/right border
  * top/bottom:  [OUT] the widget's top/bottom border
  * direction:   the text direction for the widget
  * inhtml:      boolean indicating whether this widget will be drawn as a HTML form control,
  *              in order to workaround a size issue (MOZ_GTK_BUTTON only, ignored otherwise)
  *
  * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
  */
-gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, 
+gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
                                gint* right, gint* bottom, GtkTextDirection direction,
                                gboolean inhtml);
 
 /**
  * Get the border size of a notebook tab
  * left/right:  [OUT] the tab's left/right border
  * top/bottom:  [OUT] the tab's top/bottom border
  * direction:   the text direction for the widget
@@ -390,17 +390,17 @@ gint moz_gtk_get_tab_scroll_arrow_size(g
 /**
  * Get the desired size of an arrow in a button
  *
  * widgetType: [IN]  the widget for which to get the arrow size
  * width:      [OUT] the desired width
  * height:     [OUT] the desired height
  */
 void
-moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType,
+moz_gtk_get_arrow_size(WidgetNodeType widgetType,
                        gint* width, gint* height);
 
 /**
  * Get the minimum height of a entry widget
  * size:    [OUT] the minimum height
  *
  */
 void moz_gtk_get_entry_min_height(gint* height);
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -183,17 +183,17 @@ static bool ShouldScrollbarButtonBeDisab
   return ((aCurpos == 0 && (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP ||
                             aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT))
       || (aCurpos == aMaxpos && (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
                                  aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT)));
 }
 
 bool
 nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
-                                       GtkThemeWidgetType& aGtkWidgetType,
+                                       WidgetNodeType& aGtkWidgetType,
                                        GtkWidgetState* aState,
                                        gint* aWidgetFlags)
 {
   if (aState) {
     if (!aFrame) {
       // reset the entire struct to zero
       memset(aState, 0, sizeof(GtkWidgetState));
     } else {
@@ -699,26 +699,26 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
   }
 
   return true;
 }
 
 #if (MOZ_WIDGET_GTK == 2)
 class ThemeRenderer : public gfxGdkNativeRenderer {
 public:
-  ThemeRenderer(GtkWidgetState aState, GtkThemeWidgetType aGTKWidgetType,
+  ThemeRenderer(GtkWidgetState aState, WidgetNodeType aGTKWidgetType,
                 gint aFlags, GtkTextDirection aDirection,
                 const GdkRectangle& aGDKRect, const GdkRectangle& aGDKClip)
     : mState(aState), mGTKWidgetType(aGTKWidgetType), mFlags(aFlags),
       mDirection(aDirection), mGDKRect(aGDKRect), mGDKClip(aGDKClip) {}
   nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX, gint offsetY,
                        GdkRectangle * clipRects, uint32_t numClipRects);
 private:
   GtkWidgetState mState;
-  GtkThemeWidgetType mGTKWidgetType;
+  WidgetNodeType mGTKWidgetType;
   gint mFlags;
   GtkTextDirection mDirection;
   const GdkRectangle& mGDKRect;
   const GdkRectangle& mGDKClip;
 };
 
 nsresult
 ThemeRenderer::DrawWithGDK(GdkDrawable * drawable, gint offsetX, 
@@ -821,17 +821,17 @@ public:
 
 private:
   cairo_t* mContext;
   Point mCurrentPoint;
 };
 
 static void
 DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
-                   GtkWidgetState aState, GtkThemeWidgetType aGTKWidgetType,
+                   GtkWidgetState aState, WidgetNodeType aGTKWidgetType,
                    gint aFlags, GtkTextDirection aDirection, gint aScaleFactor,
                    bool aSnapped, const Point& aDrawOrigin, const nsIntSize& aDrawSize,
                    GdkRectangle& aGDKRect, nsITheme::Transparency aTransparency)
 {
   Point drawOffset;
   Matrix transform;
   if (!aSnapped) {
     // If we are not snapped, we depend on the DT for translation.
@@ -1078,17 +1078,17 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
 NS_IMETHODIMP
 nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
                                        nsIFrame* aFrame,
                                        uint8_t aWidgetType,
                                        const nsRect& aRect,
                                        const nsRect& aDirtyRect)
 {
   GtkWidgetState state;
-  GtkThemeWidgetType gtkWidgetType;
+  WidgetNodeType gtkWidgetType;
   GtkTextDirection direction = GetTextDirection(aFrame);
   gint flags;
   if (!GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, &state,
                             &flags))
     return NS_OK;
 
   gfxContext* ctx = aContext->ThebesContext();
   nsPresContext *presContext = aFrame->PresContext();
@@ -1255,17 +1255,17 @@ nsNativeThemeGTK::GetWidgetBorder(nsDevi
     // around the entire button + dropdown, and also an inner border if you're
     // over the button part.  But, we want the inner button to be right up
     // against the edge of the outer button so that the borders overlap.
     // To make this happen, we draw a button border for the outer button,
     // but don't reserve any space for it.
     break;
   case NS_THEME_TAB:
     {
-      GtkThemeWidgetType gtkWidgetType;
+      WidgetNodeType gtkWidgetType;
       gint flags;
 
       if (!GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nullptr,
                                 &flags))
         return NS_OK;
 
       moz_gtk_get_tab_border(&aResult->left, &aResult->top,
                              &aResult->right, &aResult->bottom, direction,
@@ -1278,17 +1278,17 @@ nsNativeThemeGTK::GetWidgetBorder(nsDevi
     // For regular menuitems, we will be using GetWidgetPadding instead of
     // GetWidgetBorder to pad up the widget's internals; other menuitems
     // will need to fall through and use the default case as before.
     if (IsRegularMenuItem(aFrame))
       break;
     MOZ_FALLTHROUGH;
   default:
     {
-      GtkThemeWidgetType gtkWidgetType;
+      WidgetNodeType gtkWidgetType;
       if (GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nullptr,
                                nullptr)) {
         moz_gtk_get_widget_border(gtkWidgetType, &aResult->left, &aResult->top,
                                   &aResult->right, &aResult->bottom, direction,
                                   IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML));
       }
     }
   }
@@ -1330,17 +1330,17 @@ nsNativeThemeGTK::GetWidgetPadding(nsDev
     case NS_THEME_CHECKMENUITEM:
     case NS_THEME_RADIOMENUITEM:
       {
         // Menubar and menulist have their padding specified in CSS.
         if (!IsRegularMenuItem(aFrame))
           return false;
 
         aResult->SizeTo(0, 0, 0, 0);
-        GtkThemeWidgetType gtkWidgetType;
+        WidgetNodeType gtkWidgetType;
         if (GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nullptr,
                                  nullptr)) {
           moz_gtk_get_widget_border(gtkWidgetType, &aResult->left, &aResult->top,
                                     &aResult->right, &aResult->bottom, GetTextDirection(aFrame),
                                     IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML));
         }
 
         gint horizontal_padding;
--- a/widget/gtk/nsNativeThemeGTK.h
+++ b/widget/gtk/nsNativeThemeGTK.h
@@ -71,18 +71,18 @@ public:
   nsNativeThemeGTK();
 
 protected:
   virtual ~nsNativeThemeGTK();
 
 private:
   gint GetTabMarginPixels(nsIFrame* aFrame);
   bool GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
-                              GtkThemeWidgetType& aGtkWidgetType,
-                              GtkWidgetState* aState, gint* aWidgetFlags);
+                            WidgetNodeType& aGtkWidgetType,
+                            GtkWidgetState* aState, gint* aWidgetFlags);
   bool GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType,
                                nsIntMargin* aExtra);
 
   void RefreshWidgetWindow(nsIFrame* aFrame);
 
   uint8_t mDisabledWidgetTypes[32];
   uint8_t mSafeWidgetStates[1024];    // 256 widgets * 32 bits per widget
   static const char* sDisabledEngines[];