зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`, `IntrinsicISize` by adding a helper struct as a preparation. Then we can just add more data such as a percentage basis to the struct without altering the signature in the future. When passing `IntrinsicSizeInput` struct down to another helper method, we generally just pass the original one if the method is computing the intrinsic size of our own or our anonymous children. If the method is computing our children's intrinsic contribution, we'll need to create a brand new `IntrinsicSizeInput` for our children. Differential Revision: https://phabricator.services.mozilla.com/D219521
This commit is contained in:
Родитель
341da6a3fc
Коммит
5548e07e75
|
@ -2622,10 +2622,11 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsDocumentViewer::GetContentSize(
|
||||||
const nscoord minISize = wm.IsVertical() ? constraints.mMinSize.height
|
const nscoord minISize = wm.IsVertical() ? constraints.mMinSize.height
|
||||||
: constraints.mMinSize.width;
|
: constraints.mMinSize.width;
|
||||||
const nscoord maxISize = wm.IsVertical() ? aMaxHeight : aMaxWidth;
|
const nscoord maxISize = wm.IsVertical() ? aMaxHeight : aMaxWidth;
|
||||||
|
const IntrinsicSizeInput input(rcx.get());
|
||||||
if (aPrefWidth) {
|
if (aPrefWidth) {
|
||||||
prefISize = std::max(root->GetMinISize(rcx.get()), aPrefWidth);
|
prefISize = std::max(root->GetMinISize(input), aPrefWidth);
|
||||||
} else {
|
} else {
|
||||||
prefISize = root->GetPrefISize(rcx.get());
|
prefISize = root->GetPrefISize(input);
|
||||||
}
|
}
|
||||||
prefISize = nsPresContext::RoundUpAppUnitsToCSSPixel(
|
prefISize = nsPresContext::RoundUpAppUnitsToCSSPixel(
|
||||||
std::max(minISize, std::min(prefISize, maxISize)));
|
std::max(minISize, std::min(prefISize, maxISize)));
|
||||||
|
|
|
@ -4308,10 +4308,12 @@ static Maybe<nscoord> GetIntrinsicSize(nsIFrame::ExtremumLength aLength,
|
||||||
nscoord result;
|
nscoord result;
|
||||||
if (aISizeFromAspectRatio) {
|
if (aISizeFromAspectRatio) {
|
||||||
result = *aISizeFromAspectRatio;
|
result = *aISizeFromAspectRatio;
|
||||||
} else if (aLength == nsIFrame::ExtremumLength::MaxContent) {
|
|
||||||
result = aFrame->GetPrefISize(aRenderingContext);
|
|
||||||
} else {
|
} else {
|
||||||
result = aFrame->GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
auto type = aLength == nsIFrame::ExtremumLength::MaxContent
|
||||||
|
? IntrinsicISizeType::PrefISize
|
||||||
|
: IntrinsicISizeType::MinISize;
|
||||||
|
result = aFrame->IntrinsicISize(input, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
result += aContentBoxToBoxSizingDiff;
|
result += aContentBoxToBoxSizingDiff;
|
||||||
|
@ -4437,8 +4439,9 @@ static nscoord AddIntrinsicSizeOffset(
|
||||||
if (aISizeFromAspectRatio) {
|
if (aISizeFromAspectRatio) {
|
||||||
minContent = maxContent = *aISizeFromAspectRatio;
|
minContent = maxContent = *aISizeFromAspectRatio;
|
||||||
} else {
|
} else {
|
||||||
minContent = aFrame->GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
maxContent = aFrame->GetPrefISize(aRenderingContext);
|
minContent = aFrame->GetMinISize(input);
|
||||||
|
maxContent = aFrame->GetPrefISize(input);
|
||||||
}
|
}
|
||||||
minContent += contentBoxToBoxSizingDiff;
|
minContent += contentBoxToBoxSizingDiff;
|
||||||
maxContent += contentBoxToBoxSizingDiff;
|
maxContent += contentBoxToBoxSizingDiff;
|
||||||
|
@ -4731,7 +4734,8 @@ nscoord nsLayoutUtils::IntrinsicForAxis(
|
||||||
result = aFrame->BSize();
|
result = aFrame->BSize();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = aFrame->IntrinsicISize(aRenderingContext, aType);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
result = aFrame->IntrinsicISize(input, aType);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_INTRINSIC_WIDTH
|
#ifdef DEBUG_INTRINSIC_WIDTH
|
||||||
--gNoiseIndent;
|
--gNoiseIndent;
|
||||||
|
@ -4863,9 +4867,10 @@ nscoord nsLayoutUtils::IntrinsicForAxis(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFrame->IsTableFrame()) {
|
if (aFrame->IsTableFrame()) {
|
||||||
// Tables can't shrink smaller than their intrinsic minimum width,
|
// Tables can't shrink smaller than their intrinsic minimum inline size,
|
||||||
// no matter what.
|
// no matter what.
|
||||||
min = aFrame->GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
min = aFrame->GetMinISize(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have an aspect-ratio and a definite block size of |aFrame|, we should
|
// If we have an aspect-ratio and a definite block size of |aFrame|, we should
|
||||||
|
|
|
@ -43,7 +43,7 @@ void nsCheckboxRadioFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsCheckboxRadioFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsCheckboxRadioFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
|
return StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class nsCheckboxRadioFrame final : public nsAtomicContainerFrame {
|
||||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
mozilla::LogicalSize ComputeAutoSize(
|
mozilla::LogicalSize ComputeAutoSize(
|
||||||
|
|
|
@ -170,7 +170,7 @@ nscoord nsComboboxControlFrame::GetLongestOptionISize(
|
||||||
return maxOptionSize;
|
return maxOptionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsComboboxControlFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsComboboxControlFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
Maybe<nscoord> containISize = ContainIntrinsicISize(NS_UNCONSTRAINEDSIZE);
|
Maybe<nscoord> containISize = ContainIntrinsicISize(NS_UNCONSTRAINEDSIZE);
|
||||||
if (containISize && *containISize != NS_UNCONSTRAINEDSIZE) {
|
if (containISize && *containISize != NS_UNCONSTRAINEDSIZE) {
|
||||||
|
@ -179,7 +179,7 @@ nscoord nsComboboxControlFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
|
|
||||||
nscoord displayISize = 0;
|
nscoord displayISize = 0;
|
||||||
if (!containISize && !StyleContent()->mContent.IsNone()) {
|
if (!containISize && !StyleContent()->mContent.IsNone()) {
|
||||||
displayISize += GetLongestOptionISize(aContext);
|
displayISize += GetLongestOptionISize(aInput.mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add room for the dropmarker button (if there is one).
|
// Add room for the dropmarker button (if there is one).
|
||||||
|
|
|
@ -46,7 +46,7 @@ class nsComboboxControlFrame final : public nsHTMLButtonControlFrame,
|
||||||
mozilla::a11y::AccType AccessibleType() final;
|
mozilla::a11y::AccType AccessibleType() final;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
// We're a leaf, so we need to report ourselves as the content insertion
|
// We're a leaf, so we need to report ourselves as the content insertion
|
||||||
|
|
|
@ -34,11 +34,11 @@ nsDateTimeControlFrame::nsDateTimeControlFrame(ComputedStyle* aStyle,
|
||||||
nsPresContext* aPresContext)
|
nsPresContext* aPresContext)
|
||||||
: nsContainerFrame(aStyle, aPresContext, kClassID) {}
|
: nsContainerFrame(aStyle, aPresContext, kClassID) {}
|
||||||
|
|
||||||
nscoord nsDateTimeControlFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsDateTimeControlFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return mFrames.IsEmpty() ? 0
|
return mFrames.IsEmpty() ? 0
|
||||||
: nsLayoutUtils::IntrinsicForContainer(
|
: nsLayoutUtils::IntrinsicForContainer(
|
||||||
aContext, mFrames.FirstChild(), aType);
|
aInput.mContext, mFrames.FirstChild(), aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<nscoord> nsDateTimeControlFrame::GetNaturalBaselineBOffset(
|
Maybe<nscoord> nsDateTimeControlFrame::GetNaturalBaselineBOffset(
|
||||||
|
|
|
@ -47,7 +47,7 @@ class nsDateTimeControlFrame final : public nsContainerFrame {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -321,7 +321,7 @@ ImgDrawResult nsFieldSetFrame::PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsFieldSetFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsFieldSetFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// Both inner and legend are children, and if the fieldset is
|
// Both inner and legend are children, and if the fieldset is
|
||||||
// size-contained they should not contribute to the intrinsic size.
|
// size-contained they should not contribute to the intrinsic size.
|
||||||
|
@ -331,7 +331,8 @@ nscoord nsFieldSetFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
|
|
||||||
nscoord legendWidth = 0;
|
nscoord legendWidth = 0;
|
||||||
if (nsIFrame* legend = GetLegend()) {
|
if (nsIFrame* legend = GetLegend()) {
|
||||||
legendWidth = nsLayoutUtils::IntrinsicForContainer(aContext, legend, aType);
|
legendWidth =
|
||||||
|
nsLayoutUtils::IntrinsicForContainer(aInput.mContext, legend, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord contentWidth = 0;
|
nscoord contentWidth = 0;
|
||||||
|
@ -340,7 +341,8 @@ nscoord nsFieldSetFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
// outer instead, and the padding computed for the inner is wrong
|
// outer instead, and the padding computed for the inner is wrong
|
||||||
// for percentage padding.
|
// for percentage padding.
|
||||||
contentWidth = nsLayoutUtils::IntrinsicForContainer(
|
contentWidth = nsLayoutUtils::IntrinsicForContainer(
|
||||||
aContext, inner, aType, Nothing(), nsLayoutUtils::IGNORE_PADDING);
|
aInput.mContext, inner, aType, Nothing(),
|
||||||
|
nsLayoutUtils::IGNORE_PADDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::max(legendWidth, contentWidth);
|
return std::max(legendWidth, contentWidth);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class nsFieldSetFrame final : public nsContainerFrame {
|
||||||
|
|
||||||
explicit nsFieldSetFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
explicit nsFieldSetFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -234,13 +234,13 @@ void nsHTMLButtonControlFrame::BuildDisplayList(
|
||||||
DisplaySelectionOverlay(aBuilder, aLists.Content());
|
DisplaySelectionOverlay(aBuilder, aLists.Content());
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsHTMLButtonControlFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsHTMLButtonControlFrame::IntrinsicISize(
|
||||||
IntrinsicISizeType aType) {
|
const IntrinsicSizeInput& aInput, IntrinsicISizeType aType) {
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
return *containISize;
|
return *containISize;
|
||||||
}
|
}
|
||||||
return nsLayoutUtils::IntrinsicForContainer(aContext, mFrames.FirstChild(),
|
return nsLayoutUtils::IntrinsicForContainer(aInput.mContext,
|
||||||
aType);
|
mFrames.FirstChild(), aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
|
void nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
|
||||||
|
|
|
@ -27,7 +27,7 @@ class nsHTMLButtonControlFrame : public nsContainerFrame {
|
||||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -227,7 +227,7 @@ nscoord nsListControlFrame::CalcBSizeOfARow() {
|
||||||
return rowBSize;
|
return rowBSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsListControlFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsListControlFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// Always add scrollbar inline sizes to the intrinsic isize of the
|
// Always add scrollbar inline sizes to the intrinsic isize of the
|
||||||
// scrolled content. Combobox frames depend on this happening in the
|
// scrolled content. Combobox frames depend on this happening in the
|
||||||
|
@ -238,7 +238,7 @@ nscoord nsListControlFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
result = *containISize;
|
result = *containISize;
|
||||||
} else {
|
} else {
|
||||||
result = GetScrolledFrame()->IntrinsicISize(aContext, aType);
|
result = GetScrolledFrame()->IntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
LogicalMargin scrollbarSize(wm, GetDesiredScrollbarSizes());
|
LogicalMargin scrollbarSize(wm, GetDesiredScrollbarSizes());
|
||||||
result = NSCoordSaturatingAdd(result, scrollbarSize.IStartEnd(wm));
|
result = NSCoordSaturatingAdd(result, scrollbarSize.IStartEnd(wm));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class nsListControlFrame final : public mozilla::ScrollContainerFrame,
|
||||||
|
|
||||||
void SetInitialChildList(ChildListID aListID, nsFrameList&& aChildList) final;
|
void SetInitialChildList(ChildListID aListID, nsFrameList&& aChildList) final;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -178,7 +178,7 @@ nsresult nsMeterFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsMeterFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsMeterFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord iSize = OneEmInAppUnits();
|
nscoord iSize = OneEmInAppUnits();
|
||||||
if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
|
if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class nsMeterFrame final : public nsContainerFrame,
|
||||||
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||||
int32_t aModType) override;
|
int32_t aModType) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -207,7 +207,7 @@ nsresult nsProgressFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsProgressFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsProgressFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord iSize = OneEmInAppUnits();
|
nscoord iSize = OneEmInAppUnits();
|
||||||
if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
|
if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class nsProgressFrame final : public nsContainerFrame,
|
||||||
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||||
int32_t aModType) override;
|
int32_t aModType) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -624,7 +624,7 @@ nscoord nsRangeFrame::AutoCrossSize() {
|
||||||
NSToCoordRound(OneEmInAppUnits() * CROSS_AXIS_EM_SIZE));
|
NSToCoordRound(OneEmInAppUnits() * CROSS_AXIS_EM_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsRangeFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsRangeFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
if (aType == IntrinsicISizeType::MinISize) {
|
if (aType == IntrinsicISizeType::MinISize) {
|
||||||
const auto* pos = StylePosition();
|
const auto* pos = StylePosition();
|
||||||
|
|
|
@ -72,7 +72,7 @@ class nsRangeFrame final : public nsContainerFrame,
|
||||||
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||||
int32_t aModType) override;
|
int32_t aModType) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -249,8 +249,8 @@ LogicalSize nsTextControlFrame::CalcIntrinsicSize(gfxContext* aRenderingContext,
|
||||||
// Add the inline size of the button if our char size is explicit, so as to
|
// Add the inline size of the button if our char size is explicit, so as to
|
||||||
// make sure to make enough space for it.
|
// make sure to make enough space for it.
|
||||||
if (maybeCols.isSome() && mButton && mButton->GetPrimaryFrame()) {
|
if (maybeCols.isSome() && mButton && mButton->GetPrimaryFrame()) {
|
||||||
intrinsicSize.ISize(aWM) +=
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
mButton->GetPrimaryFrame()->GetMinISize(aRenderingContext);
|
intrinsicSize.ISize(aWM) += mButton->GetPrimaryFrame()->GetMinISize(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
return intrinsicSize;
|
return intrinsicSize;
|
||||||
|
@ -559,12 +559,12 @@ void nsTextControlFrame::AppendAnonymousContentTo(
|
||||||
aElements.AppendElement(mRootNode);
|
aElements.AppendElement(mRootNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsTextControlFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsTextControlFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// Our min inline size is just our preferred inline-size if we have auto
|
// Our min inline size is just our preferred inline-size if we have auto
|
||||||
// inline size.
|
// inline size.
|
||||||
WritingMode wm = GetWritingMode();
|
WritingMode wm = GetWritingMode();
|
||||||
return CalcIntrinsicSize(aContext, wm).ISize(wm);
|
return CalcIntrinsicSize(aInput.mContext, wm).ISize(wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<nscoord> nsTextControlFrame::ComputeBaseline(
|
Maybe<nscoord> nsTextControlFrame::ComputeBaseline(
|
||||||
|
|
|
@ -60,7 +60,7 @@ class nsTextControlFrame : public nsContainerFrame,
|
||||||
|
|
||||||
mozilla::ScrollContainerFrame* GetScrollTargetFrame() const override;
|
mozilla::ScrollContainerFrame* GetScrollTargetFrame() const override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -149,22 +149,22 @@ void ColumnSetWrapperFrame::MarkIntrinsicISizesDirty() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord ColumnSetWrapperFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord ColumnSetWrapperFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
if (aType == IntrinsicISizeType::MinISize) {
|
if (aType == IntrinsicISizeType::MinISize) {
|
||||||
if (mCachedMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (mCachedMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
mCachedMinISize = MinISize(aContext);
|
mCachedMinISize = MinISize(aInput);
|
||||||
}
|
}
|
||||||
return mCachedMinISize;
|
return mCachedMinISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
mCachedPrefISize = PrefISize(aContext);
|
mCachedPrefISize = PrefISize(aInput);
|
||||||
}
|
}
|
||||||
return mCachedPrefISize;
|
return mCachedPrefISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord ColumnSetWrapperFrame::MinISize(gfxContext* aContext) {
|
nscoord ColumnSetWrapperFrame::MinISize(const IntrinsicSizeInput& aInput) {
|
||||||
nscoord iSize = 0;
|
nscoord iSize = 0;
|
||||||
|
|
||||||
if (Maybe<nscoord> containISize =
|
if (Maybe<nscoord> containISize =
|
||||||
|
@ -199,14 +199,15 @@ nscoord ColumnSetWrapperFrame::MinISize(gfxContext* aContext) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (nsIFrame* f : PrincipalChildList()) {
|
for (nsIFrame* f : PrincipalChildList()) {
|
||||||
iSize = std::max(iSize, f->GetMinISize(aContext));
|
const IntrinsicSizeInput input(aInput.mContext);
|
||||||
|
iSize = std::max(iSize, f->GetMinISize(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iSize;
|
return iSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord ColumnSetWrapperFrame::PrefISize(gfxContext* aContext) {
|
nscoord ColumnSetWrapperFrame::PrefISize(const IntrinsicSizeInput& aInput) {
|
||||||
nscoord iSize = 0;
|
nscoord iSize = 0;
|
||||||
|
|
||||||
if (Maybe<nscoord> containISize =
|
if (Maybe<nscoord> containISize =
|
||||||
|
@ -235,7 +236,8 @@ nscoord ColumnSetWrapperFrame::PrefISize(gfxContext* aContext) {
|
||||||
iSize = ColumnUtils::IntrinsicISize(numColumns, colGap, colISize);
|
iSize = ColumnUtils::IntrinsicISize(numColumns, colGap, colISize);
|
||||||
} else {
|
} else {
|
||||||
for (nsIFrame* f : PrincipalChildList()) {
|
for (nsIFrame* f : PrincipalChildList()) {
|
||||||
iSize = std::max(iSize, f->GetPrefISize(aContext));
|
const IntrinsicSizeInput input(aInput.mContext);
|
||||||
|
iSize = std::max(iSize, f->GetPrefISize(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ColumnSetWrapperFrame final : public nsBlockFrame {
|
||||||
|
|
||||||
void MarkIntrinsicISizesDirty() override;
|
void MarkIntrinsicISizesDirty() override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) override;
|
IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
Maybe<nscoord> GetNaturalBaselineBOffset(
|
Maybe<nscoord> GetNaturalBaselineBOffset(
|
||||||
|
@ -68,8 +68,8 @@ class ColumnSetWrapperFrame final : public nsBlockFrame {
|
||||||
~ColumnSetWrapperFrame() override = default;
|
~ColumnSetWrapperFrame() override = default;
|
||||||
|
|
||||||
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
||||||
nscoord MinISize(gfxContext* aContext);
|
nscoord MinISize(const IntrinsicSizeInput& aInput);
|
||||||
nscoord PrefISize(gfxContext* aContext);
|
nscoord PrefISize(const IntrinsicSizeInput& aInput);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void AssertColumnSpanWrapperSubtreeIsSane(const nsIFrame* aFrame);
|
static void AssertColumnSpanWrapperSubtreeIsSane(const nsIFrame* aFrame);
|
||||||
|
|
|
@ -56,8 +56,8 @@ void MiddleCroppingBlockFrame::UpdateDisplayedValueToUncroppedValue(
|
||||||
UpdateDisplayedValue(value, /* aIsCropped = */ false, aNotify);
|
UpdateDisplayedValue(value, /* aIsCropped = */ false, aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord MiddleCroppingBlockFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord MiddleCroppingBlockFrame::IntrinsicISize(
|
||||||
IntrinsicISizeType aType) {
|
const IntrinsicSizeInput& aInput, IntrinsicISizeType aType) {
|
||||||
nsAutoString prevValue;
|
nsAutoString prevValue;
|
||||||
bool restoreOldValue = false;
|
bool restoreOldValue = false;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ nscoord MiddleCroppingBlockFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
// Our min inline size is the same as our pref inline size, so we always
|
// Our min inline size is the same as our pref inline size, so we always
|
||||||
// delegate to nsBlockFrame's pref inline size.
|
// delegate to nsBlockFrame's pref inline size.
|
||||||
nscoord result =
|
nscoord result =
|
||||||
nsBlockFrame::IntrinsicISize(aContext, IntrinsicISizeType::PrefISize);
|
nsBlockFrame::IntrinsicISize(aInput, IntrinsicISizeType::PrefISize);
|
||||||
|
|
||||||
if (restoreOldValue) {
|
if (restoreOldValue) {
|
||||||
UpdateDisplayedValue(prevValue, /* aIsCropped = */ true, false);
|
UpdateDisplayedValue(prevValue, /* aIsCropped = */ true, false);
|
||||||
|
|
|
@ -34,7 +34,7 @@ class MiddleCroppingBlockFrame : public nsBlockFrame,
|
||||||
void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&,
|
void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&,
|
||||||
nsReflowStatus&) override;
|
nsReflowStatus&) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) override;
|
IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ static bool IsMarqueeScrollbox(const nsIFrame& aScrollFrame) {
|
||||||
return HTMLMarqueeElement::FromNodeOrNull(aScrollFrame.GetContent());
|
return HTMLMarqueeElement::FromNodeOrNull(aScrollFrame.GetContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord ScrollContainerFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord ScrollContainerFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord result = [&] {
|
nscoord result = [&] {
|
||||||
if (const Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (const Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
|
@ -1282,7 +1282,7 @@ nscoord ScrollContainerFrame::IntrinsicISize(gfxContext* aContext,
|
||||||
MOZ_UNLIKELY(IsMarqueeScrollbox(*this))) {
|
MOZ_UNLIKELY(IsMarqueeScrollbox(*this))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mScrolledFrame->IntrinsicISize(aContext, aType);
|
return mScrolledFrame->IntrinsicISize(aInput, aType);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
return NSCoordSaturatingAdd(result,
|
return NSCoordSaturatingAdd(result,
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ScrollContainerFrame : public nsContainerFrame,
|
||||||
nsIFrame::Sides aSkipSides,
|
nsIFrame::Sides aSkipSides,
|
||||||
nscoord aRadii[8]) const final;
|
nscoord aRadii[8]) const final;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) override;
|
IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -269,11 +269,11 @@ void ViewportFrame::RemoveFrame(DestroyContext& aContext, ChildListID aListID,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord ViewportFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord ViewportFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return mFrames.IsEmpty()
|
return mFrames.IsEmpty()
|
||||||
? 0
|
? 0
|
||||||
: mFrames.FirstChild()->IntrinsicISize(aContext, aType);
|
: mFrames.FirstChild()->IntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPoint ViewportFrame::AdjustReflowInputForScrollbars(
|
nsPoint ViewportFrame::AdjustReflowInputForScrollbars(
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ViewportFrame : public nsContainerFrame {
|
||||||
nsDisplayWrapList* BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
|
nsDisplayWrapList* BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
|
||||||
bool* aIsOpaque = nullptr);
|
bool* aIsOpaque = nullptr);
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) override;
|
IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -807,30 +807,30 @@ bool nsBlockFrame::TextIndentAppliesTo(const LineIterator& aLine) const {
|
||||||
return isFirstLineOrAfterHardBreak != textIndent.hanging;
|
return isFirstLineOrAfterHardBreak != textIndent.hanging;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsBlockFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsBlockFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nsIFrame* firstCont = FirstContinuation();
|
nsIFrame* firstCont = FirstContinuation();
|
||||||
if (firstCont != this) {
|
if (firstCont != this) {
|
||||||
return firstCont->IntrinsicISize(aContext, aType);
|
return firstCont->IntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckIntrinsicCacheAgainstShrinkWrapState();
|
CheckIntrinsicCacheAgainstShrinkWrapState();
|
||||||
|
|
||||||
if (aType == IntrinsicISizeType::MinISize) {
|
if (aType == IntrinsicISizeType::MinISize) {
|
||||||
if (mCachedMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (mCachedMinISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
mCachedMinISize = MinISize(aContext);
|
mCachedMinISize = MinISize(aInput);
|
||||||
}
|
}
|
||||||
return mCachedMinISize;
|
return mCachedMinISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
mCachedPrefISize = PrefISize(aContext);
|
mCachedPrefISize = PrefISize(aInput);
|
||||||
}
|
}
|
||||||
return mCachedPrefISize;
|
return mCachedPrefISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
nscoord nsBlockFrame::MinISize(gfxContext* aContext) {
|
nscoord nsBlockFrame::MinISize(const IntrinsicSizeInput& aInput) {
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
return *containISize;
|
return *containISize;
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ nscoord nsBlockFrame::MinISize(gfxContext* aContext) {
|
||||||
if (line->IsBlock()) {
|
if (line->IsBlock()) {
|
||||||
data.ForceBreak();
|
data.ForceBreak();
|
||||||
data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(
|
data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(
|
||||||
aContext, line->mFirstChild, IntrinsicISizeType::MinISize);
|
aInput.mContext, line->mFirstChild, IntrinsicISizeType::MinISize);
|
||||||
data.ForceBreak();
|
data.ForceBreak();
|
||||||
} else {
|
} else {
|
||||||
if (!curFrame->GetPrevContinuation() && TextIndentAppliesTo(line)) {
|
if (!curFrame->GetPrevContinuation() && TextIndentAppliesTo(line)) {
|
||||||
|
@ -883,7 +883,7 @@ nscoord nsBlockFrame::MinISize(gfxContext* aContext) {
|
||||||
nsIFrame* kid = line->mFirstChild;
|
nsIFrame* kid = line->mFirstChild;
|
||||||
for (int32_t i = 0, i_end = line->GetChildCount(); i != i_end;
|
for (int32_t i = 0, i_end = line->GetChildCount(); i != i_end;
|
||||||
++i, kid = kid->GetNextSibling()) {
|
++i, kid = kid->GetNextSibling()) {
|
||||||
kid->AddInlineMinISize(aContext, &data);
|
kid->AddInlineMinISize(aInput.mContext, &data);
|
||||||
if (whiteSpaceCanWrap && data.mTrailingWhitespace) {
|
if (whiteSpaceCanWrap && data.mTrailingWhitespace) {
|
||||||
data.OptionallyBreak();
|
data.OptionallyBreak();
|
||||||
}
|
}
|
||||||
|
@ -903,7 +903,7 @@ nscoord nsBlockFrame::MinISize(gfxContext* aContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
nscoord nsBlockFrame::PrefISize(gfxContext* aContext) {
|
nscoord nsBlockFrame::PrefISize(const IntrinsicSizeInput& aInput) {
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
return *containISize;
|
return *containISize;
|
||||||
}
|
}
|
||||||
|
@ -949,7 +949,7 @@ nscoord nsBlockFrame::PrefISize(gfxContext* aContext) {
|
||||||
}
|
}
|
||||||
data.ForceBreak(clearType);
|
data.ForceBreak(clearType);
|
||||||
data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(
|
data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(
|
||||||
aContext, line->mFirstChild, IntrinsicISizeType::PrefISize);
|
aInput.mContext, line->mFirstChild, IntrinsicISizeType::PrefISize);
|
||||||
data.ForceBreak();
|
data.ForceBreak();
|
||||||
} else {
|
} else {
|
||||||
if (!curFrame->GetPrevContinuation() && TextIndentAppliesTo(line)) {
|
if (!curFrame->GetPrevContinuation() && TextIndentAppliesTo(line)) {
|
||||||
|
@ -965,7 +965,7 @@ nscoord nsBlockFrame::PrefISize(gfxContext* aContext) {
|
||||||
nsIFrame* kid = line->mFirstChild;
|
nsIFrame* kid = line->mFirstChild;
|
||||||
for (int32_t i = 0, i_end = line->GetChildCount(); i != i_end;
|
for (int32_t i = 0, i_end = line->GetChildCount(); i != i_end;
|
||||||
++i, kid = kid->GetNextSibling()) {
|
++i, kid = kid->GetNextSibling()) {
|
||||||
kid->AddInlinePrefISize(aContext, &data);
|
kid->AddInlinePrefISize(aInput.mContext, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -274,11 +274,11 @@ class nsBlockFrame : public nsContainerFrame {
|
||||||
BaselineExportContext aExportContext) const;
|
BaselineExportContext aExportContext) const;
|
||||||
|
|
||||||
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
||||||
nscoord MinISize(gfxContext* aContext);
|
nscoord MinISize(const mozilla::IntrinsicSizeInput& aInput);
|
||||||
nscoord PrefISize(gfxContext* aContext);
|
nscoord PrefISize(const mozilla::IntrinsicSizeInput& aInput);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
|
nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
|
||||||
|
|
|
@ -601,11 +601,11 @@ void nsCanvasFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) {
|
||||||
text->mColor.ToColor());
|
text->mColor.ToColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsCanvasFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsCanvasFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return mFrames.IsEmpty()
|
return mFrames.IsEmpty()
|
||||||
? 0
|
? 0
|
||||||
: mFrames.FirstChild()->IntrinsicISize(aContext, aType);
|
: mFrames.FirstChild()->IntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsCanvasFrame::Reflow(nsPresContext* aPresContext,
|
void nsCanvasFrame::Reflow(nsPresContext* aPresContext,
|
||||||
|
|
|
@ -58,7 +58,7 @@ class nsCanvasFrame final : public nsContainerFrame,
|
||||||
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
|
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
|
@ -411,17 +411,17 @@ static void MoveChildTo(nsIFrame* aChild, LogicalPoint aOrigin, WritingMode aWM,
|
||||||
nsContainerFrame::PlaceFrameView(aChild);
|
nsContainerFrame::PlaceFrameView(aChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsColumnSetFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsColumnSetFrame::IntrinsicISize(const IntrinsicSizeInput& input,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return aType == IntrinsicISizeType::MinISize ? MinISize(aContext)
|
return aType == IntrinsicISizeType::MinISize ? MinISize(input)
|
||||||
: PrefISize(aContext);
|
: PrefISize(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsColumnSetFrame::MinISize(gfxContext* aContext) {
|
nscoord nsColumnSetFrame::MinISize(const IntrinsicSizeInput& aInput) {
|
||||||
nscoord iSize = 0;
|
nscoord iSize = 0;
|
||||||
|
|
||||||
if (mFrames.FirstChild()) {
|
if (mFrames.FirstChild()) {
|
||||||
iSize = mFrames.FirstChild()->GetMinISize(aContext);
|
iSize = mFrames.FirstChild()->GetMinISize(aInput);
|
||||||
}
|
}
|
||||||
const nsStyleColumn* colStyle = StyleColumn();
|
const nsStyleColumn* colStyle = StyleColumn();
|
||||||
if (colStyle->mColumnWidth.IsLength()) {
|
if (colStyle->mColumnWidth.IsLength()) {
|
||||||
|
@ -446,7 +446,7 @@ nscoord nsColumnSetFrame::MinISize(gfxContext* aContext) {
|
||||||
return iSize;
|
return iSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsColumnSetFrame::PrefISize(gfxContext* aContext) {
|
nscoord nsColumnSetFrame::PrefISize(const IntrinsicSizeInput& aInput) {
|
||||||
// Our preferred width is our desired column width, if specified, otherwise
|
// Our preferred width is our desired column width, if specified, otherwise
|
||||||
// the child's preferred width, times the number of columns, plus the width
|
// the child's preferred width, times the number of columns, plus the width
|
||||||
// of any required column gaps
|
// of any required column gaps
|
||||||
|
@ -458,7 +458,7 @@ nscoord nsColumnSetFrame::PrefISize(gfxContext* aContext) {
|
||||||
colISize =
|
colISize =
|
||||||
ColumnUtils::ClampUsedColumnWidth(colStyle->mColumnWidth.AsLength());
|
ColumnUtils::ClampUsedColumnWidth(colStyle->mColumnWidth.AsLength());
|
||||||
} else if (mFrames.FirstChild()) {
|
} else if (mFrames.FirstChild()) {
|
||||||
colISize = mFrames.FirstChild()->GetPrefISize(aContext);
|
colISize = mFrames.FirstChild()->GetPrefISize(aInput);
|
||||||
} else {
|
} else {
|
||||||
colISize = 0;
|
colISize = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class nsColumnSetFrame final : public nsContainerFrame {
|
||||||
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
|
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
nsContainerFrame* GetContentInsertionFrame() override {
|
nsContainerFrame* GetContentInsertionFrame() override {
|
||||||
|
@ -198,8 +198,8 @@ class nsColumnSetFrame final : public nsContainerFrame {
|
||||||
const nsPoint& aPt) const;
|
const nsPoint& aPt) const;
|
||||||
|
|
||||||
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
// MinISize() and PrefISize() are helpers to implement IntrinsicISize().
|
||||||
nscoord MinISize(gfxContext* aContext);
|
nscoord MinISize(const mozilla::IntrinsicSizeInput& aInput);
|
||||||
nscoord PrefISize(gfxContext* aContext);
|
nscoord PrefISize(const mozilla::IntrinsicSizeInput& aInput);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsColumnSetFrame_h___
|
#endif // nsColumnSetFrame_h___
|
||||||
|
|
|
@ -833,17 +833,18 @@ LogicalSize nsContainerFrame::ComputeAutoSize(
|
||||||
AutoMaybeDisableFontInflation an(this);
|
AutoMaybeDisableFontInflation an(this);
|
||||||
|
|
||||||
WritingMode tableWM = GetParent()->GetWritingMode();
|
WritingMode tableWM = GetParent()->GetWritingMode();
|
||||||
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
if (aWM.IsOrthogonalTo(tableWM)) {
|
if (aWM.IsOrthogonalTo(tableWM)) {
|
||||||
// For an orthogonal caption on a block-dir side of the table, shrink-wrap
|
// For an orthogonal caption on a block-dir side of the table, shrink-wrap
|
||||||
// to min-isize.
|
// to min-isize.
|
||||||
result.ISize(aWM) = GetMinISize(aRenderingContext);
|
result.ISize(aWM) = GetMinISize(input);
|
||||||
} else {
|
} else {
|
||||||
// The outer frame constrains our available isize to the isize of
|
// The outer frame constrains our available isize to the isize of
|
||||||
// the table. Grow if our min-isize is bigger than that, but not
|
// the table. Grow if our min-isize is bigger than that, but not
|
||||||
// larger than the containing block isize. (It would really be nice
|
// larger than the containing block isize. (It would really be nice
|
||||||
// to transmit that information another way, so we could grow up to
|
// to transmit that information another way, so we could grow up to
|
||||||
// the table's available isize, but that's harder.)
|
// the table's available isize, but that's harder.)
|
||||||
nscoord min = GetMinISize(aRenderingContext);
|
nscoord min = GetMinISize(input);
|
||||||
if (min > aCBSize.ISize(aWM)) {
|
if (min > aCBSize.ISize(aWM)) {
|
||||||
min = aCBSize.ISize(aWM);
|
min = aCBSize.ISize(aWM);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,9 +123,9 @@ void nsFirstLetterFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for floating first-letter frames.
|
// Needed for floating first-letter frames.
|
||||||
nscoord nsFirstLetterFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsFirstLetterFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return IntrinsicISizeFromInline(aContext, aType);
|
return IntrinsicISizeFromInline(aInput.mContext, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
|
|
|
@ -35,7 +35,7 @@ class nsFirstLetterFrame : public nsContainerFrame {
|
||||||
|
|
||||||
bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW); }
|
bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW); }
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||||
|
|
|
@ -6415,8 +6415,8 @@ void nsFlexContainerFrame::ReflowPlaceholders(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsFlexContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
nscoord nsFlexContainerFrame::ComputeIntrinsicISize(
|
||||||
IntrinsicISizeType aType) {
|
const IntrinsicSizeInput& aInput, IntrinsicISizeType aType) {
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
return *containISize;
|
return *containISize;
|
||||||
}
|
}
|
||||||
|
@ -6454,8 +6454,8 @@ nscoord nsFlexContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord childISize =
|
nscoord childISize = nsLayoutUtils::IntrinsicForContainer(
|
||||||
nsLayoutUtils::IntrinsicForContainer(aContext, childFrame, aType);
|
aInput.mContext, childFrame, aType);
|
||||||
|
|
||||||
// * For a row-oriented single-line flex container, the intrinsic
|
// * For a row-oriented single-line flex container, the intrinsic
|
||||||
// {min/pref}-isize is the sum of its items' {min/pref}-isizes and
|
// {min/pref}-isize is the sum of its items' {min/pref}-isizes and
|
||||||
|
@ -6480,13 +6480,13 @@ nscoord nsFlexContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
||||||
return containerISize;
|
return containerISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsFlexContainerFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsFlexContainerFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord& cachedISize = aType == IntrinsicISizeType::MinISize
|
nscoord& cachedISize = aType == IntrinsicISizeType::MinISize
|
||||||
? mCachedMinISize
|
? mCachedMinISize
|
||||||
: mCachedPrefISize;
|
: mCachedPrefISize;
|
||||||
if (cachedISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (cachedISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
cachedISize = ComputeIntrinsicISize(aContext, aType);
|
cachedISize = ComputeIntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
return cachedISize;
|
return cachedISize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ class nsFlexContainerFrame final : public nsContainerFrame,
|
||||||
const ReflowInput& aReflowInput,
|
const ReflowInput& aReflowInput,
|
||||||
nsReflowStatus& aStatus) override;
|
nsReflowStatus& aStatus) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
|
@ -650,7 +650,7 @@ class nsFlexContainerFrame final : public nsContainerFrame,
|
||||||
/**
|
/**
|
||||||
* Helper to implement IntrinsicISize().
|
* Helper to implement IntrinsicISize().
|
||||||
*/
|
*/
|
||||||
nscoord ComputeIntrinsicISize(gfxContext* aContext,
|
nscoord ComputeIntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType);
|
mozilla::IntrinsicISizeType aType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9469,8 +9469,8 @@ void nsGridContainerFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
||||||
UpdateSubgridFrameState();
|
UpdateSubgridFrameState();
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsGridContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
nscoord nsGridContainerFrame::ComputeIntrinsicISize(
|
||||||
IntrinsicISizeType aType) {
|
const IntrinsicSizeInput& aInput, IntrinsicISizeType aType) {
|
||||||
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
|
||||||
return *containISize;
|
return *containISize;
|
||||||
}
|
}
|
||||||
|
@ -9478,7 +9478,7 @@ nscoord nsGridContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
||||||
// Calculate the sum of column sizes under intrinsic sizing.
|
// Calculate the sum of column sizes under intrinsic sizing.
|
||||||
// https://drafts.csswg.org/css-grid-2/#intrinsic-sizes
|
// https://drafts.csswg.org/css-grid-2/#intrinsic-sizes
|
||||||
NormalizeChildLists();
|
NormalizeChildLists();
|
||||||
GridReflowInput state(this, *aContext);
|
GridReflowInput state(this, *aInput.mContext);
|
||||||
InitImplicitNamedAreas(state.mGridStyle); // XXX optimize
|
InitImplicitNamedAreas(state.mGridStyle); // XXX optimize
|
||||||
|
|
||||||
// The min/sz/max sizes are the input to the "repeat-to-fill" algorithm:
|
// The min/sz/max sizes are the input to the "repeat-to-fill" algorithm:
|
||||||
|
@ -9539,18 +9539,18 @@ nscoord nsGridContainerFrame::ComputeIntrinsicISize(gfxContext* aContext,
|
||||||
return last.mPosition + last.mBase;
|
return last.mPosition + last.mBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsGridContainerFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsGridContainerFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
auto* firstCont = static_cast<nsGridContainerFrame*>(FirstContinuation());
|
auto* firstCont = static_cast<nsGridContainerFrame*>(FirstContinuation());
|
||||||
if (firstCont != this) {
|
if (firstCont != this) {
|
||||||
return firstCont->IntrinsicISize(aContext, aType);
|
return firstCont->IntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord& cachedISize = aType == IntrinsicISizeType::MinISize
|
nscoord& cachedISize = aType == IntrinsicISizeType::MinISize
|
||||||
? mCachedMinISize
|
? mCachedMinISize
|
||||||
: mCachedPrefISize;
|
: mCachedPrefISize;
|
||||||
if (cachedISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
if (cachedISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
|
||||||
cachedISize = ComputeIntrinsicISize(aContext, aType);
|
cachedISize = ComputeIntrinsicISize(aInput, aType);
|
||||||
}
|
}
|
||||||
return cachedISize;
|
return cachedISize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ class nsGridContainerFrame final : public nsContainerFrame,
|
||||||
nsIFrame* aPrevInFlow) override;
|
nsIFrame* aPrevInFlow) override;
|
||||||
void DidSetComputedStyle(ComputedStyle* aOldStyle) override;
|
void DidSetComputedStyle(ComputedStyle* aOldStyle) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void MarkIntrinsicISizesDirty() override;
|
void MarkIntrinsicISizesDirty() override;
|
||||||
|
@ -373,7 +373,7 @@ class nsGridContainerFrame final : public nsContainerFrame,
|
||||||
/**
|
/**
|
||||||
* Helper to implement IntrinsicISize().
|
* Helper to implement IntrinsicISize().
|
||||||
*/
|
*/
|
||||||
nscoord ComputeIntrinsicISize(gfxContext* aContext,
|
nscoord ComputeIntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType);
|
mozilla::IntrinsicISizeType aType);
|
||||||
|
|
||||||
nscoord GetBBaseline(BaselineSharingGroup aBaselineGroup) const {
|
nscoord GetBBaseline(BaselineSharingGroup aBaselineGroup) const {
|
||||||
|
|
|
@ -365,7 +365,7 @@ CSSIntSize nsHTMLCanvasFrame::GetCanvasSize() const {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsHTMLCanvasFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsHTMLCanvasFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// XXX The caller doesn't account for constraints of the height,
|
// XXX The caller doesn't account for constraints of the height,
|
||||||
// min-height, and max-height properties.
|
// min-height, and max-height properties.
|
||||||
|
|
|
@ -51,7 +51,7 @@ class nsHTMLCanvasFrame final : public nsContainerFrame {
|
||||||
// Get the size of the canvas's image in CSS pixels.
|
// Get the size of the canvas's image in CSS pixels.
|
||||||
mozilla::CSSIntSize GetCanvasSize() const;
|
mozilla::CSSIntSize GetCanvasSize() const;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
|
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
|
||||||
|
|
|
@ -6515,6 +6515,7 @@ nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
|
||||||
result.ISize(aWM) = std::min(maxISize, result.ISize(aWM));
|
result.ISize(aWM) = std::min(maxISize, result.ISize(aWM));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
const auto& minISizeCoord = stylePos->MinISize(aWM);
|
const auto& minISizeCoord = stylePos->MinISize(aWM);
|
||||||
nscoord minISize;
|
nscoord minISize;
|
||||||
if (!minISizeCoord.IsAuto() && !shouldIgnoreMinMaxISize) {
|
if (!minISizeCoord.IsAuto() && !shouldIgnoreMinMaxISize) {
|
||||||
|
@ -6526,7 +6527,7 @@ nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
|
||||||
aFlags.contains(ComputeSizeFlag::IApplyAutoMinSize))) {
|
aFlags.contains(ComputeSizeFlag::IApplyAutoMinSize))) {
|
||||||
// This implements "Implied Minimum Size of Grid Items".
|
// This implements "Implied Minimum Size of Grid Items".
|
||||||
// https://drafts.csswg.org/css-grid/#min-size-auto
|
// https://drafts.csswg.org/css-grid/#min-size-auto
|
||||||
minISize = std::min(maxISize, GetMinISize(aRenderingContext));
|
minISize = std::min(maxISize, GetMinISize(input));
|
||||||
if (styleISize.IsLengthPercentage()) {
|
if (styleISize.IsLengthPercentage()) {
|
||||||
minISize = std::min(minISize, result.ISize(aWM));
|
minISize = std::min(minISize, result.ISize(aWM));
|
||||||
} else if (aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize)) {
|
} else if (aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize)) {
|
||||||
|
@ -6549,7 +6550,7 @@ nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
|
||||||
"aspect-ratio minimums should not apply to replaced elements");
|
"aspect-ratio minimums should not apply to replaced elements");
|
||||||
// The inline size computed by aspect-ratio shouldn't less than the
|
// The inline size computed by aspect-ratio shouldn't less than the
|
||||||
// min-content size, which should be capped by its maximum inline size.
|
// min-content size, which should be capped by its maximum inline size.
|
||||||
minISize = std::min(GetMinISize(aRenderingContext), maxISize);
|
minISize = std::min(GetMinISize(input), maxISize);
|
||||||
} else {
|
} else {
|
||||||
// Treat "min-width: auto" as 0.
|
// Treat "min-width: auto" as 0.
|
||||||
// NOTE: Technically, "auto" is supposed to behave like "min-content" on
|
// NOTE: Technically, "auto" is supposed to behave like "min-content" on
|
||||||
|
@ -6710,12 +6711,13 @@ LogicalSize nsIFrame::ComputeAutoSize(
|
||||||
if (styleISize.IsAuto()) {
|
if (styleISize.IsAuto()) {
|
||||||
nscoord availBased =
|
nscoord availBased =
|
||||||
aAvailableISize - aMargin.ISize(aWM) - aBorderPadding.ISize(aWM);
|
aAvailableISize - aMargin.ISize(aWM) - aBorderPadding.ISize(aWM);
|
||||||
result.ISize(aWM) = ShrinkISizeToFit(aRenderingContext, availBased, aFlags);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
result.ISize(aWM) = ShrinkISizeToFit(input, availBased, aFlags);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsIFrame::ShrinkISizeToFit(gfxContext* aRenderingContext,
|
nscoord nsIFrame::ShrinkISizeToFit(const IntrinsicSizeInput& aInput,
|
||||||
nscoord aISizeInCB,
|
nscoord aISizeInCB,
|
||||||
ComputeSizeFlags aFlags) {
|
ComputeSizeFlags aFlags) {
|
||||||
// If we're a container for font size inflation, then shrink
|
// If we're a container for font size inflation, then shrink
|
||||||
|
@ -6723,12 +6725,12 @@ nscoord nsIFrame::ShrinkISizeToFit(gfxContext* aRenderingContext,
|
||||||
AutoMaybeDisableFontInflation an(this);
|
AutoMaybeDisableFontInflation an(this);
|
||||||
|
|
||||||
nscoord result;
|
nscoord result;
|
||||||
nscoord minISize = GetMinISize(aRenderingContext);
|
nscoord minISize = GetMinISize(aInput);
|
||||||
if (minISize > aISizeInCB) {
|
if (minISize > aISizeInCB) {
|
||||||
const bool clamp = aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize);
|
const bool clamp = aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize);
|
||||||
result = MOZ_UNLIKELY(clamp) ? aISizeInCB : minISize;
|
result = MOZ_UNLIKELY(clamp) ? aISizeInCB : minISize;
|
||||||
} else {
|
} else {
|
||||||
nscoord prefISize = GetPrefISize(aRenderingContext);
|
nscoord prefISize = GetPrefISize(aInput);
|
||||||
if (prefISize > aISizeInCB) {
|
if (prefISize > aISizeInCB) {
|
||||||
result = aISizeInCB;
|
result = aISizeInCB;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6800,17 +6802,18 @@ nsIFrame::ISizeComputationResult nsIFrame::ComputeISizeValue(
|
||||||
aAspectRatio));
|
aAspectRatio));
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
nscoord result;
|
nscoord result;
|
||||||
switch (aSize) {
|
switch (aSize) {
|
||||||
case ExtremumLength::MaxContent:
|
case ExtremumLength::MaxContent:
|
||||||
result = iSizeFromAspectRatio ? *iSizeFromAspectRatio
|
result =
|
||||||
: GetPrefISize(aRenderingContext);
|
iSizeFromAspectRatio ? *iSizeFromAspectRatio : GetPrefISize(input);
|
||||||
NS_ASSERTION(result >= 0, "inline-size less than zero");
|
NS_ASSERTION(result >= 0, "inline-size less than zero");
|
||||||
return {result, iSizeFromAspectRatio ? AspectRatioUsage::ToComputeISize
|
return {result, iSizeFromAspectRatio ? AspectRatioUsage::ToComputeISize
|
||||||
: AspectRatioUsage::None};
|
: AspectRatioUsage::None};
|
||||||
case ExtremumLength::MinContent:
|
case ExtremumLength::MinContent:
|
||||||
result = iSizeFromAspectRatio ? *iSizeFromAspectRatio
|
result =
|
||||||
: GetMinISize(aRenderingContext);
|
iSizeFromAspectRatio ? *iSizeFromAspectRatio : GetMinISize(input);
|
||||||
NS_ASSERTION(result >= 0, "inline-size less than zero");
|
NS_ASSERTION(result >= 0, "inline-size less than zero");
|
||||||
if (MOZ_UNLIKELY(
|
if (MOZ_UNLIKELY(
|
||||||
aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize))) {
|
aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize))) {
|
||||||
|
@ -6827,8 +6830,8 @@ nsIFrame::ISizeComputationResult nsIFrame::ComputeISizeValue(
|
||||||
// size computed from the block size and the aspect ratio.
|
// size computed from the block size and the aspect ratio.
|
||||||
pref = min = *iSizeFromAspectRatio;
|
pref = min = *iSizeFromAspectRatio;
|
||||||
} else {
|
} else {
|
||||||
pref = GetPrefISize(aRenderingContext);
|
pref = GetPrefISize(input);
|
||||||
min = GetMinISize(aRenderingContext);
|
min = GetMinISize(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nscoord fill = aAvailableISizeOverride ? *aAvailableISizeOverride
|
const nscoord fill = aAvailableISizeOverride ? *aAvailableISizeOverride
|
||||||
|
|
|
@ -416,6 +416,17 @@ struct FrameBidiData {
|
||||||
mozilla::intl::BidiEmbeddingLevel precedingControl;
|
mozilla::intl::BidiEmbeddingLevel precedingControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A struct aggregates necessary data to compute the intrinsic sizes for a
|
||||||
|
// frame, used as an input for GetMinISize(), GetPrefISize(), IntrinsicISize(),
|
||||||
|
// and others.
|
||||||
|
struct MOZ_STACK_CLASS IntrinsicSizeInput final {
|
||||||
|
gfxContext* const mContext;
|
||||||
|
|
||||||
|
explicit IntrinsicSizeInput(gfxContext* aContext) : mContext(aContext) {
|
||||||
|
MOZ_ASSERT(mContext);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
/// Generic destructor for frame properties. Calls delete.
|
/// Generic destructor for frame properties. Calls delete.
|
||||||
|
@ -2579,8 +2590,8 @@ class nsIFrame : public nsQueryFrame {
|
||||||
*
|
*
|
||||||
* This method must not return a negative value.
|
* This method must not return a negative value.
|
||||||
*/
|
*/
|
||||||
nscoord GetMinISize(gfxContext* aContext) {
|
nscoord GetMinISize(const mozilla::IntrinsicSizeInput& aInput) {
|
||||||
return IntrinsicISize(aContext, mozilla::IntrinsicISizeType::MinISize);
|
return IntrinsicISize(aInput, mozilla::IntrinsicISizeType::MinISize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2589,8 +2600,8 @@ class nsIFrame : public nsQueryFrame {
|
||||||
*
|
*
|
||||||
* Otherwise, all the comments for |GetMinISize| above apply.
|
* Otherwise, all the comments for |GetMinISize| above apply.
|
||||||
*/
|
*/
|
||||||
nscoord GetPrefISize(gfxContext* aContext) {
|
nscoord GetPrefISize(const mozilla::IntrinsicSizeInput& aInput) {
|
||||||
return IntrinsicISize(aContext, mozilla::IntrinsicISizeType::PrefISize);
|
return IntrinsicISize(aInput, mozilla::IntrinsicISizeType::PrefISize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2599,7 +2610,7 @@ class nsIFrame : public nsQueryFrame {
|
||||||
*
|
*
|
||||||
* All the comments for GetMinISize() and GetPrefISize() apply.
|
* All the comments for GetMinISize() and GetPrefISize() apply.
|
||||||
*/
|
*/
|
||||||
virtual nscoord IntrinsicISize(gfxContext* aContext,
|
virtual nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) {
|
mozilla::IntrinsicISizeType aType) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2893,7 +2904,8 @@ class nsIFrame : public nsQueryFrame {
|
||||||
* Utility function for ComputeAutoSize implementations. Return
|
* Utility function for ComputeAutoSize implementations. Return
|
||||||
* max(GetMinISize(), min(aISizeInCB, GetPrefISize()))
|
* max(GetMinISize(), min(aISizeInCB, GetPrefISize()))
|
||||||
*/
|
*/
|
||||||
nscoord ShrinkISizeToFit(gfxContext* aRenderingContext, nscoord aISizeInCB,
|
nscoord ShrinkISizeToFit(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
|
nscoord aISizeInCB,
|
||||||
mozilla::ComputeSizeFlags aFlags);
|
mozilla::ComputeSizeFlags aFlags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1467,7 +1467,7 @@ nscoord nsImageFrame::GetContinuationOffset() const {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsImageFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsImageFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// XXX The caller doesn't account for constraints of the block-size,
|
// XXX The caller doesn't account for constraints of the block-size,
|
||||||
// min-block-size, and max-block-size properties.
|
// min-block-size, and max-block-size properties.
|
||||||
|
|
|
@ -77,7 +77,7 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
|
||||||
nsIFrame* aPrevInFlow) override;
|
nsIFrame* aPrevInFlow) override;
|
||||||
void BuildDisplayList(nsDisplayListBuilder*, const nsDisplayListSet&) final;
|
void BuildDisplayList(nsDisplayListBuilder*, const nsDisplayListSet&) final;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
mozilla::IntrinsicSize GetIntrinsicSize() final { return mIntrinsicSize; }
|
mozilla::IntrinsicSize GetIntrinsicSize() final { return mIntrinsicSize; }
|
||||||
|
|
|
@ -22,7 +22,7 @@ void nsLeafFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsLeafFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsLeafFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class nsLeafFrame : public nsIFrame {
|
||||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -555,7 +555,7 @@ nsresult nsSubDocumentFrame::GetFrameName(nsAString& aResult) const {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord nsSubDocumentFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsSubDocumentFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// Note: when computing max-content inline size (i.e. when aType is
|
// Note: when computing max-content inline size (i.e. when aType is
|
||||||
// IntrinsicISizeType::PrefISize), if the subdocument is an SVG document, then
|
// IntrinsicISizeType::PrefISize), if the subdocument is an SVG document, then
|
||||||
|
|
|
@ -49,7 +49,7 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
|
||||||
|
|
||||||
void Destroy(DestroyContext&) override;
|
void Destroy(DestroyContext&) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
mozilla::IntrinsicSize GetIntrinsicSize() override;
|
mozilla::IntrinsicSize GetIntrinsicSize() override;
|
||||||
|
|
|
@ -4402,9 +4402,9 @@ nsIFrame* nsContinuingTextFrame::FirstInFlow() const {
|
||||||
// XXX We really need to make :first-letter happen during frame
|
// XXX We really need to make :first-letter happen during frame
|
||||||
// construction.
|
// construction.
|
||||||
|
|
||||||
nscoord nsTextFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsTextFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return IntrinsicISizeFromInline(aContext, aType);
|
return IntrinsicISizeFromInline(aInput.mContext, aType);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -394,7 +394,7 @@ class nsTextFrame : public nsIFrame {
|
||||||
|
|
||||||
void MarkIntrinsicISizesDirty() final;
|
void MarkIntrinsicISizesDirty() final;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||||
|
|
|
@ -373,7 +373,7 @@ nsIFrame::SizeComputationResult nsVideoFrame::ComputeSize(
|
||||||
AspectRatioUsage::None};
|
AspectRatioUsage::None};
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsVideoFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsVideoFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
// <audio> / <video> has the same min / pref ISize.
|
// <audio> / <video> has the same min / pref ISize.
|
||||||
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class nsVideoFrame : public nsContainerFrame,
|
||||||
const mozilla::StyleSizeOverrides& aSizeOverrides,
|
const mozilla::StyleSizeOverrides& aSizeOverrides,
|
||||||
mozilla::ComputeSizeFlags aFlags) final;
|
mozilla::ComputeSizeFlags aFlags) final;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) final;
|
mozilla::IntrinsicISizeType aType) final;
|
||||||
|
|
||||||
void Destroy(DestroyContext&) final;
|
void Destroy(DestroyContext&) final;
|
||||||
|
|
|
@ -896,9 +896,9 @@ void nsMathMLContainerFrame::UpdateIntrinsicISize(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsMathMLContainerFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsMathMLContainerFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
UpdateIntrinsicISize(aContext);
|
UpdateIntrinsicISize(aInput.mContext);
|
||||||
return mIntrinsicISize;
|
return mIntrinsicISize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||||
void RemoveFrame(DestroyContext&, ChildListID aListID,
|
void RemoveFrame(DestroyContext&, ChildListID aListID,
|
||||||
nsIFrame* aOldFrame) override;
|
nsIFrame* aOldFrame) override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -122,7 +122,7 @@ NS_QUERYFRAME_TAIL_INHERITING(SVGDisplayContainerFrame)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIFrame methods
|
// nsIFrame methods
|
||||||
|
|
||||||
nscoord SVGOuterSVGFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord SVGOuterSVGFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
if (aType == IntrinsicISizeType::MinISize) {
|
if (aType == IntrinsicISizeType::MinISize) {
|
||||||
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
return GetIntrinsicSize().ISize(GetWritingMode()).valueOr(0);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
|
||||||
NS_DECL_QUERYFRAME
|
NS_DECL_QUERYFRAME
|
||||||
NS_DECL_FRAMEARENA_HELPERS(SVGOuterSVGFrame)
|
NS_DECL_FRAMEARENA_HELPERS(SVGOuterSVGFrame)
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) override;
|
IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
IntrinsicSize GetIntrinsicSize() override;
|
IntrinsicSize GetIntrinsicSize() override;
|
||||||
|
|
|
@ -5105,7 +5105,8 @@ void SVGTextFrame::DoReflow() {
|
||||||
kid->MarkIntrinsicISizesDirty();
|
kid->MarkIntrinsicISizesDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord inlineSize = kid->GetPrefISize(renderingContext.get());
|
const IntrinsicSizeInput input(renderingContext.get());
|
||||||
|
nscoord inlineSize = kid->GetPrefISize(input);
|
||||||
WritingMode wm = kid->GetWritingMode();
|
WritingMode wm = kid->GetWritingMode();
|
||||||
ReflowInput reflowInput(presContext, kid, renderingContext.get(),
|
ReflowInput reflowInput(presContext, kid, renderingContext.get(),
|
||||||
LogicalSize(wm, inlineSize, NS_UNCONSTRAINEDSIZE));
|
LogicalSize(wm, inlineSize, NS_UNCONSTRAINEDSIZE));
|
||||||
|
|
|
@ -84,8 +84,9 @@ static CellISizeInfo GetISizeInfo(gfxContext* aRenderingContext,
|
||||||
// wrapping inside of it should not apply font size inflation.
|
// wrapping inside of it should not apply font size inflation.
|
||||||
AutoMaybeDisableFontInflation an(aFrame);
|
AutoMaybeDisableFontInflation an(aFrame);
|
||||||
|
|
||||||
minCoord = aFrame->GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
prefCoord = aFrame->GetPrefISize(aRenderingContext);
|
minCoord = aFrame->GetMinISize(input);
|
||||||
|
prefCoord = aFrame->GetPrefISize(input);
|
||||||
// Until almost the end of this function, minCoord and prefCoord
|
// Until almost the end of this function, minCoord and prefCoord
|
||||||
// represent the box-sizing based isize values (which mean they
|
// represent the box-sizing based isize values (which mean they
|
||||||
// should include inline padding and border width when
|
// should include inline padding and border width when
|
||||||
|
|
|
@ -596,10 +596,11 @@ ScrollContainerFrame* nsTableCellFrame::GetScrollTargetFrame() const {
|
||||||
return do_QueryFrame(Inner());
|
return do_QueryFrame(Inner());
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsTableCellFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsTableCellFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
return nsLayoutUtils::IntrinsicForContainer(
|
return nsLayoutUtils::IntrinsicForContainer(aInput.mContext, Inner(), aType,
|
||||||
aContext, Inner(), aType, Nothing(), nsLayoutUtils::IGNORE_PADDING);
|
Nothing(),
|
||||||
|
nsLayoutUtils::IGNORE_PADDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ nsIFrame::IntrinsicSizeOffsetData
|
/* virtual */ nsIFrame::IntrinsicSizeOffsetData
|
||||||
|
|
|
@ -105,7 +105,7 @@ class nsTableCellFrame : public nsContainerFrame,
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists);
|
const nsDisplayListSet& aLists);
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
|
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
|
||||||
|
|
|
@ -1345,17 +1345,17 @@ void nsTableFrame::MarkIntrinsicISizesDirty() {
|
||||||
nsContainerFrame::MarkIntrinsicISizesDirty();
|
nsContainerFrame::MarkIntrinsicISizesDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsTableFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsTableFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
if (NeedToCalcBCBorders()) {
|
if (NeedToCalcBCBorders()) {
|
||||||
CalcBCBorders();
|
CalcBCBorders();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReflowColGroups(aContext);
|
ReflowColGroups(aInput.mContext);
|
||||||
|
|
||||||
return aType == IntrinsicISizeType::MinISize
|
return aType == IntrinsicISizeType::MinISize
|
||||||
? LayoutStrategy()->GetMinISize(aContext)
|
? LayoutStrategy()->GetMinISize(aInput.mContext)
|
||||||
: LayoutStrategy()->GetPrefISize(aContext, false);
|
: LayoutStrategy()->GetPrefISize(aInput.mContext, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ nsIFrame::IntrinsicSizeOffsetData
|
/* virtual */ nsIFrame::IntrinsicSizeOffsetData
|
||||||
|
@ -1403,7 +1403,8 @@ nsIFrame::SizeComputationResult nsTableFrame::ComputeSize(
|
||||||
AutoMaybeDisableFontInflation an(this);
|
AutoMaybeDisableFontInflation an(this);
|
||||||
|
|
||||||
// Tables never shrink below their min inline-size.
|
// Tables never shrink below their min inline-size.
|
||||||
nscoord minISize = GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
nscoord minISize = GetMinISize(input);
|
||||||
if (minISize > result.mLogicalSize.ISize(aWM)) {
|
if (minISize > result.mLogicalSize.ISize(aWM)) {
|
||||||
result.mLogicalSize.ISize(aWM) = minISize;
|
result.mLogicalSize.ISize(aWM) = minISize;
|
||||||
}
|
}
|
||||||
|
@ -1418,7 +1419,8 @@ nscoord nsTableFrame::TableShrinkISizeToFit(gfxContext* aRenderingContext,
|
||||||
AutoMaybeDisableFontInflation an(this);
|
AutoMaybeDisableFontInflation an(this);
|
||||||
|
|
||||||
nscoord result;
|
nscoord result;
|
||||||
nscoord minISize = GetMinISize(aRenderingContext);
|
const IntrinsicSizeInput input(aRenderingContext);
|
||||||
|
nscoord minISize = GetMinISize(input);
|
||||||
if (minISize > aISizeInCB) {
|
if (minISize > aISizeInCB) {
|
||||||
result = minISize;
|
result = minISize;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -271,7 +271,7 @@ class nsTableFrame : public nsContainerFrame {
|
||||||
void MarkIntrinsicISizesDirty() override;
|
void MarkIntrinsicISizesDirty() override;
|
||||||
// For border-collapse tables, the caller must not add padding and
|
// For border-collapse tables, the caller must not add padding and
|
||||||
// border to the results of these functions.
|
// border to the results of these functions.
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
|
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
|
||||||
nscoord aPercentageBasis = NS_UNCONSTRAINEDSIZE) override;
|
nscoord aPercentageBasis = NS_UNCONSTRAINEDSIZE) override;
|
||||||
|
|
|
@ -238,15 +238,16 @@ ComputedStyle* nsTableWrapperFrame::GetParentComputedStyle(
|
||||||
return (*aProviderFrame = InnerTableFrame())->Style();
|
return (*aProviderFrame = InnerTableFrame())->Style();
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsTableWrapperFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsTableWrapperFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord iSize =
|
nscoord iSize = nsLayoutUtils::IntrinsicForContainer(
|
||||||
nsLayoutUtils::IntrinsicForContainer(aContext, InnerTableFrame(), aType);
|
aInput.mContext, InnerTableFrame(), aType);
|
||||||
if (mCaptionFrames.NotEmpty()) {
|
if (mCaptionFrames.NotEmpty()) {
|
||||||
// The table wrapper's intrinsic inline size should be as least as large as
|
// The table wrapper's intrinsic inline size should be as least as large as
|
||||||
// caption's min inline size.
|
// caption's min inline size.
|
||||||
const nscoord capMinISize = nsLayoutUtils::IntrinsicForContainer(
|
const nscoord capMinISize = nsLayoutUtils::IntrinsicForContainer(
|
||||||
aContext, mCaptionFrames.FirstChild(), IntrinsicISizeType::MinISize);
|
aInput.mContext, mCaptionFrames.FirstChild(),
|
||||||
|
IntrinsicISizeType::MinISize);
|
||||||
iSize = std::max(iSize, capMinISize);
|
iSize = std::max(iSize, capMinISize);
|
||||||
}
|
}
|
||||||
return iSize;
|
return iSize;
|
||||||
|
|
|
@ -71,7 +71,7 @@ class nsTableWrapperFrame : public nsContainerFrame {
|
||||||
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
|
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
|
||||||
BaselineExportContext aExportContext) const override;
|
BaselineExportContext aExportContext) const override;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
SizeComputationResult ComputeSize(
|
SizeComputationResult ComputeSize(
|
||||||
|
|
|
@ -458,9 +458,9 @@ void nsMenuPopupFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
||||||
PropagateStyleToWidget(flags);
|
PropagateStyleToWidget(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord nsMenuPopupFrame::IntrinsicISize(gfxContext* aContext,
|
nscoord nsMenuPopupFrame::IntrinsicISize(const IntrinsicSizeInput& aInput,
|
||||||
IntrinsicISizeType aType) {
|
IntrinsicISizeType aType) {
|
||||||
nscoord iSize = nsBlockFrame::IntrinsicISize(aContext, aType);
|
nscoord iSize = nsBlockFrame::IntrinsicISize(aInput, aType);
|
||||||
if (!ShouldExpandToInflowParentOrAnchor()) {
|
if (!ShouldExpandToInflowParentOrAnchor()) {
|
||||||
return iSize;
|
return iSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ class nsMenuPopupFrame final : public nsBlockFrame {
|
||||||
|
|
||||||
mozilla::dom::XULPopupElement& PopupElement() const;
|
mozilla::dom::XULPopupElement& PopupElement() const;
|
||||||
|
|
||||||
nscoord IntrinsicISize(gfxContext* aContext,
|
nscoord IntrinsicISize(const mozilla::IntrinsicSizeInput& aInput,
|
||||||
mozilla::IntrinsicISizeType aType) override;
|
mozilla::IntrinsicISizeType aType) override;
|
||||||
|
|
||||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче