diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index d430272f8c1..90ac5e88f94 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -690,7 +690,15 @@ nsSliderFrame::CurrentPositionChanged() // avoid putting the scroll thumb at subpixel positions which cause needless invalidations nscoord appUnitsPerPixel = PresContext()->AppUnitsPerDevPixel(); - newThumbRect = newThumbRect.ToNearestPixels(appUnitsPerPixel).ToAppUnits(appUnitsPerPixel); + nsRect snappedThumbRect = newThumbRect.ToNearestPixels(appUnitsPerPixel).ToAppUnits(appUnitsPerPixel); + if (IsHorizontal()) { + newThumbRect.x = snappedThumbRect.x; + newThumbRect.width = snappedThumbRect.width; + } else { + newThumbRect.y = snappedThumbRect.y; + newThumbRect.height = snappedThumbRect.height; + } + newThumbRect = newThumbRect.Intersect(clientRect); // set the rect thumbFrame->SetRect(newThumbRect);