Bug 1639963 - Update the API of nsIFrame::ComputeSize for aspect-ratio. r=emilio

In order to apply Automatic content-based minimum sizes, we have to know
the content size on the block axis. We cannot get the content size until
we finish the reflow of the child frames. So we have to keep a flag
which indicates the size of the ratio-dependent axis is overrideen by
aspect-ratio in ReflowInput.

We will set the correct return value in the next patch, For now, we
always return AspectRatioUsage::None.

Differential Revision: https://phabricator.services.mozilla.com/D79335
This commit is contained in:
Boris Chiou 2020-08-17 06:57:56 +00:00
parent 4e7c9bc450
commit dd3c20ccd8
27 changed files with 109 additions and 81 deletions

View File

@ -614,7 +614,7 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
AutoMaybeDisableFontInflation an(aFloat);
WritingMode wm = aFloatOffsetState.GetWritingMode();
LogicalSize floatSize = aFloat->ComputeSize(
auto floatSize = aFloat->ComputeSize(
aCBReflowInput.mRenderingContext, wm, aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize, aFloatOffsetState.ComputedLogicalMargin().Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding().Size(wm) -
@ -623,7 +623,7 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
nsIFrame::ComputeSizeFlags::eShrinkWrap);
WritingMode cbwm = aCBReflowInput.GetWritingMode();
nscoord floatISize = floatSize.ConvertTo(cbwm, wm).ISize(cbwm);
nscoord floatISize = floatSize.mLogicalSize.ConvertTo(cbwm, wm).ISize(cbwm);
if (floatISize == NS_UNCONSTRAINEDSIZE) {
return NS_UNCONSTRAINEDSIZE; // reflow is needed to get the true size
}

View File

@ -1672,24 +1672,27 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
}
}
LogicalSize computedSize(wm);
nsIFrame::SizeComputationResult sizeResult = {
LogicalSize(wm), nsIFrame::AspectRatioUsage::None};
{
AutoMaybeDisableFontInflation an(mFrame);
computedSize = mFrame->ComputeSize(
sizeResult = mFrame->ComputeSize(
mRenderingContext, wm, cbSize.ConvertTo(wm, cbwm),
cbSize.ConvertTo(wm, cbwm).ISize(wm), // XXX or AvailableISize()?
ComputedLogicalMargin().Size(wm) + ComputedLogicalOffsets().Size(wm),
ComputedLogicalBorderPadding().Size(wm) -
ComputedLogicalPadding().Size(wm),
ComputedLogicalPadding().Size(wm), computeSizeFlags);
ComputedISize() = computedSize.ISize(wm);
ComputedBSize() = computedSize.BSize(wm);
ComputedISize() = sizeResult.mLogicalSize.ISize(wm);
ComputedBSize() = sizeResult.mLogicalSize.BSize(wm);
NS_ASSERTION(ComputedISize() >= 0, "Bogus inline-size");
NS_ASSERTION(
ComputedBSize() == NS_UNCONSTRAINEDSIZE || ComputedBSize() >= 0,
"Bogus block-size");
}
LogicalSize& computedSize = sizeResult.mLogicalSize;
computedSize = computedSize.ConvertTo(cbwm, wm);
// XXX Now that we have ComputeSize, can we condense many of the
@ -2421,15 +2424,15 @@ void ReflowInput::InitConstraints(
cbSize.ISize(wm) = AvailableISize();
}
LogicalSize size = mFrame->ComputeSize(
auto size = mFrame->ComputeSize(
mRenderingContext, wm, cbSize, AvailableISize(),
ComputedLogicalMargin().Size(wm),
ComputedLogicalBorderPadding().Size(wm) -
ComputedLogicalPadding().Size(wm),
ComputedLogicalPadding().Size(wm), computeSizeFlags);
ComputedISize() = size.ISize(wm);
ComputedBSize() = size.BSize(wm);
ComputedISize() = size.mLogicalSize.ISize(wm);
ComputedBSize() = size.mLogicalSize.BSize(wm);
NS_ASSERTION(ComputedISize() >= 0, "Bogus inline-size");
NS_ASSERTION(
ComputedBSize() == NS_UNCONSTRAINEDSIZE || ComputedBSize() >= 0,

View File

@ -123,7 +123,7 @@ nscoord nsFirstLetterFrame::GetPrefISize(gfxContext* aRenderingContext) {
}
/* virtual */
LogicalSize nsFirstLetterFrame::ComputeSize(
nsIFrame::SizeComputationResult nsFirstLetterFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
@ -131,7 +131,8 @@ LogicalSize nsFirstLetterFrame::ComputeSize(
if (GetPrevInFlow()) {
// We're wrapping the text *after* the first letter, so behave like an
// inline frame.
return LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};
}
return nsContainerFrame::ComputeSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorder,

View File

@ -47,8 +47,8 @@ class nsFirstLetterFrame final : public nsContainerFrame {
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -394,7 +394,7 @@ AspectRatio nsHTMLCanvasFrame::GetIntrinsicRatio() {
}
/* virtual */
LogicalSize nsHTMLCanvasFrame::ComputeSize(
nsIFrame::SizeComputationResult nsHTMLCanvasFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
@ -410,9 +410,10 @@ LogicalSize nsHTMLCanvasFrame::ComputeSize(
intrinsicRatio = IntrinsicRatioFromCanvasSize(canvasSizeInPx);
}
return ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, intrinsicSize, intrinsicRatio, aCBSize, aMargin,
aBorder, aPadding, aFlags);
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, intrinsicSize, intrinsicRatio, aCBSize,
aMargin, aBorder, aPadding, aFlags),
AspectRatioUsage::None};
}
void nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,

View File

@ -66,8 +66,8 @@ class nsHTMLCanvasFrame final : public nsContainerFrame {
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
virtual mozilla::AspectRatio GetIntrinsicRatio() override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -5982,13 +5982,11 @@ static nscoord ComputeBlockSizeFromAspectRatio(
}
/* virtual */
LogicalSize nsIFrame::ComputeSize(gfxContext* aRenderingContext,
WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
MOZ_ASSERT(!GetIntrinsicRatio(),
"Please override this method and call "
"nsIFrame::ComputeSizeWithIntrinsicDimensions instead.");
@ -6249,7 +6247,7 @@ LogicalSize nsIFrame::ComputeSize(gfxContext* aRenderingContext,
result.ISize(aWM) = std::max(0, result.ISize(aWM));
result.BSize(aWM) = std::max(0, result.BSize(aWM));
return result;
return {result, AspectRatioUsage::None};
}
nsRect nsIFrame::ComputeTightBounds(DrawTarget* aDrawTarget) const {
@ -10371,7 +10369,7 @@ void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
reflowInput.ComputedLogicalPadding().Size(wm),
reflowInput.ComputedLogicalPadding().Size(wm),
ComputeSizeFlags::eDefault)
.Height(wm));
.mLogicalSize.Height(wm));
}
}

