[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 18:41:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 85f041be3ade5fec5028c01a61f2bf06137cd9e9
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 15 19:39:10 2010 +0000

    2010-12-15  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [GTK] Move button rendering from gtk{2,3}drawing.cpp to RenderThemeGtk
            https://bugs.webkit.org/show_bug.cgi?id=48486
    
            Implement button rendering in RenderThemeGtk. The implementation
            from gtk{2,3}drawing.cpp will be removed once menu list button rendering
            is implemented in RenderThemeGtk as well.
    
            No new tests, as this should not change functionality.
    
            * platform/gtk/RenderThemeGtk.cpp:
            (WebCore::RenderThemeGtk::paintButton): Add an implementation of button
            rendering that uses WidgetRenderingContext.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74132 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b905057..e16c2c5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-15  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [GTK] Move button rendering from gtk{2,3}drawing.cpp to RenderThemeGtk
+        https://bugs.webkit.org/show_bug.cgi?id=48486
+
+        Implement button rendering in RenderThemeGtk. The implementation
+        from gtk{2,3}drawing.cpp will be removed once menu list button rendering
+        is implemented in RenderThemeGtk as well.
+
+        No new tests, as this should not change functionality.
+
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::paintButton): Add an implementation of button
+        rendering that uses WidgetRenderingContext.
+
 2010-10-18  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp
index 43a23f2..f732c16 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -350,9 +350,56 @@ void RenderThemeGtk::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle*
         style->setLineHeight(RenderStyle::initialLineHeight());
 }
 
-bool RenderThemeGtk::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
+bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, const IntRect& rect)
 {
-    return paintRenderObject(MOZ_GTK_BUTTON, o, i.context, rect, GTK_RELIEF_NORMAL);
+    if (info.context->paintingDisabled())
+        return false;
+
+    GtkWidget* widget = gtkButton();
+    IntRect buttonRect(IntPoint(), rect.size());
+    IntRect focusRect(buttonRect);
+
+    GtkStateType state = getGtkStateType(object);
+    gtk_widget_set_state(widget, state);
+    gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction()));
+
+    if (isFocused(object)) {
+        if (isEnabled(object)) {
+#if !GTK_CHECK_VERSION(2, 22, 0)
+            GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+#endif
+            g_object_set(widget, "has-focus", TRUE, NULL);
+        }
+
+        gboolean interiorFocus = 0, focusWidth = 0, focusPadding = 0;
+        gtk_widget_style_get(widget,
+                             "interior-focus", &interiorFocus,
+                             "focus-line-width", &focusWidth,
+                             "focus-padding", &focusPadding, NULL);
+        // If we are using exterior focus, we shrink the button rect down before
+        // drawing. If we are using interior focus we shrink the focus rect. This
+        // approach originates from the Mozilla theme drawing code (gtk2drawing.c).
+        if (interiorFocus) {
+            GtkStyle* style = gtk_widget_get_style(widget);
+            focusRect.inflateX(-style->xthickness - focusPadding);
+            focusRect.inflateY(-style->ythickness - focusPadding);
+        } else {
+            buttonRect.inflateX(-focusWidth - focusPadding);
+            buttonRect.inflateY(-focusPadding - focusPadding);
+        }
+    }
+
+    WidgetRenderingContext widgetContext(info.context, rect);
+    GtkShadowType shadowType = state == GTK_STATE_ACTIVE ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+    widgetContext.gtkPaintBox(buttonRect, widget, state, shadowType, "button");
+    if (isFocused(object))
+        widgetContext.gtkPaintFocus(focusRect, widget, state, "button");
+
+#if !GTK_CHECK_VERSION(2, 22, 0)
+    GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
+#endif
+    g_object_set(widget, "has-focus", FALSE, NULL);
+    return false;
 }
 
 static void getComboBoxPadding(RenderStyle* style, int& left, int& top, int& right, int& bottom)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list