Bug 1741251 - Use rect rather than point for button box position computation. r=dholbert

Otherwise the origin of the rect might not be correctly converted.

We have a supposed test for something like this:

  layout/reftests/forms/input/number/spinner-overflow-vertical.html

But in practice it doesn't work, because I removed the "overflowing
descendants inflate outlines" behavior (bug 1739894), and even with that
pref it doesn't seem to cut it... So repurpose that test to test both.

Differential Revision: https://phabricator.services.mozilla.com/D131175
This commit is contained in:
Emilio Cobos Álvarez 2021-11-16 10:57:05 +00:00
Родитель 507f143b88
Коммит 9d20445d1e
3 изменённых файлов: 12 добавлений и 16 удалений

Просмотреть файл

@ -783,14 +783,17 @@ void nsTextControlFrame::ReflowTextControlChild(
auto size = desiredSize.Size(outerWM);
// Center button in the block axis of our content box. We do this
// computation in terms of outerWM for simplicity.
position = LogicalPoint(outerWM);
position.B(outerWM) =
LogicalRect buttonRect(outerWM);
buttonRect.BSize(outerWM) = size.BSize(outerWM);
buttonRect.ISize(outerWM) = size.ISize(outerWM);
buttonRect.BStart(outerWM) =
bp.BStart(outerWM) +
(aReflowInput.ComputedBSize() - size.BSize(outerWM)) / 2;
// Align to the inline-end of the content box.
position.I(outerWM) =
buttonRect.IStart(outerWM) =
bp.IStart(outerWM) + aReflowInput.ComputedISize() - size.ISize(outerWM);
position = position.ConvertTo(wm, outerWM, containerSize);
buttonRect = buttonRect.ConvertTo(wm, outerWM, containerSize);
position = buttonRect.Origin(wm);
aButtonBoxISize = size.ISize(outerWM);
}

Просмотреть файл

@ -1,14 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<style>
:root { writing-mode: vertical-lr; }
input {
appearance: none;
width: 5px;
height: 200px;
outline: 2px solid black;
overflow: clip;
}
</style>
<input type="text">
<!-- div to cover spin box area for type=number to type=text comparison -->
<div style="position:absolute; background-color:black; width:100px; height:200px; top:100px; left:0;">
<input type="number" style="writing-mode: vertical-lr">
<input type="number" style="writing-mode: vertical-rl">

Просмотреть файл

@ -1,14 +1,10 @@
<!DOCTYPE html>
<meta charset="utf-8">
<style>
:root { writing-mode: vertical-lr; }
input {
appearance: none;
width: 5px;
height: 200px;
outline: 2px solid black;
}
</style>
<input type="number">
<!-- div to cover spin box area for type=number to type=text comparison -->
<div style="position:absolute; background-color:black; width:100px; height:200px; top:100px; left:0;">
<input type="number" style="writing-mode: vertical-lr">
<input type="number" style="writing-mode: vertical-rl">