View File

@ -2747,9 +2747,24 @@ class nsIFrame : public nsQueryFrame {
* the frame, including actual values resulting from
* percentages.
* @param aFlags Flags to further customize behavior (definitions above).
*
* The return value includes the computed LogicalSize and the enum class which
* indicates whether the inline/block size is affected by aspect-ratio or not.
* We need this information during reflow because the final size may be
* affected by the content size after applying aspect-ratio.
* https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
*/
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
enum class AspectRatioUsage : uint8_t {
None,
ToComputeISize,
ToComputeBSize,
};
struct SizeComputationResult {
mozilla::LogicalSize mLogicalSize;
AspectRatioUsage mAspectRatioUsage = AspectRatioUsage::None;
};
virtual SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags);

View File

@ -940,15 +940,16 @@ void nsImageFrame::EnsureIntrinsicSizeAndRatio() {
UpdateIntrinsicRatio();
}
LogicalSize nsImageFrame::ComputeSize(
nsIFrame::SizeComputationResult nsImageFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
EnsureIntrinsicSizeAndRatio();
return ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, mIntrinsicSize, mIntrinsicRatio, aCBSize, aMargin,
aBorder, aPadding, aFlags);
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, mIntrinsicSize, mIntrinsicRatio, aCBSize,
aMargin, aBorder, aPadding, aFlags),
AspectRatioUsage::None};
}
// XXXdholbert This function's clients should probably just be calling

