[GTK] GTK+ 3 theming code does not use the GtkOrientable style class

https://bugs.webkit.org/show_bug.cgi?id=72789

Patch by Martin Robinson <mrobinson@igalia.com> on 2012-01-03
Reviewed by Philippe Normand.

No new tests. Testing GTK+ theming is quite difficult
because no two distributions have the same set of themes.
Current tests prevent regressions.

* platform/gtk/RenderThemeGtk3.cpp:
(WebCore::applySliderStyleContextClasses): Added this helper that
properly handles the orientable style class.
(WebCore::RenderThemeGtk::paintSliderTrack): Use the new helper.
(WebCore::RenderThemeGtk::paintSliderThumb): Ditto.
* platform/gtk/ScrollbarThemeGtk3.cpp:
(WebCore::applyScrollbarStyleContextClasses): Added this helper that
properly handles the orientable style class.
(WebCore::ScrollbarThemeGtk::paintTrackBackground): Use the new helper.
(WebCore::ScrollbarThemeGtk::paintScrollbarBackground): Ditto.
(WebCore::ScrollbarThemeGtk::paintThumb): Ditto.
(WebCore::ScrollbarThemeGtk::paintButton): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8282a1d8
2012-01-03 Martin Robinson <mrobinson@igalia.com>
[GTK] GTK+ 3 theming code does not use the GtkOrientable style class
https://bugs.webkit.org/show_bug.cgi?id=72789
Reviewed by Philippe Normand.
No new tests. Testing GTK+ theming is quite difficult
because no two distributions have the same set of themes.
Current tests prevent regressions.
* platform/gtk/RenderThemeGtk3.cpp:
(WebCore::applySliderStyleContextClasses): Added this helper that
properly handles the orientable style class.
(WebCore::RenderThemeGtk::paintSliderTrack): Use the new helper.
(WebCore::RenderThemeGtk::paintSliderThumb): Ditto.
* platform/gtk/ScrollbarThemeGtk3.cpp:
(WebCore::applyScrollbarStyleContextClasses): Added this helper that
properly handles the orientable style class.
(WebCore::ScrollbarThemeGtk::paintTrackBackground): Use the new helper.
(WebCore::ScrollbarThemeGtk::paintScrollbarBackground): Ditto.
(WebCore::ScrollbarThemeGtk::paintThumb): Ditto.
(WebCore::ScrollbarThemeGtk::paintButton): Ditto.
2012-01-03 Florin Malita <fmalita@google.com>
NULL ptr in WebCore::SVGStyledTransformableElement::animatedLocalTransform
......@@ -616,6 +616,15 @@ bool RenderThemeGtk::paintTextField(RenderObject* renderObject, const PaintInfo&
return false;
}
static void applySliderStyleContextClasses(GtkStyleContext* context, ControlPart part)
{
gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCALE);
if (part == SliderHorizontalPart || part == SliderThumbHorizontalPart)
gtk_style_context_add_class(context, GTK_STYLE_CLASS_HORIZONTAL);
else if (part == SliderVerticalPart || part == SliderThumbVerticalPart)
gtk_style_context_add_class(context, GTK_STYLE_CLASS_VERTICAL);
}
bool RenderThemeGtk::paintSliderTrack(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
{
ControlPart part = renderObject->style()->appearance();
......@@ -625,7 +634,7 @@ bool RenderThemeGtk::paintSliderTrack(RenderObject* renderObject, const PaintInf
gtk_style_context_save(context);
gtk_style_context_set_direction(context, gtkTextDirection(renderObject->style()->direction()));
gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCALE);
applySliderStyleContextClasses(context, part);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_TROUGH);
if (!isEnabled(renderObject) || isReadOnlyControl(renderObject))
......@@ -660,7 +669,7 @@ bool RenderThemeGtk::paintSliderThumb(RenderObject* renderObject, const PaintInf
gtk_style_context_save(context);
gtk_style_context_set_direction(context, gtkTextDirection(renderObject->style()->direction()));
gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCALE);
applySliderStyleContextClasses(context, part);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_SLIDER);
guint flags = 0;
......
......@@ -64,6 +64,12 @@ void ScrollbarThemeGtk::updateThemeProperties()
updateScrollbarsFrameThickness();
}
static void applyScrollbarStyleContextClasses(GtkStyleContext* context, ScrollbarOrientation orientation)
{
gtk_style_context_add_class(context, GTK_STYLE_CLASS_SCROLLBAR);
gtk_style_context_add_class(context, orientation == VerticalScrollbar ? GTK_STYLE_CLASS_VERTICAL : GTK_STYLE_CLASS_HORIZONTAL);
}
void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
{
// Paint the track background. If the trough-under-steppers property is true, this
......@@ -75,7 +81,7 @@ void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar
gtk_style_context_save(m_context);
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_SCROLLBAR);
applyScrollbarStyleContextClasses(m_context, scrollbar->orientation());
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_TROUGH);
gtk_render_background(m_context, context->platformContext()->cr(),
......@@ -90,7 +96,7 @@ void ScrollbarThemeGtk::paintScrollbarBackground(GraphicsContext* context, Scrol
{
gtk_style_context_save(m_context);
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_SCROLLBAR);
applyScrollbarStyleContextClasses(m_context, scrollbar->orientation());
gtk_style_context_add_class(m_context, "scrolled-window");
gtk_render_frame(m_context, context->platformContext()->cr(), scrollbar->x(), scrollbar->y(), scrollbar->width(), scrollbar->height());
......@@ -101,7 +107,8 @@ void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, Scrollbar* scrollba
{
gtk_style_context_save(m_context);
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_SCROLLBAR);
ScrollbarOrientation orientation = scrollbar->orientation();
applyScrollbarStyleContextClasses(m_context, orientation);
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_SLIDER);
guint flags = 0;
......@@ -112,7 +119,7 @@ void ScrollbarThemeGtk::paintThumb(GraphicsContext* context, Scrollbar* scrollba
gtk_style_context_set_state(m_context, static_cast<GtkStateFlags>(flags));
gtk_render_slider(m_context, context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height(),
scrollbar->orientation() == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
gtk_style_context_restore(m_context);
}
......@@ -121,7 +128,8 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollb
{
gtk_style_context_save(m_context);
gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_SCROLLBAR);
ScrollbarOrientation orientation = scrollbar->orientation();
applyScrollbarStyleContextClasses(m_context, orientation);
guint flags = 0;
if ((BackButtonStartPart == part && scrollbar->currentPos())
......@@ -157,7 +165,7 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollb
}
gdouble angle;
if (scrollbar->orientation() == VerticalScrollbar) {
if (orientation == VerticalScrollbar) {
angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI : 0;
} else {
angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment