Bug 916972 - Eliminate nsIFrame::GetSplittableType() completely. r=mats,dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 05 Nov 2018 19:11:12 +0000
changeset 444456 09df5390e2fb01be435bf72a8c8e1c1948e45f62
parent 444455 541186291b888899e895b8aa92d3823cf3475905
child 444457 723af5c4a100e82ec21605eac9367c2b8487a7e0
push id34996
push userrgurzau@mozilla.com
push dateTue, 06 Nov 2018 09:53:23 +0000
treeherdermozilla-central@e160f0a60e4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats, dholbert
bugs916972
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 916972 - Eliminate nsIFrame::GetSplittableType() completely. r=mats,dholbert Currently, GetSplittableType() is called only in nsCSSFrameConstructor::CreateContinuingFrame(). The splittable concrete frames should inherit from nsSplittableFrame, and must explicitly create continuing frame in CreateContinuingFrame(). Thus, no need to maintain GetSplittableType(). Differential Revision: https://phabricator.services.mozilla.com/D10798
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsAtomicContainerFrame.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsIFrame.h
layout/generic/nsImageFrame.h
layout/generic/nsSplittableFrame.cpp
layout/generic/nsSplittableFrame.h
layout/generic/nsTextFrame.h
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGOuterSVGFrame.h
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColFrame.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8324,19 +8324,16 @@ nsCSSFrameConstructor::CreateContinuingF
   nsIFrame*                  newFrame = nullptr;
   nsIFrame*                  nextContinuation = aFrame->GetNextContinuation();
   nsIFrame*                  nextInFlow = aFrame->GetNextInFlow();
 
   // Use the frame type to determine what type of frame to create
   LayoutFrameType frameType = aFrame->Type();
   nsIContent* content = aFrame->GetContent();
 
-  NS_ASSERTION(aFrame->GetSplittableType() != NS_FRAME_NOT_SPLITTABLE,
-               "why CreateContinuingFrame for a non-splittable frame?");
-
   if (LayoutFrameType::Text == frameType) {
     newFrame = NS_NewContinuingTextFrame(shell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Inline == frameType) {
     newFrame = NS_NewInlineFrame(shell, computedStyle);
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (LayoutFrameType::Block == frameType) {
     MOZ_ASSERT(!aFrame->IsTableCaption(),
--- a/layout/generic/nsAtomicContainerFrame.h
+++ b/layout/generic/nsAtomicContainerFrame.h
@@ -30,20 +30,16 @@ public:
   }
   FrameSearchResult
   PeekOffsetCharacter(bool aForward, int32_t* aOffset,
                       PeekOffsetCharacterOptions aOptions =
                         PeekOffsetCharacterOptions()) override
   {
     return nsFrame::PeekOffsetCharacter(aForward, aOffset, aOptions);
   }
-  nsSplittableType GetSplittableType() const override
-  {
-    return nsFrame::GetSplittableType();
-  }
 
 protected:
   nsAtomicContainerFrame(ComputedStyle* aStyle, ClassID aID)
     : nsContainerFrame(aStyle, aID)
   {}
 };
 
 #endif // nsAtomicContainerFrame_h___
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -399,22 +399,16 @@ nsBlockFrame::GetLineIterator()
   }
   return it;
 }
 
 NS_QUERYFRAME_HEAD(nsBlockFrame)
   NS_QUERYFRAME_ENTRY(nsBlockFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
-nsSplittableType
-nsBlockFrame::GetSplittableType() const
-{
-  return NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
-}
-
 #ifdef DEBUG_FRAME_DUMP
 void
 nsBlockFrame::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
 {
   nsCString str;
   ListGeneric(str, aPrefix, aFlags);
 
   fprintf_stderr(out, "%s<\n", str.get());
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -132,17 +132,16 @@ public:
     }
     return false;
   }
   bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
                                  BaselineSharingGroup aBaselineGroup,
                                  nscoord*             aBaseline) const override;
   nscoord GetCaretBaseline() const override;
   void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