View File

@ -221,8 +221,8 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
return !HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
}
mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) final;

View File

@ -243,13 +243,14 @@ void nsInlineFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
}
/* virtual */
LogicalSize nsInlineFrame::ComputeSize(
nsIFrame::SizeComputationResult nsInlineFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
// Inlines and text don't compute size before reflow.
return LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};
}
nsRect nsInlineFrame::ComputeTightBounds(DrawTarget* aDrawTarget) const {

View File

@ -76,8 +76,8 @@ class nsInlineFrame : public nsContainerFrame {
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -248,14 +248,15 @@ bool nsRubyBaseContainerFrame::IsFrameOfType(uint32_t aFlags) const {
bool nsRubyBaseContainerFrame::CanContinueTextRun() const { return true; }
/* virtual */
LogicalSize nsRubyBaseContainerFrame::ComputeSize(
nsIFrame::SizeComputationResult nsRubyBaseContainerFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
// Ruby base container frame is inline,
// hence don't compute size before reflow.
return LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};
}
/* virtual */

View File

@ -35,8 +35,8 @@ class nsRubyBaseContainerFrame final : public nsContainerFrame {
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -661,14 +661,15 @@ LogicalSize nsSubDocumentFrame::ComputeAutoSize(
}
/* virtual */
LogicalSize nsSubDocumentFrame::ComputeSize(
nsIFrame::SizeComputationResult nsSubDocumentFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
return ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, GetIntrinsicSize(), GetIntrinsicRatio(), aCBSize,
aMargin, aBorder, aPadding, aFlags);
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, GetIntrinsicSize(), GetIntrinsicRatio(),
aCBSize, aMargin, aBorder, aPadding, aFlags),
AspectRatioUsage::None};
}
void nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,

View File

@ -64,8 +64,8 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -8618,13 +8618,14 @@ void nsTextFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
}
/* virtual */
LogicalSize nsTextFrame::ComputeSize(
nsIFrame::SizeComputationResult nsTextFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
// Inlines and text don't compute size before reflow.
return LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};
}
static nsRect RoundOut(const gfxRect& aRect) {

View File

@ -414,8 +414,8 @@ class nsTextFrame : public nsIFrame {
InlineMinISizeData* aData) override;
void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) final;

View File

