зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1911027 Part 1 - Clean up for various frame classes. r=layout-reviewers,emilio
- Replace 'Width' with 'ISize'. - Drop `virtual` on methods already with `override`. - Define `AddInlineMinISize()` and `AddInlinePrefISize` directly in `nsContinuingTextFrame`. - Rename `ReflowOutpt` parameter to `aReflowOutput`. Differential Revision: https://phabricator.services.mozilla.com/D218282
This commit is contained in:
Родитель
47a2034735
Коммит
4d4953cb0e
|
@ -265,7 +265,8 @@ static void ReparentChildListStyle(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
void nsInlineFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
||||
void nsInlineFrame::Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aReflowOutput,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) {
|
||||
MarkInReflow();
|
||||
|
@ -276,7 +277,7 @@ void nsInlineFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
|||
NS_ERROR("must have non-null aReflowInput.mLineLayout");
|
||||
return;
|
||||
}
|
||||
if (IsFrameTreeTooDeep(aReflowInput, aMetrics, aStatus)) {
|
||||
if (IsFrameTreeTooDeep(aReflowInput, aReflowOutput, aStatus)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -353,9 +354,9 @@ void nsInlineFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
|||
Unused << PullOneFrame(aPresContext, irs);
|
||||
}
|
||||
|
||||
ReflowFrames(aPresContext, aReflowInput, irs, aMetrics, aStatus);
|
||||
ReflowFrames(aPresContext, aReflowInput, irs, aReflowOutput, aStatus);
|
||||
|
||||
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowInput, aStatus);
|
||||
ReflowAbsoluteFrames(aPresContext, aReflowOutput, aReflowInput, aStatus);
|
||||
|
||||
// Note: the line layout code will properly compute our
|
||||
// overflow-rect state for us.
|
||||
|
@ -441,7 +442,8 @@ void nsInlineFrame::PullOverflowsFromPrevInFlow() {
|
|||
|
||||
void nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
||||
const ReflowInput& aReflowInput,
|
||||
InlineReflowInput& irs, ReflowOutput& aMetrics,
|
||||
InlineReflowInput& irs,
|
||||
ReflowOutput& aReflowOutput,
|
||||
nsReflowStatus& aStatus) {
|
||||
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
||||
|
||||
|
@ -591,7 +593,7 @@ void nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
// line-height calculations. However, continuations of an inline
|
||||
// that are empty we force to empty so that things like collapsed
|
||||
// whitespace in an inline element don't affect the line-height.
|
||||
aMetrics.ISize(lineWM) = lineLayout->EndSpan(this);
|
||||
aReflowOutput.ISize(lineWM) = lineLayout->EndSpan(this);
|
||||
|
||||
// Compute final width.
|
||||
|
||||
|
@ -607,7 +609,7 @@ void nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
// and padding since all continuations have them.
|
||||
if ((!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) ||
|
||||
boxDecorationBreakClone) {
|
||||
aMetrics.ISize(lineWM) += framePadding.IStart(frameWM);
|
||||
aReflowOutput.ISize(lineWM) += framePadding.IStart(frameWM);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -621,20 +623,20 @@ void nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
if ((aStatus.IsComplete() && !LastInFlow()->GetNextContinuation() &&
|
||||
!FrameIsNonLastInIBSplit()) ||
|
||||
boxDecorationBreakClone) {
|
||||
aMetrics.ISize(lineWM) += framePadding.IEnd(frameWM);
|
||||
aReflowOutput.ISize(lineWM) += framePadding.IEnd(frameWM);
|
||||
}
|
||||
|
||||
nsLayoutUtils::SetBSizeFromFontMetrics(this, aMetrics, framePadding, lineWM,
|
||||
frameWM);
|
||||
nsLayoutUtils::SetBSizeFromFontMetrics(this, aReflowOutput, framePadding,
|
||||
lineWM, frameWM);
|
||||
|
||||
// For now our overflow area is zero. The real value will be
|
||||
// computed in |nsLineLayout::RelativePositionFrames|.
|
||||
aMetrics.mOverflowAreas.Clear();
|
||||
aReflowOutput.mOverflowAreas.Clear();
|
||||
|
||||
#ifdef NOISY_FINAL_SIZE
|
||||
ListTag(stdout);
|
||||
printf(": metrics=%d,%d ascent=%d\n", aMetrics.Width(), aMetrics.Height(),
|
||||
aMetrics.BlockStartAscent());
|
||||
printf(": metrics=%d,%d ascent=%d\n", aReflowOutput.Width(),
|
||||
aReflowOutput.Height(), aReflowOutput.BlockStartAscent());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -982,7 +984,7 @@ nsIFrame* nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
void nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aMetrics,
|
||||
ReflowOutput& aReflowOutput,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) {
|
||||
MarkInReflow();
|
||||
|
@ -1043,10 +1045,10 @@ void nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
|
|||
NS_ASSERTION(!aReflowInput.mLineLayout->GetInFirstLine(),
|
||||
"Nested first-line frames? BOGUS");
|
||||
aReflowInput.mLineLayout->SetInFirstLine(true);
|
||||
ReflowFrames(aPresContext, aReflowInput, irs, aMetrics, aStatus);
|
||||
ReflowFrames(aPresContext, aReflowInput, irs, aReflowOutput, aStatus);
|
||||
aReflowInput.mLineLayout->SetInFirstLine(false);
|
||||
|
||||
ReflowAbsoluteFrames(aPresContext, aMetrics, aReflowInput, aStatus);
|
||||
ReflowAbsoluteFrames(aPresContext, aReflowOutput, aReflowInput, aStatus);
|
||||
|
||||
// Note: the line layout code will properly compute our overflow state for us
|
||||
}
|
||||
|
|
|
@ -32,28 +32,27 @@ class nsInlineFrame : public nsContainerFrame {
|
|||
friend nsInlineFrame* NS_NewInlineFrame(mozilla::PresShell* aPresShell,
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
// nsIFrame overrides
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual mozilla::a11y::AccType AccessibleType() override;
|
||||
mozilla::a11y::AccType AccessibleType() override;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0,
|
||||
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
|
||||
bool aRebuildDisplayItems = true) override;
|
||||
void InvalidateFrameWithRect(const nsRect& aRect,
|
||||
uint32_t aDisplayItemKey = 0,
|
||||
bool aRebuildDisplayItems = true) override;
|
||||
virtual void InvalidateFrameWithRect(
|
||||
const nsRect& aRect, uint32_t aDisplayItemKey = 0,
|
||||
bool aRebuildDisplayItems = true) override;
|
||||
|
||||
virtual bool IsEmpty() override;
|
||||
virtual bool IsSelfEmpty() override;
|
||||
bool IsEmpty() override;
|
||||
bool IsSelfEmpty() override;
|
||||
|
||||
virtual FrameSearchResult PeekOffsetCharacter(
|
||||
FrameSearchResult PeekOffsetCharacter(
|
||||
bool aForward, int32_t* aOffset,
|
||||
PeekOffsetCharacterOptions aOptions =
|
||||
PeekOffsetCharacterOptions()) override;
|
||||
|
@ -62,11 +61,10 @@ class nsInlineFrame : public nsContainerFrame {
|
|||
|
||||
void StealFrame(nsIFrame* aChild) override;
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
SizeComputationResult ComputeSize(
|
||||
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
|
||||
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
|
||||
|
@ -74,22 +72,23 @@ class nsInlineFrame : public nsContainerFrame {
|
|||
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,
|
||||
nsReflowStatus& aStatus) override;
|
||||
nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
|
||||
|
||||
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
int32_t aModType) override;
|
||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aReflowOutput,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
virtual bool CanContinueTextRun() const override;
|
||||
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
int32_t aModType) override;
|
||||
|
||||
virtual void PullOverflowsFromPrevInFlow() override;
|
||||
bool CanContinueTextRun() const override;
|
||||
|
||||
void PullOverflowsFromPrevInFlow() override;
|
||||
|
||||
Maybe<nscoord> GetNaturalBaselineBOffset(
|
||||
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
|
||||
BaselineExportContext) const override;
|
||||
virtual bool DrainSelfOverflowList() override;
|
||||
bool DrainSelfOverflowList() override;
|
||||
|
||||
/**
|
||||
* Return true if the frame is first visual frame or first continuation
|
||||
|
@ -189,16 +188,17 @@ class nsFirstLineFrame final : public nsInlineFrame {
|
|||
ComputedStyle* aStyle);
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
virtual void PullOverflowsFromPrevInFlow() override;
|
||||
virtual bool DrainSelfOverflowList() override;
|
||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aReflowOutput,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
void PullOverflowsFromPrevInFlow() override;
|
||||
bool DrainSelfOverflowList() override;
|
||||
|
||||
protected:
|
||||
explicit nsFirstLineFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
||||
|
|
|
@ -48,7 +48,7 @@ NS_QUERYFRAME_TAIL_INHERITING(nsIFrame)
|
|||
/* virtual */
|
||||
void nsPlaceholderFrame::AddInlineMinISize(
|
||||
gfxContext* aRenderingContext, nsIFrame::InlineMinISizeData* aData) {
|
||||
// Override AddInlineMinWith so that *nothing* happens. In
|
||||
// Override AddInlineMinISize so that *nothing* happens. In
|
||||
// particular, we don't want to zero out |aData->mTrailingWhitespace|,
|
||||
// since nsLineLayout skips placeholders when trimming trailing
|
||||
// whitespace, and we don't want to set aData->mSkipWhitespace to
|
||||
|
@ -65,7 +65,7 @@ void nsPlaceholderFrame::AddInlineMinISize(
|
|||
/* virtual */
|
||||
void nsPlaceholderFrame::AddInlinePrefISize(
|
||||
gfxContext* aRenderingContext, nsIFrame::InlinePrefISizeData* aData) {
|
||||
// Override AddInlinePrefWith so that *nothing* happens. In
|
||||
// Override AddInlinePrefISize so that *nothing* happens. In
|
||||
// particular, we don't want to zero out |aData->mTrailingWhitespace|,
|
||||
// since nsLineLayout skips placeholders when trimming trailing
|
||||
// whitespace, and we don't want to set aData->mSkipWhitespace to
|
||||
|
|
|
@ -28,12 +28,11 @@ class nsRubyBaseContainerFrame final : public nsContainerFrame {
|
|||
NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// nsIFrame overrides
|
||||
virtual bool CanContinueTextRun() const override;
|
||||
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
bool CanContinueTextRun() const override;
|
||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
SizeComputationResult ComputeSize(
|
||||
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
|
||||
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
|
||||
|
@ -41,16 +40,16 @@ class nsRubyBaseContainerFrame final : public nsContainerFrame {
|
|||
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;
|
||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
Maybe<nscoord> GetNaturalBaselineBOffset(
|
||||
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
|
||||
BaselineExportContext) const override;
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
void UpdateDescendantLeadings(const mozilla::RubyBlockLeadings& aLeadings) {
|
||||
|
|
|
@ -28,7 +28,7 @@ class nsRubyBaseFrame final : public nsRubyContentFrame {
|
|||
NS_DECL_QUERYFRAME
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
|
@ -28,17 +28,16 @@ class nsRubyFrame final : public nsInlineFrame {
|
|||
NS_DECL_FRAMEARENA_HELPERS(nsRubyFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// nsIFrame overrides
|
||||
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) override;
|
||||
void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) override;
|
||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
mozilla::RubyBlockLeadings GetBlockLeadings() const { return mLeadings; }
|
||||
|
|
|
@ -27,19 +27,18 @@ class nsRubyTextFrame final : public nsRubyContentFrame {
|
|||
NS_DECL_FRAMEARENA_HELPERS(nsRubyTextFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// nsIFrame overrides
|
||||
virtual bool CanContinueTextRun() const override;
|
||||
bool CanContinueTextRun() const override;
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
bool IsCollapsed() const {
|
||||
return HasAnyStateBits(NS_RUBY_TEXT_FRAME_COLLAPSED);
|
||||
|
|
|
@ -4253,9 +4253,13 @@ class nsContinuingTextFrame final : public nsTextFrame {
|
|||
};
|
||||
|
||||
void AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) final;
|
||||
InlineMinISizeData* aData) final {
|
||||
// Do nothing, since the first-in-flow accounts for everything.
|
||||
}
|
||||
void AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) final;
|
||||
InlinePrefISizeData* aData) final {
|
||||
// Do nothing, since the first-in-flow accounts for everything.
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit nsContinuingTextFrame(ComputedStyle* aStyle,
|
||||
|
@ -4380,18 +4384,6 @@ nscoord nsTextFrame::IntrinsicISize(gfxContext* aContext,
|
|||
return IntrinsicISizeFromInline(aContext, aType);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
void nsContinuingTextFrame::AddInlineMinISize(gfxContext* aRenderingContext,
|
||||
InlineMinISizeData* aData) {
|
||||
// Do nothing, since the first-in-flow accounts for everything.
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
void nsContinuingTextFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
|
||||
InlinePrefISizeData* aData) {
|
||||
// Do nothing, since the first-in-flow accounts for everything.
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#if defined(DEBUG_rbs) || defined(DEBUG_bzbarsky)
|
||||
|
|
Загрузка…
Ссылка в новой задаче