зеркало из https://github.com/mozilla/pjs.git
Remember the lowest floater top for CSS2 9.5.1 rule 5 (a float cannot be higher than earlier floats) on the space manager rather than the block reflow state so that it works across blocks sharing the same space manager. Save and restore it in the space manager's PushState and PopState to fix incremental reflow bug (177331). b=196919 r+sr=roc+moz Change PRIntn to PRInt32. b=115153 r+sr=bzbarsky
This commit is contained in:
Родитель
53de0d9911
Коммит
62f2b8c3bd
|
@ -107,6 +107,7 @@ MOZ_DECL_CTOR_COUNTER(nsSpaceManager)
|
|||
nsSpaceManager::nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame)
|
||||
: mFrame(aFrame),
|
||||
mXMost(0),
|
||||
mLowestTop(NSCOORD_MIN),
|
||||
mFloatDamage(PSArenaAllocCB, PSArenaFreeCB, aPresShell)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsSpaceManager);
|
||||
|
@ -817,6 +818,9 @@ nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
|||
if (xmost > mXMost)
|
||||
mXMost = xmost;
|
||||
|
||||
if (rect.y > mLowestTop)
|
||||
mLowestTop = rect.y;
|
||||
|
||||
// Create a frame info structure
|
||||
frameInfo = CreateFrameInfo(aFrame, rect);
|
||||
if (nsnull == frameInfo) {
|
||||
|
@ -840,58 +844,6 @@ nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge)
|
||||
{
|
||||
// Get the frame info associated with with aFrame
|
||||
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
|
||||
|
||||
if (nsnull == frameInfo) {
|
||||
NS_WARNING("no region associated with aFrame");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Compute new rect
|
||||
nsRect rect(frameInfo->mRect);
|
||||
rect.SizeBy(aDeltaWidth, aDeltaHeight);
|
||||
if (aEdge == LeftEdge) {
|
||||
rect.x += aDeltaWidth;
|
||||
}
|
||||
|
||||
// For the time being just remove it and add it back in. Because
|
||||
// AddRectRegion() operates relative to the local coordinate space,
|
||||
// translate from world coordinates to the local coordinate space
|
||||
rect.MoveBy(-mX, -mY);
|
||||
RemoveRegion(aFrame);
|
||||
return AddRectRegion(aFrame, rect);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::OffsetRegion(nsIFrame* aFrame, nscoord aDx, nscoord aDy)
|
||||
{
|
||||
// Get the frame info associated with with aFrame
|
||||
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
|
||||
|
||||
if (nsnull == frameInfo) {
|
||||
NS_WARNING("no region associated with aFrame");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Compute new rect
|
||||
nsRect rect(frameInfo->mRect);
|
||||
rect.MoveBy(aDx, aDy);
|
||||
|
||||
// For the time being just remove it and add it back in. Because
|
||||
// AddRectRegion() operates relative to the local coordinate space,
|
||||
// translate from world coordinates to the local coordinate space
|
||||
rect.MoveBy(-mX, -mY);
|
||||
RemoveRegion(aFrame);
|
||||
return AddRectRegion(aFrame, rect);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::RemoveRegion(nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -1038,6 +990,7 @@ nsSpaceManager::PushState()
|
|||
state->mX = mX;
|
||||
state->mY = mY;
|
||||
state->mXMost = mXMost;
|
||||
state->mLowestTop = mLowestTop;
|
||||
|
||||
if (mFrameInfoMap) {
|
||||
state->mLastFrame = mFrameInfoMap->mFrame;
|
||||
|
@ -1082,6 +1035,7 @@ nsSpaceManager::PopState()
|
|||
mX = mSavedStates->mX;
|
||||
mY = mSavedStates->mY;
|
||||
mXMost = mSavedStates->mXMost;
|
||||
mLowestTop = mSavedStates->mLowestTop;
|
||||
|
||||
// Now that we've restored our state, pop the topmost
|
||||
// state and delete it.
|
||||
|
@ -1091,6 +1045,14 @@ nsSpaceManager::PopState()
|
|||
delete state;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsSpaceManager::GetLowestRegionTop()
|
||||
{
|
||||
if (mLowestTop == NSCOORD_MIN)
|
||||
return mLowestTop;
|
||||
return mLowestTop - mY;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
DebugListSpaceManager(nsSpaceManager *aSpaceManager)
|
||||
|
|
|
@ -249,36 +249,16 @@ public:
|
|||
nsresult AddRectRegion(nsIFrame* aFrame,
|
||||
const nsRect& aUnavailableSpace);
|
||||
|
||||
/**
|
||||
* Resize the rectangular region associated with aFrame by the specified
|
||||
* deltas. The height change always applies to the bottom edge or the existing
|
||||
* rect. You specify whether the width change applies to the left or right edge
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
enum AffectedEdge {LeftEdge, RightEdge};
|
||||
nsresult ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge = RightEdge);
|
||||
|
||||
/**
|
||||
* Offset the region associated with aFrame by the specified amount.
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
nsresult OffsetRegion(nsIFrame* aFrame, nscoord dx, nscoord dy);
|
||||
|
||||
/**
|
||||
* Remove the region associated with aFrane.
|
||||
*
|
||||
* Returns NS_OK if successful and NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
protected: /* doesn't work in the general case */
|
||||
nsresult RemoveRegion(nsIFrame* aFrame);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Clears the list of regions representing the unavailable space.
|
||||
*/
|
||||
|
@ -314,6 +294,13 @@ public:
|
|||
*/
|
||||
void PopState();
|
||||
|
||||
/**
|
||||
* Get the top of the last region placed into the space 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.
|
||||
*/
|
||||
nscoord GetLowestRegionTop();
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Dump the state of the spacemanager out to a file
|
||||
|
@ -341,6 +328,7 @@ protected:
|
|||
nscoord mX, mY;
|
||||
nsIFrame *mLastFrame;
|
||||
nscoord mXMost;
|
||||
nscoord mLowestTop;
|
||||
SpaceManagerState *mNext;
|
||||
|
||||
SpaceManagerState() : mX(0), mY(0), mLastFrame(nsnull), mNext(nsnull) {}
|
||||
|
@ -352,7 +340,7 @@ public:
|
|||
struct BandRect : PRCListStr {
|
||||
nscoord mLeft, mTop;
|
||||
nscoord mRight, mBottom;
|
||||
PRIntn mNumFrames; // number of frames occupying this rect
|
||||
PRInt32 mNumFrames; // number of frames occupying this rect
|
||||
union {
|
||||
nsIFrame* mFrame; // single frame occupying the space
|
||||
nsVoidArray* mFrames; // list of frames occupying the space
|
||||
|
@ -416,6 +404,7 @@ protected:
|
|||
nscoord mX, mY; // translation from local to global coordinate space
|
||||
BandList mBandList; // header/sentinel for circular linked list of band rects
|
||||
nscoord mXMost;
|
||||
nscoord mLowestTop; // the lowest *top*
|
||||
FrameInfo* mFrameInfoMap;
|
||||
nsIntervalSet mFloatDamage;
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@ public:
|
|||
PRBool TestAddBandOverlap();
|
||||
PRBool TestAddRectToBand();
|
||||
PRBool TestRemoveRegion();
|
||||
PRBool TestOffsetRegion();
|
||||
PRBool TestResizeRectRegion();
|
||||
PRBool TestGetBandData();
|
||||
|
||||
struct BandInfo {
|
||||
|
@ -643,91 +641,6 @@ PRBool MySpaceManager::TestRemoveRegion()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Test of offseting regions
|
||||
//
|
||||
// This tests the following:
|
||||
// 1. simple test of offseting the one and only band rect
|
||||
PRBool MySpaceManager::TestOffsetRegion()
|
||||
{
|
||||
BandsInfo bandsInfo;
|
||||
BandRect* bandRect;
|
||||
nsresult status;
|
||||
|
||||
// Clear any existing regions
|
||||
ClearRegions();
|
||||
NS_ASSERTION(mBandList.IsEmpty(), "clear regions failed");
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// #1. A simple test of offseting the one and only band rect
|
||||
status = AddRectRegion((nsIFrame*)0x01, nsRect(10, 100, 100, 100));
|
||||
NS_ASSERTION(NS_SUCCEEDED(status), "unexpected status");
|
||||
status = OffsetRegion((nsIFrame*)0x01, 50, 50);
|
||||
NS_ASSERTION(NS_SUCCEEDED(status), "unexpected status");
|
||||
|
||||
// Verify there is one band with one rect
|
||||
GetBandsInfo(bandsInfo);
|
||||
if (bandsInfo.numBands != 1) {
|
||||
printf("TestOffsetRegion: wrong number of bands (#1): %i\n", bandsInfo.numBands);
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (bandsInfo.bands[0].numRects != 1) {
|
||||
printf("TestOffsetRegion: wrong number of rects (#1): %i\n", bandsInfo.bands[0].numRects);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the position
|
||||
bandRect = bandsInfo.bands[0].firstRect;
|
||||
if ((bandRect->mLeft != 60) || (bandRect->mTop != 150)) {
|
||||
printf("TestOffsetRegion: wrong rect origin (#1)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Test of resizing rect regions
|
||||
//
|
||||
// This tests the following:
|
||||
// 1. simple test of resizing the one and only band rect
|
||||
PRBool MySpaceManager::TestResizeRectRegion()
|
||||
{
|
||||
BandsInfo bandsInfo;
|
||||
BandRect* bandRect;
|
||||
nsresult status;
|
||||
|
||||
// Clear any existing regions
|
||||
ClearRegions();
|
||||
NS_ASSERTION(mBandList.IsEmpty(), "clear regions failed");
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// #1. A simple test of resizing the right edge of the one and only band rect
|
||||
status = AddRectRegion((nsIFrame*)0x01, nsRect(10, 100, 100, 100));
|
||||
NS_ASSERTION(NS_SUCCEEDED(status), "unexpected status");
|
||||
status = ResizeRectRegion((nsIFrame*)0x01, 50, 50, nsSpaceManager::RightEdge);
|
||||
NS_ASSERTION(NS_SUCCEEDED(status), "unexpected status");
|
||||
|
||||
// Verify there is one band with one rect
|
||||
GetBandsInfo(bandsInfo);
|
||||
if (bandsInfo.numBands != 1) {
|
||||
printf("TestResizeRectRegion: wrong number of bands (#1): %i\n", bandsInfo.numBands);
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (bandsInfo.bands[0].numRects != 1) {
|
||||
printf("TestResizeRectRegion: wrong number of rects (#1): %i\n", bandsInfo.bands[0].numRects);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the position and size of the rect
|
||||
bandRect = bandsInfo.bands[0].firstRect;
|
||||
if ((bandRect->mLeft != 10) || (bandRect->mTop != 100) ||
|
||||
(bandRect->mRight != 160) || (bandRect->mBottom != 250)) {
|
||||
printf("TestResizeRectRegion: wrong rect shape (#1)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Test of getting the band data
|
||||
PRBool MySpaceManager::TestGetBandData()
|
||||
{
|
||||
|
@ -827,16 +740,6 @@ int main(int argc, char** argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Test offseting regions
|
||||
if (!spaceMgr->TestOffsetRegion()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Test resizing rect regions
|
||||
if (!spaceMgr->TestResizeRectRegion()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Test getting the band data
|
||||
if (!spaceMgr->TestGetBandData()) {
|
||||
return -1;
|
||||
|
|
|
@ -64,7 +64,6 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
: mBlock(aFrame),
|
||||
mPresContext(aPresContext),
|
||||
mReflowState(aReflowState),
|
||||
mLastFloaterY(0),
|
||||
mPrevBottomMargin(),
|
||||
mLineNumber(0),
|
||||
mFlags(0),
|
||||
|
@ -519,7 +518,6 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
}
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, fc->mRegion);
|
||||
mLastFloaterY = fc->mRegion.y;
|
||||
fc = fc->Next();
|
||||
}
|
||||
} else if (aLine->IsBlock()) {
|
||||
|
@ -779,6 +777,8 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
xa = mAvailSpaceRect.XMost() - aFloaterRect.width;
|
||||
|
||||
// In case the floater is too big, don't go past the left edge
|
||||
// XXXldb This seems wrong, but we might want to fix bug 6976
|
||||
// first.
|
||||
if (xa < mAvailSpaceRect.x) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
|
@ -868,10 +868,9 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
floater->GetRect(oldRegion);
|
||||
oldRegion.Inflate(aFloaterCache->mMargins);
|
||||
|
||||
// Advance mY to mLastFloaterY (if it's not past it already) to
|
||||
// enforce 9.5.1 rule [2]; i.e., make sure that a float isn't
|
||||
// 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(mLastFloaterY, mY);
|
||||
mY = NS_MAX(mSpaceManager->GetLowestRegionTop(), mY);
|
||||
|
||||
// See if the floater should clear any preceeding floaters...
|
||||
if (NS_STYLE_CLEAR_NONE != floaterDisplay->mBreakType) {
|
||||
|
@ -1134,9 +1133,6 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
SetFlag(BRS_NEEDRESIZEREFLOW, PR_TRUE);
|
||||
}
|
||||
|
||||
// Remember the y-coordinate of the floater we've just placed
|
||||
mLastFloaterY = mY;
|
||||
|
||||
// Now restore mY
|
||||
mY = saveY;
|
||||
|
||||
|
@ -1160,6 +1156,8 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
|||
{
|
||||
nsFloaterCache* fc = aList.Head();
|
||||
while (fc) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloater,
|
||||
"A cl floater crept into the bcl floater list.");
|
||||
if (!fc->mIsCurrentLineFloater) {
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
|
|
|
@ -184,10 +184,6 @@ public:
|
|||
// The combined area of all floaters placed so far
|
||||
nsRect mFloaterCombinedArea;
|
||||
|
||||
// The y-coordinate of the last floater placed. We keep this around
|
||||
// to enforce 9.5.1 rule [2]
|
||||
nscoord mLastFloaterY;
|
||||
|
||||
nsFloaterCacheFreeList mFloaterCacheFreeList;
|
||||
|
||||
// Previous child. This is used when pulling up a frame to update
|
||||
|
|
|
@ -107,6 +107,7 @@ MOZ_DECL_CTOR_COUNTER(nsSpaceManager)
|
|||
nsSpaceManager::nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame)
|
||||
: mFrame(aFrame),
|
||||
mXMost(0),
|
||||
mLowestTop(NSCOORD_MIN),
|
||||
mFloatDamage(PSArenaAllocCB, PSArenaFreeCB, aPresShell)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsSpaceManager);
|
||||
|
@ -817,6 +818,9 @@ nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
|||
if (xmost > mXMost)
|
||||
mXMost = xmost;
|
||||
|
||||
if (rect.y > mLowestTop)
|
||||
mLowestTop = rect.y;
|
||||
|
||||
// Create a frame info structure
|
||||
frameInfo = CreateFrameInfo(aFrame, rect);
|
||||
if (nsnull == frameInfo) {
|
||||
|
@ -840,58 +844,6 @@ nsSpaceManager::AddRectRegion(nsIFrame* aFrame, const nsRect& aUnavailableSpace)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge)
|
||||
{
|
||||
// Get the frame info associated with with aFrame
|
||||
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
|
||||
|
||||
if (nsnull == frameInfo) {
|
||||
NS_WARNING("no region associated with aFrame");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Compute new rect
|
||||
nsRect rect(frameInfo->mRect);
|
||||
rect.SizeBy(aDeltaWidth, aDeltaHeight);
|
||||
if (aEdge == LeftEdge) {
|
||||
rect.x += aDeltaWidth;
|
||||
}
|
||||
|
||||
// For the time being just remove it and add it back in. Because
|
||||
// AddRectRegion() operates relative to the local coordinate space,
|
||||
// translate from world coordinates to the local coordinate space
|
||||
rect.MoveBy(-mX, -mY);
|
||||
RemoveRegion(aFrame);
|
||||
return AddRectRegion(aFrame, rect);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::OffsetRegion(nsIFrame* aFrame, nscoord aDx, nscoord aDy)
|
||||
{
|
||||
// Get the frame info associated with with aFrame
|
||||
FrameInfo* frameInfo = GetFrameInfoFor(aFrame);
|
||||
|
||||
if (nsnull == frameInfo) {
|
||||
NS_WARNING("no region associated with aFrame");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Compute new rect
|
||||
nsRect rect(frameInfo->mRect);
|
||||
rect.MoveBy(aDx, aDy);
|
||||
|
||||
// For the time being just remove it and add it back in. Because
|
||||
// AddRectRegion() operates relative to the local coordinate space,
|
||||
// translate from world coordinates to the local coordinate space
|
||||
rect.MoveBy(-mX, -mY);
|
||||
RemoveRegion(aFrame);
|
||||
return AddRectRegion(aFrame, rect);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSpaceManager::RemoveRegion(nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -1038,6 +990,7 @@ nsSpaceManager::PushState()
|
|||
state->mX = mX;
|
||||
state->mY = mY;
|
||||
state->mXMost = mXMost;
|
||||
state->mLowestTop = mLowestTop;
|
||||
|
||||
if (mFrameInfoMap) {
|
||||
state->mLastFrame = mFrameInfoMap->mFrame;
|
||||
|
@ -1082,6 +1035,7 @@ nsSpaceManager::PopState()
|
|||
mX = mSavedStates->mX;
|
||||
mY = mSavedStates->mY;
|
||||
mXMost = mSavedStates->mXMost;
|
||||
mLowestTop = mSavedStates->mLowestTop;
|
||||
|
||||
// Now that we've restored our state, pop the topmost
|
||||
// state and delete it.
|
||||
|
@ -1091,6 +1045,14 @@ nsSpaceManager::PopState()
|
|||
delete state;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsSpaceManager::GetLowestRegionTop()
|
||||
{
|
||||
if (mLowestTop == NSCOORD_MIN)
|
||||
return mLowestTop;
|
||||
return mLowestTop - mY;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
DebugListSpaceManager(nsSpaceManager *aSpaceManager)
|
||||
|
|
|
@ -249,36 +249,16 @@ public:
|
|||
nsresult AddRectRegion(nsIFrame* aFrame,
|
||||
const nsRect& aUnavailableSpace);
|
||||
|
||||
/**
|
||||
* Resize the rectangular region associated with aFrame by the specified
|
||||
* deltas. The height change always applies to the bottom edge or the existing
|
||||
* rect. You specify whether the width change applies to the left or right edge
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
enum AffectedEdge {LeftEdge, RightEdge};
|
||||
nsresult ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge = RightEdge);
|
||||
|
||||
/**
|
||||
* Offset the region associated with aFrame by the specified amount.
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
nsresult OffsetRegion(nsIFrame* aFrame, nscoord dx, nscoord dy);
|
||||
|
||||
/**
|
||||
* Remove the region associated with aFrane.
|
||||
*
|
||||
* Returns NS_OK if successful and NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
protected: /* doesn't work in the general case */
|
||||
nsresult RemoveRegion(nsIFrame* aFrame);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Clears the list of regions representing the unavailable space.
|
||||
*/
|
||||
|
@ -314,6 +294,13 @@ public:
|
|||
*/
|
||||
void PopState();
|
||||
|
||||
/**
|
||||
* Get the top of the last region placed into the space 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.
|
||||
*/
|
||||
nscoord GetLowestRegionTop();
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Dump the state of the spacemanager out to a file
|
||||
|
@ -341,6 +328,7 @@ protected:
|
|||
nscoord mX, mY;
|
||||
nsIFrame *mLastFrame;
|
||||
nscoord mXMost;
|
||||
nscoord mLowestTop;
|
||||
SpaceManagerState *mNext;
|
||||
|
||||
SpaceManagerState() : mX(0), mY(0), mLastFrame(nsnull), mNext(nsnull) {}
|
||||
|
@ -352,7 +340,7 @@ public:
|
|||
struct BandRect : PRCListStr {
|
||||
nscoord mLeft, mTop;
|
||||
nscoord mRight, mBottom;
|
||||
PRIntn mNumFrames; // number of frames occupying this rect
|
||||
PRInt32 mNumFrames; // number of frames occupying this rect
|
||||
union {
|
||||
nsIFrame* mFrame; // single frame occupying the space
|
||||
nsVoidArray* mFrames; // list of frames occupying the space
|
||||
|
@ -416,6 +404,7 @@ protected:
|
|||
nscoord mX, mY; // translation from local to global coordinate space
|
||||
BandList mBandList; // header/sentinel for circular linked list of band rects
|
||||
nscoord mXMost;
|
||||
nscoord mLowestTop; // the lowest *top*
|
||||
FrameInfo* mFrameInfoMap;
|
||||
nsIntervalSet mFloatDamage;
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
: mBlock(aFrame),
|
||||
mPresContext(aPresContext),
|
||||
mReflowState(aReflowState),
|
||||
mLastFloaterY(0),
|
||||
mPrevBottomMargin(),
|
||||
mLineNumber(0),
|
||||
mFlags(0),
|
||||
|
@ -519,7 +518,6 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
}
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, fc->mRegion);
|
||||
mLastFloaterY = fc->mRegion.y;
|
||||
fc = fc->Next();
|
||||
}
|
||||
} else if (aLine->IsBlock()) {
|
||||
|
@ -779,6 +777,8 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
xa = mAvailSpaceRect.XMost() - aFloaterRect.width;
|
||||
|
||||
// In case the floater is too big, don't go past the left edge
|
||||
// XXXldb This seems wrong, but we might want to fix bug 6976
|
||||
// first.
|
||||
if (xa < mAvailSpaceRect.x) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
|
@ -868,10 +868,9 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
floater->GetRect(oldRegion);
|
||||
oldRegion.Inflate(aFloaterCache->mMargins);
|
||||
|
||||
// Advance mY to mLastFloaterY (if it's not past it already) to
|
||||
// enforce 9.5.1 rule [2]; i.e., make sure that a float isn't
|
||||
// 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(mLastFloaterY, mY);
|
||||
mY = NS_MAX(mSpaceManager->GetLowestRegionTop(), mY);
|
||||
|
||||
// See if the floater should clear any preceeding floaters...
|
||||
if (NS_STYLE_CLEAR_NONE != floaterDisplay->mBreakType) {
|
||||
|
@ -1134,9 +1133,6 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
SetFlag(BRS_NEEDRESIZEREFLOW, PR_TRUE);
|
||||
}
|
||||
|
||||
// Remember the y-coordinate of the floater we've just placed
|
||||
mLastFloaterY = mY;
|
||||
|
||||
// Now restore mY
|
||||
mY = saveY;
|
||||
|
||||
|
@ -1160,6 +1156,8 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
|||
{
|
||||
nsFloaterCache* fc = aList.Head();
|
||||
while (fc) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloater,
|
||||
"A cl floater crept into the bcl floater list.");
|
||||
if (!fc->mIsCurrentLineFloater) {
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
|
|
|
@ -184,10 +184,6 @@ public:
|
|||
// The combined area of all floaters placed so far
|
||||
nsRect mFloaterCombinedArea;
|
||||
|
||||
// The y-coordinate of the last floater placed. We keep this around
|
||||
// to enforce 9.5.1 rule [2]
|
||||
nscoord mLastFloaterY;
|
||||
|
||||
nsFloaterCacheFreeList mFloaterCacheFreeList;
|
||||
|
||||
// Previous child. This is used when pulling up a frame to update
|
||||
|
|
Загрузка…
Ссылка в новой задаче