Title: [197248] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
197248
Author
[email protected]
Date
2016-02-27 07:08:43 -0800 (Sat, 27 Feb 2016)

Log Message

Merge r192723 - [GTK] Warning spam from GtkStyleContext
https://bugs.webkit.org/show_bug.cgi?id=151520

Reviewed by Carlos Garcia Campos.

Audit every use of gtk_style_context_get_* to fix compatibility with GTK+ 3.19. Some of
these were already fine and are only changed for clarity.

Company:  gtk_style_context_get() (and _get_padding/border/color()) should only ever be
          called with the same state as gtk_style_context_get_state()
Company:  usually that's a simple replacing of the old state (like in the trace you posted)
Company:  sometimes it requires calling gtk_style_context_set_sate() with the right state
          first
Company:  and in very rare cases it needs a gtk_style_context_save() before the set_state(),
          too

* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::adjustRectAccordingToMargin):
* rendering/RenderThemeGtk.cpp:
(gtk_css_section_print):
(WebCore::getStyleContext):
(WebCore::RenderThemeGtk::initMediaColors):
(WebCore::renderButton):
(WebCore::getComboBoxMetrics):
(WebCore::RenderThemeGtk::paintMenuList):
(WebCore::RenderThemeGtk::paintTextField):
(WebCore::RenderThemeGtk::paintProgressBar):
(WebCore::spinButtonArrowSize):
(WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
(WebCore::styleColor):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (197247 => 197248)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-27 15:02:59 UTC (rev 197247)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-27 15:08:43 UTC (rev 197248)
@@ -1,3 +1,36 @@
+2015-11-21  Michael Catanzaro  <[email protected]>
+
+        [GTK] Warning spam from GtkStyleContext
+        https://bugs.webkit.org/show_bug.cgi?id=151520
+
+        Reviewed by Carlos Garcia Campos.
+
+        Audit every use of gtk_style_context_get_* to fix compatibility with GTK+ 3.19. Some of
+        these were already fine and are only changed for clarity.
+
+        Company:  gtk_style_context_get() (and _get_padding/border/color()) should only ever be
+                  called with the same state as gtk_style_context_get_state()
+        Company:  usually that's a simple replacing of the old state (like in the trace you posted)
+        Company:  sometimes it requires calling gtk_style_context_set_sate() with the right state
+                  first
+        Company:  and in very rare cases it needs a gtk_style_context_save() before the set_state(),
+                  too
+
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::adjustRectAccordingToMargin):
+        * rendering/RenderThemeGtk.cpp:
+        (gtk_css_section_print):
+        (WebCore::getStyleContext):
+        (WebCore::RenderThemeGtk::initMediaColors):
+        (WebCore::renderButton):
+        (WebCore::getComboBoxMetrics):
+        (WebCore::RenderThemeGtk::paintMenuList):
+        (WebCore::RenderThemeGtk::paintTextField):
+        (WebCore::RenderThemeGtk::paintProgressBar):
+        (WebCore::spinButtonArrowSize):
+        (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
+        (WebCore::styleColor):
+
 2015-10-07  ChangSeok Oh  <[email protected]>
 
         [GTK] Progress bar is broken on recent GTK+

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp (197247 => 197248)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2016-02-27 15:02:59 UTC (rev 197247)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp	2016-02-27 15:08:43 UTC (rev 197248)
@@ -139,12 +139,19 @@
     GdkRGBA color;
     GtkStyleContext* containerContext = getStyleContext(GTK_TYPE_CONTAINER);
 
-    gtk_style_context_get_background_color(containerContext, GTK_STATE_FLAG_NORMAL, &color);
+    gtk_style_context_save(containerContext);
+
+    gtk_style_context_set_state(containerContext, GTK_STATE_FLAG_NORMAL);
+    gtk_style_context_get_background_color(containerContext, gtk_style_context_get_state(containerContext), &color);
     m_panelColor = color;
-    gtk_style_context_get_background_color(containerContext, GTK_STATE_FLAG_ACTIVE, &color);
+    gtk_style_context_set_state(containerContext, GTK_STATE_FLAG_ACTIVE);
+    gtk_style_context_get_background_color(containerContext, gtk_style_context_get_state(containerContext), &color);
     m_sliderColor = color;
-    gtk_style_context_get_background_color(containerContext, GTK_STATE_FLAG_SELECTED, &color);
+    gtk_style_context_set_state(containerContext, GTK_STATE_FLAG_SELECTED);
+    gtk_style_context_get_background_color(containerContext, gtk_style_context_get_state(containerContext), &color);
     m_sliderThumbColor = color;
+
+    gtk_style_context_restore(containerContext);
 }
 #endif
 