-  nsSplittableType GetSplittableType() const override;
   bool IsFloatContainingBlock() const override;
   void BuildDisplayList(nsDisplayListBuilder* aBuilder,
                         const nsDisplayListSet& aLists) override;
   bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsContainerFrame::IsFrameOfType(aFlags &
              ~(nsIFrame::eCanContainOverflowContainers |
                nsIFrame::eBlockFrame));
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6625,22 +6625,16 @@ nsFrame::AttributeChanged(int32_t       
                           nsAtom*        aAttribute,
                           int32_t         aModType)
 {
   return NS_OK;
 }
 
 // Flow member functions
 
-nsSplittableType
-nsFrame::GetSplittableType() const
-{
-  return NS_FRAME_NOT_SPLITTABLE;
-}
-
 nsIFrame* nsFrame::GetPrevContinuation() const
 {
   return nullptr;
 }
 
 void
 nsFrame::SetPrevContinuation(nsIFrame* aPrevContinuation)
 {
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -196,17 +196,16 @@ public:
                                                  nsIFrame *aBlockFrame,
                                                  int32_t aLineStart,
                                                  int8_t aOutSideLimit);
 
   nsresult CharacterDataChanged(const CharacterDataChangeInfo& aInfo) override;
   nsresult AttributeChanged(int32_t  aNameSpaceID,
                             nsAtom* aAttribute,
                             int32_t aModType) override;
-  nsSplittableType GetSplittableType() const override;
   nsIFrame* GetPrevContinuation() const override;
   void SetPrevContinuation(nsIFrame*) override;
   nsIFrame* GetNextContinuation() const override;
   void SetNextContinuation(nsIFrame*) override;
   nsIFrame* GetPrevInFlowVirtual() const override;
   void SetPrevInFlow(nsIFrame*) override;
   nsIFrame* GetNextInFlowVirtual() const override;
   void SetNextInFlow(nsIFrame*) override;
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -194,22 +194,16 @@ void
 nsHTMLScrollFrame::RemoveFrame(ChildListID aListID,
                                nsIFrame* aOldFrame)
 {
   NS_ASSERTION(aListID == kPrincipalList, "Only main list supported");
   mFrames.DestroyFrame(aOldFrame);
   mHelper.ReloadChildFrames();
 }
 
-nsSplittableType
-nsHTMLScrollFrame::GetSplittableType() const
-{
-  return NS_FRAME_NOT_SPLITTABLE;
-}
-
 /**
  HTML scrolling implementation
 
  All other things being equal, we prefer layouts with fewer scrollbars showing.
 */
 
 namespace mozilla {
 
@@ -1611,22 +1605,16 @@ nsXULScrollFrame::InsertFrames(ChildList
 void
 nsXULScrollFrame::RemoveFrame(ChildListID     aListID,
                               nsIFrame*       aOldFrame)
 {
   nsBoxFrame::RemoveFrame(aListID, aOldFrame);
   mHelper.ReloadChildFrames();
 }
 
-nsSplittableType
-nsXULScrollFrame::GetSplittableType() const
-{
-  return NS_FRAME_NOT_SPLITTABLE;
-}
-
 nsresult
 nsXULScrollFrame::GetXULPadding(nsMargin& aMargin)
 {
   aMargin.SizeTo(0,0,0,0);
   return NS_OK;
 }
 
 nscoord
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -813,17 +813,16 @@ public:
     return this;
   }
 
   virtual nsContainerFrame* GetContentInsertionFrame() override {
     return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
   }
 
   virtual bool DoesClipChildren() override { return true; }
-  virtual nsSplittableType GetSplittableType() const override;
 
   nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) override
   { nsPoint pt = aChild->GetPosition();
     if (aChild == mHelper.GetScrolledFrame()) pt += GetScrollPosition();
     return pt;
   }
 
   // nsIAnonymousContentCreator
