Backed out changeset 811d8bd2f7f9 (bug 1802687) for causing failures in range-vlr.html CLOSED TREE

This commit is contained in:
Noemi Erli 2023-07-07 19:32:17 +03:00
parent e631ff3d66
commit e6aff2fa18
5 changed files with 13 additions and 36 deletions

View File

@ -434,10 +434,8 @@ Decimal nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent) {
nscoord posOfPoint = mozilla::clamped(point.y, posAtStart, posAtEnd);
// For a vertical range, the top (posAtStart) is the highest value, so we
// subtract the fraction from 1.0 to get that polarity correct.
fraction = Decimal(posOfPoint - posAtStart) / Decimal(traversableDistance);
if (IsUpwards()) {
fraction = Decimal(1) - fraction;
}
fraction = Decimal(1) -
Decimal(posOfPoint - posAtStart) / Decimal(traversableDistance);
}
MOZ_ASSERT(fraction >= Decimal(0) && fraction <= Decimal(1));
@ -574,11 +572,7 @@ void nsRangeFrame::DoUpdateThumbPosition(nsIFrame* aThumbFrame,
nscoord traversableDistance =
rangeContentBoxSize.height - thumbSize.height;
newPosition.x += (rangeContentBoxSize.width - thumbSize.width) / 2;
if (IsUpwards()) {
newPosition.y += NSToCoordRound((1.0 - fraction) * traversableDistance);
} else {
newPosition.y += NSToCoordRound(fraction * traversableDistance);
}
newPosition.y += NSToCoordRound((1.0 - fraction) * traversableDistance);
}
}
aThumbFrame->SetPosition(newPosition);
@ -619,9 +613,7 @@ void nsRangeFrame::DoUpdateRangeProgressFrame(nsIFrame* aRangeProgressFrame,
} else {
nscoord progLength = NSToCoordRound(fraction * rangeContentBoxSize.height);
progRect.x += (rangeContentBoxSize.width - progSize.width) / 2;
if (IsUpwards()) {
progRect.y += rangeContentBoxSize.height - progLength;
}
progRect.y += rangeContentBoxSize.height - progLength;
progRect.height = progLength;
}
aRangeProgressFrame->SetRect(progRect);

View File

@ -115,18 +115,6 @@ class nsRangeFrame final : public nsContainerFrame,
return GetWritingMode().IsPhysicalRTL();
}
/**
* Returns true if the range progresses upwards (for vertical ranges in
* horizontal writing mode, or for bidi-RTL in vertical mode). Only
* relevant when IsHorizontal() is false.
*/
bool IsUpwards() const {
MOZ_ASSERT(!IsHorizontal());
mozilla::WritingMode wm = GetWritingMode();
return wm.GetBlockDir() == mozilla::WritingMode::eBlockTB ||
wm.GetInlineDir() == mozilla::WritingMode::eInlineBTT;
}
double GetMin() const;
double GetMax() const;
double GetValue() const;

View File

@ -0,0 +1,2 @@
[range-input-appearance-native-vertical-rtl.optional.html]
expected: FAIL

View File

@ -0,0 +1,2 @@
[range-input-appearance-none-vertical-rtl.optional.html]
expected: FAIL

View File

@ -880,18 +880,11 @@ void Theme::PaintRange(nsIFrame* aFrame, PaintBackendData& aPaintData,
tickMarkSize = LayoutDeviceSize(tickMarkHeight, tickMarkWidth);
thumbRect.x = aRect.x + (aRect.width - thumbRect.width) / 2;
if (rangeFrame->IsUpwards()) {
thumbRect.y =
aRect.y + (aRect.height - thumbRect.height) * (1.0 - progress);
float midPoint = thumbRect.Center().Y();
trackClipRect.SetBoxY(aRect.Y(), midPoint);
progressClipRect.SetBoxY(midPoint, aRect.YMost());
} else {
thumbRect.y = aRect.y + (aRect.height - thumbRect.height) * progress;
float midPoint = thumbRect.Center().Y();
trackClipRect.SetBoxY(midPoint, aRect.YMost());
progressClipRect.SetBoxY(aRect.Y(), midPoint);
}
thumbRect.y =
aRect.y + (aRect.height - thumbRect.height) * (1.0 - progress);
float midPoint = thumbRect.Center().Y();
trackClipRect.SetBoxY(aRect.Y(), midPoint);
progressClipRect.SetBoxY(midPoint, aRect.YMost());
}
const CSSCoord borderWidth = 1.0f;