[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mrobinson at webkit.org
mrobinson at webkit.org
Wed Dec 22 13:04:52 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e60e17641bd420cdd4e6da2c4867a2f4b4fba492
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 6 19:49:12 2010 +0000
2010-09-06 Martin Robinson <mrobinson at igalia.com>
Reviewed by Gustavo Noronha Silva.
[GTK] ScrollbarThemeGtk should support secondary steppers
https://bugs.webkit.org/show_bug.cgi?id=44791
Add support to ScrollbarThemeGtk for drawing alternate steppers. Adjust
the algorithms for calculating forward and back button rects, if they
are active in the theme. Expose this information via GtkScrollbarMetrics.
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::updateThemeProperties): Access the secondary stepper properties
of GtkScrollbarMetrics when updating the style cache.
(WebCore::ScrollbarThemeGtk::backButtonRect): Account for alternate steppers.
(WebCore::ScrollbarThemeGtk::forwardButtonRect): Ditto.
(WebCore::ScrollbarThemeGtk::trackRect): Ditto.
(WebCore::ScrollbarThemeGtk::paintButton): Ditto.
* platform/gtk/ScrollbarThemeGtk.h:
* platform/gtk/gtk2drawing.c: Expose whether or not the style uses alternate steppers
via GtkScrollbarMetrics.
* platform/gtk/gtkdrawing.h: Added fields to GtkScrollbarMetrics.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 01c18fe..8f13822 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-06 Martin Robinson <mrobinson at igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] ScrollbarThemeGtk should support secondary steppers
+ https://bugs.webkit.org/show_bug.cgi?id=44791
+
+ Add support to ScrollbarThemeGtk for drawing alternate steppers. Adjust
+ the algorithms for calculating forward and back button rects, if they
+ are active in the theme. Expose this information via GtkScrollbarMetrics.
+
+ * platform/gtk/ScrollbarThemeGtk.cpp:
+ (WebCore::ScrollbarThemeGtk::updateThemeProperties): Access the secondary stepper properties
+ of GtkScrollbarMetrics when updating the style cache.
+ (WebCore::ScrollbarThemeGtk::backButtonRect): Account for alternate steppers.
+ (WebCore::ScrollbarThemeGtk::forwardButtonRect): Ditto.
+ (WebCore::ScrollbarThemeGtk::trackRect): Ditto.
+ (WebCore::ScrollbarThemeGtk::paintButton): Ditto.
+ * platform/gtk/ScrollbarThemeGtk.h:
+ * platform/gtk/gtk2drawing.c: Expose whether or not the style uses alternate steppers
+ via GtkScrollbarMetrics.
+ * platform/gtk/gtkdrawing.h: Added fields to GtkScrollbarMetrics.
+
2010-09-06 Tony Gentilcore <tonyg at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk.cpp b/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
index b6efe54..2e942fe 100644
--- a/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
@@ -82,6 +82,8 @@ void ScrollbarThemeGtk::updateThemeProperties()
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;
@@ -120,30 +122,45 @@ bool ScrollbarThemeGtk::hasThumb(Scrollbar* scrollbar)
IntRect ScrollbarThemeGtk::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
- // We do not support multiple steppers per end yet.
- if (part == BackButtonEndPart)
+ if (part == BackButtonEndPart && !m_hasBackButtonEndPart)
return IntRect();
+ int x = scrollbar->x() + m_troughBorderWidth;
+ int y = scrollbar->y() + m_troughBorderWidth;
IntSize size = buttonSize(scrollbar);
- return IntRect(scrollbar->x() + m_troughBorderWidth, scrollbar->y() + m_troughBorderWidth, size.width(), size.height());
+ if (part == BackButtonStartPart)
+ return IntRect(x, y, size.width(), size.height());
+
+ // BackButtonEndPart (alternate button)
+ if (scrollbar->orientation() == HorizontalScrollbar)
+ return IntRect(scrollbar->x() + scrollbar->width() - m_troughBorderWidth - (2 * size.width()), y, size.width(), size.height());
+
+ // VerticalScrollbar alternate button
+ return IntRect(x, scrollbar->y() + scrollbar->height() - m_troughBorderWidth - (2 * size.height()), size.width(), size.height());
}
IntRect ScrollbarThemeGtk::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
- // We do not support multiple steppers per end yet.
- if (part == ForwardButtonStartPart)
+ if (part == ForwardButtonStartPart && !m_hasForwardButtonStartPart)
return IntRect();
IntSize size = buttonSize(scrollbar);
- int x, y;
if (scrollbar->orientation() == HorizontalScrollbar) {
- x = scrollbar->x() + scrollbar->width() - size.width() - m_troughBorderWidth;
- y = scrollbar->y() + m_troughBorderWidth;
- } else {
- x = scrollbar->x() + m_troughBorderWidth;
- y = scrollbar->y() + scrollbar->height() - size.height() - m_troughBorderWidth;
+ int y = scrollbar->y() + m_troughBorderWidth;
+ if (part == ForwardButtonEndPart)
+ return IntRect(scrollbar->x() + scrollbar->width() - size.width() - m_troughBorderWidth, y, size.width(), size.height());
+
+ // ForwardButtonStartPart (alternate button)
+ return IntRect(scrollbar->x() + m_troughBorderWidth + size.width(), y, size.width(), size.height());
}
- return IntRect(x, y, size.width(), size.height());
+
+ // VerticalScrollbar
+ int x = scrollbar->x() + m_troughBorderWidth;
+ if (part == ForwardButtonEndPart)
+ return IntRect(x, scrollbar->y() + scrollbar->height() - size.height() - m_troughBorderWidth, size.width(), size.height());
+
+ // ForwardButtonStartPart (alternate button)
+ return IntRect(x, scrollbar->y() + m_troughBorderWidth + size.height(), size.width(), size.height());
}
IntRect ScrollbarThemeGtk::trackRect(Scrollbar* scrollbar, bool)
@@ -157,17 +174,28 @@ IntRect ScrollbarThemeGtk::trackRect(Scrollbar* scrollbar, bool)
// The fatness of the scrollbar on the non-movement axis.
int thickness = scrollbarThickness(scrollbar->controlSize());
+ int alternateButtonOffset = 0;
+ int alternateButtonWidth = 0;
+ if (m_hasForwardButtonStartPart) {
+ alternateButtonOffset += m_stepperSize;
+ alternateButtonWidth += m_stepperSize;
+ }
+ if (m_hasBackButtonEndPart)
+ alternateButtonWidth += m_stepperSize;
+
if (scrollbar->orientation() == HorizontalScrollbar) {
// Once the scrollbar becomes smaller than the natural size of the
// two buttons, the track disappears.
if (scrollbar->width() < 2 * thickness)
return IntRect();
- return IntRect(scrollbar->x() + movementAxisPadding, scrollbar->y(), scrollbar->width() - (2 * movementAxisPadding), thickness);
+ return IntRect(scrollbar->x() + movementAxisPadding + alternateButtonOffset, scrollbar->y(),
+ scrollbar->width() - (2 * movementAxisPadding) - alternateButtonWidth, thickness);
}
if (scrollbar->height() < 2 * thickness)
return IntRect();
- return IntRect(scrollbar->x(), scrollbar->y() + movementAxisPadding, thickness, scrollbar->height() - (2 * movementAxisPadding));
+ return IntRect(scrollbar->x(), scrollbar->y() + movementAxisPadding + alternateButtonOffset,
+ thickness, scrollbar->height() - (2 * movementAxisPadding) - alternateButtonWidth);
}
void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect)
@@ -304,10 +332,10 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollb
if (scrollbar->orientation() == VerticalScrollbar)
flags |= MOZ_GTK_STEPPER_VERTICAL;
- if (part == ForwardButtonEndPart) {
+ if (part == ForwardButtonEndPart)
+ flags |= (MOZ_GTK_STEPPER_DOWN | MOZ_GTK_STEPPER_BOTTOM);
+ if (part == ForwardButtonStartPart)
flags |= MOZ_GTK_STEPPER_DOWN;
- flags |= MOZ_GTK_STEPPER_BOTTOM;
- }
GtkWidgetState state;
state.focused = TRUE;
@@ -315,7 +343,9 @@ void ScrollbarThemeGtk::paintButton(GraphicsContext* context, Scrollbar* scrollb
state.canDefault = TRUE;
if ((BackButtonStartPart == part && scrollbar->currentPos())
- || (ForwardButtonEndPart == part && scrollbar->currentPos() != scrollbar->maximum())) {
+ || (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();
diff --git a/WebCore/platform/gtk/ScrollbarThemeGtk.h b/WebCore/platform/gtk/ScrollbarThemeGtk.h
index eff2fee..8f990d5 100644
--- a/WebCore/platform/gtk/ScrollbarThemeGtk.h
+++ b/WebCore/platform/gtk/ScrollbarThemeGtk.h
@@ -68,6 +68,8 @@ protected:
int m_stepperSpacing;
int m_minThumbLength;
bool m_troughUnderSteppers;
+ bool m_hasForwardButtonStartPart;
+ bool m_hasBackButtonEndPart;
};
}
diff --git a/WebCore/platform/gtk/gtk2drawing.c b/WebCore/platform/gtk/gtk2drawing.c
index b33fb1f..ba69cdc 100644
--- a/WebCore/platform/gtk/gtk2drawing.c
+++ b/WebCore/platform/gtk/gtk2drawing.c
@@ -3079,6 +3079,8 @@ moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics *metrics)
"stepper_size", &metrics->stepper_size,
"stepper_spacing", &metrics->stepper_spacing,
"trough_under_steppers", &metrics->trough_under_steppers,
+ "has_secondary_forward_stepper", &metrics->has_secondary_forward_stepper,
+ "has_secondary_backward_stepper", &metrics->has_secondary_backward_stepper,
NULL);
metrics->min_slider_size = gtk_range_get_min_slider_size(GTK_RANGE(gParts->horizScrollbarWidget));
diff --git a/WebCore/platform/gtk/gtkdrawing.h b/WebCore/platform/gtk/gtkdrawing.h
index 9d06d5d..c00da97 100644
--- a/WebCore/platform/gtk/gtkdrawing.h
+++ b/WebCore/platform/gtk/gtkdrawing.h
@@ -76,6 +76,8 @@ typedef struct {
gint stepper_spacing;
gint min_slider_size;
gboolean trough_under_steppers;
+ gboolean has_secondary_forward_stepper;
+ gboolean has_secondary_backward_stepper;
} MozGtkScrollbarMetrics;
typedef struct _GtkThemeParts {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list