зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1151243 part 1 - Replace three bool params for nsAbsoluteContainingBlock::Reflow with a flag param (idempotent patch). r=dholbert
This commit is contained in:
Родитель
9e0a3e3bb5
Коммит
953043bd52
|
@ -113,9 +113,7 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aReflowStatus,
|
||||
const nsRect& aContainingBlock,
|
||||
bool aConstrainHeight,
|
||||
bool aCBWidthChanged,
|
||||
bool aCBHeightChanged,
|
||||
AbsPosReflowFlags aFlags,
|
||||
nsOverflowAreas* aOverflowAreas)
|
||||
{
|
||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
|
@ -134,15 +132,16 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
|
|||
nsOverflowContinuationTracker tracker(aDelegatingFrame, true);
|
||||
for (kidFrame = mAbsoluteFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) {
|
||||
bool kidNeedsReflow = reflowAll || NS_SUBTREE_DIRTY(kidFrame) ||
|
||||
FrameDependsOnContainer(kidFrame, aCBWidthChanged, aCBHeightChanged);
|
||||
FrameDependsOnContainer(kidFrame,
|
||||
!!(aFlags & AbsPosReflowFlags::eCBWidthChanged),
|
||||
!!(aFlags & AbsPosReflowFlags::eCBHeightChanged));
|
||||
if (kidNeedsReflow && !aPresContext->HasPendingInterrupt()) {
|
||||
// Reflow the frame
|
||||
nsReflowStatus kidStatus = NS_FRAME_COMPLETE;
|
||||
const nsRect& cb = isGrid ? nsGridContainerFrame::GridItemCB(kidFrame)
|
||||
: aContainingBlock;
|
||||
ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowState, cb,
|
||||
aConstrainHeight, kidFrame, kidStatus,
|
||||
aOverflowAreas);
|
||||
aFlags, kidFrame, kidStatus, aOverflowAreas);
|
||||
nsIFrame* nextFrame = kidFrame->GetNextInFlow();
|
||||
if (!NS_FRAME_IS_FULLY_COMPLETE(kidStatus) &&
|
||||
aDelegatingFrame->IsFrameOfType(nsIFrame::eCanContainOverflowContainers)) {
|
||||
|
@ -354,7 +353,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
|||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsRect& aContainingBlock,
|
||||
bool aConstrainBSize,
|
||||
AbsPosReflowFlags aFlags,
|
||||
nsIFrame* aKidFrame,
|
||||
nsReflowStatus& aStatus,
|
||||
nsOverflowAreas* aOverflowAreas)
|
||||
|
@ -404,7 +403,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
|||
const LogicalMargin margin =
|
||||
kidReflowState.ComputedLogicalMargin().ConvertTo(outerWM, wm);
|
||||
bool constrainBSize = (aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE)
|
||||
&& aConstrainBSize
|
||||
&& (aFlags & AbsPosReflowFlags::eConstrainHeight)
|
||||
// Don't split if told not to (e.g. for fixed frames)
|
||||
&& (aDelegatingFrame->GetType() != nsGkAtoms::inlineFrame)
|
||||
//XXX we don't handle splitting frames for inline absolute containing blocks yet
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "nsFrameList.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
class nsContainerFrame;
|
||||
struct nsHTMLReflowState;
|
||||
|
@ -68,6 +69,13 @@ public:
|
|||
ChildListID aListID,
|
||||
nsIFrame* aOldFrame);
|
||||
|
||||
enum class AbsPosReflowFlags {
|
||||
eConstrainHeight = 0x1,
|
||||
eCBWidthChanged = 0x2,
|
||||
eCBHeightChanged = 0x4,
|
||||
eCBWidthAndHeightChanged = eCBWidthChanged | eCBHeightChanged,
|
||||
};
|
||||
|
||||
/**
|
||||
* Called by the delegating frame after it has done its reflow first. This
|
||||
* function will reflow any absolutely positioned child frames that need to
|
||||
|
@ -81,15 +89,15 @@ public:
|
|||
* @param aReflowStatus is assumed to be already-initialized, e.g. with the
|
||||
* status of the delegating frame's main reflow. This function merges in the
|
||||
* statuses of the absolutely positioned children's reflows.
|
||||
*
|
||||
* @param aFlags zero or more AbsPosReflowFlags
|
||||
*/
|
||||
void Reflow(nsContainerFrame* aDelegatingFrame,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aReflowStatus,
|
||||
const nsRect& aContainingBlock,
|
||||
bool aConstrainHeight,
|
||||
bool aCBWidthChanged,
|
||||
bool aCBHeightChanged,
|
||||
AbsPosReflowFlags aFlags,
|
||||
nsOverflowAreas* aOverflowAreas);
|
||||
|
||||
void DestroyFrames(nsIFrame* aDelegatingFrame,
|
||||
|
@ -121,7 +129,7 @@ protected:
|
|||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const nsRect& aContainingBlockRect,
|
||||
bool aConstrainHeight,
|
||||
AbsPosReflowFlags aFlags,
|
||||
nsIFrame* aKidFrame,
|
||||
nsReflowStatus& aStatus,
|
||||
nsOverflowAreas* aOverflowAreas);
|
||||
|
@ -142,4 +150,7 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsAbsoluteContainingBlock::AbsPosReflowFlags)
|
||||
}
|
||||
#endif /* nsnsAbsoluteContainingBlock_h___ */
|
||||
|
|
|
@ -61,6 +61,7 @@ static const char16_t kDiscCharacter = 0x2022;
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::css;
|
||||
using namespace mozilla::layout;
|
||||
typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
|
||||
|
||||
static void MarkAllDescendantLinesDirty(nsBlockFrame* aBlock)
|
||||
{
|
||||
|
@ -1366,10 +1367,16 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
nsRect containingBlock(nsPoint(0, 0),
|
||||
containingBlockSize.GetPhysicalSize(parentWM));
|
||||
AbsPosReflowFlags flags = AbsPosReflowFlags::eConstrainHeight;
|
||||
if (cbWidthChanged) {
|
||||
flags |= AbsPosReflowFlags::eCBWidthChanged;
|
||||
}
|
||||
if (cbHeightChanged) {
|
||||
flags |= AbsPosReflowFlags::eCBHeightChanged;
|
||||
}
|
||||
absoluteContainer->Reflow(this, aPresContext, *reflowState,
|
||||
state.mReflowStatus,
|
||||
containingBlock, true,
|
||||
cbWidthChanged, cbHeightChanged,
|
||||
containingBlock, flags,
|
||||
&aMetrics.mOverflowAreas);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ using namespace mozilla::dom;
|
|||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::layout;
|
||||
typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -4666,9 +4667,13 @@ nsFrame::ReflowAbsoluteFrames(nsPresContext* aPresContext,
|
|||
NS_ASSERTION(container, "Abs-pos children only supported on container frames for now");
|
||||
|
||||
nsRect containingBlock(0, 0, containingBlockWidth, containingBlockHeight);
|
||||
AbsPosReflowFlags flags =
|
||||
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
|
||||
if (aConstrainBSize) {
|
||||
flags |= AbsPosReflowFlags::eConstrainHeight;
|
||||
}
|
||||
absoluteContainer->Reflow(container, aPresContext, aReflowState, aStatus,
|
||||
containingBlock,
|
||||
aConstrainBSize, true, true, // XXX could be optimized
|
||||
containingBlock, flags,
|
||||
&aDesiredSize.mOverflowAreas);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsStyleContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
|
||||
typedef nsGridContainerFrame::TrackSize TrackSize;
|
||||
const uint32_t nsGridContainerFrame::kTranslatedMaxLine =
|
||||
uint32_t(nsStyleGridLine::kMaxLine - nsStyleGridLine::kMinLine);
|
||||
|
@ -3247,9 +3248,11 @@ nsGridContainerFrame::ReflowChildren(GridReflowState& aState,
|
|||
// away the virtual GetType() call in the callee in most cases.
|
||||
// @see nsAbsoluteContainingBlock::Reflow
|
||||
nsRect dummyRect(0, 0, VERY_LIKELY_A_GRID_CONTAINER, 0);
|
||||
AbsPosReflowFlags flags =
|
||||
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
|
||||
flags |= AbsPosReflowFlags::eConstrainHeight;
|
||||
GetAbsoluteContainingBlock()->Reflow(this, pc, *aState.mReflowState,
|
||||
aStatus, dummyRect, true,
|
||||
true, true, // XXX could be optimized
|
||||
aStatus, dummyRect, flags,
|
||||
&aDesiredSize.mOverflowAreas);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsIMozBrowserFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
|
||||
|
||||
ViewportFrame*
|
||||
NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
|
@ -350,10 +351,10 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
|
||||
overflowAreas = nullptr;
|
||||
}
|
||||
AbsPosReflowFlags flags =
|
||||
AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized
|
||||
GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowState, aStatus,
|
||||
rect,
|
||||
false, true, true, // XXX could be optimized
|
||||
overflowAreas);
|
||||
rect, flags, overflowAreas);
|
||||
}
|
||||
|
||||
if (mFrames.NotEmpty()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче