Bug 1686603 Part 2 - Add StyleSizeOverrides parameter to ReflowInput's constructor & co. to override data from style system data. r=dholbert

This patch adds the struct as a parameter to various functions.

The struct is cached in ReflowInput so that we don't need to pass it
down to the internal method where nsIFrame::ComputeSize() is called.

In the subsequent patches, we'll use it to revise the implementation of
flex container's flex base size resolution, and size overrides.

Differential Revision: https://phabricator.services.mozilla.com/D101793
This commit is contained in:
Ting-Yu Lin 2021-01-26 02:47:40 +00:00
Родитель 6e74b37f10
Коммит a43cae175a
50 изменённых файлов: 245 добавлений и 168 удалений

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

@ -67,7 +67,8 @@ nscoord nsCheckboxRadioFrame::GetPrefISize(gfxContext* aRenderingContext) {
LogicalSize nsCheckboxRadioFrame::ComputeAutoSize(
gfxContext* aRC, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
LogicalSize size(aWM, 0, 0);
if (!StyleDisplay()->HasAppearance()) {
return size;
@ -75,7 +76,8 @@ LogicalSize nsCheckboxRadioFrame::ComputeAutoSize(
// Note: this call always set the BSize to NS_UNCONSTRAINEDSIZE.
size = nsAtomicContainerFrame::ComputeAutoSize(
aRC, aWM, aCBSize, aAvailableISize, aMargin, aBorderPadding, aFlags);
aRC, aWM, aCBSize, aAvailableISize, aMargin, aBorderPadding,
aSizeOverrides, aFlags);
size.BSize(aWM) = DefaultSize();
return size;
}

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

@ -48,11 +48,12 @@ class nsCheckboxRadioFrame final : public nsAtomicContainerFrame,
/**
* Our auto size is just intrinsic width and intrinsic height.
*/
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
/**

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

@ -187,7 +187,8 @@ nsresult nsMeterFrame::AttributeChanged(int32_t aNameSpaceID,
LogicalSize nsMeterFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
RefPtr<nsFontMetrics> fontMet =
nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);

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

@ -53,6 +53,7 @@ class nsMeterFrame final : public nsContainerFrame,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;

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

@ -204,7 +204,8 @@ nsresult nsProgressFrame::AttributeChanged(int32_t aNameSpaceID,
LogicalSize nsProgressFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
const WritingMode wm = GetWritingMode();
LogicalSize autoSize(wm);
autoSize.BSize(wm) = autoSize.ISize(wm) =

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

@ -58,6 +58,7 @@ class nsProgressFrame final : public nsContainerFrame,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;

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

@ -610,7 +610,8 @@ static mozilla::Length OneEm(nsRangeFrame* aFrame) {
LogicalSize nsRangeFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
bool isInlineOriented = IsInlineOriented();
auto em = OneEm(this);

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

@ -71,11 +71,12 @@ class nsRangeFrame final : public nsContainerFrame,
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;

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

@ -560,7 +560,8 @@ nscoord nsTextControlFrame::GetMinISize(gfxContext* aRenderingContext) {
LogicalSize nsTextControlFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
LogicalSize autoSize = CalcIntrinsicSize(aRenderingContext, aWM, inflation);
@ -573,16 +574,16 @@ LogicalSize nsTextControlFrame::ComputeAutoSize(
// fall back to nsContainerFrame's ComputeAutoSize to handle that.
// XXX maybe a font-inflation issue here? (per the assertion below).
autoSize.ISize(aWM) =
nsContainerFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin,
aBorderPadding, aFlags)
nsContainerFrame::ComputeAutoSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
aBorderPadding, aSizeOverrides, aFlags)
.ISize(aWM);
}
#ifdef DEBUG
else {
LogicalSize ancestorAutoSize = nsContainerFrame::ComputeAutoSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
aBorderPadding, aFlags);
aBorderPadding, aSizeOverrides, aFlags);
// Disabled when there's inflation; see comment in GetXULPrefSize.
MOZ_ASSERT(inflation != 1.0f ||
ancestorAutoSize.ISize(aWM) == autoSize.ISize(aWM),

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

@ -70,6 +70,7 @@ class nsTextControlFrame : public nsContainerFrame,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,

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

@ -621,7 +621,7 @@ static nscoord FloatMarginISize(const ReflowInput& aCBReflowInput,
aCBReflowInput.mRenderingContext, wm, aCBReflowInput.ComputedSize(wm),
aFloatAvailableISize,
aFloatOffsetState.ComputedLogicalMargin(wm).Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding(wm).Size(wm),
aFloatOffsetState.ComputedLogicalBorderPadding(wm).Size(wm), {},
ComputeSizeFlag::ShrinkWrap);
WritingMode cbwm = aCBReflowInput.GetWritingMode();

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

@ -156,7 +156,9 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
const ReflowInput& aParentReflowInput,
nsIFrame* aFrame, const LogicalSize& aAvailableSpace,
const Maybe<LogicalSize>& aContainingBlockSize,
InitFlags aFlags, ComputeSizeFlags aComputeSizeFlags)
InitFlags aFlags,
const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aComputeSizeFlags)
: SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext),
mParentReflowInput(&aParentReflowInput),
mFloatManager(aParentReflowInput.mFloatManager),
@ -169,6 +171,7 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
? aParentReflowInput.mPercentBSizeObserver
: nullptr),
mFlags(aParentReflowInput.mFlags),
mStyleSizeOverrides(aSizeOverrides),
mComputeSizeFlags(aComputeSizeFlags),
mReflowDepth(aParentReflowInput.mReflowDepth + 1),
mAvailableSize(aAvailableSpace) {
@ -1620,7 +1623,7 @@ void ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
cbSize.ConvertTo(wm, cbwm).ISize(wm), // XXX or AvailableISize()?
ComputedLogicalMargin(wm).Size(wm) +
ComputedLogicalOffsets(wm).Size(wm),
ComputedLogicalBorderPadding(wm).Size(wm), mComputeSizeFlags);
ComputedLogicalBorderPadding(wm).Size(wm), {}, mComputeSizeFlags);
ComputedISize() = sizeResult.mLogicalSize.ISize(wm);
ComputedBSize() = sizeResult.mLogicalSize.BSize(wm);
NS_ASSERTION(ComputedISize() >= 0, "Bogus inline-size");
@ -2346,10 +2349,11 @@ void ReflowInput::InitConstraints(
cbSize.ISize(wm) = AvailableISize();
}
auto size = mFrame->ComputeSize(
mRenderingContext, wm, cbSize, AvailableISize(),
ComputedLogicalMargin(wm).Size(wm),
ComputedLogicalBorderPadding(wm).Size(wm), mComputeSizeFlags);
auto size =
mFrame->ComputeSize(mRenderingContext, wm, cbSize, AvailableISize(),
ComputedLogicalMargin(wm).Size(wm),
ComputedLogicalBorderPadding(wm).Size(wm),
mStyleSizeOverrides, mComputeSizeFlags);
ComputedISize() = size.mLogicalSize.ISize(wm);
ComputedBSize() = size.mLogicalSize.BSize(wm);

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

@ -30,7 +30,20 @@ class nsReflowStatus;
namespace mozilla {
enum class LayoutFrameType : uint8_t;
}
/**
* A set of StyleSizes used as an input parameter to various functions that
* compute sizes like nsIFrame::ComputeSize(). If any of the member fields has a
* value, the function may use the value instead of retrieving it from the
* frame's style.
*
* The logical sizes are assumed to be in the associated frame's writing-mode.
*/
struct StyleSizeOverrides {
Maybe<StyleSize> mStyleISize;
Maybe<StyleSize> mStyleBSize;
};
} // namespace mozilla
/**
* @return aValue clamped to [aMinValue, aMaxValue].
@ -512,6 +525,9 @@ struct ReflowInput : public SizeComputationInput {
bool mIsBSizeSetByAspectRatio : 1;
};
Flags mFlags;
mozilla::StyleSizeOverrides mStyleSizeOverrides;
mozilla::ComputeSizeFlags mComputeSizeFlags;
// This value keeps track of how deeply nested a given reflow input
@ -612,6 +628,8 @@ struct ReflowInput : public SizeComputationInput {
* Init() instead.
* @param aFlags A set of flags used for additional boolean parameters (see
* InitFlags above).
* @param aStyleSizeOverrides The style data used to override mFrame's when we
* call nsIFrame::ComputeSize() internally.
* @param aComputeSizeFlags A set of flags used when we call
* nsIFrame::ComputeSize() internally.
*/
@ -621,6 +639,7 @@ struct ReflowInput : public SizeComputationInput {
const mozilla::Maybe<mozilla::LogicalSize>& aContainingBlockSize =
mozilla::Nothing(),
InitFlags aFlags = {},
const mozilla::StyleSizeOverrides& aSizeOverrides = {},
mozilla::ComputeSizeFlags aComputeSizeFlags = {});
/**

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

@ -49,7 +49,8 @@ void nsBackdropFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
LogicalSize nsBackdropFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Note that this frame is a child of the viewport frame.
LogicalSize result(aWM, 0xdeadbeef, NS_UNCONSTRAINEDSIZE);
if (aFlags.contains(ComputeSizeFlag::ShrinkWrap)) {

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

@ -25,11 +25,12 @@ class nsBackdropFrame final : public nsIFrame {
nsIFrame** aProviderFrame) const override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -7411,7 +7411,7 @@ void nsBlockFrame::ReflowOutsideMarker(nsIFrame* aMarkerFrame,
availSize.BSize(markerWM) = NS_UNCONSTRAINEDSIZE;
ReflowInput reflowInput(aState.mPresContext, ri, aMarkerFrame, availSize,
Nothing(), {}, {ComputeSizeFlag::ShrinkWrap});
Nothing(), {}, {}, {ComputeSizeFlag::ShrinkWrap});
nsReflowStatus status;
aMarkerFrame->Reflow(aState.mPresContext, aMetrics, reflowInput, status);

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

@ -977,7 +977,8 @@ void nsContainerFrame::DoInlineIntrinsicISize(gfxContext* aRenderingContext,
LogicalSize nsContainerFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const mozilla::LogicalSize& aBorderPadding,
const StyleSizeOverrides& aSizeOverrides, ComputeSizeFlags aFlags) {
LogicalSize result(aWM, 0xdeadbeef, NS_UNCONSTRAINEDSIZE);
nscoord availBased =
aAvailableISize - aMargin.ISize(aWM) - aBorderPadding.ISize(aWM);
@ -2390,7 +2391,8 @@ LogicalSize nsContainerFrame::ComputeSizeWithIntrinsicDimensions(
gfxContext* aRenderingContext, WritingMode aWM,
const IntrinsicSize& aIntrinsicSize, const AspectRatio& aAspectRatio,
const LogicalSize& aCBSize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
const nsStylePosition* stylePos = StylePosition();
const auto* inlineStyleCoord = &stylePos->ISize(aWM);
const auto* blockStyleCoord = &stylePos->BSize(aWM);

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

@ -225,6 +225,7 @@ class nsContainerFrame : public nsSplittableFrame {
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
/**
@ -872,6 +873,7 @@ class nsContainerFrame : public nsSplittableFrame {
const mozilla::AspectRatio& aAspectRatio,
const mozilla::LogicalSize& aCBSize, const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags);
// Compute tight bounds assuming this frame honours its border, background

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

@ -129,7 +129,8 @@ nscoord nsFirstLetterFrame::GetPrefISize(gfxContext* aRenderingContext) {
nsIFrame::SizeComputationResult nsFirstLetterFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
if (GetPrevInFlow()) {
// We're wrapping the text *after* the first letter, so behave like an
// inline frame.
@ -138,7 +139,7 @@ nsIFrame::SizeComputationResult nsFirstLetterFrame::ComputeSize(
}
return nsContainerFrame::ComputeSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorderPadding,
aFlags);
aSizeOverrides, aFlags);
}
void nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,

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

@ -47,13 +47,13 @@ class nsFirstLetterFrame final : public nsContainerFrame {
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -1597,7 +1597,7 @@ void nsFlexContainerFrame::ResolveAutoFlexBasisAndMinSize(
aItemReflowInput.mContainingBlockSize, availISize,
aItemReflowInput.ComputedLogicalMargin(itemWM).Size(itemWM),
aItemReflowInput.ComputedLogicalBorderPadding(itemWM).Size(itemWM),
{ComputeSizeFlag::UseAutoISize, ComputeSizeFlag::ShrinkWrap});
{}, {ComputeSizeFlag::UseAutoISize, ComputeSizeFlag::ShrinkWrap});
contentSizeSuggestion = aAxisTracker.MainComponent(
sizeInItemWM.mLogicalSize.ConvertTo(cbWM, itemWM));

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

@ -4984,7 +4984,7 @@ static nscoord MeasuringReflow(nsIFrame* aChild,
} else {
aChild->RemoveProperty(nsIFrame::BClampMarginBoxMinSizeProperty());
}
ReflowInput childRI(pc, *rs, aChild, aAvailableSize, Some(aCBSize), {},
ReflowInput childRI(pc, *rs, aChild, aAvailableSize, Some(aCBSize), {}, {},
csFlags);
// Because we pass ComputeSizeFlag::UseAutoBSize, and the
@ -5036,7 +5036,7 @@ static void PostReflowStretchChild(
aChild->RemoveProperty(nsIFrame::BClampMarginBoxMinSizeProperty());
}
ReflowInput ri(pc, aReflowInput, aChild, aAvailableSize, Some(aCBSize), {},
csFlags);
{}, csFlags);
if (aChildAxis == eLogicalAxisBlock) {
ri.SetComputedBSize(ri.ApplyMinMaxBSize(aNewContentBoxSize));
} else {
@ -7245,7 +7245,7 @@ void nsGridContainerFrame::ReflowInFlowChild(
}
LogicalSize percentBasis(cb.Size(wm).ConvertTo(childWM, wm));
ReflowInput childRI(pc, *aState.mReflowInput, aChild, childCBSize,
Some(percentBasis), {}, csFlags);
Some(percentBasis), {}, {}, csFlags);
childRI.mFlags.mIsTopOfPage =
aFragmentainer ? aFragmentainer->mIsTopOfPage : false;

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

@ -404,10 +404,11 @@ AspectRatio nsHTMLCanvasFrame::GetIntrinsicRatio() const {
nsIFrame::SizeComputationResult nsHTMLCanvasFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, GetIntrinsicSize(), GetAspectRatio(),
aCBSize, aMargin, aBorderPadding, aFlags),
aCBSize, aMargin, aBorderPadding, aSizeOverrides, aFlags),
AspectRatioUsage::None};
}

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

@ -69,13 +69,13 @@ class nsHTMLCanvasFrame final : public nsContainerFrame {
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
mozilla::AspectRatio GetIntrinsicRatio() const override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -6076,13 +6076,14 @@ static MinMaxSize ComputeTransferredMinMaxInlineSize(
nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
MOZ_ASSERT(!GetIntrinsicRatio(),
"Please override this method and call "
"nsContainerFrame::ComputeSizeWithIntrinsicDimensions instead.");
LogicalSize result =
ComputeAutoSize(aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
aBorderPadding, aFlags);
aBorderPadding, aSizeOverrides, aFlags);
const nsStylePosition* stylePos = StylePosition();
const nsStyleDisplay* disp = StyleDisplay();
auto aspectRatioUsage = AspectRatioUsage::None;
@ -6431,7 +6432,8 @@ LogicalSize nsIFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const mozilla::LogicalSize& aBorderPadding,
const StyleSizeOverrides& aSizeOverrides, ComputeSizeFlags aFlags) {
// Use basic shrink-wrapping as a default implementation.
LogicalSize result(aWM, 0xdeadbeef, NS_UNCONSTRAINEDSIZE);
@ -10682,7 +10684,7 @@ void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
ComputeSize(
aRenderingContext, wm, logicalSize, logicalSize.ISize(wm),
reflowInput.ComputedLogicalMargin(wm).Size(wm),
reflowInput.ComputedLogicalBorderPadding(wm).Size(wm), {})
reflowInput.ComputedLogicalBorderPadding(wm).Size(wm), {}, {})
.mLogicalSize.Height(wm));
}
}

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

@ -2741,6 +2741,9 @@ class nsIFrame : public nsQueryFrame {
* @param aBorderPadding The sum of the frame's inline / block border-widths
* and padding (including actual values resulting from
* percentage padding values).
* @param aSizeOverride Optional override values for size properties, which
* this function will use internally instead of the
* actual property values.
* @param aFlags Flags to further customize behavior (definitions in
* LayoutConstants.h).
*
@ -2767,6 +2770,7 @@ class nsIFrame : public nsQueryFrame {
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags);
protected:
@ -2780,15 +2784,21 @@ class nsIFrame : public nsQueryFrame {
* should override only ComputeAutoSize, and frames that cannot do so need to
* override ComputeSize to enforce their inline-size/block-size invariants.
*
* Implementations may optimize by returning a garbage width if
* StylePosition()->ISize() is not 'auto', and likewise for BSize(), since in
* such cases the result is guaranteed to be unused.
* Implementations may optimize by returning a garbage inline-size if
* StylePosition()->ISize() is not 'auto' (or inline-size override in
* aSizeOverrides is not 'auto' if provided), and likewise for BSize(), since
* in such cases the result is guaranteed to be unused.
*
* Most of the frame are not expected to check the aSizeOverrides parameter
* apart from checking the inline size override for 'auto' if they want to
* optimize and return garbage inline-size.
*/
virtual mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags);
/**

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

@ -962,11 +962,12 @@ void nsImageFrame::EnsureIntrinsicSizeAndRatio() {
nsIFrame::SizeComputationResult nsImageFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
EnsureIntrinsicSizeAndRatio();
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, mIntrinsicSize, GetAspectRatio(), aCBSize,
aMargin, aBorderPadding, aFlags),
aMargin, aBorderPadding, aSizeOverrides, aFlags),
AspectRatioUsage::None};
}

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

@ -215,13 +215,13 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
return !HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
}
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) final;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) final;
bool IsServerImageMap();

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

@ -243,7 +243,8 @@ void nsInlineFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
nsIFrame::SizeComputationResult nsInlineFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Inlines and text don't compute size before reflow.
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};

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

@ -76,13 +76,13 @@ class nsInlineFrame : public nsContainerFrame {
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -42,7 +42,8 @@ nscoord nsLeafFrame::GetPrefISize(gfxContext* aRenderingContext) {
LogicalSize nsLeafFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
const WritingMode wm = GetWritingMode();
LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
return result.ConvertTo(aWM, wm);

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

@ -37,11 +37,12 @@ class nsLeafFrame : public nsIFrame {
/**
* Our auto size is just intrinsic width and intrinsic height.
*/
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
/**

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

@ -251,7 +251,8 @@ bool nsRubyBaseContainerFrame::CanContinueTextRun() const { return true; }
nsIFrame::SizeComputationResult nsRubyBaseContainerFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Ruby base container frame is inline,
// hence don't compute size before reflow.
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),

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

@ -35,13 +35,13 @@ class nsRubyBaseContainerFrame final : public nsContainerFrame {
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;

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

@ -671,11 +671,12 @@ AspectRatio nsSubDocumentFrame::GetIntrinsicRatio() const {
LogicalSize nsSubDocumentFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
if (!IsInline()) {
return nsIFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorderPadding,
aFlags);
aSizeOverrides, aFlags);
}
const WritingMode wm = GetWritingMode();
@ -687,10 +688,11 @@ LogicalSize nsSubDocumentFrame::ComputeAutoSize(
nsIFrame::SizeComputationResult nsSubDocumentFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, GetIntrinsicSize(), GetAspectRatio(),
aCBSize, aMargin, aBorderPadding, aFlags),
aCBSize, aMargin, aBorderPadding, aSizeOverrides, aFlags),
AspectRatioUsage::None};
}

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

@ -69,15 +69,16 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -8676,7 +8676,8 @@ void nsTextFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
nsIFrame::SizeComputationResult nsTextFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Inlines and text don't compute size before reflow.
return {LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
AspectRatioUsage::None};

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

@ -398,13 +398,13 @@ class nsTextFrame : public nsIFrame {
InlineMinISizeData* aData) override;
void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) final;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) final;
nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const final;
nsresult GetPrefWidthTightBounds(gfxContext* aContext, nscoord* aX,
nscoord* aXMost) final;

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

@ -556,16 +556,17 @@ nsresult nsVideoFrame::GetFrameName(nsAString& aResult) const {
nsIFrame::SizeComputationResult nsVideoFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
if (!HasVideoElement()) {
return nsContainerFrame::ComputeSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin,
aBorderPadding, aFlags);
return nsContainerFrame::ComputeSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
aBorderPadding, aSizeOverrides, aFlags);
}
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWM, GetIntrinsicSize(), GetAspectRatio(),
aCBSize, aMargin, aBorderPadding, aFlags),
aCBSize, aMargin, aBorderPadding, aSizeOverrides, aFlags),
AspectRatioUsage::None};
}

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

@ -57,13 +57,13 @@ class nsVideoFrame final : public nsContainerFrame,
nsSize GetVideoIntrinsicSize() const;
mozilla::IntrinsicSize GetIntrinsicSize() override;
mozilla::AspectRatio GetIntrinsicRatio() const override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
void DestroyFrom(nsIFrame* aDestructRoot,

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

@ -80,7 +80,8 @@ void nsMathMLSelectedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsIFrame::SizeComputationResult nsMathMLSelectedFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) {
// Delegate size computation to the child frame.
@ -94,7 +95,8 @@ nsIFrame::SizeComputationResult nsMathMLSelectedFrame::ComputeSize(
const auto bpSize = offsetState.ComputedLogicalBorderPadding(aWM).Size(aWM);
auto size = childFrame->ComputeSize(
aRenderingContext, aWM, cbSize, availableISize,
offsetState.ComputedLogicalMargin(aWM).Size(aWM), bpSize, aFlags);
offsetState.ComputedLogicalMargin(aWM).Size(aWM), bpSize,
aSizeOverrides, aFlags);
return {size.mLogicalSize + bpSize, size.mAspectRatioUsage};
}
return {LogicalSize(aWM), AspectRatioUsage::None};

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

@ -27,13 +27,13 @@ class nsMathMLSelectedFrame : public nsMathMLContainerFrame {
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
ReflowOutput& aDesiredSize) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -291,7 +291,7 @@ nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorderPadding,
ComputeSizeFlags aFlags) {
const StyleSizeOverrides& aSizeOverrides, ComputeSizeFlags aFlags) {
if (IsRootOfImage() || mIsInObjectOrEmbed) {
// The embedding element has sized itself using the CSS replaced element
// sizing rules, using our intrinsic dimensions as necessary. The SVG spec
@ -353,7 +353,7 @@ nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
return {ComputeSizeWithIntrinsicDimensions(
aRenderingContext, aWritingMode, intrinsicSize, GetAspectRatio(),
cbSize, aMargin, aBorderPadding, aFlags),
cbSize, aMargin, aBorderPadding, aSizeOverrides, aFlags),
AspectRatioUsage::None};
}

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

@ -62,13 +62,12 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
virtual IntrinsicSize GetIntrinsicSize() override;
AspectRatio GetIntrinsicRatio() const override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
WritingMode aWritingMode,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorderPadding,
ComputeSizeFlags aFlags) override;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

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

@ -1523,10 +1523,11 @@ nsTableFrame::IntrinsicISizeOffsets(nscoord aPercentageBasis) {
nsIFrame::SizeComputationResult nsTableFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
auto result = nsContainerFrame::ComputeSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin,
aBorderPadding, aFlags);
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
auto result = nsContainerFrame::ComputeSize(
aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin, aBorderPadding,
aSizeOverrides, 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;
@ -1580,7 +1581,8 @@ nscoord nsTableFrame::TableShrinkISizeToFit(gfxContext* aRenderingContext,
LogicalSize nsTableFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Tables always shrink-wrap.
nscoord cbBased =
aAvailableISize - aMargin.ISize(aWM) - aBorderPadding.ISize(aWM);

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

@ -295,19 +295,20 @@ class nsTableFrame : public nsContainerFrame {
IntrinsicSizeOffsetData IntrinsicISizeOffsets(
nscoord aPercentageBasis = NS_UNCONSTRAINEDSIZE) override;
SizeComputationResult ComputeSize(gfxContext* aRenderingContext,
mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
mozilla::ComputeSizeFlags aFlags) override;
virtual mozilla::LogicalSize ComputeAutoSize(
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
/**

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

@ -360,7 +360,7 @@ nscoord nsTableWrapperFrame::GetPrefISize(gfxContext* aRenderingContext) {
nscoord nsTableWrapperFrame::ChildShrinkWrapISize(
gfxContext* aRenderingContext, nsIFrame* aChildFrame, WritingMode aWM,
LogicalSize aCBSize, nscoord aAvailableISize,
nscoord* aMarginResult) const {
const StyleSizeOverrides& aSizeOverrides, nscoord* aMarginResult) const {
AutoMaybeDisableFontInflation an(aChildFrame);
SizeComputationInput offsets(aChildFrame, aRenderingContext, aWM,
@ -384,7 +384,7 @@ nscoord nsTableWrapperFrame::ChildShrinkWrapISize(
auto size =
aChildFrame->ComputeSize(aRenderingContext, aWM, aCBSize, aAvailableISize,
marginSize, bpSize, flags);
marginSize, bpSize, aSizeOverrides, flags);
if (aMarginResult) {
*aMarginResult = offsets.ComputedLogicalMargin(aWM).IStartEnd(aWM);
}
@ -396,7 +396,8 @@ nscoord nsTableWrapperFrame::ChildShrinkWrapISize(
LogicalSize nsTableWrapperFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
nscoord kidAvailableISize = aAvailableISize - aMargin.ISize(aWM);
NS_ASSERTION(aBorderPadding.IsAllZero(),
"Table wrapper frames cannot have borders or paddings");
@ -410,24 +411,27 @@ LogicalSize nsTableWrapperFrame::ComputeAutoSize(
uint8_t captionSide = GetCaptionSide();
nscoord inlineSize;
if (captionSide == NO_SIDE) {
inlineSize = ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM,
aCBSize, kidAvailableISize);
inlineSize =
ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM, aCBSize,
kidAvailableISize, aSizeOverrides);
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
nscoord capISize =
ChildShrinkWrapISize(aRenderingContext, mCaptionFrames.FirstChild(),
aWM, aCBSize, kidAvailableISize);
inlineSize = capISize +
ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM,
aCBSize, kidAvailableISize - capISize);
aWM, aCBSize, kidAvailableISize, aSizeOverrides);
inlineSize =
capISize +
ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM, aCBSize,
kidAvailableISize - capISize, aSizeOverrides);
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
nscoord margin;
inlineSize = ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM,
aCBSize, kidAvailableISize, &margin);
inlineSize =
ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM, aCBSize,
kidAvailableISize, aSizeOverrides, &margin);
nscoord capISize =
ChildShrinkWrapISize(aRenderingContext, mCaptionFrames.FirstChild(),
aWM, aCBSize, inlineSize - margin);
aWM, aCBSize, inlineSize - margin, aSizeOverrides);
if (capISize > inlineSize) {
inlineSize = capISize;
}
@ -435,11 +439,12 @@ LogicalSize nsTableWrapperFrame::ComputeAutoSize(
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
"unexpected caption-side");
inlineSize = ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM,
aCBSize, kidAvailableISize);
inlineSize =
ChildShrinkWrapISize(aRenderingContext, InnerTableFrame(), aWM, aCBSize,
kidAvailableISize, aSizeOverrides);
nscoord capISize =
ChildShrinkWrapISize(aRenderingContext, mCaptionFrames.FirstChild(),
aWM, aCBSize, kidAvailableISize);
aWM, aCBSize, kidAvailableISize, aSizeOverrides);
if (capISize > inlineSize) {
inlineSize = capISize;
}

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

@ -92,11 +92,12 @@ class nsTableWrapperFrame : public nsContainerFrame {
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
/** process a reflow command for the table.
@ -266,11 +267,12 @@ class nsTableWrapperFrame : public nsContainerFrame {
* If aMarginResult is non-null, fill it with the part of the
* margin-isize that was contributed by the margin.
*/
nscoord ChildShrinkWrapISize(gfxContext* aRenderingContext,
nsIFrame* aChildFrame, mozilla::WritingMode aWM,
mozilla::LogicalSize aCBSize,
nscoord aAvailableISize,
nscoord* aMarginResult = nullptr) const;
nscoord ChildShrinkWrapISize(
gfxContext* aRenderingContext, nsIFrame* aChildFrame,
mozilla::WritingMode aWM, mozilla::LogicalSize aCBSize,
nscoord aAvailableISize,
const mozilla::StyleSizeOverrides& aSizeOverrides,
nscoord* aMarginResult = nullptr) const;
private:
nsFrameList mCaptionFrames;

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

@ -116,11 +116,12 @@ nscoord nsLeafBoxFrame::GetIntrinsicISize() {
LogicalSize nsLeafBoxFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize, const LogicalSize& aMargin,
const LogicalSize& aBorderPadding, ComputeSizeFlags aFlags) {
const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
ComputeSizeFlags aFlags) {
// Important: NOT calling our direct superclass here!
return nsIFrame::ComputeAutoSize(aRenderingContext, aWM, aCBSize,
aAvailableISize, aMargin, aBorderPadding,
aFlags);
aSizeOverrides, aFlags);
}
void nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,

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

@ -44,11 +44,12 @@ class nsLeafBoxFrame : public nsLeafFrame {
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
// Our auto size is that provided by nsFrame, not nsLeafFrame
virtual mozilla::LogicalSize ComputeAutoSize(
mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,