@@ -346,7 +353,7 @@
 
         if (interiorFocus) {
             GtkBorder borderWidth;
-            gtk_style_context_get_border(context, static_cast<GtkStateFlags>(flags), &borderWidth);
+            gtk_style_context_get_border(context, gtk_style_context_get_state(context), &borderWidth);
 
             buttonRect = IntRect(buttonRect.x() + borderWidth.left + focusPad, buttonRect.y() + borderWidth.top + focusPad,
                                  buttonRect.width() - (2 * focusPad + borderWidth.left + borderWidth.right),
@@ -395,7 +402,8 @@
     gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
     gtk_style_context_set_direction(context, static_cast<GtkTextDirection>(gtkTextDirection(style->direction())));
 
-    gtk_style_context_get_border(context, static_cast<GtkStateFlags>(0), &border);
+    gtk_style_context_set_state(context, static_cast<GtkStateFlags>(0));
+    gtk_style_context_get_border(context, gtk_style_context_get_state(context), &border);
 
     gboolean interiorFocus;
     gint focusWidth, focusPad;
@@ -575,9 +583,9 @@
                          separatorWidth, innerRect.height());
     } else {
         GtkBorder padding;
-        gtk_style_context_get_padding(separatorStyleContext, state, &padding);
+        gtk_style_context_get_padding(separatorStyleContext, gtk_style_context_get_state(separatorStyleContext), &padding);
         GtkBorder border;
-        gtk_style_context_get_border(separatorStyleContext, state, &border);
+        gtk_style_context_get_border(separatorStyleContext, gtk_style_context_get_state(separatorStyleContext), &border);
 
         if (direction == GTK_TEXT_DIR_LTR)
             separatorPosition.move(-(padding.left + border.left), 0);
@@ -751,9 +759,10 @@
     gtk_style_context_save(context);
     gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
 
+    gtk_style_context_set_state(context, static_cast<GtkStateFlags>(0));
 
     GtkBorder padding;
-    gtk_style_context_get_padding(context, static_cast<GtkStateFlags>(0), &padding);
+    gtk_style_context_get_padding(context, gtk_style_context_get_state(context), &padding);
     IntRect progressRect(rect.x() + padding.left, rect.y() + padding.top,
                          rect.width() - (padding.left + padding.right),
                          rect.height() - (padding.top + padding.bottom));
@@ -775,7 +784,7 @@
 static gint spinButtonArrowSize(GtkStyleContext* context)
 {
     PangoFontDescription* fontDescription;
-    gtk_style_context_get(context, static_cast<GtkStateFlags>(0), "font", &fontDescription, NULL);
+    gtk_style_context_get(context, gtk_style_context_get_state(context), "font", &fontDescription, nullptr);
     gint fontSize = pango_font_description_get_size(fontDescription);
     gint arrowSize = std::max(PANGO_PIXELS(fontSize), minSpinButtonArrowSize);
     pango_font_description_free(fontDescription);
@@ -788,7 +797,7 @@
     GtkStyleContext* context = getStyleContext(GTK_TYPE_SPIN_BUTTON);
 
     GtkBorder padding;
-    gtk_style_context_get_padding(context, static_cast<GtkStateFlags>(0), &padding);
+    gtk_style_context_get_padding(context, gtk_style_context_get_state(context), &padding);
 
     int width = spinButtonArrowSize(context) + padding.left + padding.right;
     style->setWidth(Length(width, Fixed));
@@ -947,9 +956,9 @@
 
     GdkRGBA gdkRGBAColor;
     if (colorType == StyleColorBackground)
-        gtk_style_context_get_background_color(context, state, &gdkRGBAColor);
+        gtk_style_context_get_background_color(context, gtk_style_context_get_state(context), &gdkRGBAColor);
     else
-        gtk_style_context_get_color(context, state, &gdkRGBAColor);
+        gtk_style_context_get_color(context, gtk_style_context_get_state(context), &gdkRGBAColor);
     return gdkRGBAColor;
 }
 

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp (197247 => 197248)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp	2016-02-27 15:02:59 UTC (rev 197247)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp	2016-02-27 15:08:43 UTC (rev 197248)
@@ -75,7 +75,8 @@
 static void adjustRectAccordingToMargin(GtkStyleContext* context, GtkStateFlags state, IntRect& rect)
 {
     GtkBorder margin;
-    gtk_style_context_get_margin(context, state, &margin);
+    gtk_style_context_set_state(context, state);
+    gtk_style_context_get_margin(context, gtk_style_context_get_state(context), &margin);
     rect.move(margin.left, margin.right);
     rect.contract(margin.left + margin.right, margin.top + margin.bottom);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to