Bug 1887539 - Fix nsRangeFrame::UpdateForValueChange after bug 1740580. r=dholbert

In bug 1740580 I updated these functions to take the content size, but
forgot to update two existing callers.

Differential Revision: https://phabricator.services.mozilla.com/D205549
This commit is contained in:
Emilio Cobos Álvarez 2024-03-26 09:16:21 +00:00
parent 3ad4e2a42e
commit ff6647e085
4 changed files with 71 additions and 3 deletions

View file

@ -330,7 +330,7 @@ Decimal nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent) {
->GetValueAsDecimal();
}
nsRect rangeContentRect = GetContentRectRelativeToSelf();
const nsRect rangeContentRect = GetContentRectRelativeToSelf();
nsSize thumbSize;
if (IsThemed()) {
@ -397,11 +397,12 @@ void nsRangeFrame::UpdateForValueChange() {
if (!rangeProgressFrame && !thumbFrame) {
return; // diplay:none?
}
const nsSize contentBoxSize = GetContentRect().Size();
if (rangeProgressFrame) {
DoUpdateRangeProgressFrame(rangeProgressFrame, GetSize());
DoUpdateRangeProgressFrame(rangeProgressFrame, contentBoxSize);
}
if (thumbFrame) {
DoUpdateThumbPosition(thumbFrame, GetSize());
DoUpdateThumbPosition(thumbFrame, contentBoxSize);
}
if (IsThemed()) {
// We don't know the exact dimensions or location of the thumb when native

View file

@ -0,0 +1,30 @@
<!doctype html>
<style>
#scrubber {
height: 100px;
width: 100%;
appearance: none;
background-color: black;
box-sizing: border-box;
padding: 6px 2px;
margin: 0;
&::-moz-range-thumb {
border-radius: 14px;
background-color: #BFBFC9;
width: 8px;
height: 8px;
border: 3px solid white;
padding: 0;
}
&::-moz-range-track {
background-color: #969696;
}
&::-moz-range-progress {
background-color: white;
}
}
</style>
<input type="range" id="scrubber" value="0.5" min="0" max="1" step=".001">

View file

@ -0,0 +1,35 @@
<!doctype html>
<style>
#scrubber {
height: 100px;
width: 100%;
appearance: none;
background-color: black;
box-sizing: border-box;
padding: 6px 2px;
margin: 0;
&::-moz-range-thumb {
border-radius: 14px;
background-color: #BFBFC9;
width: 8px;
height: 8px;
border: 3px solid white;
padding: 0;
}
&::-moz-range-track {
background-color: #969696;
}
&::-moz-range-progress {
background-color: white;
}
}
</style>
<input type="range" id="scrubber" value="0" min="0" max="1" step=".001">
<script>
let scrubber = document.getElementById('scrubber');
scrubber.getBoundingClientRect();
scrubber.value = 0.5;
</script>

View file

@ -59,3 +59,5 @@ skip-if(Android) == range-border-background.html range-border-background-ref.htm
fails-if(Android) fuzzy(0-2,0-80) == auto-size.html auto-size-ref.html # Snapping, bug 1621141
== range-track-bg.html range-track-bg-ref.html
!= track-default-rendering.html track-default-rendering-ref.html
== 1887539.html 1887539-ref.html