Bug 1066934 - Don't allow the snapped scrollbar thumb to extend past the scrollbar bounds. r=roc

This commit is contained in:
Markus Stange 2014-09-18 10:52:38 +02:00
parent 27c0bd9537
commit d0db5839ff

View File

@ -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);