[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

carlosgc at webkit.org carlosgc at webkit.org
Fri Jan 21 14:57:09 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 24a6b8c23a9ebd5c3edd915eb63e63f5aa1e17b1
Author: carlosgc at webkit.org <carlosgc at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 5 10:45:01 2011 +0000

    2011-01-05  Carlos Garcia Campos  <cgarcia at igalia.com>
    
            Reviewed by Martin Robinson.
    
            [GTK] Use GtkStyleContext to get platform colors
            https://bugs.webkit.org/show_bug.cgi?id=51830
    
            Use GtkStyleContext API to get platform colors when building with
            GTK+ 3.x.
    
            No new tests. This should not change functionality.
    
            * platform/graphics/Color.h: Add specialized constructor for GdkRGBA.
            * platform/graphics/gtk/ColorGtk.cpp:
            (WebCore::Color::Color):
            (WebCore::Color::operator GdkRGBA):
            * platform/gtk/RenderThemeGtk3.cpp:
            (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor):
            (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor):
            (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor):
            (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor):
            (WebCore::RenderThemeGtk::activeListBoxSelectionBackgroundColor):
            (WebCore::RenderThemeGtk::inactiveListBoxSelectionBackgroundColor):
            (WebCore::RenderThemeGtk::activeListBoxSelectionForegroundColor):
            (WebCore::RenderThemeGtk::inactiveListBoxSelectionForegroundColor):
            (WebCore::RenderThemeGtk::systemColor):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75056 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e57d7b6..0273d62 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,32 @@
 2011-01-05  Carlos Garcia Campos  <cgarcia at igalia.com>
 
+        Reviewed by Martin Robinson.
+
+        [GTK] Use GtkStyleContext to get platform colors
+        https://bugs.webkit.org/show_bug.cgi?id=51830
+
+        Use GtkStyleContext API to get platform colors when building with
+        GTK+ 3.x.
+
+        No new tests. This should not change functionality.
+
+        * platform/graphics/Color.h: Add specialized constructor for GdkRGBA.
+        * platform/graphics/gtk/ColorGtk.cpp:
+        (WebCore::Color::Color):
+        (WebCore::Color::operator GdkRGBA):
+        * platform/gtk/RenderThemeGtk3.cpp:
+        (WebCore::RenderThemeGtk::platformActiveSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::platformInactiveSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::platformActiveSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::platformInactiveSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::activeListBoxSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::inactiveListBoxSelectionBackgroundColor):
+        (WebCore::RenderThemeGtk::activeListBoxSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::inactiveListBoxSelectionForegroundColor):
+        (WebCore::RenderThemeGtk::systemColor):
+
+2011-01-05  Carlos Garcia Campos  <cgarcia at igalia.com>
+
         Unreviewed. Build fix for GTK when using gtk+-3 after r75009.
 
         * platform/gtk/RenderThemeGtk3.cpp:
diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h
index 2e4e962..ef0d31c 100644
--- a/WebCore/platform/graphics/Color.h
+++ b/WebCore/platform/graphics/Color.h
@@ -44,6 +44,9 @@ QT_END_NAMESPACE
 
 #if PLATFORM(GTK)
 typedef struct _GdkColor GdkColor;
+#ifndef GTK_API_VERSION_2
+typedef struct _GdkRGBA GdkRGBA;
+#endif
 #endif
 
 #if PLATFORM(WX)
@@ -125,6 +128,10 @@ public:
 #if PLATFORM(GTK)
     Color(const GdkColor&);
     // We can't sensibly go back to GdkColor without losing the alpha value
+#ifndef GTK_API_VERSION_2
+    Color(const GdkRGBA&);
+    operator GdkRGBA() const;
+#endif
 #endif
 
 #if PLATFORM(WX)
diff --git a/WebCore/platform/graphics/gtk/ColorGtk.cpp b/WebCore/platform/graphics/gtk/ColorGtk.cpp
index 27f1b14..8f56ba6 100644
--- a/WebCore/platform/graphics/gtk/ColorGtk.cpp
+++ b/WebCore/platform/graphics/gtk/ColorGtk.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Alp Toker <alp at atoker.com>
+ * Copyright (C) 2011 Igalia S.L.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -30,6 +31,25 @@ Color::Color(const GdkColor& c)
 {
 }
 
+#ifndef GTK_API_VERSION_2
+Color::Color(const GdkRGBA& c)
+    : m_color(makeRGBA(static_cast<int>(c.red * 255),
+                       static_cast<int>(c.green * 255),
+                       static_cast<int>(c.blue * 255),
+                       static_cast<int>(c.alpha * 255)))
+    , m_valid(true)
+{
+}
+
+Color::operator GdkRGBA() const
+{
+    double red, green, blue, alpha;
+    getRGBA(red, green, blue, alpha);
+    GdkRGBA rgba = { red, green, blue, alpha };
+    return rgba;
+}
+#endif
+
 }
 
 // vim: ts=4 sw=4 et