@ -563,7 +563,7 @@ nsresult nsVideoFrame::GetFrameName(nsAString& aResult) const {
}
#endif
LogicalSize nsVideoFrame::ComputeSize(
nsIFrame::SizeComputationResult nsVideoFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
@ -582,9 +582,10 @@ LogicalSize nsVideoFrame::ComputeSize(
? AspectRatio::FromSize(size.width, size.height)
: AspectRatio();
return ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, intrinsicSize, intrinsicRatio, aCBSize, aMargin,
aBorder, aPadding, aFlags);
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, intrinsicSize, intrinsicRatio, aCBSize,
aMargin, aBorder, aPadding, aFlags),
AspectRatioUsage::None};
}
nscoord nsVideoFrame::GetMinISize(gfxContext* aRenderingContext) {

View File

@ -56,8 +56,8 @@ class nsVideoFrame final : public nsContainerFrame,
/* get the size of the video's display */
nsSize GetVideoIntrinsicSize(gfxContext* aRenderingContext);
mozilla::AspectRatio GetIntrinsicRatio() override;
mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -77,7 +77,7 @@ void nsMathMLSelectedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
/* virtual */
LogicalSize nsMathMLSelectedFrame::ComputeSize(
nsIFrame::SizeComputationResult nsMathMLSelectedFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
@ -92,15 +92,17 @@ LogicalSize nsMathMLSelectedFrame::ComputeSize(
LogicalSize cbSize = aCBSize - aBorder - aPadding - aMargin;
SizeComputationInput offsetState(childFrame, aRenderingContext, aWM,
availableISize);
LogicalSize size = childFrame->ComputeSize(
auto size = childFrame->ComputeSize(
aRenderingContext, aWM, cbSize, availableISize,
offsetState.ComputedLogicalMargin().Size(aWM),
offsetState.ComputedLogicalBorderPadding().Size(aWM) -
offsetState.ComputedLogicalPadding().Size(aWM),
offsetState.ComputedLogicalPadding().Size(aWM), aFlags);
return size + offsetState.ComputedLogicalBorderPadding().Size(aWM);
return {size.mLogicalSize +
offsetState.ComputedLogicalBorderPadding().Size(aWM),
size.mAspectRatioUsage};
}
return LogicalSize(aWM);
return {LogicalSize(aWM), AspectRatioUsage::None};
}
// Only reflow the selected child ...

View File

@ -27,8 +27,8 @@ class nsMathMLSelectedFrame : public nsMathMLContainerFrame {
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
ReflowOutput& aDesiredSize) override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;

View File

@ -304,7 +304,7 @@ AspectRatio SVGOuterSVGFrame::GetIntrinsicRatio() {
}
/* virtual */
LogicalSize SVGOuterSVGFrame::ComputeSize(
nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorder,
@ -315,7 +315,7 @@ LogicalSize SVGOuterSVGFrame::ComputeSize(
// says that the width and height of embedded SVG is overridden by the
// width and height of the embedding element, so we just need to size to
// the viewport that the embedding element has established for us.
return aCBSize;
return {aCBSize, AspectRatioUsage::None};
}
LogicalSize cbSize = aCBSize;
@ -368,9 +368,10 @@ LogicalSize SVGOuterSVGFrame::ComputeSize(
"we lack an intrinsic height or width.");
}
return ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWritingMode, intrinsicSize, GetIntrinsicRatio(),
cbSize, aMargin, aBorder, aPadding, aFlags);
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWritingMode, intrinsicSize,
GetIntrinsicRatio(), cbSize, aMargin, aBorder, aPadding, aFlags),
AspectRatioUsage::None};
}
void SVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,

View File

@ -58,7 +58,7 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
virtual IntrinsicSize GetIntrinsicSize() override;
virtual AspectRatio GetIntrinsicRatio() override;
virtual LogicalSize ComputeSize(
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorder,

View File

@ -1502,14 +1502,14 @@ nsTableFrame::IntrinsicISizeOffsets(nscoord aPercentageBasis) {
}
/* virtual */
LogicalSize nsTableFrame::ComputeSize(
nsIFrame::SizeComputationResult nsTableFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorder, const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
LogicalSize result = nsContainerFrame::ComputeSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin, aBorder,
aPadding, aFlags);
auto result = nsContainerFrame::ComputeSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorder,
aPadding, aFlags);
// XXX The code below doesn't make sense if the caller's writing mode
// is orthogonal to this frame's. Not sure yet what should happen then;
@ -1524,8 +1524,8 @@ LogicalSize nsTableFrame::ComputeSize(
// Tables never shrink below their min inline-size.
nscoord minISize = GetMinISize(aRenderingContext);
if (minISize > result.ISize(aWM)) {
result.ISize(aWM) = minISize;
if (minISize > result.mLogicalSize.ISize(aWM)) {
result.mLogicalSize.ISize(aWM) = minISize;
}
return result;

View File

@ -302,7 +302,7 @@ class nsTableFrame : public nsContainerFrame {
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
nscoord aPercentageBasis = NS_UNCONSTRAINEDSIZE) override;
virtual mozilla::LogicalSize ComputeSize(
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,

View File

@ -394,13 +394,14 @@ nscoord nsTableWrapperFrame::ChildShrinkWrapISize(
}
}
LogicalSize size = aChildFrame->ComputeSize(
auto size = aChildFrame->ComputeSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, marginSize,
bpSize - paddingSize, paddingSize, flags);
if (aMarginResult) {
*aMarginResult = offsets.ComputedLogicalMargin().IStartEnd(aWM);
}
return size.ISize(aWM) + marginSize.ISize(aWM) + bpSize.ISize(aWM);
return size.mLogicalSize.ISize(aWM) + marginSize.ISize(aWM) +
bpSize.ISize(aWM);
}
/* virtual */