зеркало из https://github.com/mozilla/pjs.git
Rename flags and methods from space manager to float manager. (Bug 191448) r+sr=roc
This commit is contained in:
Родитель
ace85fd55d
Коммит
53ac2c7d8b
|
@ -2284,8 +2284,8 @@ nsCSSFrameConstructor::CreateInputFrame(nsFrameConstructorState& aState,
|
|||
*aFrame = NS_NewFileControlFrame(mPresShell, aStyleContext);
|
||||
|
||||
if (*aFrame) {
|
||||
// The (block-like) file control frame should have a space manager
|
||||
(*aFrame)->AddStateBits(NS_BLOCK_SPACE_MGR);
|
||||
// The (block-like) file control frame should have a float manager
|
||||
(*aFrame)->AddStateBits(NS_BLOCK_FLOAT_MGR);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
|
@ -4306,7 +4306,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsFrameConstructorState& aState,
|
|||
#endif
|
||||
{
|
||||
contentFrame = NS_NewBlockFrame(mPresShell, styleContext,
|
||||
NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
NS_BLOCK_FLOAT_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
if (!contentFrame)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsFrameItems frameItems;
|
||||
|
@ -4825,7 +4825,7 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState,
|
|||
aStyleContext);
|
||||
|
||||
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, styleContext,
|
||||
NS_BLOCK_SPACE_MGR);
|
||||
NS_BLOCK_FLOAT_MGR);
|
||||
|
||||
if (NS_UNLIKELY(!blockFrame)) {
|
||||
buttonFrame->Destroy();
|
||||
|
@ -4922,7 +4922,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
|
|||
// a dropdown list. The display area and button are created through anonymous content.
|
||||
// The drop-down list's frame is created explicitly. The combobox frame shares its content
|
||||
// with the drop-down list.
|
||||
PRUint32 flags = NS_BLOCK_SPACE_MGR;
|
||||
PRUint32 flags = NS_BLOCK_FLOAT_MGR;
|
||||
nsIFrame* comboboxFrame = NS_NewComboboxControlFrame(mPresShell, aStyleContext, flags);
|
||||
|
||||
// Save the history state so we don't restore during construction
|
||||
|
@ -5024,7 +5024,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
|
|||
}
|
||||
|
||||
nsIFrame* scrolledFrame = NS_NewSelectsAreaFrame(
|
||||
mPresShell, aStyleContext, NS_BLOCK_SPACE_MGR);
|
||||
mPresShell, aStyleContext, NS_BLOCK_FLOAT_MGR);
|
||||
|
||||
// ******* this code stolen from Initialze ScrollFrame ********
|
||||
// please adjust this code to use BuildScrollFrame.
|
||||
|
@ -5167,7 +5167,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
|
|||
aStyleContext);
|
||||
|
||||
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, styleContext,
|
||||
NS_BLOCK_SPACE_MGR |
|
||||
NS_BLOCK_FLOAT_MGR |
|
||||
NS_BLOCK_MARGIN_ROOT);
|
||||
InitAndRestoreFrame(aState, aContent, newFrame, nsnull, blockFrame);
|
||||
|
||||
|
@ -5890,11 +5890,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState,
|
|||
// things like columns etc
|
||||
if (aTag == nsGkAtoms::label) {
|
||||
newFrame = NS_NewXULLabelFrame(mPresShell, aStyleContext,
|
||||
NS_BLOCK_SPACE_MGR |
|
||||
NS_BLOCK_FLOAT_MGR |
|
||||
NS_BLOCK_MARGIN_ROOT);
|
||||
} else {
|
||||
newFrame = NS_NewBlockFrame(mPresShell, aStyleContext,
|
||||
NS_BLOCK_SPACE_MGR |
|
||||
NS_BLOCK_FLOAT_MGR |
|
||||
NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
}
|
||||
|
@ -6468,7 +6468,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
|
|||
// pass a temporary stylecontext, the correct one will be set later
|
||||
nsIFrame* scrolledFrame =
|
||||
NS_NewBlockFrame(mPresShell, aStyleContext,
|
||||
NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
|
||||
nsFrameItems blockItem;
|
||||
rv = ConstructBlock(aState,
|
||||
|
@ -6541,9 +6541,9 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
|
|||
}
|
||||
// Is it block-level or inline-level?
|
||||
if (aDisplay->IsBlockInside()) {
|
||||
// Create a wrapper frame. Only need space manager if it's inline-block
|
||||
// Create a wrapper frame. Only need float manager if it's inline-block
|
||||
PRUint32 flags = (aDisplay->mDisplay == NS_STYLE_DISPLAY_INLINE_BLOCK ?
|
||||
NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT : 0);
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT : 0);
|
||||
newFrame = NS_NewRelativeItemWrapperFrame(mPresShell, aStyleContext,
|
||||
flags);
|
||||
// XXXbz should we be passing in a non-null aContentParentFrame?
|
||||
|
@ -6571,7 +6571,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
|
|||
}
|
||||
PRUint32 flags = 0;
|
||||
if (NS_STYLE_DISPLAY_INLINE_BLOCK == aDisplay->mDisplay) {
|
||||
flags = NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT;
|
||||
flags = NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT;
|
||||
}
|
||||
// Create the block frame
|
||||
newFrame = NS_NewBlockFrame(mPresShell, aStyleContext, flags);
|
||||
|
@ -6829,7 +6829,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
|||
// MathML frame so that Get(Absolute/Float)ContainingBlockFor know that this
|
||||
// is not a suitable block.
|
||||
nsIFrame* blockFrame = NS_NewMathMLmathBlockFrame(mPresShell, blockContext,
|
||||
NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
if (NS_UNLIKELY(!blockFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -7263,7 +7263,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
|
|||
nsCSSAnonBoxes::mozSVGForeignContent, aStyleContext);
|
||||
|
||||
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, innerPseudoStyle,
|
||||
NS_BLOCK_SPACE_MGR |
|
||||
NS_BLOCK_FLOAT_MGR |
|
||||
NS_BLOCK_MARGIN_ROOT);
|
||||
if (NS_UNLIKELY(!blockFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -11415,7 +11415,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
|||
nsCSSAnonBoxes::mozXULAnonymousBlock,
|
||||
frameStyleContext);
|
||||
nsIFrame *blockFrame = NS_NewBlockFrame(mPresShell, blockSC);
|
||||
// We might, in theory, want to set NS_BLOCK_SPACE_MGR and
|
||||
// We might, in theory, want to set NS_BLOCK_FLOAT_MGR and
|
||||
// NS_BLOCK_MARGIN_ROOT, but I think it's a bad idea given that
|
||||
// a real block placed here wouldn't get those set on it.
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ nsLayoutStatics::Shutdown()
|
|||
#endif
|
||||
|
||||
nsCSSFrameConstructor::ReleaseGlobals();
|
||||
nsSpaceManager::Shutdown();
|
||||
nsFloatManager::Shutdown();
|
||||
nsImageFrame::ReleaseGlobals();
|
||||
|
||||
nsCSSScanner::ReleaseGlobals();
|
||||
|
|
|
@ -87,7 +87,7 @@ NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
nsIsIndexFrame::nsIsIndexFrame(nsStyleContext* aContext) :
|
||||
nsBlockFrame(aContext)
|
||||
{
|
||||
SetFlags(NS_BLOCK_SPACE_MGR);
|
||||
SetFlags(NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
|
||||
nsIsIndexFrame::~nsIsIndexFrame()
|
||||
|
|
|
@ -59,7 +59,7 @@ NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
{
|
||||
nsIFrame* f = new (aPresShell) nsLegendFrame(aContext);
|
||||
if (f) {
|
||||
f->AddStateBits(NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
f->AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRUint32
|
|||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame(aContext);
|
||||
|
||||
if (it) {
|
||||
// We need NS_BLOCK_SPACE_MGR to ensure that the options inside the select
|
||||
// We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
|
||||
// aren't expanded by right floats outside the select.
|
||||
it->SetFlags(aFlags | NS_BLOCK_SPACE_MGR);
|
||||
it->SetFlags(aFlags | NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
|
||||
return it;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* code for management of floats that implements space manager interfaces */
|
||||
/* code for management of floats that implements float manager interfaces */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBlockBandData.h"
|
||||
|
@ -108,7 +108,7 @@ nsBlockBandData::GetAvailableSpace(nscoord aY, PRBool aRelaxHeightConstraint,
|
|||
nsresult
|
||||
nsBlockBandData::GetBandData(nscoord aY, PRBool aRelaxHeightConstraint)
|
||||
{
|
||||
NS_ASSERTION(mSpaceManager, "bad state, no space manager");
|
||||
NS_ASSERTION(mSpaceManager, "bad state, no float manager");
|
||||
PRInt32 iterations =0;
|
||||
nsSize space = mSpace;
|
||||
if (aRelaxHeightConstraint) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* code for management of floats that implements space manager interfaces */
|
||||
/* code for management of floats that implements float manager interfaces */
|
||||
|
||||
#ifndef nsBlockBandData_h___
|
||||
#define nsBlockBandData_h___
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
nsresult Init(nsSpaceManager* aSpaceManager, const nsSize& aSpace);
|
||||
|
||||
// Get some available space. Note that aY is relative to the current
|
||||
// space manager translation.
|
||||
// float manager translation.
|
||||
nsresult GetAvailableSpace(nscoord aY, PRBool aRelaxHeightConstraint,
|
||||
nsRect& aResult);
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
// Get the number of floats that are impacting the current
|
||||
// band. Note that this value is relative to the current translation
|
||||
// in the space manager which means that some floats may be hidden
|
||||
// in the float manager which means that some floats may be hidden
|
||||
// by the translation and therefore won't be in the count.
|
||||
PRInt32 GetFloatCount() const {
|
||||
return mLeftFloats + mRightFloats;
|
||||
|
@ -116,7 +116,7 @@ protected:
|
|||
|
||||
// Number of left/right floats in the current band. Note that this
|
||||
// number may be less than the total number of floats present in
|
||||
// the band, if our translation in the space manager "hides" some
|
||||
// the band, if our translation in the float manager "hides" some
|
||||
// floats.
|
||||
PRInt32 mLeftFloats, mRightFloats;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#undef NOISY_VERTICAL_MARGINS
|
||||
#undef NOISY_REFLOW_REASON // gives a little info about why each reflow was requested
|
||||
#undef REFLOW_STATUS_COVERAGE // I think this is most useful for printing, to see which frames return "incomplete"
|
||||
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floats and positioned elements
|
||||
#undef NOISY_FLOATMANAGER // enables debug output for float manager use, useful for analysing reflow of floats and positioned elements
|
||||
#undef NOISY_BLOCK_INVALIDATE // enables debug output for all calls to invalidate
|
||||
#undef REALLY_NOISY_REFLOW // some extra debug info
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ PRBool nsBlockFrame::gNoisyDamageRepair;
|
|||
PRBool nsBlockFrame::gNoisyIntrinsic;
|
||||
PRBool nsBlockFrame::gNoisyReflow;
|
||||
PRBool nsBlockFrame::gReallyNoisyReflow;
|
||||
PRBool nsBlockFrame::gNoisySpaceManager;
|
||||
PRBool nsBlockFrame::gNoisyFloatManager;
|
||||
PRBool nsBlockFrame::gVerifyLines;
|
||||
PRBool nsBlockFrame::gDisableResizeOpt;
|
||||
|
||||
|
@ -126,7 +126,7 @@ static const BlockDebugFlags gFlags[] = {
|
|||
{ "reflow", &nsBlockFrame::gNoisyReflow },
|
||||
{ "really-noisy-reflow", &nsBlockFrame::gReallyNoisyReflow },
|
||||
{ "intrinsic", &nsBlockFrame::gNoisyIntrinsic },
|
||||
{ "space-manager", &nsBlockFrame::gNoisySpaceManager },
|
||||
{ "float-manager", &nsBlockFrame::gNoisyFloatManager },
|
||||
{ "verify-lines", &nsBlockFrame::gVerifyLines },
|
||||
{ "damage-repair", &nsBlockFrame::gNoisyDamageRepair },
|
||||
{ "lame-paint-metrics", &nsBlockFrame::gLamePaintMetrics },
|
||||
|
@ -891,16 +891,16 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
// abs-pos-containing-block-size-change optimization!
|
||||
nsSize oldSize = GetSize();
|
||||
|
||||
// Should we create a space manager?
|
||||
nsAutoSpaceManager autoSpaceManager(const_cast<nsHTMLReflowState &>(aReflowState));
|
||||
// Should we create a float manager?
|
||||
nsAutoFloatManager autoFloatManager(const_cast<nsHTMLReflowState &>(aReflowState));
|
||||
|
||||
// XXXldb If we start storing the space manager in the frame rather
|
||||
// XXXldb If we start storing the float manager in the frame rather
|
||||
// than keeping it around only during reflow then we should create it
|
||||
// only when there are actually floats to manage. Otherwise things
|
||||
// like tables will gain significant bloat.
|
||||
PRBool needSpaceManager = nsBlockFrame::BlockNeedsSpaceManager(this);
|
||||
if (needSpaceManager)
|
||||
autoSpaceManager.CreateSpaceManager(aPresContext);
|
||||
PRBool needFloatManager = nsBlockFrame::BlockNeedsFloatManager(this);
|
||||
if (needFloatManager)
|
||||
autoFloatManager.CreateFloatManager(aPresContext);
|
||||
|
||||
// OK, some lines may be reflowed. Blow away any saved line cursor because
|
||||
// we may invalidate the nondecreasing combinedArea.y/yMost invariant,
|
||||
|
@ -923,7 +923,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
PRBool marginRoot = BlockIsMarginRoot(this);
|
||||
nsBlockReflowState state(aReflowState, aPresContext, this, aMetrics,
|
||||
marginRoot, marginRoot, needSpaceManager);
|
||||
marginRoot, marginRoot, needFloatManager);
|
||||
|
||||
#ifdef IBMBIDI
|
||||
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
|
||||
|
@ -963,23 +963,23 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
state.mReflowStatus);
|
||||
}
|
||||
|
||||
// If the block is complete, put continuted floats in the closest ancestor
|
||||
// block that uses the same space manager and leave the block complete; this
|
||||
// If the block is complete, put continued floats in the closest ancestor
|
||||
// block that uses the same float manager and leave the block complete; this
|
||||
// allows subsequent lines on the page to be impacted by floats. If the
|
||||
// block is incomplete or there is no ancestor using the same space manager,
|
||||
// block is incomplete or there is no ancestor using the same float manager,
|
||||
// put continued floats at the beginning of the first overflow line.
|
||||
if (state.mOverflowPlaceholders.NotEmpty()) {
|
||||
NS_ASSERTION(aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE,
|
||||
"Somehow we failed to fit all content, even though we have unlimited space!");
|
||||
if (NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) {
|
||||
// find the nearest block ancestor that uses the same space manager
|
||||
// find the nearest block ancestor that uses the same float manager
|
||||
for (const nsHTMLReflowState* ancestorRS = aReflowState.parentReflowState;
|
||||
ancestorRS;
|
||||
ancestorRS = ancestorRS->parentReflowState) {
|
||||
nsIFrame* ancestor = ancestorRS->frame;
|
||||
if (nsLayoutUtils::GetAsBlock(ancestor) &&
|
||||
aReflowState.mSpaceManager == ancestorRS->mSpaceManager) {
|
||||
// Put the continued floats in ancestor since it uses the same space manager
|
||||
aReflowState.mFloatManager == ancestorRS->mFloatManager) {
|
||||
// Put the continued floats in ancestor since it uses the same float manager
|
||||
nsFrameList* ancestorPlace =
|
||||
((nsBlockFrame*)ancestor)->GetOverflowPlaceholders();
|
||||
// The ancestor should have this list, since it's being reflowed. But maybe
|
||||
|
@ -1180,11 +1180,11 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
FinishAndStoreOverflow(&aMetrics);
|
||||
|
||||
// Clear the space manager pointer in the block reflow state so we
|
||||
// Clear the float manager pointer in the block reflow state so we
|
||||
// don't waste time translating the coordinate system back on a dead
|
||||
// space manager.
|
||||
if (needSpaceManager)
|
||||
state.mSpaceManager = nsnull;
|
||||
// float manager.
|
||||
if (needFloatManager)
|
||||
state.mFloatManager = nsnull;
|
||||
|
||||
aStatus = state.mReflowStatus;
|
||||
|
||||
|
@ -1311,8 +1311,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
aState.mReflowState.availableHeight);
|
||||
}
|
||||
}
|
||||
if (aState.GetFlag(BRS_SPACE_MGR)) {
|
||||
// Include the space manager's state to properly account for the
|
||||
if (aState.GetFlag(BRS_FLOAT_MGR)) {
|
||||
// Include the float manager's state to properly account for the
|
||||
// bottom margin of any floated elements; e.g., inside a table cell.
|
||||
nscoord floatHeight =
|
||||
aState.ClearFloats(bottomEdgeOfChildren, NS_STYLE_CLEAR_LEFT_AND_RIGHT);
|
||||
|
@ -1634,36 +1634,36 @@ nsBlockFrame::PropagateFloatDamage(nsBlockReflowState& aState,
|
|||
nsLineBox* aLine,
|
||||
nscoord aDeltaY)
|
||||
{
|
||||
nsSpaceManager *spaceManager = aState.mReflowState.mSpaceManager;
|
||||
nsFloatManager *floatManager = aState.mReflowState.mFloatManager;
|
||||
NS_ASSERTION((aState.mReflowState.parentReflowState &&
|
||||
aState.mReflowState.parentReflowState->mSpaceManager == spaceManager) ||
|
||||
aState.mReflowState.parentReflowState->mFloatManager == floatManager) ||
|
||||
aState.mReflowState.mBlockDelta == 0, "Bad block delta passed in");
|
||||
|
||||
// Check to see if there are any floats; if there aren't, there can't
|
||||
// be any float damage
|
||||
if (!spaceManager->HasAnyFloats())
|
||||
if (!floatManager->HasAnyFloats())
|
||||
return;
|
||||
|
||||
// Check the damage region recorded in the float damage.
|
||||
if (spaceManager->HasFloatDamage()) {
|
||||
if (floatManager->HasFloatDamage()) {
|
||||
// Need to check mBounds *and* mCombinedArea to find intersections
|
||||
// with aLine's floats
|
||||
nscoord lineYA = aLine->mBounds.y + aDeltaY;
|
||||
nscoord lineYB = lineYA + aLine->mBounds.height;
|
||||
nscoord lineYCombinedA = aLine->GetCombinedArea().y + aDeltaY;
|
||||
nscoord lineYCombinedB = lineYCombinedA + aLine->GetCombinedArea().height;
|
||||
if (spaceManager->IntersectsDamage(lineYA, lineYB) ||
|
||||
spaceManager->IntersectsDamage(lineYCombinedA, lineYCombinedB)) {
|
||||
if (floatManager->IntersectsDamage(lineYA, lineYB) ||
|
||||
floatManager->IntersectsDamage(lineYCombinedA, lineYCombinedB)) {
|
||||
aLine->MarkDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the line is moving relative to the space manager
|
||||
// Check if the line is moving relative to the float manager
|
||||
if (aDeltaY + aState.mReflowState.mBlockDelta != 0) {
|
||||
if (aLine->IsBlock()) {
|
||||
// Unconditionally reflow sliding blocks; we only really need to reflow
|
||||
// if there's a float impacting this block, but the current space manager
|
||||
// if there's a float impacting this block, but the current float manager
|
||||
// makes it difficult to check that. Therefore, we let the child block
|
||||
// decide what it needs to reflow.
|
||||
aLine->MarkDirty();
|
||||
|
@ -1992,7 +1992,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
|||
// If we're going to reflow everything again, and this line is a block,
|
||||
// then there is no need to recover float state. The line may contain
|
||||
// other lines with floats, but in that case RecoverStateFrom would only
|
||||
// add floats to the space manager. We don't need to do that because
|
||||
// add floats to the float manager. We don't need to do that because
|
||||
// everything's going to get reflowed again "for real". Calling
|
||||
// RecoverStateFrom in this situation could be lethal because the
|
||||
// block's descendant lines may have float caches containing dangling
|
||||
|
@ -2989,10 +2989,10 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
nsSize(availSpace.width, availSpace.height));
|
||||
blockHtmlRS.mFlags.mHasClearance = aLine->HasClearance();
|
||||
|
||||
nsSpaceManager::SavedState spaceManagerState;
|
||||
nsFloatManager::SavedState floatManagerState;
|
||||
if (mayNeedRetry) {
|
||||
blockHtmlRS.mDiscoveredClearance = &clearanceFrame;
|
||||
aState.mSpaceManager->PushState(&spaceManagerState);
|
||||
aState.mFloatManager->PushState(&floatManagerState);
|
||||
} else if (!applyTopMargin) {
|
||||
blockHtmlRS.mDiscoveredClearance = aState.mReflowState.mDiscoveredClearance;
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mayNeedRetry && clearanceFrame) {
|
||||
aState.mSpaceManager->PopState(&spaceManagerState);
|
||||
aState.mFloatManager->PopState(&floatManagerState);
|
||||
aState.mY = startingY;
|
||||
aState.mPrevBottomMargin = incomingMargin;
|
||||
continue;
|
||||
|
@ -3242,8 +3242,8 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState,
|
|||
PRInt32 forceBreakOffset = -1;
|
||||
gfxBreakPriority forceBreakPriority = eNoBreak;
|
||||
do {
|
||||
nsSpaceManager::SavedState spaceManagerState;
|
||||
aState.mReflowState.mSpaceManager->PushState(&spaceManagerState);
|
||||
nsFloatManager::SavedState floatManagerState;
|
||||
aState.mReflowState.mFloatManager->PushState(&floatManagerState);
|
||||
|
||||
// Once upon a time we allocated the first 30 nsLineLayout objects
|
||||
// on the stack, and then we switched to the heap. At that time
|
||||
|
@ -3253,7 +3253,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState,
|
|||
// smaller, the complexity of 2 different ways of allocating
|
||||
// no longer makes sense. Now we always allocate on the stack.
|
||||
nsLineLayout lineLayout(aState.mPresContext,
|
||||
aState.mReflowState.mSpaceManager,
|
||||
aState.mReflowState.mFloatManager,
|
||||
&aState.mReflowState, &aLine);
|
||||
lineLayout.Init(&aState, aState.mMinLineHeight, aState.mLineNumber);
|
||||
if (forceBreakInContent) {
|
||||
|
@ -3275,8 +3275,8 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState,
|
|||
} else {
|
||||
forceBreakInContent = nsnull;
|
||||
}
|
||||
// restore the space manager state
|
||||
aState.mReflowState.mSpaceManager->PopState(&spaceManagerState);
|
||||
// restore the float manager state
|
||||
aState.mReflowState.mFloatManager->PopState(&floatManagerState);
|
||||
// Clear out float lists
|
||||
aState.mCurrentLineFloats.DeleteAll();
|
||||
aState.mBelowCurrentLineFloats.DeleteAll();
|
||||
|
@ -4978,22 +4978,22 @@ static void MarkAllDescendantLinesDirty(nsBlockFrame* aBlock)
|
|||
}
|
||||
}
|
||||
|
||||
static void MarkSameSpaceManagerLinesDirty(nsBlockFrame* aBlock)
|
||||
static void MarkSameFloatManagerLinesDirty(nsBlockFrame* aBlock)
|
||||
{
|
||||
nsBlockFrame* blockWithSpaceMgr = aBlock;
|
||||
while (!(blockWithSpaceMgr->GetStateBits() & NS_BLOCK_SPACE_MGR)) {
|
||||
nsBlockFrame* bf = nsLayoutUtils::GetAsBlock(blockWithSpaceMgr->GetParent());
|
||||
nsBlockFrame* blockWithFloatMgr = aBlock;
|
||||
while (!(blockWithFloatMgr->GetStateBits() & NS_BLOCK_FLOAT_MGR)) {
|
||||
nsBlockFrame* bf = nsLayoutUtils::GetAsBlock(blockWithFloatMgr->GetParent());
|
||||
if (!bf) {
|
||||
break;
|
||||
}
|
||||
blockWithSpaceMgr = bf;
|
||||
blockWithFloatMgr = bf;
|
||||
}
|
||||
|
||||
// Mark every line at and below the line where the float was
|
||||
// dirty, and mark their lines dirty too. We could probably do
|
||||
// something more efficient --- e.g., just dirty the lines that intersect
|
||||
// the float vertically.
|
||||
MarkAllDescendantLinesDirty(blockWithSpaceMgr);
|
||||
MarkAllDescendantLinesDirty(blockWithFloatMgr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5034,7 +5034,7 @@ nsBlockFrame::RemoveFrame(nsIAtom* aListName,
|
|||
PRBool hasFloats = BlockHasAnyFloats(aOldFrame);
|
||||
rv = DoRemoveFrame(aOldFrame, REMOVE_FIXED_CONTINUATIONS);
|
||||
if (hasFloats) {
|
||||
MarkSameSpaceManagerLinesDirty(this);
|
||||
MarkSameFloatManagerLinesDirty(this);
|
||||
}
|
||||
}
|
||||
else if (nsGkAtoms::absoluteList == aListName) {
|
||||
|
@ -5049,7 +5049,7 @@ nsBlockFrame::RemoveFrame(nsIAtom* aListName,
|
|||
nsIFrame* continuation = curFrame->GetNextContinuation();
|
||||
nsBlockFrame* curParent = static_cast<nsBlockFrame*>(curFrame->GetParent());
|
||||
curParent->RemoveFloat(curFrame);
|
||||
MarkSameSpaceManagerLinesDirty(curParent);
|
||||
MarkSameFloatManagerLinesDirty(curParent);
|
||||
curFrame = continuation;
|
||||
} while (curFrame);
|
||||
}
|
||||
|
@ -5754,8 +5754,8 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
|
|||
|
||||
if (mayNeedRetry && !clearanceFrame) {
|
||||
floatRS.mDiscoveredClearance = &clearanceFrame;
|
||||
// We don't need to push the space manager state because the the block has its own
|
||||
// space manager that will be destroyed and recreated
|
||||
// We don't need to push the float manager state because the the block has its own
|
||||
// float manager that will be destroyed and recreated
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6770,17 +6770,17 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState)
|
|||
|
||||
nsFrameList oofs = GetOverflowOutOfFlows();
|
||||
if (oofs.NotEmpty()) {
|
||||
// Floats that were pushed should be removed from our space
|
||||
// manager. Otherwise the space manager's YMost or XMost might
|
||||
// Floats that were pushed should be removed from our float
|
||||
// manager. Otherwise the float manager's YMost or XMost might
|
||||
// be larger than necessary, causing this block to get an
|
||||
// incorrect desired height (or width). Some of these floats
|
||||
// may not actually have been added to the space manager because
|
||||
// may not actually have been added to the float manager because
|
||||
// they weren't reflowed before being pushed; that's OK,
|
||||
// RemoveRegions will ignore them. It is safe to do this here
|
||||
// because we know from here on the space manager will only be
|
||||
// because we know from here on the float manager will only be
|
||||
// used for its XMost and YMost, not to place new floats and
|
||||
// lines.
|
||||
aState.mSpaceManager->RemoveTrailingRegions(oofs.FirstChild());
|
||||
aState.mFloatManager->RemoveTrailingRegions(oofs.FirstChild());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6799,13 +6799,13 @@ nsBlockFrame::BlockIsMarginRoot(nsIFrame* aBlock)
|
|||
|
||||
/* static */
|
||||
PRBool
|
||||
nsBlockFrame::BlockNeedsSpaceManager(nsIFrame* aBlock)
|
||||
nsBlockFrame::BlockNeedsFloatManager(nsIFrame* aBlock)
|
||||
{
|
||||
NS_PRECONDITION(aBlock, "Must have a frame");
|
||||
NS_ASSERTION(nsLayoutUtils::GetAsBlock(aBlock), "aBlock must be a block");
|
||||
|
||||
nsIFrame* parent = aBlock->GetParent();
|
||||
return (aBlock->GetStateBits() & NS_BLOCK_SPACE_MGR) ||
|
||||
return (aBlock->GetStateBits() & NS_BLOCK_FLOAT_MGR) ||
|
||||
(parent && !parent->IsFloatContainingBlock());
|
||||
}
|
||||
|
||||
|
@ -6815,7 +6815,7 @@ nsBlockFrame::BlockCanIntersectFloats(nsIFrame* aFrame)
|
|||
{
|
||||
return aFrame->IsFrameOfType(nsIFrame::eBlockFrame) &&
|
||||
!aFrame->IsFrameOfType(nsIFrame::eReplaced) &&
|
||||
!(aFrame->GetStateBits() & NS_BLOCK_SPACE_MGR);
|
||||
!(aFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
|
||||
// Note that this width can vary based on the vertical position.
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
nsBlockReflowState& aState, nsLineBox* aLine);
|
||||
|
||||
static PRBool BlockIsMarginRoot(nsIFrame* aBlock);
|
||||
static PRBool BlockNeedsSpaceManager(nsIFrame* aBlock);
|
||||
static PRBool BlockNeedsFloatManager(nsIFrame* aBlock);
|
||||
|
||||
/**
|
||||
* Returns whether aFrame is a block frame that will wrap its contents
|
||||
|
@ -679,7 +679,7 @@ public:
|
|||
static PRBool gNoisyIntrinsic;
|
||||
static PRBool gNoisyReflow;
|
||||
static PRBool gReallyNoisyReflow;
|
||||
static PRBool gNoisySpaceManager;
|
||||
static PRBool gNoisyFloatManager;
|
||||
static PRBool gVerifyLines;
|
||||
static PRBool gDisableResizeOpt;
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
|
||||
nscoord tx = 0, ty = 0;
|
||||
// The values of x and y do not matter for floats, so don't bother calculating
|
||||
// them. Floats are guaranteed to have their own space manager, so tx and ty
|
||||
// them. Floats are guaranteed to have their own float manager, so tx and ty
|
||||
// don't matter. mX and mY don't matter becacuse they are only used in
|
||||
// PlaceBlock, which is not used for floats.
|
||||
if (aLine) {
|
||||
|
@ -281,7 +281,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
nscoord x = mSpace.x + aFrameRS.mComputedMargin.left;
|
||||
nscoord y = mSpace.y + mTopMargin.get() + aClearance;
|
||||
|
||||
if ((mFrame->GetStateBits() & NS_BLOCK_SPACE_MGR) == 0)
|
||||
if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
|
||||
aFrameRS.mBlockDelta = mOuterReflowState.mBlockDelta + y - aLine->mBounds.y;
|
||||
|
||||
mX = x;
|
||||
|
@ -306,9 +306,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
mMetrics.height = nscoord(0xdeadbeef);
|
||||
#endif
|
||||
|
||||
mOuterReflowState.mSpaceManager->Translate(tx, ty);
|
||||
mOuterReflowState.mFloatManager->Translate(tx, ty);
|
||||
rv = mFrame->Reflow(mPresContext, mMetrics, aFrameRS, aFrameReflowStatus);
|
||||
mOuterReflowState.mSpaceManager->Translate(-tx, -ty);
|
||||
mOuterReflowState.mFloatManager->Translate(-tx, -ty);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {
|
||||
|
|
|
@ -64,7 +64,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
const nsHTMLReflowMetrics& aMetrics,
|
||||
PRBool aTopMarginRoot,
|
||||
PRBool aBottomMarginRoot,
|
||||
PRBool aBlockNeedsSpaceManager)
|
||||
PRBool aBlockNeedsFloatManager)
|
||||
: mBlock(aFrame),
|
||||
mPresContext(aPresContext),
|
||||
mReflowState(aReflowState),
|
||||
|
@ -89,19 +89,19 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
if (GetFlag(BRS_ISTOPMARGINROOT)) {
|
||||
SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE);
|
||||
}
|
||||
if (aBlockNeedsSpaceManager) {
|
||||
SetFlag(BRS_SPACE_MGR, PR_TRUE);
|
||||
if (aBlockNeedsFloatManager) {
|
||||
SetFlag(BRS_FLOAT_MGR, PR_TRUE);
|
||||
}
|
||||
|
||||
mSpaceManager = aReflowState.mSpaceManager;
|
||||
mFloatManager = aReflowState.mFloatManager;
|
||||
|
||||
NS_ASSERTION(mSpaceManager,
|
||||
"SpaceManager should be set in nsBlockReflowState" );
|
||||
if (mSpaceManager) {
|
||||
NS_ASSERTION(mFloatManager,
|
||||
"FloatManager should be set in nsBlockReflowState" );
|
||||
if (mFloatManager) {
|
||||
// Translate into our content area and then save the
|
||||
// coordinate system origin for later.
|
||||
mSpaceManager->Translate(borderPadding.left, borderPadding.top);
|
||||
mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY);
|
||||
mFloatManager->Translate(borderPadding.left, borderPadding.top);
|
||||
mFloatManager->GetTranslation(mFloatManagerX, mFloatManagerY);
|
||||
}
|
||||
|
||||
mReflowStatus = NS_FRAME_COMPLETE;
|
||||
|
@ -134,7 +134,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
}
|
||||
|
||||
mY = borderPadding.top;
|
||||
mBand.Init(mSpaceManager, mContentArea);
|
||||
mBand.Init(mFloatManager, mContentArea);
|
||||
|
||||
mPrevChild = nsnull;
|
||||
mCurrentLine = aFrame->end_lines();
|
||||
|
@ -168,11 +168,11 @@ nsBlockReflowState::~nsBlockReflowState()
|
|||
NS_ASSERTION(mOverflowPlaceholders.IsEmpty(),
|
||||
"Leaking overflow placeholder frames");
|
||||
|
||||
// Restore the coordinate system, unless the space manager is null,
|
||||
// Restore the coordinate system, unless the float manager is null,
|
||||
// which means it was just destroyed.
|
||||
if (mSpaceManager) {
|
||||
if (mFloatManager) {
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
mSpaceManager->Translate(-borderPadding.left, -borderPadding.top);
|
||||
mFloatManager->Translate(-borderPadding.left, -borderPadding.top);
|
||||
}
|
||||
|
||||
if (mBlock->GetStateBits() & NS_BLOCK_HAS_OVERFLOW_PLACEHOLDERS) {
|
||||
|
@ -205,7 +205,7 @@ nsBlockReflowState::ComputeReplacedBlockOffsetsForFloats(nsIFrame* aFrame,
|
|||
ReplacedElementWidthToClear
|
||||
*aReplacedWidth)
|
||||
{
|
||||
// The frame is clueless about the space manager and therefore we
|
||||
// The frame is clueless about the float manager and therefore we
|
||||
// only give it free space. An example is a table frame - the
|
||||
// tables do not flow around floats.
|
||||
// However, we can let its margins intersect floats.
|
||||
|
@ -342,8 +342,8 @@ nsBlockReflowState::GetAvailableSpace(nscoord aY, PRBool aRelaxHeightConstraint)
|
|||
#ifdef DEBUG
|
||||
// Verify that the caller setup the coordinate system properly
|
||||
nscoord wx, wy;
|
||||
mSpaceManager->GetTranslation(wx, wy);
|
||||
NS_ASSERTION((wx == mSpaceManagerX) && (wy == mSpaceManagerY),
|
||||
mFloatManager->GetTranslation(wx, wy);
|
||||
NS_ASSERTION((wx == mFloatManagerX) && (wy == mFloatManagerY),
|
||||
"bad coord system");
|
||||
#endif
|
||||
|
||||
|
@ -402,7 +402,7 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
}
|
||||
|
||||
/**
|
||||
* Restore information about floats into the space manager for an
|
||||
* Restore information about floats into the float manager for an
|
||||
* incremental reflow, and simultaneously push the floats by
|
||||
* |aDeltaY|, which is the amount |aLine| was pushed relative to its
|
||||
* parent. The recovery of state is one of the things that makes
|
||||
|
@ -427,19 +427,19 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
|||
nsContainerFrame::PositionChildViews(floatFrame);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
mFloatManager->GetTranslation(tx, ty);
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("RecoverFloats: txy=%d,%d (%d,%d) ",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY);
|
||||
tx, ty, mFloatManagerX, mFloatManagerY);
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" aDeltaY=%d region={%d,%d,%d,%d}\n",
|
||||
aDeltaY, fc->mRegion.x, fc->mRegion.y,
|
||||
fc->mRegion.width, fc->mRegion.height);
|
||||
}
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floatFrame, fc->mRegion);
|
||||
mFloatManager->AddRectRegion(floatFrame, fc->mRegion);
|
||||
fc = fc->Next();
|
||||
}
|
||||
} else if (aLine->IsBlock()) {
|
||||
|
@ -447,7 +447,7 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
|||
// don't recover any state inside a block that has its own space
|
||||
// manager (we don't currently have any blocks like this, though,
|
||||
// thanks to our use of extra frames for 'overflow')
|
||||
if (kid && !nsBlockFrame::BlockNeedsSpaceManager(kid)) {
|
||||
if (kid && !nsBlockFrame::BlockNeedsFloatManager(kid)) {
|
||||
nscoord tx = kid->mRect.x, ty = kid->mRect.y;
|
||||
|
||||
// If the element is relatively positioned, then adjust x and y
|
||||
|
@ -464,16 +464,16 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
|||
}
|
||||
}
|
||||
|
||||
mSpaceManager->Translate(tx, ty);
|
||||
mFloatManager->Translate(tx, ty);
|
||||
for (nsBlockFrame::line_iterator line = kid->begin_lines(),
|
||||
line_end = kid->end_lines();
|
||||
line != line_end;
|
||||
++line)
|
||||
// Pass 0, not the real DeltaY, since these floats aren't
|
||||
// moving relative to their parent block, only relative to
|
||||
// the space manager.
|
||||
// the float manager.
|
||||
RecoverFloats(line, 0);
|
||||
mSpaceManager->Translate(-tx, -ty);
|
||||
mFloatManager->Translate(-tx, -ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -497,23 +497,23 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
// Make the line being recovered the current line
|
||||
mCurrentLine = aLine;
|
||||
|
||||
// Place floats for this line into the space manager
|
||||
// Place floats for this line into the float manager
|
||||
if (aLine->HasFloats() || aLine->IsBlock()) {
|
||||
// Undo border/padding translation since the nsFloatCache's
|
||||
// coordinates are relative to the frame not relative to the
|
||||
// border/padding.
|
||||
const nsMargin& bp = BorderPadding();
|
||||
mSpaceManager->Translate(-bp.left, -bp.top);
|
||||
mFloatManager->Translate(-bp.left, -bp.top);
|
||||
|
||||
RecoverFloats(aLine, aDeltaY);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
mSpaceManager->List(stdout);
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
|
||||
mFloatManager->List(stdout);
|
||||
}
|
||||
#endif
|
||||
// And then put the translation back again
|
||||
mSpaceManager->Translate(bp.left, bp.top);
|
||||
mFloatManager->Translate(bp.left, bp.top);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,10 +584,10 @@ nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout,
|
|||
// manager's translation to the space that the block resides in
|
||||
// before placing the float.
|
||||
nscoord ox, oy;
|
||||
mSpaceManager->GetTranslation(ox, oy);
|
||||
nscoord dx = ox - mSpaceManagerX;
|
||||
nscoord dy = oy - mSpaceManagerY;
|
||||
mSpaceManager->Translate(-dx, -dy);
|
||||
mFloatManager->GetTranslation(ox, oy);
|
||||
nscoord dx = ox - mFloatManagerX;
|
||||
nscoord dy = oy - mFloatManagerY;
|
||||
mFloatManager->Translate(-dx, -dy);
|
||||
|
||||
// And then place it
|
||||
PRBool isLeftFloat;
|
||||
|
@ -627,7 +627,7 @@ nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout,
|
|||
}
|
||||
|
||||
// Restore coordinate system
|
||||
mSpaceManager->Translate(dx, dy);
|
||||
mFloatManager->Translate(dx, dy);
|
||||
}
|
||||
else {
|
||||
// Always claim to be placed; we don't know whether we fit yet, so we
|
||||
|
@ -775,7 +775,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
|
||||
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
|
||||
// ``above'' another float that preceded it in the flow.
|
||||
mY = NS_MAX(mSpaceManager->GetLowestRegionTop() + BorderPadding().top, mY);
|
||||
mY = NS_MAX(mFloatManager->GetLowestRegionTop() + BorderPadding().top, mY);
|
||||
|
||||
// See if the float should clear any preceding floats...
|
||||
// XXX We need to mark this float somehow so that it gets reflowed
|
||||
|
@ -919,7 +919,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
floatY = 0;
|
||||
}
|
||||
|
||||
// Place the float in the space manager
|
||||
// Place the float in the float manager
|
||||
// if the float split, then take up all of the vertical height
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus) &&
|
||||
(NS_UNCONSTRAINEDSIZE != mContentArea.height)) {
|
||||
|
@ -929,7 +929,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
nsRect region(floatX, floatY, floatSize.width, floatSize.height);
|
||||
|
||||
// Don't send rectangles with negative margin-box width or height to
|
||||
// the space manager; it can't deal with them.
|
||||
// the float manager; it can't deal with them.
|
||||
if (region.width < 0) {
|
||||
// Preserve the right margin-edge for left floats and the left
|
||||
// margin-edge for right floats
|
||||
|
@ -944,7 +944,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floatFrame, region);
|
||||
mFloatManager->AddRectRegion(floatFrame, region);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement");
|
||||
|
||||
// Save away the floats region in the spacemanager, after making
|
||||
|
@ -958,7 +958,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
nsPoint(borderPadding.left, borderPadding.top);
|
||||
|
||||
// If the float's dimensions have changed, note the damage in the
|
||||
// space manager.
|
||||
// float manager.
|
||||
if (aFloatCache->mRegion != oldRegion) {
|
||||
// XXXwaterson conservative: we could probably get away with noting
|
||||
// less damage; e.g., if only height has changed, then only note the
|
||||
|
@ -966,15 +966,15 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
|||
// shrunk.
|
||||
nscoord top = NS_MIN(region.y, oldRegion.y);
|
||||
nscoord bottom = NS_MAX(region.YMost(), oldRegion.YMost());
|
||||
mSpaceManager->IncludeInDamage(top, bottom);
|
||||
mFloatManager->IncludeInDamage(top, bottom);
|
||||
}
|
||||
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
#ifdef NOISY_FLOATMANAGER
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
mFloatManager->GetTranslation(tx, ty);
|
||||
nsFrame::ListTag(stdout, mBlock);
|
||||
printf(": FlowAndPlaceFloat: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY,
|
||||
tx, ty, mFloatManagerX, mFloatManagerY,
|
||||
aFloatCache->mRegion.x, aFloatCache->mRegion.y,
|
||||
aFloatCache->mRegion.width, aFloatCache->mRegion.height);
|
||||
#endif
|
||||
|
@ -1086,14 +1086,14 @@ nsBlockReflowState::ClearFloats(nscoord aY, PRUint8 aBreakType,
|
|||
#ifdef NOISY_FLOAT_CLEARING
|
||||
printf("nsBlockReflowState::ClearFloats: aY=%d breakType=%d\n",
|
||||
aY, aBreakType);
|
||||
mSpaceManager->List(stdout);
|
||||
mFloatManager->List(stdout);
|
||||
#endif
|
||||
|
||||
const nsMargin& bp = BorderPadding();
|
||||
nscoord newY = aY;
|
||||
|
||||
if (aBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
newY = bp.top + mSpaceManager->ClearFloats(newY - bp.top, aBreakType);
|
||||
newY = bp.top + mFloatManager->ClearFloats(newY - bp.top, aBreakType);
|
||||
}
|
||||
|
||||
if (aReplacedBlock) {
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
#define BRS_ISFIRSTINFLOW 0x00000010
|
||||
// Set when mLineAdjacentToTop is valid
|
||||
#define BRS_HAVELINEADJACENTTOTOP 0x00000020
|
||||
// Set when the block has the equivalent of NS_BLOCK_SPACE_MGR
|
||||
#define BRS_SPACE_MGR 0x00000040
|
||||
// Set when the block has the equivalent of NS_BLOCK_FLOAT_MGR
|
||||
#define BRS_FLOAT_MGR 0x00000040
|
||||
// Set when nsLineLayout::LineIsEmpty was true at the end of reflowing
|
||||
// the current line
|
||||
#define BRS_LINE_LAYOUT_EMPTY 0x00000080
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
nsBlockFrame* aFrame,
|
||||
const nsHTMLReflowMetrics& aMetrics,
|
||||
PRBool aTopMarginRoot, PRBool aBottomMarginRoot,
|
||||
PRBool aBlockNeedsSpaceManager);
|
||||
PRBool aBlockNeedsFloatManager);
|
||||
|
||||
~nsBlockReflowState();
|
||||
|
||||
|
@ -192,14 +192,14 @@ public:
|
|||
|
||||
const nsHTMLReflowState& mReflowState;
|
||||
|
||||
nsSpaceManager* mSpaceManager;
|
||||
nsFloatManager* mFloatManager;
|
||||
|
||||
// The coordinates within the spacemanager where the block is being
|
||||
// placed <b>after</b> taking into account the blocks border and
|
||||
// padding. This, therefore, represents the inner "content area" (in
|
||||
// spacemanager coordinates) where child frames will be placed,
|
||||
// including child blocks and floats.
|
||||
nscoord mSpaceManagerX, mSpaceManagerY;
|
||||
nscoord mFloatManagerX, mFloatManagerY;
|
||||
|
||||
// XXX get rid of this
|
||||
nsReflowStatus mReflowStatus;
|
||||
|
|
|
@ -644,10 +644,10 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
|||
|
||||
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mFlags);
|
||||
|
||||
// XXX it would be cool to consult the space manager for the
|
||||
// XXX it would be cool to consult the float manager for the
|
||||
// previous block to figure out the region of floats from the
|
||||
// previous column that extend into this column, and subtract
|
||||
// that region from the new space manager. So you could stick a
|
||||
// that region from the new float manager. So you could stick a
|
||||
// really big float in the first column and text in following
|
||||
// columns would flow around it.
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class nsTableColFrame;
|
|||
*/
|
||||
#define NS_BLOCK_NO_AUTO_MARGINS 0x00200000
|
||||
#define NS_BLOCK_MARGIN_ROOT 0x00400000
|
||||
#define NS_BLOCK_SPACE_MGR 0x00800000
|
||||
#define NS_BLOCK_FLOAT_MGR 0x00800000
|
||||
#define NS_BLOCK_HAS_FIRST_LETTER_STYLE 0x20000000
|
||||
#define NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET 0x40000000
|
||||
#define NS_BLOCK_HAS_FIRST_LETTER_CHILD 0x80000000
|
||||
|
@ -108,17 +108,17 @@ NS_NewTableCellInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
|
|||
// This type of BlockFrame is a margin root, but does not shrink wrap
|
||||
inline nsIFrame*
|
||||
NS_NewAbsoluteItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
|
||||
return NS_NewBlockFrame(aPresShell, aContext, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
return NS_NewBlockFrame(aPresShell, aContext, NS_BLOCK_FLOAT_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of BlockFrame shrink wraps
|
||||
inline nsIFrame*
|
||||
NS_NewFloatingItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) {
|
||||
return NS_NewBlockFrame(aPresShell, aContext,
|
||||
NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
NS_BLOCK_FLOAT_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of BlockFrame doesn't use its own space manager and
|
||||
// This type of BlockFrame doesn't use its own float manager and
|
||||
// doesn't shrink wrap.
|
||||
inline nsIFrame*
|
||||
NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags) {
|
||||
|
|
|
@ -96,7 +96,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
|||
parentReflowState = nsnull;
|
||||
availableWidth = aAvailableSpace.width;
|
||||
availableHeight = aAvailableSpace.height;
|
||||
mSpaceManager = nsnull;
|
||||
mFloatManager = nsnull;
|
||||
mLineLayout = nsnull;
|
||||
mFlags.mSpecialHeightReflow = PR_FALSE;
|
||||
mFlags.mIsTopOfPage = PR_FALSE;
|
||||
|
@ -155,7 +155,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
|||
availableWidth = aAvailableSpace.width;
|
||||
availableHeight = aAvailableSpace.height;
|
||||
|
||||
mSpaceManager = aParentReflowState.mSpaceManager;
|
||||
mFloatManager = aParentReflowState.mFloatManager;
|
||||
if (frame->IsFrameOfType(nsIFrame::eLineParticipant))
|
||||
mLineLayout = aParentReflowState.mLineLayout;
|
||||
else
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
class nsPresContext;
|
||||
class nsIRenderingContext;
|
||||
class nsSpaceManager;
|
||||
class nsFloatManager;
|
||||
class nsLineLayout;
|
||||
class nsIPercentHeightObserver;
|
||||
|
||||
|
@ -244,8 +244,8 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
|
|||
// initialized by the Init method below.
|
||||
nsCSSFrameType mFrameType;
|
||||
|
||||
// pointer to the space manager associated with this area
|
||||
nsSpaceManager* mSpaceManager;
|
||||
// pointer to the float manager associated with this area
|
||||
nsFloatManager* mFloatManager;
|
||||
|
||||
// The amount the in-flow position of the block is moving vertically relative
|
||||
// to its previous in-flow position (i.e. the amount the line containing the
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsILineIterator.h"
|
||||
|
||||
class nsSpaceManager;
|
||||
class nsFloatManager;
|
||||
class nsLineBox;
|
||||
class nsFloatCache;
|
||||
class nsFloatCacheList;
|
||||
|
|
|
@ -93,11 +93,11 @@
|
|||
#define PLACED_RIGHT 0x2
|
||||
|
||||
nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
||||
nsSpaceManager* aSpaceManager,
|
||||
nsFloatManager* aFloatManager,
|
||||
const nsHTMLReflowState* aOuterReflowState,
|
||||
const nsLineList::iterator* aLine)
|
||||
: mPresContext(aPresContext),
|
||||
mSpaceManager(aSpaceManager),
|
||||
mFloatManager(aFloatManager),
|
||||
mBlockReflowState(aOuterReflowState),
|
||||
mLastOptionalBreakContent(nsnull),
|
||||
mForceBreakContent(nsnull),
|
||||
|
@ -108,9 +108,9 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
|||
mMinLineHeight(0),
|
||||
mTextIndent(0)
|
||||
{
|
||||
NS_ASSERTION(aSpaceManager || aOuterReflowState->frame->GetType() ==
|
||||
NS_ASSERTION(aFloatManager || aOuterReflowState->frame->GetType() ==
|
||||
nsGkAtoms::letterFrame,
|
||||
"space manager should be present");
|
||||
"float manager should be present");
|
||||
MOZ_COUNT_CTOR(nsLineLayout);
|
||||
|
||||
// Stash away some style data that we need
|
||||
|
@ -841,7 +841,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
#endif
|
||||
nscoord tx = x - psd->mReflowState->mComputedBorderPadding.left;
|
||||
nscoord ty = y - psd->mReflowState->mComputedBorderPadding.top;
|
||||
mSpaceManager->Translate(tx, ty);
|
||||
mFloatManager->Translate(tx, ty);
|
||||
|
||||
nsIAtom* frameType = aFrame->GetType();
|
||||
PRInt32 savedOptionalBreakOffset;
|
||||
|
@ -949,7 +949,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
}
|
||||
}
|
||||
|
||||
mSpaceManager->Translate(-tx, -ty);
|
||||
mFloatManager->Translate(-tx, -ty);
|
||||
|
||||
NS_ASSERTION(metrics.width>=0, "bad width");
|
||||
NS_ASSERTION(metrics.height>=0,"bad height");
|
||||
|
|
|
@ -59,14 +59,14 @@
|
|||
|
||||
class nsBlockFrame;
|
||||
|
||||
class nsSpaceManager;
|
||||
class nsFloatManager;
|
||||
class nsPlaceholderFrame;
|
||||
struct nsStyleText;
|
||||
|
||||
class nsLineLayout {
|
||||
public:
|
||||
nsLineLayout(nsPresContext* aPresContext,
|
||||
nsSpaceManager* aSpaceManager,
|
||||
nsFloatManager* aFloatManager,
|
||||
const nsHTMLReflowState* aOuterReflowState,
|
||||
const nsLineList::iterator* aLine);
|
||||
~nsLineLayout();
|
||||
|
@ -373,7 +373,7 @@ public:
|
|||
|
||||
protected:
|
||||
// This state is constant for a given block frame doing line layout
|
||||
nsSpaceManager* mSpaceManager;
|
||||
nsFloatManager* mFloatManager;
|
||||
const nsStyleText* mStyleText; // for the block
|
||||
const nsHTMLReflowState* mBlockReflowState;
|
||||
|
||||
|
|
|
@ -60,19 +60,19 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BandList
|
||||
|
||||
PRInt32 nsSpaceManager::sCachedSpaceManagerCount = 0;
|
||||
void* nsSpaceManager::sCachedSpaceManagers[NS_SPACE_MANAGER_CACHE_SIZE];
|
||||
PRInt32 nsFloatManager::sCachedFloatManagerCount = 0;
|
||||
void* nsFloatManager::sCachedFloatManagers[NS_SPACE_MANAGER_CACHE_SIZE];
|
||||
|
||||
#define NSCOORD_MIN (-2147483647 - 1) /* minimum signed value */
|
||||
|
||||
nsSpaceManager::BandList::BandList()
|
||||
: nsSpaceManager::BandRect(NSCOORD_MIN, NSCOORD_MIN, NSCOORD_MIN, NSCOORD_MIN, (nsIFrame*)nsnull)
|
||||
nsFloatManager::BandList::BandList()
|
||||
: nsFloatManager::BandRect(NSCOORD_MIN, NSCOORD_MIN, NSCOORD_MIN, NSCOORD_MIN, (nsIFrame*)nsnull)
|
||||
{
|
||||
PR_INIT_CLIST(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::BandList::Clear()
|
||||
nsFloatManager::BandList::Clear()
|
||||
{
|
||||
if (!IsEmpty()) {
|
||||
BandRect* bandRect = Head();
|
||||
|
@ -105,9 +105,9 @@ PSArenaFreeCB(size_t aSize, void* aPtr, void* aClosure)
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsSpaceManager
|
||||
// nsFloatManager
|
||||
|
||||
nsSpaceManager::nsSpaceManager(nsIPresShell* aPresShell)
|
||||
nsFloatManager::nsFloatManager(nsIPresShell* aPresShell)
|
||||
: mLowestTop(NSCOORD_MIN),
|
||||
mFloatDamage(PSArenaAllocCB, PSArenaFreeCB, aPresShell),
|
||||
mHaveCachedLeftYMost(PR_TRUE),
|
||||
|
@ -116,13 +116,13 @@ nsSpaceManager::nsSpaceManager(nsIPresShell* aPresShell)
|
|||
mMaximalRightYMost(nscoord_MIN),
|
||||
mCachedBandPosition(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsSpaceManager);
|
||||
MOZ_COUNT_CTOR(nsFloatManager);
|
||||
mX = mY = 0;
|
||||
mFrameInfoMap = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::ClearFrameInfo()
|
||||
nsFloatManager::ClearFrameInfo()
|
||||
{
|
||||
while (mFrameInfoMap) {
|
||||
FrameInfo* next = mFrameInfoMap->mNext;
|
||||
|
@ -131,20 +131,20 @@ nsSpaceManager::ClearFrameInfo()
|
|||
}
|
||||
}
|
||||
|
||||
nsSpaceManager::~nsSpaceManager()
|
||||
nsFloatManager::~nsFloatManager()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsSpaceManager);
|
||||
MOZ_COUNT_DTOR(nsFloatManager);
|
||||
mBandList.Clear();
|
||||
ClearFrameInfo();
|
||||
}
|
||||
|
||||
// static
|
||||
void* nsSpaceManager::operator new(size_t aSize) CPP_THROW_NEW
|
||||
void* nsFloatManager::operator new(size_t aSize) CPP_THROW_NEW
|
||||
{
|
||||
if (sCachedSpaceManagerCount > 0) {
|
||||
if (sCachedFloatManagerCount > 0) {
|
||||
// We have cached unused instances of this class, return a cached
|
||||
// instance in stead of always creating a new one.
|
||||
return sCachedSpaceManagers[--sCachedSpaceManagerCount];
|
||||
return sCachedFloatManagers[--sCachedFloatManagerCount];
|
||||
}
|
||||
|
||||
// The cache is empty, this means we haveto create a new instance using
|
||||
|
@ -153,49 +153,49 @@ void* nsSpaceManager::operator new(size_t aSize) CPP_THROW_NEW
|
|||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::operator delete(void* aPtr, size_t aSize)
|
||||
nsFloatManager::operator delete(void* aPtr, size_t aSize)
|
||||
{
|
||||
if (!aPtr)
|
||||
return;
|
||||
// This space manager is no longer used, if there's still room in
|
||||
// the cache we'll cache this space manager, unless the layout
|
||||
// This float manager is no longer used, if there's still room in
|
||||
// the cache we'll cache this float manager, unless the layout
|
||||
// module was already shut down.
|
||||
|
||||
if (sCachedSpaceManagerCount < NS_SPACE_MANAGER_CACHE_SIZE &&
|
||||
sCachedSpaceManagerCount >= 0) {
|
||||
if (sCachedFloatManagerCount < NS_SPACE_MANAGER_CACHE_SIZE &&
|
||||
sCachedFloatManagerCount >= 0) {
|
||||
// There's still space in the cache for more instances, put this
|
||||
// instance in the cache in stead of deleting it.
|
||||
|
||||
sCachedSpaceManagers[sCachedSpaceManagerCount++] = aPtr;
|
||||
sCachedFloatManagers[sCachedFloatManagerCount++] = aPtr;
|
||||
return;
|
||||
}
|
||||
|
||||
// The cache is full, or the layout module has been shut down,
|
||||
// delete this space manager.
|
||||
// delete this float manager.
|
||||
nsMemory::Free(aPtr);
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
void nsSpaceManager::Shutdown()
|
||||
void nsFloatManager::Shutdown()
|
||||
{
|
||||
// The layout module is being shut down, clean up the cache and
|
||||
// disable further caching.
|
||||
|
||||
PRInt32 i;
|
||||
|
||||
for (i = 0; i < sCachedSpaceManagerCount; i++) {
|
||||
void* spaceManager = sCachedSpaceManagers[i];
|
||||
if (spaceManager)
|
||||
nsMemory::Free(spaceManager);
|
||||
for (i = 0; i < sCachedFloatManagerCount; i++) {
|
||||
void* floatManager = sCachedFloatManagers[i];
|
||||
if (floatManager)
|
||||
nsMemory::Free(floatManager);
|
||||
}
|
||||
|
||||
// Disable further caching.
|
||||
sCachedSpaceManagerCount = -1;
|
||||
sCachedFloatManagerCount = -1;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSpaceManager::YMost(nscoord& aYMost) const
|
||||
nsFloatManager::YMost(nscoord& aYMost) const
|
||||
{
|
||||
PRBool result;
|
||||
|
||||
|
@ -229,7 +229,7 @@ nsSpaceManager::YMost(nscoord& aYMost) const
|
|||
* @param aBandData the object to populate with available and unavailable space
|
||||
*/
|
||||
nsresult
|
||||
nsSpaceManager::GetBandAvailableSpace(const BandRect* aBand,
|
||||
nsFloatManager::GetBandAvailableSpace(const BandRect* aBand,
|
||||
nscoord aY,
|
||||
const nsSize& aMaxSize,
|
||||
nsBandData& aBandData) const
|
||||
|
@ -334,7 +334,7 @@ nsSpaceManager::GetBandAvailableSpace(const BandRect* aBand,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::GetBandData(nscoord aYOffset,
|
||||
nsFloatManager::GetBandData(nscoord aYOffset,
|
||||
const nsSize& aMaxSize,
|
||||
nsBandData& aBandData) const
|
||||
{
|
||||
|
@ -390,8 +390,8 @@ nsSpaceManager::GetBandData(nscoord aYOffset,
|
|||
* @param aBandRect A rect within the band
|
||||
* @returns The start of the next band, or nsnull of this is the last band.
|
||||
*/
|
||||
nsSpaceManager::BandRect*
|
||||
nsSpaceManager::GetNextBand(const BandRect* aBandRect) const
|
||||
nsFloatManager::BandRect*
|
||||
nsFloatManager::GetNextBand(const BandRect* aBandRect) const
|
||||
{
|
||||
nscoord topOfBand = aBandRect->mTop;
|
||||
|
||||
|
@ -416,8 +416,8 @@ nsSpaceManager::GetNextBand(const BandRect* aBandRect) const
|
|||
* @param aBandRect The first rect within a band
|
||||
* @returns The start of the previous band, or nsnull of this is the first band.
|
||||
*/
|
||||
nsSpaceManager::BandRect*
|
||||
nsSpaceManager::GetPrevBand(const BandRect* aBandRect) const
|
||||
nsFloatManager::BandRect*
|
||||
nsFloatManager::GetPrevBand(const BandRect* aBandRect) const
|
||||
{
|
||||
NS_ASSERTION(aBandRect->Prev() == &mBandList ||
|
||||
aBandRect->Prev()->mBottom <= aBandRect->mTop,
|
||||
|
@ -449,7 +449,7 @@ nsSpaceManager::GetPrevBand(const BandRect* aBandRect) const
|
|||
* part
|
||||
*/
|
||||
void
|
||||
nsSpaceManager::DivideBand(BandRect* aBandRect, nscoord aBottom)
|
||||
nsFloatManager::DivideBand(BandRect* aBandRect, nscoord aBottom)
|
||||
{
|
||||
NS_PRECONDITION(aBottom < aBandRect->mBottom, "bad height");
|
||||
nscoord topOfBand = aBandRect->mTop;
|
||||
|
@ -472,7 +472,7 @@ nsSpaceManager::DivideBand(BandRect* aBandRect, nscoord aBottom)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsSpaceManager::CanJoinBands(BandRect* aBand, BandRect* aPrevBand)
|
||||
nsFloatManager::CanJoinBands(BandRect* aBand, BandRect* aPrevBand)
|
||||
{
|
||||
PRBool result;
|
||||
nscoord topOfBand = aBand->mTop;
|
||||
|
@ -527,7 +527,7 @@ nsSpaceManager::CanJoinBands(BandRect* aBand, BandRect* aPrevBand)
|
|||
* If the two bands are joined, the previous band is the band that's deleted
|
||||
*/
|
||||
PRBool
|
||||
nsSpaceManager::JoinBands(BandRect* aBand, BandRect* aPrevBand)
|
||||
nsFloatManager::JoinBands(BandRect* aBand, BandRect* aPrevBand)
|
||||
{
|
||||
if (CanJoinBands(aBand, aPrevBand)) {
|
||||
BandRect* startOfNextBand = aBand;
|
||||
|
@ -566,7 +566,7 @@ nsSpaceManager::JoinBands(BandRect* aBand, BandRect* aPrevBand)
|
|||
* @param aBandRect the band rect to add to the band
|
||||
*/
|
||||
void
|
||||
nsSpaceManager::AddRectToBand(BandRect* aBand, BandRect* aBandRect)
|
||||
nsFloatManager::AddRectToBand(BandRect* aBand, BandRect* aBandRect)
|
||||
{
|
||||
NS_PRECONDITION((aBand->mTop == aBandRect->mTop) &&
|
||||
(aBand->mBottom == aBandRect->mBottom), "bad band");
|
||||
|
@ -747,7 +747,7 @@ nsSpaceManager::AddRectToBand(BandRect* aBand, BandRect* aBandRect)
|
|||
// +-----+
|
||||
//
|
||||
void
|
||||
nsSpaceManager::InsertBandRect(BandRect* aBandRect)
|
||||
nsFloatManager::InsertBandRect(BandRect* aBandRect)
|
||||
{
|
||||
// If there are no existing bands or this rect is below the bottommost
|
||||
// band, then add a new band
|
||||
|
@ -847,7 +847,7 @@ nsSpaceManager::InsertBandRect(BandRect* aBandRect)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
||||
nsFloatManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aFrame, "null frame");
|
||||
|
||||
|
@ -882,7 +882,7 @@ nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::RemoveTrailingRegions(nsIFrame* aFrameList) {
|
||||
nsFloatManager::RemoveTrailingRegions(nsIFrame* aFrameList) {
|
||||
nsVoidHashSet frameSet;
|
||||
|
||||
frameSet.Init(1);
|
||||
|
@ -908,7 +908,7 @@ nsSpaceManager::RemoveTrailingRegions(nsIFrame* aFrameList) {
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::RemoveRegion(nsIFrame* aFrame)
|
||||
nsFloatManager::RemoveRegion(nsIFrame* aFrame)
|
||||
{
|
||||
// Get the frame info associated with aFrame
|
||||
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
|
||||
|
@ -1021,7 +1021,7 @@ nsSpaceManager::RemoveRegion(nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::PushState(SavedState* aState)
|
||||
nsFloatManager::PushState(SavedState* aState)
|
||||
{
|
||||
NS_PRECONDITION(aState, "Need a place to save state");
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ nsSpaceManager::PushState(SavedState* aState)
|
|||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::PopState(SavedState* aState)
|
||||
nsFloatManager::PopState(SavedState* aState)
|
||||
{
|
||||
NS_PRECONDITION(aState, "No state to restore?");
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ nsSpaceManager::PopState(SavedState* aState)
|
|||
}
|
||||
|
||||
nscoord
|
||||
nsSpaceManager::GetLowestRegionTop()
|
||||
nsFloatManager::GetLowestRegionTop()
|
||||
{
|
||||
if (mLowestTop == NSCOORD_MIN)
|
||||
return mLowestTop;
|
||||
|
@ -1106,17 +1106,17 @@ nsSpaceManager::GetLowestRegionTop()
|
|||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
DebugListSpaceManager(nsSpaceManager *aSpaceManager)
|
||||
DebugListFloatManager(nsFloatManager *aFloatManager)
|
||||
{
|
||||
aSpaceManager->List(stdout);
|
||||
aFloatManager->List(stdout);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::List(FILE* out)
|
||||
nsFloatManager::List(FILE* out)
|
||||
{
|
||||
nsAutoString tmp;
|
||||
|
||||
fprintf(out, "SpaceManager@%p", this);
|
||||
fprintf(out, "FloatManager@%p", this);
|
||||
fprintf(out, " xy=%d,%d <\n", mX, mY);
|
||||
if (mBandList.IsEmpty()) {
|
||||
fprintf(out, " no bands\n");
|
||||
|
@ -1149,8 +1149,8 @@ nsSpaceManager::List(FILE* out)
|
|||
}
|
||||
#endif
|
||||
|
||||
nsSpaceManager::FrameInfo*
|
||||
nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame)
|
||||
nsFloatManager::FrameInfo*
|
||||
nsFloatManager::GetFrameInfoFor(nsIFrame* aFrame)
|
||||
{
|
||||
FrameInfo* result = nsnull;
|
||||
|
||||
|
@ -1163,8 +1163,8 @@ nsSpaceManager::GetFrameInfoFor(nsIFrame* aFrame)
|
|||
return result;
|
||||
}
|
||||
|
||||
nsSpaceManager::FrameInfo*
|
||||
nsSpaceManager::CreateFrameInfo(nsIFrame* aFrame, const nsRect& aRect)
|
||||
nsFloatManager::FrameInfo*
|
||||
nsFloatManager::CreateFrameInfo(nsIFrame* aFrame, const nsRect& aRect)
|
||||
{
|
||||
FrameInfo* frameInfo = new FrameInfo(aFrame, aRect);
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ nsSpaceManager::CreateFrameInfo(nsIFrame* aFrame, const nsRect& aRect)
|
|||
}
|
||||
|
||||
void
|
||||
nsSpaceManager::DestroyFrameInfo(FrameInfo* aFrameInfo)
|
||||
nsFloatManager::DestroyFrameInfo(FrameInfo* aFrameInfo)
|
||||
{
|
||||
// See if it's at the head of the list
|
||||
if (mFrameInfoMap == aFrameInfo) {
|
||||
|
@ -1229,7 +1229,7 @@ nsSpaceManager::DestroyFrameInfo(FrameInfo* aFrameInfo)
|
|||
}
|
||||
|
||||
nscoord
|
||||
nsSpaceManager::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
nsFloatManager::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
{
|
||||
nscoord bottom = aY + mY;
|
||||
|
||||
|
@ -1290,8 +1290,8 @@ nsSpaceManager::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
|||
return bottom;
|
||||
}
|
||||
|
||||
nsSpaceManager::BandRect*
|
||||
nsSpaceManager::GuessBandWithTopAbove(nscoord aYOffset) const
|
||||
nsFloatManager::BandRect*
|
||||
nsFloatManager::GuessBandWithTopAbove(nscoord aYOffset) const
|
||||
{
|
||||
NS_ASSERTION(!mBandList.IsEmpty(), "no bands");
|
||||
BandRect* band = nsnull;
|
||||
|
@ -1314,23 +1314,23 @@ nsSpaceManager::GuessBandWithTopAbove(nscoord aYOffset) const
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FrameInfo
|
||||
|
||||
nsSpaceManager::FrameInfo::FrameInfo(nsIFrame* aFrame, const nsRect& aRect)
|
||||
nsFloatManager::FrameInfo::FrameInfo(nsIFrame* aFrame, const nsRect& aRect)
|
||||
: mFrame(aFrame), mRect(aRect), mNext(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsSpaceManager::FrameInfo);
|
||||
MOZ_COUNT_CTOR(nsFloatManager::FrameInfo);
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
nsSpaceManager::FrameInfo::~FrameInfo()
|
||||
nsFloatManager::FrameInfo::~FrameInfo()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsSpaceManager::FrameInfo);
|
||||
MOZ_COUNT_DTOR(nsFloatManager::FrameInfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BandRect
|
||||
|
||||
nsSpaceManager::BandRect::BandRect(nscoord aLeft,
|
||||
nsFloatManager::BandRect::BandRect(nscoord aLeft,
|
||||
nscoord aTop,
|
||||
nscoord aRight,
|
||||
nscoord aBottom,
|
||||
|
@ -1344,7 +1344,7 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft,
|
|||
AddFrame(aFrame);
|
||||
}
|
||||
|
||||
nsSpaceManager::BandRect::BandRect(nscoord aLeft,
|
||||
nsFloatManager::BandRect::BandRect(nscoord aLeft,
|
||||
nscoord aTop,
|
||||
nscoord aRight,
|
||||
nscoord aBottom,
|
||||
|
@ -1358,13 +1358,13 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft,
|
|||
mFrames = aFrames;
|
||||
}
|
||||
|
||||
nsSpaceManager::BandRect::~BandRect()
|
||||
nsFloatManager::BandRect::~BandRect()
|
||||
{
|
||||
MOZ_COUNT_DTOR(BandRect);
|
||||
}
|
||||
|
||||
nsSpaceManager::BandRect*
|
||||
nsSpaceManager::BandRect::SplitVertically(nscoord aBottom)
|
||||
nsFloatManager::BandRect*
|
||||
nsFloatManager::BandRect::SplitVertically(nscoord aBottom)
|
||||
{
|
||||
NS_PRECONDITION((aBottom > mTop) && (aBottom < mBottom), "bad argument");
|
||||
|
||||
|
@ -1376,8 +1376,8 @@ nsSpaceManager::BandRect::SplitVertically(nscoord aBottom)
|
|||
return bottomBandRect;
|
||||
}
|
||||
|
||||
nsSpaceManager::BandRect*
|
||||
nsSpaceManager::BandRect::SplitHorizontally(nscoord aRight)
|
||||
nsFloatManager::BandRect*
|
||||
nsFloatManager::BandRect::SplitHorizontally(nscoord aRight)
|
||||
{
|
||||
NS_PRECONDITION((aRight > mLeft) && (aRight < mRight), "bad argument");
|
||||
|
||||
|
@ -1390,7 +1390,7 @@ nsSpaceManager::BandRect::SplitHorizontally(nscoord aRight)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsSpaceManager::BandRect::HasSameFrameList(const BandRect* aBandRect) const
|
||||
nsFloatManager::BandRect::HasSameFrameList(const BandRect* aBandRect) const
|
||||
{
|
||||
const PRInt32 count = mFrames.Count();
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ nsSpaceManager::BandRect::HasSameFrameList(const BandRect* aBandRect) const
|
|||
* including the current band rect
|
||||
*/
|
||||
PRInt32
|
||||
nsSpaceManager::BandRect::Length() const
|
||||
nsFloatManager::BandRect::Length() const
|
||||
{
|
||||
PRInt32 len = 1;
|
||||
BandRect* bandRect = Next();
|
||||
|
@ -1433,17 +1433,17 @@ nsSpaceManager::BandRect::Length() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsAutoSpaceManager::~nsAutoSpaceManager()
|
||||
nsAutoFloatManager::~nsAutoFloatManager()
|
||||
{
|
||||
// Restore the old space manager in the reflow state if necessary.
|
||||
// Restore the old float manager in the reflow state if necessary.
|
||||
if (mNew) {
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
printf("restoring old space manager %p\n", mOld);
|
||||
#ifdef NOISY_FLOATMANAGER
|
||||
printf("restoring old float manager %p\n", mOld);
|
||||
#endif
|
||||
|
||||
mReflowState.mSpaceManager = mOld;
|
||||
mReflowState.mFloatManager = mOld;
|
||||
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
#ifdef NOISY_FLOATMANAGER
|
||||
if (mOld) {
|
||||
static_cast<nsFrame *>(mReflowState.frame)->ListTag(stdout);
|
||||
printf(": space-manager %p after reflow\n", mOld);
|
||||
|
@ -1456,22 +1456,22 @@ nsAutoSpaceManager::~nsAutoSpaceManager()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsAutoSpaceManager::CreateSpaceManager(nsPresContext *aPresContext)
|
||||
nsAutoFloatManager::CreateFloatManager(nsPresContext *aPresContext)
|
||||
{
|
||||
// Create a new space manager and install it in the reflow
|
||||
// state. `Remember' the old space manager so we can restore it
|
||||
// Create a new float manager and install it in the reflow
|
||||
// state. `Remember' the old float manager so we can restore it
|
||||
// later.
|
||||
mNew = new nsSpaceManager(aPresContext->PresShell());
|
||||
mNew = new nsFloatManager(aPresContext->PresShell());
|
||||
if (! mNew)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
printf("constructed new space manager %p (replacing %p)\n",
|
||||
mNew, mReflowState.mSpaceManager);
|
||||
#ifdef NOISY_FLOATMANAGER
|
||||
printf("constructed new float manager %p (replacing %p)\n",
|
||||
mNew, mReflowState.mFloatManager);
|
||||
#endif
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
mOld = mReflowState.mSpaceManager;
|
||||
mReflowState.mSpaceManager = mNew;
|
||||
// Set the float manager in the existing reflow state
|
||||
mOld = mReflowState.mFloatManager;
|
||||
mReflowState.mFloatManager = mNew;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -140,15 +140,15 @@ struct nsBandData {
|
|||
};
|
||||
|
||||
/**
|
||||
* Class for dealing with bands of available space. The space manager
|
||||
* Class for dealing with bands of available space. The float manager
|
||||
* defines a coordinate space (relative to the frame that created the
|
||||
* space manager) with an origin at (0, 0) that grows down and to the
|
||||
* float manager) with an origin at (0, 0) that grows down and to the
|
||||
* right.
|
||||
*/
|
||||
class nsSpaceManager {
|
||||
class nsFloatManager {
|
||||
public:
|
||||
nsSpaceManager(nsIPresShell* aPresShell);
|
||||
~nsSpaceManager();
|
||||
nsFloatManager(nsIPresShell* aPresShell);
|
||||
~nsFloatManager();
|
||||
|
||||
void* operator new(size_t aSize) CPP_THROW_NEW;
|
||||
void operator delete(void* aPtr, size_t aSize);
|
||||
|
@ -223,7 +223,7 @@ public:
|
|||
* been added; if there's a frame in the middle of them that should
|
||||
* not be removed, YOU LOSE.
|
||||
*
|
||||
* This can only be done at the end of the life of this space manager. The only
|
||||
* This can only be done at the end of the life of this float manager. The only
|
||||
* methods it is safe to call after this are XMost() and YMost().
|
||||
*/
|
||||
nsresult RemoveTrailingRegions(nsIFrame* aFrameList);
|
||||
|
@ -252,7 +252,7 @@ public:
|
|||
PRPackedBool mHaveCachedLeftYMost;
|
||||
PRPackedBool mHaveCachedRightYMost;
|
||||
|
||||
friend class nsSpaceManager;
|
||||
friend class nsFloatManager;
|
||||
};
|
||||
|
||||
PRBool HasAnyFloats() { return mFrameInfoMap != nsnull; }
|
||||
|
@ -277,12 +277,12 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Saves the current state of the space manager into aState.
|
||||
* Saves the current state of the float manager into aState.
|
||||
*/
|
||||
void PushState(SavedState* aState);
|
||||
|
||||
/**
|
||||
* Restores the space manager to the saved state.
|
||||
* Restores the float manager to the saved state.
|
||||
*
|
||||
* These states must be managed using stack discipline. PopState can only
|
||||
* be used after PushState has been used to save the state, and it can only
|
||||
|
@ -292,7 +292,7 @@ public:
|
|||
void PopState(SavedState* aState);
|
||||
|
||||
/**
|
||||
* Get the top of the last region placed into the space manager, to
|
||||
* Get the top of the last region placed into the float manager, to
|
||||
* enforce the rule that a float can't be above an earlier float.
|
||||
* Returns the minimum nscoord value if there are no regions.
|
||||
*/
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
|
||||
/**
|
||||
* Return the coordinate of the lowest float matching aBreakType in this
|
||||
* space manager. Returns aY if there are no matching floats.
|
||||
* float manager. Returns aY if there are no matching floats.
|
||||
*/
|
||||
nscoord ClearFloats(nscoord aY, PRUint8 aBreakType);
|
||||
|
||||
|
@ -452,39 +452,39 @@ protected:
|
|||
|
||||
|
||||
private:
|
||||
static PRInt32 sCachedSpaceManagerCount;
|
||||
static void* sCachedSpaceManagers[NS_SPACE_MANAGER_CACHE_SIZE];
|
||||
static PRInt32 sCachedFloatManagerCount;
|
||||
static void* sCachedFloatManagers[NS_SPACE_MANAGER_CACHE_SIZE];
|
||||
|
||||
nsSpaceManager(const nsSpaceManager&); // no implementation
|
||||
void operator=(const nsSpaceManager&); // no implementation
|
||||
nsFloatManager(const nsFloatManager&); // no implementation
|
||||
void operator=(const nsFloatManager&); // no implementation
|
||||
};
|
||||
|
||||
/**
|
||||
* A helper class to manage maintenance of the space manager during
|
||||
* A helper class to manage maintenance of the float manager during
|
||||
* nsBlockFrame::Reflow. It automatically restores the old space
|
||||
* manager in the reflow state when the object goes out of scope.
|
||||
*/
|
||||
class nsAutoSpaceManager {
|
||||
class nsAutoFloatManager {
|
||||
public:
|
||||
nsAutoSpaceManager(nsHTMLReflowState& aReflowState)
|
||||
nsAutoFloatManager(nsHTMLReflowState& aReflowState)
|
||||
: mReflowState(aReflowState),
|
||||
mNew(nsnull),
|
||||
mOld(nsnull) {}
|
||||
|
||||
~nsAutoSpaceManager();
|
||||
~nsAutoFloatManager();
|
||||
|
||||
/**
|
||||
* Create a new space manager for the specified frame. This will
|
||||
* `remember' the old space manager, and install the new space
|
||||
* Create a new float manager for the specified frame. This will
|
||||
* `remember' the old float manager, and install the new space
|
||||
* manager in the reflow state.
|
||||
*/
|
||||
nsresult
|
||||
CreateSpaceManager(nsPresContext *aPresContext);
|
||||
CreateFloatManager(nsPresContext *aPresContext);
|
||||
|
||||
protected:
|
||||
nsHTMLReflowState &mReflowState;
|
||||
nsSpaceManager *mNew;
|
||||
nsSpaceManager *mOld;
|
||||
nsFloatManager *mNew;
|
||||
nsFloatManager *mOld;
|
||||
};
|
||||
|
||||
#endif /* nsSpaceManager_h___ */
|
||||
|
|
|
@ -454,9 +454,9 @@ public:
|
|||
|
||||
protected:
|
||||
nsMathMLmathBlockFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {
|
||||
// We should always have a space manager. Not that things can really try
|
||||
// We should always have a float manager. Not that things can really try
|
||||
// to float out of us anyway, but we need one for line layout.
|
||||
AddStateBits(NS_BLOCK_SPACE_MGR);
|
||||
AddStateBits(NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
virtual ~nsMathMLmathBlockFrame() {}
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ nsTableCaptionFrame::nsTableCaptionFrame(nsStyleContext* aContext):
|
|||
nsBlockFrame(aContext)
|
||||
{
|
||||
// shrink wrap
|
||||
SetFlags(NS_BLOCK_SPACE_MGR);
|
||||
SetFlags(NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
|
||||
nsTableCaptionFrame::~nsTableCaptionFrame()
|
||||
|
|
Загрузка…
Ссылка в новой задаче