diff --git a/WebCore/platform/gtk/RenderThemeGtk3.cpp b/WebCore/platform/gtk/RenderThemeGtk3.cpp
index 0a9bee9..a37abc7 100644
--- a/WebCore/platform/gtk/RenderThemeGtk3.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk3.cpp
@@ -416,59 +416,71 @@ GRefPtr<GdkPixbuf> RenderThemeGtk::getStockIcon(GType widgetType, const char* ic
 
 Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const
 {
-    GtkWidget* widget = gtkEntry();
-    return gtk_widget_get_style(widget)->base[GTK_STATE_SELECTED];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_background_color(getStyleContext(GTK_TYPE_ENTRY), GTK_STATE_FLAG_SELECTED, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::platformInactiveSelectionBackgroundColor() const
 {
-    GtkWidget* widget = gtkEntry();
-    return gtk_widget_get_style(widget)->base[GTK_STATE_ACTIVE];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_background_color(getStyleContext(GTK_TYPE_ENTRY), GTK_STATE_FLAG_ACTIVE, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::platformActiveSelectionForegroundColor() const
 {
-    GtkWidget* widget = gtkEntry();
-    return gtk_widget_get_style(widget)->text[GTK_STATE_SELECTED];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_color(getStyleContext(GTK_TYPE_ENTRY), GTK_STATE_FLAG_SELECTED, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::platformInactiveSelectionForegroundColor() const
 {
-    GtkWidget* widget = gtkEntry();
-    return gtk_widget_get_style(widget)->text[GTK_STATE_ACTIVE];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_color(getStyleContext(GTK_TYPE_ENTRY), GTK_STATE_FLAG_ACTIVE, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::activeListBoxSelectionBackgroundColor() const
 {
-    GtkWidget* widget = gtkTreeView();
-    return gtk_widget_get_style(widget)->base[GTK_STATE_SELECTED];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_background_color(getStyleContext(GTK_TYPE_TREE_VIEW), GTK_STATE_FLAG_SELECTED, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::inactiveListBoxSelectionBackgroundColor() const
 {
-    GtkWidget* widget = gtkTreeView();
-    return gtk_widget_get_style(widget)->base[GTK_STATE_ACTIVE];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_background_color(getStyleContext(GTK_TYPE_TREE_VIEW), GTK_STATE_FLAG_ACTIVE, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::activeListBoxSelectionForegroundColor() const
 {
-    GtkWidget* widget = gtkTreeView();
-    return gtk_widget_get_style(widget)->text[GTK_STATE_SELECTED];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_color(getStyleContext(GTK_TYPE_TREE_VIEW), GTK_STATE_FLAG_SELECTED, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::inactiveListBoxSelectionForegroundColor() const
 {
-    GtkWidget* widget = gtkTreeView();
-    return gtk_widget_get_style(widget)->text[GTK_STATE_ACTIVE];
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_color(getStyleContext(GTK_TYPE_TREE_VIEW), GTK_STATE_FLAG_ACTIVE, &gdkRGBAColor);
+    return gdkRGBAColor;
 }
 
 Color RenderThemeGtk::systemColor(int cssValueId) const
 {
+    GdkRGBA gdkRGBAColor;
+
     switch (cssValueId) {
     case CSSValueButtontext:
-        return Color(gtk_widget_get_style(gtkButton())->fg[GTK_STATE_NORMAL]);
+        gtk_style_context_get_color(getStyleContext(GTK_TYPE_BUTTON), static_cast<GtkStateFlags>(0), &gdkRGBAColor);
+        return gdkRGBAColor;
     case CSSValueCaptiontext:
-        return Color(gtk_widget_get_style(gtkEntry())->fg[GTK_STATE_NORMAL]);
+        gtk_style_context_get_color(getStyleContext(GTK_TYPE_ENTRY), static_cast<GtkStateFlags>(0), &gdkRGBAColor);
+        return gdkRGBAColor;
     default:
         return RenderTheme::systemColor(cssValueId);
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list