diff options
author | Job Bautista <jobbautista9@protonmail.com> | 2022-06-17 16:05:57 +0800 |
---|---|---|
committer | Job Bautista <jobbautista9@protonmail.com> | 2022-06-17 16:05:57 +0800 |
commit | b3cacb2c3ac849f70a2746b252fe0874ffe41e33 (patch) | |
tree | c3c1d0fa9665c5050b958d1c3dc3b4c60abd970e /layout/xul | |
parent | 5652238ba898931d9705c9df37259284bb76619e (diff) | |
download | uxp-b3cacb2c3ac849f70a2746b252fe0874ffe41e33.tar.gz |
Issue #1916 - Part 1: Convert flags passed to ReflowChild, FinishReflowChild, etc into an enum class.
Backported from Mozilla bug 1571250.
Diffstat (limited to 'layout/xul')
-rw-r--r-- | layout/xul/nsBox.cpp | 21 | ||||
-rw-r--r-- | layout/xul/nsBoxFrame.cpp | 4 | ||||
-rw-r--r-- | layout/xul/nsBoxLayoutState.cpp | 2 | ||||
-rw-r--r-- | layout/xul/nsBoxLayoutState.h | 9 | ||||
-rw-r--r-- | layout/xul/nsDeckFrame.cpp | 5 | ||||
-rw-r--r-- | layout/xul/nsMenuPopupFrame.cpp | 9 | ||||
-rw-r--r-- | layout/xul/nsMenuPopupFrame.h | 2 |
7 files changed, 24 insertions, 28 deletions
diff --git a/layout/xul/nsBox.cpp b/layout/xul/nsBox.cpp index 787758b157..c43c5cbb7d 100644 --- a/layout/xul/nsBox.cpp +++ b/layout/xul/nsBox.cpp @@ -235,16 +235,14 @@ nsBox::SetXULBounds(nsBoxLayoutState& aState, const nsRect& aRect, bool aRemoveO nsRect rect(mRect); - uint32_t flags = GetXULLayoutFlags(); + ReflowChildFlags flags = GetXULLayoutFlags() | aState.LayoutFlags(); - uint32_t stateFlags = aState.LayoutFlags(); - - flags |= stateFlags; - - if ((flags & NS_FRAME_NO_MOVE_FRAME) == NS_FRAME_NO_MOVE_FRAME) + if ((flags & ReflowChildFlags::NoMoveFrame) == + ReflowChildFlags::NoMoveFrame) { SetSize(aRect.Size()); - else + } else { SetRect(aRect); + } // Nuke the overflow area. The caller is responsible for restoring // it if necessary. @@ -253,8 +251,7 @@ nsBox::SetXULBounds(nsBoxLayoutState& aState, const nsRect& aRect, bool aRemoveO ClearOverflowRects(); } - if (!(flags & NS_FRAME_NO_MOVE_VIEW)) - { + if (!(flags & ReflowChildFlags::NoMoveView)) { nsContainerFrame::PositionFrameView(this); if ((rect.x != aRect.x) || (rect.y != aRect.y)) nsContainerFrame::PositionChildViews(this); @@ -533,11 +530,7 @@ nsBox::SyncLayout(nsBoxLayoutState& aState) nsPresContext* presContext = aState.PresContext(); - uint32_t flags = GetXULLayoutFlags(); - - uint32_t stateFlags = aState.LayoutFlags(); - - flags |= stateFlags; + ReflowChildFlags flags = GetXULLayoutFlags() | aState.LayoutFlags(); nsRect visualOverflow; diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index d63861794a..4ede720143 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -905,8 +905,8 @@ nsBoxFrame::GetXULFlex() NS_IMETHODIMP nsBoxFrame::DoXULLayout(nsBoxLayoutState& aState) { - uint32_t oldFlags = aState.LayoutFlags(); - aState.SetLayoutFlags(0); + ReflowChildFlags oldFlags = aState.LayoutFlags(); + aState.SetLayoutFlags(ReflowChildFlags::Default); nsresult rv = NS_OK; if (mLayoutManager) { diff --git a/layout/xul/nsBoxLayoutState.cpp b/layout/xul/nsBoxLayoutState.cpp index e1219534e0..2e459ade8e 100644 --- a/layout/xul/nsBoxLayoutState.cpp +++ b/layout/xul/nsBoxLayoutState.cpp @@ -19,7 +19,7 @@ nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext, : mPresContext(aPresContext) , mRenderingContext(aRenderingContext) , mOuterReflowInput(aOuterReflowInput) - , mLayoutFlags(0) + , mLayoutFlags(nsIFrame::ReflowChildFlags::Default) , mReflowDepth(aReflowDepth) , mPaintingDisabled(false) { diff --git a/layout/xul/nsBoxLayoutState.h b/layout/xul/nsBoxLayoutState.h index b857ad9c09..91c99def2d 100644 --- a/layout/xul/nsBoxLayoutState.h +++ b/layout/xul/nsBoxLayoutState.h @@ -15,6 +15,7 @@ #include "nsCOMPtr.h" #include "nsPresContext.h" +#include "nsIFrame.h" #include "nsIPresShell.h" class nsRenderingContext; @@ -38,8 +39,10 @@ public: nsPresContext* PresContext() const { return mPresContext; } nsIPresShell* PresShell() const { return mPresContext->PresShell(); } - uint32_t LayoutFlags() const { return mLayoutFlags; } - void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; } + nsIFrame::ReflowChildFlags LayoutFlags() const { return mLayoutFlags; } + void SetLayoutFlags(nsIFrame::ReflowChildFlags aFlags) { + mLayoutFlags = aFlags; + } // if true no one under us will paint during reflow. void SetPaintingDisabled(bool aDisable) { mPaintingDisabled = aDisable; } @@ -68,7 +71,7 @@ private: RefPtr<nsPresContext> mPresContext; nsRenderingContext *mRenderingContext; const ReflowInput *mOuterReflowInput; - uint32_t mLayoutFlags; + nsIFrame::ReflowChildFlags mLayoutFlags; uint16_t mReflowDepth; bool mPaintingDisabled; }; diff --git a/layout/xul/nsDeckFrame.cpp b/layout/xul/nsDeckFrame.cpp index 91359c177a..44470185dc 100644 --- a/layout/xul/nsDeckFrame.cpp +++ b/layout/xul/nsDeckFrame.cpp @@ -202,8 +202,9 @@ nsDeckFrame::DoXULLayout(nsBoxLayoutState& aState) { // Make sure we tweak the state so it does not resize our children. // We will do that. - uint32_t oldFlags = aState.LayoutFlags(); - aState.SetLayoutFlags(NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY); + ReflowChildFlags oldFlags = aState.LayoutFlags(); + aState.SetLayoutFlags(ReflowChildFlags::NoSizeView | + ReflowChildFlags::NoVisibility); // do a normal layout nsresult rv = nsBoxFrame::DoXULLayout(aState); diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 378d719d44..73e7d2fa55 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -531,7 +531,7 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu, } viewManager->SetViewVisibility(view, nsViewVisibility_kShow); - nsContainerFrame::SyncFrameViewProperties(pc, this, nullptr, view, 0); + nsContainerFrame::SyncFrameViewProperties(pc, this, nullptr, view); } // finally, if the popup just opened, send a popupshown event @@ -993,10 +993,9 @@ nsMenuPopupFrame::HidePopup(bool aDeselectMenu, nsPopupState aNewState) } } -uint32_t -nsMenuPopupFrame::GetXULLayoutFlags() -{ - return NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_VISIBILITY; +nsIFrame::ReflowChildFlags nsMenuPopupFrame::GetXULLayoutFlags() { + return ReflowChildFlags::NoSizeView | ReflowChildFlags::NoMoveView | + ReflowChildFlags::NoVisibility; } /////////////////////////////////////////////////////////////////////////////// diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index b32073960c..c5d70eab02 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -447,7 +447,7 @@ protected: nsPopupLevel PopupLevel(bool aIsNoAutoHide) const; // redefine to tell the box system not to move the views. - virtual uint32_t GetXULLayoutFlags() override; + ReflowChildFlags GetXULLayoutFlags() override; void InitPositionFromAnchorAlign(const nsAString& aAnchor, const nsAString& aAlign); |