[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:41 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 57a2f41ce432b93b6f1d07356ad8205102aae7f9
Author: carlosgc at webkit.org <carlosgc at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 5 17:23:39 2011 +0000

    2011-01-05  Carlos Garcia Campos  <cgarcia at igalia.com>
    
            Reviewed by Martin Robinson.
    
            [GTK] Fork code of ScrollbarThemeGtk that will differ for GTK+ 3
            https://bugs.webkit.org/show_bug.cgi?id=51923
    
            Split out pieces of ScrollbarThemeGtk into ScrollbarThemeGtk2 and
            ScrollbarThemeGtk3 that will differ between GTK+ 2 and GTK+ 3.
    
            No new tests. This should not change functionality.
    
            * GNUmakefile.am: Add ScrollbarThemeGtk2.cpp and ScrollbarThemeGtk3.cpp
            * platform/gtk/ScrollbarThemeGtk.cpp:
            (WebCore::ScrollbarThemeGtk::updateScrollbarsFrameThickness):
            * platform/gtk/ScrollbarThemeGtk.h:
            * platform/gtk/ScrollbarThemeGtk2.cpp: Added.
            (WebCore::ScrollbarThemeGtk::updateThemeProperties):
            (WebCore::ScrollbarThemeGtk::paintTrackBackground):
            (WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
            (WebCore::ScrollbarThemeGtk::paintThumb):
            (WebCore::ScrollbarThemeGtk::paintButton):
            * platform/gtk/ScrollbarThemeGtk3.cpp: Added.
            (WebCore::ScrollbarThemeGtk::updateThemeProperties):
            (WebCore::ScrollbarThemeGtk::paintTrackBackground):
            (WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
            (WebCore::ScrollbarThemeGtk::paintThumb):
            (WebCore::ScrollbarThemeGtk::paintButton):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75070 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d09e87a..81781f8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2011-01-05  Carlos Garcia Campos  <cgarcia at igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Fork code of ScrollbarThemeGtk that will differ for GTK+ 3
+        https://bugs.webkit.org/show_bug.cgi?id=51923
+
+        Split out pieces of ScrollbarThemeGtk into ScrollbarThemeGtk2 and
+        ScrollbarThemeGtk3 that will differ between GTK+ 2 and GTK+ 3.
+
+        No new tests. This should not change functionality.
+
+        * GNUmakefile.am: Add ScrollbarThemeGtk2.cpp and ScrollbarThemeGtk3.cpp
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::ScrollbarThemeGtk::updateScrollbarsFrameThickness):
+        * platform/gtk/ScrollbarThemeGtk.h:
+        * platform/gtk/ScrollbarThemeGtk2.cpp: Added.
+        (WebCore::ScrollbarThemeGtk::updateThemeProperties):
+        (WebCore::ScrollbarThemeGtk::paintTrackBackground):
+        (WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
+        (WebCore::ScrollbarThemeGtk::paintThumb):
+        (WebCore::ScrollbarThemeGtk::paintButton):
+        * platform/gtk/ScrollbarThemeGtk3.cpp: Added.
+        (WebCore::ScrollbarThemeGtk::updateThemeProperties):
+        (WebCore::ScrollbarThemeGtk::paintTrackBackground):
+        (WebCore::ScrollbarThemeGtk::paintScrollbarBackground):
+        (WebCore::ScrollbarThemeGtk::paintThumb):
+        (WebCore::ScrollbarThemeGtk::paintButton):
+
 2011-01-05  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by Andreas Kling.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 11eb9c5..f01088e 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3709,6 +3709,8 @@ webcoregtk_sources += \
 	WebCore/platform/gtk/RenderThemeGtk3.cpp \
 	WebCore/platform/gtk/ScrollbarThemeGtk.cpp \
 	WebCore/platform/gtk/ScrollbarThemeGtk.h \
+	WebCore/platform/gtk/ScrollbarThemeGtk2.cpp \
+	WebCore/platform/gtk/ScrollbarThemeGtk3.cpp \
 	WebCore/platform/gtk/ScrollViewGtk.cpp \
 	WebCore/platform/gtk/SearchPopupMenuGtk.cpp \
 	WebCore/platform/gtk/SearchPopupMenuGtk.h \
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk.cpp b/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
index 10f7e71..0835c7f 100644
--- a/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
@@ -30,9 +30,6 @@
 #include "RenderThemeGtk.h"
 #include "ScrollView.h"
 #include "Scrollbar.h"
-#include "WidgetRenderingContext.h"
-#include "gtkdrawing.h"
-#include <gtk/gtk.h>
 
 namespace WebCore {
 
@@ -72,20 +69,8 @@ void ScrollbarThemeGtk::unregisterScrollbar(Scrollbar* scrollbar)
     }
 }
 
-void ScrollbarThemeGtk::updateThemeProperties()
+void ScrollbarThemeGtk::updateScrollbarsFrameThickness()
 {
-    MozGtkScrollbarMetrics metrics;
-    moz_gtk_get_scrollbar_metrics(&metrics);
-
-    m_thumbFatness = metrics.slider_width;
-    m_troughBorderWidth = metrics.trough_border;
-    m_stepperSize = metrics.stepper_size;
-    m_stepperSpacing = metrics.stepper_spacing;
-    m_minThumbLength = metrics.min_slider_size;
-    m_troughUnderSteppers = metrics.trough_under_steppers;
-    m_hasForwardButtonStartPart = metrics.has_secondary_forward_stepper;
-    m_hasBackButtonEndPart = metrics.has_secondary_backward_stepper;
-
     if (!gScrollbars)
         return;
 
@@ -199,54 +184,6 @@ IntRect ScrollbarThemeGtk::trackRect(Scrollbar* scrollbar, bool)
                    thickness, scrollbar->height() - (2 * movementAxisPadding) - alternateButtonWidth);
 }
 
-void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
-{
-    GtkWidgetState state;
-    state.focused = FALSE;
-    state.isDefault = FALSE;
-    state.canDefault = FALSE;
-    state.disabled = FALSE;
-    state.active = FALSE;
-    state.inHover = FALSE;
-
-    // Paint the track background. If the trough-under-steppers property is true, this
-    // should be the full size of the scrollbar, but if is false, it should only be the
-    // track rect.
-    IntRect fullScrollbarRect = rect;
-    if (m_troughUnderSteppers)
-        fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
-
-    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_TRACK_VERTICAL : MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL;
-    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
-    widgetContext.paintMozillaWidget(type, &state, 0);
-}
-
-void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar)
-{
-    // This is unused by the moz_gtk_scrollecd_window_paint.
-    GtkWidgetState state;
-    IntRect fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
-    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
-    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLED_WINDOW, &state, 0);
-}
-
-void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
-{
-    GtkWidgetState state;
-    state.focused = FALSE;
-    state.isDefault = FALSE;
-    state.canDefault = FALSE;
-    state.disabled = FALSE;
-    state.active = scrollbar->pressedPart() == ThumbPart;
-    state.inHover = scrollbar->hoveredPart() == ThumbPart;
-    state.maxpos = scrollbar->maximum();
-    state.curpos = scrollbar->currentPos();
-
-    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_THUMB_VERTICAL : MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL;
-    WidgetRenderingContext widgetContext(context, rect);
-    widgetContext.paintMozillaWidget(type, &state, 0);
-}
-
 IntRect ScrollbarThemeGtk::thumbRect(Scrollbar* scrollbar, const IntRect& unconstrainedTrackRect)
 {
     IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
@@ -326,40 +263,6 @@ bool ScrollbarThemeGtk::paint(Scrollbar* scrollbar, GraphicsContext* graphicsCon
     return true;
 }
 
-void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
-{
-    int flags = 0;
-    if (scrollbar->orientation() == VerticalScrollbar)
-        flags |= MOZ_GTK_STEPPER_VERTICAL;
-
-    if (part == ForwardButtonEndPart)
-        flags |= (MOZ_GTK_STEPPER_DOWN | MOZ_GTK_STEPPER_BOTTOM);
-    if (part == ForwardButtonStartPart)
-        flags |= MOZ_GTK_STEPPER_DOWN;
-
-    GtkWidgetState state;
-    state.focused = TRUE;
-    state.isDefault = TRUE;
-    state.canDefault = TRUE;
-    state.depressed = FALSE;
-
-    if ((BackButtonStartPart == part && scrollbar->currentPos())
-        || (BackButtonEndPart == part && scrollbar->currentPos())
-        || (ForwardButtonEndPart == part && scrollbar->currentPos() != scrollbar->maximum())
-        || (ForwardButtonStartPart == part && scrollbar->currentPos() != scrollbar->maximum())) {
-        state.disabled = FALSE;
-        state.active = part == scrollbar->pressedPart();
-        state.inHover = part == scrollbar->hoveredPart();
-    } else {
-        state.disabled = TRUE;
-        state.active = FALSE;
-        state.inHover = FALSE;
-    }
-
-    WidgetRenderingContext widgetContext(context, rect);
-    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLBAR_BUTTON, &state, flags);
-}
-
 void ScrollbarThemeGtk::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect)
 {
     // ScrollbarThemeComposite::paintScrollCorner incorrectly assumes that the
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk.h b/WebCore/platform/gtk/ScrollbarThemeGtk.h
index 8f990d5..e3642cb 100644
--- a/WebCore/platform/gtk/ScrollbarThemeGtk.h
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk.h
@@ -58,6 +58,7 @@ public:
     virtual double initialAutoscrollTimerDelay() { return 0.20; }
     virtual double autoscrollTimerDelay() { return 0.02; }
     void updateThemeProperties();
+    void updateScrollbarsFrameThickness();
     void registerScrollbar(Scrollbar*);
     void unregisterScrollbar(Scrollbar*);
 
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk2.cpp b/WebCore/platform/gtk/ScrollbarThemeGtk2.cpp
new file mode 100644
index 0000000..b782dd6
--- /dev/null
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk2.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "ScrollbarThemeGtk.h"
+
+#ifdef GTK_API_VERSION_2
+
+#include "PlatformMouseEvent.h"
+#include "RenderThemeGtk.h"
+#include "ScrollView.h"
+#include "Scrollbar.h"
+#include "WidgetRenderingContext.h"
+#include "gtkdrawing.h"
+#include <gtk/gtk.h>
+
+namespace WebCore {
+
+void ScrollbarThemeGtk::updateThemeProperties()
+{
+    MozGtkScrollbarMetrics metrics;
+    moz_gtk_get_scrollbar_metrics(&metrics);
+
+    m_thumbFatness = metrics.slider_width;
+    m_troughBorderWidth = metrics.trough_border;
+    m_stepperSize = metrics.stepper_size;
+    m_stepperSpacing = metrics.stepper_spacing;
+    m_minThumbLength = metrics.min_slider_size;
+    m_troughUnderSteppers = metrics.trough_under_steppers;
+    m_hasForwardButtonStartPart = metrics.has_secondary_forward_stepper;
+    m_hasBackButtonEndPart = metrics.has_secondary_backward_stepper;
+
+    updateScrollbarsFrameThickness();
+}
+
+void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
+{
+    GtkWidgetState state;
+    state.focused = FALSE;
+    state.isDefault = FALSE;
+    state.canDefault = FALSE;
+    state.disabled = FALSE;
+    state.active = FALSE;
+    state.inHover = FALSE;
+
+    // Paint the track background. If the trough-under-steppers property is true, this
+    // should be the full size of the scrollbar, but if is false, it should only be the
+    // track rect.
+    IntRect fullScrollbarRect = rect;
+    if (m_troughUnderSteppers)
+        fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
+
+    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_TRACK_VERTICAL : MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL;
+    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
+    widgetContext.paintMozillaWidget(type, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar)
+{
+    // This is unused by the moz_gtk_scrollecd_window_paint.
+    GtkWidgetState state;
+    IntRect fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
+    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
+    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLED_WINDOW, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
+{
+    GtkWidgetState state;
+    state.focused = FALSE;
+    state.isDefault = FALSE;
+    state.canDefault = FALSE;
+    state.disabled = FALSE;
+    state.active = scrollbar->pressedPart() == ThumbPart;
+    state.inHover = scrollbar->hoveredPart() == ThumbPart;
+    state.maxpos = scrollbar->maximum();
+    state.curpos = scrollbar->currentPos();
+
+    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_THUMB_VERTICAL : MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL;
+    WidgetRenderingContext widgetContext(context, rect);
+    widgetContext.paintMozillaWidget(type, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
+{
+    int flags = 0;
+    if (scrollbar->orientation() == VerticalScrollbar)
+        flags |= MOZ_GTK_STEPPER_VERTICAL;
+
+    if (part == ForwardButtonEndPart)
+        flags |= (MOZ_GTK_STEPPER_DOWN | MOZ_GTK_STEPPER_BOTTOM);
+    if (part == ForwardButtonStartPart)
+        flags |= MOZ_GTK_STEPPER_DOWN;
+
+    GtkWidgetState state;
+    state.focused = TRUE;
+    state.isDefault = TRUE;
+    state.canDefault = TRUE;
+    state.depressed = FALSE;
+
+    if ((BackButtonStartPart == part && scrollbar->currentPos())
+        || (BackButtonEndPart == part && scrollbar->currentPos())
+        || (ForwardButtonEndPart == part && scrollbar->currentPos() != scrollbar->maximum())
+        || (ForwardButtonStartPart == part && scrollbar->currentPos() != scrollbar->maximum())) {
+        state.disabled = FALSE;
+        state.active = part == scrollbar->pressedPart();
+        state.inHover = part == scrollbar->hoveredPart();
+    } else {
+        state.disabled = TRUE;
+        state.active = FALSE;
+        state.inHover = FALSE;
+    }
+
+    WidgetRenderingContext widgetContext(context, rect);
+    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLBAR_BUTTON, &state, flags);
+}
+
+} // namespace WebCore
+
+#endif // GTK_API_VERSION_2
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp b/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp
new file mode 100644
index 0000000..30d021e
--- /dev/null
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "ScrollbarThemeGtk.h"
+
+#ifndef GTK_API_VERSION_2
+
+#include "PlatformMouseEvent.h"
+#include "RenderThemeGtk.h"
+#include "ScrollView.h"
+#include "Scrollbar.h"
+#include "WidgetRenderingContext.h"
+#include "gtkdrawing.h"
+#include <gtk/gtk.h>
+
+namespace WebCore {
+
+void ScrollbarThemeGtk::updateThemeProperties()
+{
+    MozGtkScrollbarMetrics metrics;
+    moz_gtk_get_scrollbar_metrics(&metrics);
+
+    m_thumbFatness = metrics.slider_width;
+    m_troughBorderWidth = metrics.trough_border;
+    m_stepperSize = metrics.stepper_size;
+    m_stepperSpacing = metrics.stepper_spacing;
+    m_minThumbLength = metrics.min_slider_size;
+    m_troughUnderSteppers = metrics.trough_under_steppers;
+    m_hasForwardButtonStartPart = metrics.has_secondary_forward_stepper;
+    m_hasBackButtonEndPart = metrics.has_secondary_backward_stepper;
+
+    updateScrollbarsFrameThickness();
+}
+
+void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
+{
+    GtkWidgetState state;
+    state.focused = FALSE;
+    state.isDefault = FALSE;
+    state.canDefault = FALSE;
+    state.disabled = FALSE;
+    state.active = FALSE;
+    state.inHover = FALSE;
+
+    // Paint the track background. If the trough-under-steppers property is true, this
+    // should be the full size of the scrollbar, but if is false, it should only be the
+    // track rect.
+    IntRect fullScrollbarRect = rect;
+    if (m_troughUnderSteppers)
+        fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
+
+    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_TRACK_VERTICAL : MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL;
+    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
+    widgetContext.paintMozillaWidget(type, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar)
+{
+    // This is unused by the moz_gtk_scrollecd_window_paint.
+    GtkWidgetState state;
+    IntRect fullScrollbarRect = IntRect(scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
+    WidgetRenderingContext widgetContext(context, fullScrollbarRect);
+    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLED_WINDOW, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
+{
+    GtkWidgetState state;
+    state.focused = FALSE;
+    state.isDefault = FALSE;
+    state.canDefault = FALSE;
+    state.disabled = FALSE;
+    state.active = scrollbar->pressedPart() == ThumbPart;
+    state.inHover = scrollbar->hoveredPart() == ThumbPart;
+    state.maxpos = scrollbar->maximum();
+    state.curpos = scrollbar->currentPos();
+
+    GtkThemeWidgetType type = scrollbar->orientation() == VerticalScrollbar ? MOZ_GTK_SCROLLBAR_THUMB_VERTICAL : MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL;
+    WidgetRenderingContext widgetContext(context, rect);
+    widgetContext.paintMozillaWidget(type, &state, 0);
+}
+
+void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
+{
+    int flags = 0;
+    if (scrollbar->orientation() == VerticalScrollbar)
+        flags |= MOZ_GTK_STEPPER_VERTICAL;
+
+    if (part == ForwardButtonEndPart)
+        flags |= (MOZ_GTK_STEPPER_DOWN | MOZ_GTK_STEPPER_BOTTOM);
+    if (part == ForwardButtonStartPart)
+        flags |= MOZ_GTK_STEPPER_DOWN;
+
+    GtkWidgetState state;
+    state.focused = TRUE;
+    state.isDefault = TRUE;
+    state.canDefault = TRUE;
+    state.depressed = FALSE;
+
+    if ((BackButtonStartPart == part && scrollbar->currentPos())
+        || (BackButtonEndPart == part && scrollbar->currentPos())
+        || (ForwardButtonEndPart == part && scrollbar->currentPos() != scrollbar->maximum())
+        || (ForwardButtonStartPart == part && scrollbar->currentPos() != scrollbar->maximum())) {
+        state.disabled = FALSE;
+        state.active = part == scrollbar->pressedPart();
+        state.inHover = part == scrollbar->hoveredPart();
+    } else {
+        state.disabled = TRUE;
+        state.active = FALSE;
+        state.inHover = FALSE;
+    }
+
+    WidgetRenderingContext widgetContext(context, rect);
+    widgetContext.paintMozillaWidget(MOZ_GTK_SCROLLBAR_BUTTON, &state, flags);
+}
+
+} // namespace WebCore
+
+#endif // !GTK_API_VERSION_2

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list