@@ -1241,17 +1240,16 @@ public:
     return this;
   }
 
   virtual nsContainerFrame* GetContentInsertionFrame() override {
     return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
   }
 
   virtual bool DoesClipChildren() override { return true; }
-  virtual nsSplittableType GetSplittableType() const override;
 
   nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) override
   { nsPoint pt = aChild->GetPosition();
     if (aChild == mHelper.GetScrolledFrame())
       pt += mHelper.GetLogicalScrollPosition();
     return pt;
   }
 
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -115,41 +115,16 @@ class LayerManager;
 } // namespace layers
 
 namespace dom {
 class Selection;
 } // namespace dom
 
 } // namespace mozilla
 
-/**
- * Indication of how the frame can be split. This is used when doing runaround
- * of floats, and when pulling up child frames from a next-in-flow.
- *
- * The choices are splittable, not splittable at all, and splittable in
- * a non-rectangular fashion. This last type only applies to block-level
- * elements, and indicates whether splitting can be used when doing runaround.
- * If you can split across page boundaries, but you expect each continuing
- * frame to be the same width then return frSplittable and not
- * frSplittableNonRectangular.
- *
- * @see #GetSplittableType()
- */
-typedef uint32_t nsSplittableType;
-
-#define NS_FRAME_NOT_SPLITTABLE             0   // Note: not a bit!
-#define NS_FRAME_SPLITTABLE                 0x1
-#define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
-
-#define NS_FRAME_IS_SPLITTABLE(type)\
-  (0 != ((type) & NS_FRAME_SPLITTABLE))
-
-#define NS_FRAME_IS_NOT_SPLITTABLE(type)\
-  (0 == ((type) & NS_FRAME_SPLITTABLE))
-
 //----------------------------------------------------------------------
 
 #define NS_SUBTREE_DIRTY(_frame)  \
   (((_frame)->GetStateBits() &      \
     (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0)
 
 // 1 million CSS pixels less than our max app unit measure.
 // For reflowing with an "infinite" available inline space per [css-sizing].
@@ -2071,21 +2046,16 @@ public:
    * When the content states of a content object change, this method is invoked
    * on the primary frame of that content object.
    *
    * @param aStates the changed states
    */
   virtual void ContentStatesChanged(mozilla::EventStates aStates);
 
   /**
-   * Return how your frame can be split.
-   */
-  virtual nsSplittableType GetSplittableType() const = 0;
-
-  /**
    * Continuation member functions
    */
   virtual nsIFrame* GetPrevContinuation() const = 0;
   virtual void SetPrevContinuation(nsIFrame*) = 0;
   virtual nsIFrame* GetNextContinuation() const = 0;
   virtual void SetNextContinuation(nsIFrame*) = 0;
   virtual nsIFrame* FirstContinuation() const {
     return const_cast<nsIFrame*>(this);
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -119,21 +119,16 @@ public:
   }
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
   void List(FILE* out = stderr, const char* aPrefix = "",
             uint32_t aFlags = 0) const override;
 #endif
 
-  nsSplittableType GetSplittableType() const override
-  {
-    return NS_FRAME_SPLITTABLE;
-  }
-
   virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
 
   nsresult GetIntrinsicImageSize(nsSize& aSize);
 
   static void ReleaseGlobals() {
     if (gIconLoad) {
       gIconLoad->Shutdown();
       gIconLoad = nullptr;
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -36,22 +36,16 @@ nsSplittableFrame::DestroyFrom(nsIFrame*
   if (mPrevContinuation || mNextContinuation) {
     RemoveFromFlow(this);
   }
 
   // Let the base class destroy the frame
   nsFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
-nsSplittableType
-nsSplittableFrame::GetSplittableType() const
-{
-  return NS_FRAME_SPLITTABLE;
-}
-
 nsIFrame* nsSplittableFrame::GetPrevContinuation() const
 {
   return mPrevContinuation;
 }
 
 void
 nsSplittableFrame::SetPrevContinuation(nsIFrame* aFrame)
 {
--- a/layout/generic/nsSplittableFrame.h
+++ b/layout/generic/nsSplittableFrame.h
@@ -20,18 +20,16 @@ class nsSplittableFrame : public nsFrame
 {
 public:
   NS_DECL_ABSTRACT_FRAME(nsSplittableFrame)
 
   void Init(nsIContent*       aContent,
             nsContainerFrame* aParent,
             nsIFrame*         aPrevInFlow) override;
 
-  nsSplittableType GetSplittableType() const override;
-
   void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
 
   /*
    * Frame continuations can be either fluid or not:
    * Fluid continuations ("in-flows") are the result of line breaking,
    * column breaking, or page breaking.
    * Other (non-fluid) continuations can be the result of BiDi frame splitting.
    * A "flow" is a chain of fluid continuations.
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -130,21 +130,16 @@ public:
     }
     if (aNextInFlow) {
       aNextInFlow->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
     }
   }
   nsTextFrame* LastInFlow() const final;
   nsTextFrame* LastContinuation() const final;
 
-  nsSplittableType GetSplittableType() const final
-  {
-    return NS_FRAME_SPLITTABLE;
-  }
-
   bool IsFrameOfType(uint32_t aFlags) const final
   {
     // Set the frame state bit for text frames to mark them as replaced.
     // XXX kipp: temporary
     return nsFrame::IsFrameOfType(
       aFlags & ~(nsIFrame::eReplaced | nsIFrame::eLineParticipant));
   }
 
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -793,22 +793,16 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsD
                          contentList, contentList, contentList);
     BuildDisplayListForNonBlockChildren(aBuilder, set);
   } else if (IsVisibleForPainting(aBuilder) || !aBuilder->IsForPainting()) {
     aLists.Content()->AppendToTop(
       MakeDisplayItem<nsDisplayOuterSVG>(aBuilder, this));
   }
 }
 
-nsSplittableType
-nsSVGOuterSVGFrame::GetSplittableType() const
-{
-  return NS_FRAME_NOT_SPLITTABLE;
-}
-
 //----------------------------------------------------------------------
 // nsISVGSVGFrame methods:
 
 void
 nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
 {
   MOZ_ASSERT(aFlags &&
              !(aFlags & ~(COORD_CONTEXT_CHANGED | TRANSFORM_CHANGED |
--- a/layout/svg/nsSVGOuterSVGFrame.h
+++ b/layout/svg/nsSVGOuterSVGFrame.h
@@ -75,18 +75,16 @@ public:
                     nsIFrame*         aPrevInFlow) override;
 
   bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsSVGDisplayContainerFrame::IsFrameOfType(
       aFlags & ~eSupportsContainLayoutAndPaint);
   }
 
-  virtual nsSplittableType GetSplittableType() const override;
-
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override
   {
     return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVG"), aResult);
   }
 #endif
 
   virtual nsresult  AttributeChanged(int32_t         aNameSpaceID,
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -197,22 +197,16 @@ nsTableColFrame::GetNextCol() const
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsTableColFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("TableCol"), aResult);
 }
 #endif
 
-nsSplittableType
-nsTableColFrame::GetSplittableType() const
-{
-  return NS_FRAME_NOT_SPLITTABLE;
-}
-
 void
 nsTableColFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
   if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -55,18 +55,16 @@ public:
 
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsDisplayListSet& aLists) override;
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
 #endif
 
-  virtual nsSplittableType GetSplittableType() const override;
-
   nsTableColGroupFrame* GetTableColGroupFrame() const
   {
     nsIFrame* parent = GetParent();
     MOZ_ASSERT(parent && parent->IsTableColGroupFrame());
     return static_cast<nsTableColGroupFrame*>(parent);
   }
 
   nsTableFrame* GetTableFrame() const