Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit de69219

Browse files
committed
Bug 1868868 - The value of thumb position changed by reflow should be consistent to nsSliderFrame::CurrentPositionChanged, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D195815
1 parent 418567a commit de69219

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

layout/xul/nsSliderFrame.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,13 @@ void nsSliderFrame::Reflow(nsPresContext* aPresContext,
614614
thumbPos.y = NSToCoordRound(pos * mRatio);
615615
}
616616

617+
// Same to `snappedThumbLocation` in `nsSliderFrame::CurrentPositionChanged`,
618+
// to avoid putting the scroll thumb at subpixel positions which cause
619+
// needless invalidations
620+
nscoord appUnitsPerPixel = PresContext()->AppUnitsPerDevPixel();
621+
thumbPos =
622+
ToAppUnits(thumbPos.ToNearestPixels(appUnitsPerPixel), appUnitsPerPixel);
623+
617624
const LogicalPoint logicalPos(wm, thumbPos, availSize);
618625
// TODO: It seems like a lot of this stuff should really belong in the thumb's
619626
// reflow code rather than here, but since we rely on the frame tree structure
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[content-visibility-075.html]
22
fuzzy:
3-
# Tiny pixels differ around the scrollbar thumb.
4-
if (os == "mac"): maxDifference=0-19;totalPixels=0-26
53
# Tiny pixels differ around "P".
64
if os == "win": maxDifference=0-47;totalPixels=0-2
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[content-visibility-076.html]
22
fuzzy:
3-
# Tiny pixels differ around the scrollbar thumb.
4-
if (os == "mac"): maxDifference=0-19;totalPixels=0-26
53
# Tiny pixels differ around "P".
64
if os == "win": maxDifference=0-47;totalPixels=0-2

0 commit comments

Comments
 (0)