Add bit to lines indicating that they may have a placeholder for a float that was pushed to the next line (and bump the child count up to 32 bits). (Bug 563584, patch 24) r=roc

This commit is contained in:
L. David Baron 2010-08-05 21:59:20 -07:00
Родитель 7e4d1acd95
Коммит e8ca3f4e21
4 изменённых файлов: 29 добавлений и 8 удалений

Просмотреть файл

@ -2409,7 +2409,8 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState,
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->InvalidateCachedIsEmpty();
aLine->ClearHadFloatPushed();
// Now that we know what kind of line we have, reflow it
if (aLine->IsBlock()) {
nsRect oldBounds = aLine->mFirstChild->GetRect();
@ -4213,7 +4214,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
if (aState.mBelowCurrentLineFloats.NotEmpty()) {
// Reflow the below-current-line floats, which places on the line's
// float list.
aState.PlaceBelowCurrentLineFloats(aState.mBelowCurrentLineFloats);
aState.PlaceBelowCurrentLineFloats(aState.mBelowCurrentLineFloats, aLine);
aLine->AppendFloats(aState.mBelowCurrentLineFloats);
}

Просмотреть файл

@ -605,6 +605,8 @@ nsBlockReflowState::AddFloat(nsLineLayout* aLineLayout,
aLineLayout->UpdateBand(availSpace, aFloat);
// Record this float in the current-line list
mCurrentLineFloats.Append(mFloatCacheFreeList.Alloc(aFloat));
} else {
(*aLineLayout->GetLine())->SetHadFloatPushed();
}
}
else {
@ -956,7 +958,8 @@ nsBlockReflowState::PushFloatPastBreak(nsIFrame *aFloat)
* Place below-current-line floats.
*/
void
nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList)
nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList,
nsLineBox* aLine)
{
nsFloatCache* fc = aList.Head();
while (fc) {
@ -974,6 +977,7 @@ nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList)
if (!placed) {
aList.Remove(fc);
delete fc;
aLine->SetHadFloatPushed();
}
fc = next;
}

Просмотреть файл

@ -115,7 +115,8 @@ public:
private:
void PushFloatPastBreak(nsIFrame* aFloat);
public:
void PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aFloats);
void PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aFloats,
nsLineBox* aLine);
// Returns the first coordinate >= aY that clears the
// floats indicated by aBreakType and has enough width between floats

Просмотреть файл

@ -174,7 +174,7 @@ protected:
//----------------------------------------------------------------------
#define LINE_MAX_BREAK_TYPE ((1 << 4) - 1)
#define LINE_MAX_CHILD_COUNT ((1 << 20) - 1)
#define LINE_MAX_CHILD_COUNT PR_INT32_MAX
#if NS_STYLE_CLEAR_LAST_VALUE > 15
need to rearrange the mBits bitfield;
@ -330,8 +330,19 @@ public:
PRBool HasBullet() const {
return mFlags.mHasBullet;
}
// mHadFloatPushed bit
void SetHadFloatPushed() {
mFlags.mHadFloatPushed = PR_TRUE;
}
void ClearHadFloatPushed() {
mFlags.mHadFloatPushed = PR_FALSE;
}
PRBool HadFloatPushed() const {
return mFlags.mHadFloatPushed;
}
// mChildCount value
PRInt32 GetChildCount() const {
return (PRInt32) mFlags.mChildCount;
@ -501,9 +512,13 @@ public:
// mHasBullet indicates that this is an inline line whose block's
// bullet is adjacent to this line and non-empty.
PRUint32 mHasBullet : 1;
// Indicates that this line *may* have a placeholder for a float
// that was pushed to a later column or page.
PRUint32 mHadFloatPushed : 1;
PRUint32 mBreakType : 4;
PRUint32 mChildCount : 17;
// FIXME: Move this out of FlagBits
PRUint32 mChildCount;
};
struct ExtraData {