bug 1343802 swap vertical scrollbar button dimensions for horizontal scrollbars r?jhorak
MozReview-Commit-ID: 4fK0hFRWn1p
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2639,20 +2639,21 @@ GetScrollbarMetrics(GtkOrientation aOrie
// track
style = ClaimStyleContext(track);
metrics->border.track = GetMarginBorderPadding(style);
ReleaseStyleContext(style);
MozGtkSize trackSizeForThumb = metrics->size.thumb + metrics->border.track;
// button
if (hasButtons) {
metrics->size.button = GetMinMarginBox(MOZ_GTK_SCROLLBAR_BUTTON);
- // If the buttons will cause Gecko to expand the track to fill
- // available breadth, then add to the track border to prevent Gecko
- // from expanding the thumb to fill available breadth.
if (aOrientation == GTK_ORIENTATION_HORIZONTAL) {
+ metrics->size.button.Rotate();
+ // If the buttons will cause Gecko to expand the track to fill
+ // available breadth, then add to the track border to prevent Gecko
+ // from expanding the thumb to fill available breadth.
gint extra = metrics->size.button.height - trackSizeForThumb.height;
if (extra > 0) {
// If extra is odd, then the thumb is 0.5 pixels above
// center as in gtk_range_compute_slider_position().
metrics->border.track.top += extra / 2;
metrics->border.track.bottom += extra - extra / 2;
// Update size for change in border.
trackSizeForThumb.height += extra;
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -47,16 +47,22 @@ struct MozGtkSize {
gint height;
MozGtkSize operator+(const GtkBorder& aBorder) const
{
gint resultWidth = width + aBorder.left + aBorder.right;
gint resultHeight = height + aBorder.top + aBorder.bottom;
return {resultWidth, resultHeight};
}
+ void Rotate()
+ {
+ gint tmp = width;
+ width = height;
+ height = tmp;
+ }
};
typedef struct {
bool initialized;
struct {
MozGtkSize scrollbar;
MozGtkSize thumb;
MozGtkSize button;