Bug 1853090 - Add ContentISize() and ContentBSize() convenience methods to nsIFrame. r=layout-reviewers,jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D188157
This commit is contained in:
Ting-Yu Lin 2023-09-14 18:13:17 +00:00
Родитель 17bb56246f
Коммит 2b2646bd48
6 изменённых файлов: 11 добавлений и 5 удалений

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

@ -106,7 +106,7 @@ Maybe<nscoord> nsCheckboxRadioFrame::GetNaturalBaselineBOffset(
if (aWM.IsCentralBaseline()) {
return Some(GetLogicalUsedBorderAndPadding(aWM).BStart(aWM) +
ContentSize(aWM).BSize(aWM) / 2);
ContentBSize(aWM) / 2);
}
// This is for compatibility with Chrome, Safari and Edge (Dec 2016).
// Treat radio buttons and checkboxes as having an intrinsic baseline

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

@ -1163,7 +1163,7 @@ void nsContainerFrame::ReflowOverflowContainerChildren(
StyleSize::LengthPercentage(LengthPercentage::FromAppUnits(
frame->StylePosition()->mBoxSizing == StyleBoxSizing::Border
? prevRect.ISize(wm)
: prevInFlow->ContentSize(wm).ISize(wm))));
: prevInFlow->ContentISize(wm))));
// An overflow container's block-size must be 0.
sizeOverride.mStyleBSize.emplace(

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

@ -5352,7 +5352,7 @@ static nscoord ContentContribution(
size += child->GetLogicalUsedMargin(childWM).BStartEnd(childWM);
nscoord overflow = size - aMinSizeClamp;
if (MOZ_UNLIKELY(overflow > 0)) {
nscoord contentSize = child->ContentSize(childWM).BSize(childWM);
nscoord contentSize = child->ContentBSize(childWM);
nscoord newContentSize = std::max(nscoord(0), contentSize - overflow);
// XXXmats deal with percentages better, see bug 1300369 comment 27.
size -= contentSize - newContentSize;

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

@ -1063,6 +1063,12 @@ class nsIFrame : public nsQueryFrame {
std::max(0, size.ISize(aWritingMode) - bp.IStartEnd(aWritingMode)),
std::max(0, size.BSize(aWritingMode) - bp.BStartEnd(aWritingMode)));
}
nscoord ContentISize(mozilla::WritingMode aWritingMode) const {
return ContentSize(aWritingMode).ISize(aWritingMode);
}
nscoord ContentBSize(mozilla::WritingMode aWritingMode) const {
return ContentSize(aWritingMode).BSize(aWritingMode);
}
/**
* When we change the size of the frame's border-box rect, we may need to

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

@ -203,7 +203,7 @@ nscoord nsSplittableFrame::CalcAndCacheConsumedBSize() {
continue;
}
bSize += prev->ContentSize(wm).BSize(wm);
bSize += prev->ContentBSize(wm);
bool found = false;
nscoord consumed = prev->GetProperty(ConsumedBSizeProperty(), &found);
if (found) {

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

@ -10271,7 +10271,7 @@ Maybe<nscoord> nsTextFrame::GetNaturalBaselineBOffset(
if (!aWM.IsOrthogonalTo(GetWritingMode())) {
if (aWM.IsCentralBaseline()) {
return Some(GetLogicalUsedBorderAndPadding(aWM).BStart(aWM) +
ContentSize(aWM).BSize(aWM) / 2);
ContentBSize(aWM) / 2);
}
return Some(mAscent);
}