Bug 1854424 - Add a LogicalMargin method returning an offset to start-sides. r=layout-reviewers,jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D188847
This commit is contained in:
Ting-Yu Lin 2023-09-22 15:39:25 +00:00
Родитель b1c916c2f3
Коммит 0319ff2c6b
4 изменённых файлов: 17 добавлений и 10 удалений

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

@ -135,9 +135,8 @@ void nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
LogicalMargin childMargin = childReflowInput.ComputedLogicalMargin(myWM);
// offsets of input area frame within this frame:
LogicalPoint childOffset(
myWM, borderPadding.IStart(myWM) + childMargin.IStart(myWM),
borderPadding.BStart(myWM) + childMargin.BStart(myWM));
LogicalPoint childOffset =
borderPadding.StartOffset(myWM) + childMargin.StartOffset(myWM);
nsReflowStatus childStatus;
// We initially reflow the child with a dummy containerSize; positioning

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

@ -1341,6 +1341,15 @@ class LogicalMargin {
return LogicalSize(aWritingMode, IStartEnd(), BStartEnd());
}
/**
* Return a LogicalPoint representing an offset to the start-sides, i.e.
* inline-start and block-start.
*/
LogicalPoint StartOffset(WritingMode aWritingMode) const {
CHECK_WRITING_MODE(aWritingMode);
return LogicalPoint(aWritingMode, IStart(), BStart());
}
/**
* Accessors for physical margins, using our writing mode to convert from
* logical values.

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

@ -840,11 +840,10 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
}
LogicalRect rect(outerWM,
border.IStart(outerWM) + offsets.IStart(outerWM) +
margin.IStart(outerWM),
border.BStart(outerWM) + offsets.BStart(outerWM) +
margin.BStart(outerWM),
kidSize.ISize(outerWM), kidSize.BSize(outerWM));
border.StartOffset(outerWM) +
offsets.StartOffset(outerWM) +
margin.StartOffset(outerWM),
kidSize);
nsRect r = rect.GetPhysicalRect(
outerWM, logicalCBSize.GetPhysicalSize(wm) +
border.Size(outerWM).GetPhysicalSize(outerWM));

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

@ -5400,8 +5400,8 @@ std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
// flex container's content box (with respect to its border-box), so that
// we can compute our flex item's final positions.
WritingMode flexWM = aReflowInput.GetWritingMode();
const LogicalPoint containerContentBoxOrigin(
flexWM, aBorderPadding.IStart(flexWM), aBorderPadding.BStart(flexWM));
const LogicalPoint containerContentBoxOrigin =
aBorderPadding.StartOffset(flexWM);
// The block-end of children is relative to the flex container's border-box.
nscoord maxBlockEndEdgeOfChildren = containerContentBoxOrigin.B(flexWM);