From b3a1c3da2b3ab88f956d3a95b9478c3af7a24d71 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Fri, 15 Sep 2017 15:55:21 -0700 Subject: [PATCH] Bug 1400421 part 2: Delete unused nsLeafFrame::Reflow override (and its DoReflow helper). r=mats nsLeafFrame only exists as an abstract superclass, and every subclass actually brings along its own Reflow impl, so nsLeafFrame's own impl is just dead code. This patch makes sure it's really dead code by leaving in the Reflow() decl with " = 0;" so the compiler will enforce that all concrete subclasses *do* have a more specific override (and that they don't just inherit the stub nsFrame impl from further up the ancestor chain, for example). MozReview-Commit-ID: Co36IpuaeOc --HG-- extra : rebase_source : 036caa3abaed0a1cf75e8674af4ae2e8b55b3b8c --- layout/generic/nsLeafFrame.cpp | 47 ---------------------------------- layout/generic/nsLeafFrame.h | 19 +++----------- 2 files changed, 4 insertions(+), 62 deletions(-) diff --git a/layout/generic/nsLeafFrame.cpp b/layout/generic/nsLeafFrame.cpp index 587050ca04cf..81949940c839 100644 --- a/layout/generic/nsLeafFrame.cpp +++ b/layout/generic/nsLeafFrame.cpp @@ -48,53 +48,6 @@ nsLeafFrame::ComputeAutoSize(gfxContext* aRenderingContext, return result.ConvertTo(aWM, wm); } -void -nsLeafFrame::Reflow(nsPresContext* aPresContext, - ReflowOutput& aMetrics, - const ReflowInput& aReflowInput, - nsReflowStatus& aStatus) -{ - MarkInReflow(); - DO_GLOBAL_REFLOW_COUNT("nsLeafFrame"); - NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, - ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d", - aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight())); - - NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); - - DoReflow(aPresContext, aMetrics, aReflowInput, aStatus); - - FinishAndStoreOverflow(&aMetrics, aReflowInput.mStyleDisplay); -} - -void -nsLeafFrame::DoReflow(nsPresContext* aPresContext, - ReflowOutput& aMetrics, - const ReflowInput& aReflowInput, - nsReflowStatus& aStatus) -{ - NS_ASSERTION(aReflowInput.ComputedWidth() != NS_UNCONSTRAINEDSIZE, - "Shouldn't have unconstrained stuff here " - "thanks to the rules of reflow"); - NS_ASSERTION(NS_INTRINSICSIZE != aReflowInput.ComputedHeight(), - "Shouldn't have unconstrained stuff here " - "thanks to ComputeAutoSize"); - - // XXX how should border&padding effect baseline alignment? - // => descent = borderPadding.bottom for example - WritingMode wm = aReflowInput.GetWritingMode(); - aMetrics.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding()); - - aStatus.Reset(); - - NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, - ("exit nsLeafFrame::DoReflow: size=%d,%d", - aMetrics.ISize(wm), aMetrics.BSize(wm))); - NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics); - - aMetrics.SetOverflowAreasToDesiredBounds(); -} - nscoord nsLeafFrame::GetIntrinsicBSize() { diff --git a/layout/generic/nsLeafFrame.h b/layout/generic/nsLeafFrame.h index 99884c30f3c4..f96ba0b7a892 100644 --- a/layout/generic/nsLeafFrame.h +++ b/layout/generic/nsLeafFrame.h @@ -50,23 +50,12 @@ public: ComputeSizeFlags aFlags) override; /** - * Reflow our frame. This will use the computed width plus borderpadding for - * the desired width, and use the return value of GetIntrinsicBSize plus - * borderpadding for the desired height. Ascent will be set to the height, - * and descent will be set to 0. + * Each of our subclasses should provide its own Reflow impl: */ virtual void Reflow(nsPresContext* aPresContext, - ReflowOutput& aDesiredSize, - const ReflowInput& aReflowInput, - nsReflowStatus& aStatus) override; - - /** - * This method does most of the work that Reflow() above need done. - */ - virtual void DoReflow(nsPresContext* aPresContext, - ReflowOutput& aDesiredSize, - const ReflowInput& aReflowInput, - nsReflowStatus& aStatus); + ReflowOutput& aDesiredSize, + const ReflowInput& aReflowInput, + nsReflowStatus& aStatus) override = 0; virtual bool IsFrameOfType(uint32_t aFlags) const override {