Bug 1143218 patch 1: Back out the fix for bug 1105137, r=jfkthame

This commit is contained in:
Simon Montagu 2015-03-22 11:44:48 +02:00
Родитель 28b9e2ff78
Коммит 4454a1b4b5
6 изменённых файлов: 50 добавлений и 47 удалений

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

@ -1943,12 +1943,12 @@ nsBlockFrame::PropagateFloatDamage(nsBlockReflowState& aState,
// "Translate" the float manager with an offset of (0, 0) in order to
// set the origin to our writing mode
LogicalPoint oPt(wm);
WritingMode oldWM = floatManager->Translate(wm, oPt);
WritingMode oldWM = floatManager->Translate(wm, oPt, containerWidth);
bool isDirty = floatManager->IntersectsDamage(wm, lineBCoordBefore,
lineBCoordAfter) ||
floatManager->IntersectsDamage(wm, lineBCoordCombinedBefore,
lineBCoordCombinedAfter);
floatManager->Untranslate(oldWM, oPt);
floatManager->Untranslate(oldWM, oPt, containerWidth);
if (isDirty) {
aLine->MarkDirty();
return;
@ -6211,9 +6211,9 @@ nsBlockFrame::RecoverFloatsFor(nsIFrame* aFrame,
// accordingly so that we consider relatively positioned frames
// at their original position.
LogicalPoint pos = block->GetLogicalNormalPosition(aWM, aContainerWidth);
WritingMode oldWM = aFloatManager.Translate(aWM, pos);
WritingMode oldWM = aFloatManager.Translate(aWM, pos, aContainerWidth);
block->RecoverFloats(aFloatManager, aWM, aContainerWidth);
aFloatManager.Untranslate(oldWM, pos);
aFloatManager.Untranslate(oldWM, pos, aContainerWidth);
}
}

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

@ -284,10 +284,11 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
mMetrics.BSize(mWritingMode) = nscoord(0xdeadbeef);
#endif
WritingMode oldWM = mOuterReflowState.mFloatManager->Translate(mWritingMode,
tPt);
WritingMode oldWM =
mOuterReflowState.mFloatManager->Translate(mWritingMode, tPt,
mContainerWidth);
mFrame->Reflow(mPresContext, mMetrics, aFrameRS, aFrameReflowStatus);
mOuterReflowState.mFloatManager->Untranslate(oldWM, tPt);
mOuterReflowState.mFloatManager->Untranslate(oldWM, tPt, mContainerWidth);
#ifdef DEBUG
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {

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

@ -472,7 +472,7 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
// "Translate" the float manager with an offset of (0, 0) in order to
// set the origin to our writing mode
LogicalPoint oPt(wm);
WritingMode oldWM = mFloatManager->Translate(wm, oPt);
WritingMode oldWM = mFloatManager->Translate(wm, oPt, ContainerWidth());
if (aLine->HasFloats()) {
// Place the floats into the space-manager again. Also slide
// them, just like the regular frames on the line.
@ -512,7 +512,7 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *mFloatManager, wm,
ContainerWidth());
}
mFloatManager->Untranslate(oldWM, oPt);
mFloatManager->Untranslate(oldWM, oPt, ContainerWidth());
}
/**
@ -711,7 +711,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// "Translate" the float manager with an offset of (0, 0) in order to
// set the origin to our writing mode
LogicalPoint oPt(wm);
WritingMode oldWM = mFloatManager->Translate(wm, oPt);
WritingMode oldWM = mFloatManager->Translate(wm, oPt, ContainerWidth());
mBCoord = std::max(mFloatManager->GetLowestFloatTop(wm, ContainerWidth()),
mBCoord);
@ -1001,7 +1001,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
}
#endif
mFloatManager->Untranslate(oldWM, oPt);
mFloatManager->Untranslate(oldWM, oPt, ContainerWidth());
return true;
}

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

@ -40,7 +40,7 @@ PSArenaFreeCB(size_t aSize, void* aPtr, void* aClosure)
nsFloatManager::nsFloatManager(nsIPresShell* aPresShell,
mozilla::WritingMode aWM)
: mWritingMode(aWM),
mOffset(aWM),
mOrigin(aWM),
mFloatDamage(PSArenaAllocCB, PSArenaFreeCB, aPresShell),
mPushedLeftFloatPastBreak(false),
mPushedRightFloatPastBreak(false),
@ -121,8 +121,8 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
NS_ASSERTION(aContentArea.ISize(aWM) >= 0,
"unexpected content area inline size");
LogicalPoint offset = mOffset.ConvertTo(aWM, mWritingMode, 0);
nscoord blockStart = aBOffset + offset.B(aWM);
LogicalPoint origin = mOrigin.ConvertTo(aWM, mWritingMode, aContainerWidth);
nscoord blockStart = aBOffset + origin.B(aWM);
if (blockStart < nscoord_MIN) {
NS_WARNING("bad value");
blockStart = nscoord_MIN;
@ -162,8 +162,8 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
blockEnd = nscoord_MAX;
}
}
nscoord inlineStart = offset.I(aWM) + aContentArea.IStart(aWM);
nscoord inlineEnd = offset.I(aWM) + aContentArea.IEnd(aWM);
nscoord inlineStart = origin.I(aWM) + aContentArea.IStart(aWM);
nscoord inlineEnd = origin.I(aWM) + aContentArea.IEnd(aWM);
if (inlineEnd < inlineStart) {
NS_WARNING("bad value");
inlineEnd = inlineStart;
@ -238,7 +238,7 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
nscoord blockSize = (blockEnd == nscoord_MAX) ?
nscoord_MAX : (blockEnd - blockStart);
return nsFlowAreaRect(aWM,
inlineStart - offset.I(aWM), blockStart - offset.B(aWM),
inlineStart - origin.I(aWM), blockStart - origin.B(aWM),
inlineEnd - inlineStart, blockSize, haveFloats);
}
@ -249,7 +249,7 @@ nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
NS_ASSERTION(aMarginRect.ISize(aWM) >= 0, "negative inline size!");
NS_ASSERTION(aMarginRect.BSize(aWM) >= 0, "negative block size!");
FloatInfo info(aFloatFrame, aWM, aMarginRect + mOffset);
FloatInfo info(aFloatFrame, aWM, aMarginRect + mOrigin);
// Set mLeftBEnd and mRightBEnd.
if (HasAnyFloats()) {
@ -402,7 +402,7 @@ nsFloatManager::PushState(SavedState* aState)
// Allowing mFloatDamage to accumulate the damage incurred during both
// reflows ensures that nothing gets missed.
aState->mWritingMode = mWritingMode;
aState->mOffset = mOffset;
aState->mOrigin = mOrigin;
aState->mPushedLeftFloatPastBreak = mPushedLeftFloatPastBreak;
aState->mPushedRightFloatPastBreak = mPushedRightFloatPastBreak;
aState->mSplitLeftFloatAcrossBreak = mSplitLeftFloatAcrossBreak;
@ -416,7 +416,7 @@ nsFloatManager::PopState(SavedState* aState)
NS_PRECONDITION(aState, "No state to restore?");
mWritingMode = aState->mWritingMode;
mOffset = aState->mOffset;
mOrigin = aState->mOrigin;
mPushedLeftFloatPastBreak = aState->mPushedLeftFloatPastBreak;
mPushedRightFloatPastBreak = aState->mPushedRightFloatPastBreak;
mSplitLeftFloatAcrossBreak = aState->mSplitLeftFloatAcrossBreak;
@ -439,9 +439,9 @@ nsFloatManager::GetLowestFloatTop(WritingMode aWM,
}
FloatInfo fi = mFloats[mFloats.Length() - 1];
LogicalRect rect = fi.mRect.ConvertTo(aWM, fi.mWritingMode, aContainerWidth);
LogicalPoint offset = mOffset.ConvertTo(aWM, mWritingMode, 0);
LogicalPoint origin = mOrigin.ConvertTo(aWM, mWritingMode, aContainerWidth);
return rect.BStart(aWM) - offset.B(aWM);
return rect.BStart(aWM) - origin.B(aWM);
}
#ifdef DEBUG_FRAME_DUMP
@ -483,8 +483,8 @@ nsFloatManager::ClearFloats(WritingMode aWM, nscoord aBCoord,
return aBCoord;
}
LogicalPoint offset = mOffset.ConvertTo(aWM, mWritingMode, 0);
nscoord blockEnd = aBCoord + offset.B(aWM);
LogicalPoint origin = mOrigin.ConvertTo(aWM, mWritingMode, aContainerWidth);
nscoord blockEnd = aBCoord + origin.B(aWM);
const FloatInfo &tail = mFloats[mFloats.Length() - 1];
switch (aBreakType) {
@ -505,7 +505,7 @@ nsFloatManager::ClearFloats(WritingMode aWM, nscoord aBCoord,
break;
}
blockEnd -= offset.B(aWM);
blockEnd -= origin.B(aWM);
return blockEnd;
}

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

@ -88,12 +88,12 @@ public:
struct SavedState {
explicit SavedState(mozilla::WritingMode aWM)
: mWritingMode(aWM)
, mOffset(aWM)
, mOrigin(aWM)
{}
private:
uint32_t mFloatInfoCount;
mozilla::WritingMode mWritingMode;
mozilla::LogicalPoint mOffset;
mozilla::LogicalPoint mOrigin;
bool mPushedLeftFloatPastBreak;
bool mPushedRightFloatPastBreak;
bool mSplitLeftFloatAcrossBreak;
@ -103,37 +103,39 @@ public:
};
/**
* Translate the current offset by the specified (dICoord, dBCoord). This
* Translate the current origin by the specified (dICoord, dBCoord). This
* creates a new local coordinate space relative to the current
* coordinate space.
* @returns previous writing mode
*/
mozilla::WritingMode Translate(mozilla::WritingMode aWM,
mozilla::LogicalPoint aDOffset)
mozilla::LogicalPoint aDOrigin,
nscoord aContainerWidth)
{
mozilla::WritingMode oldWM = mWritingMode;
mOffset = mOffset.ConvertTo(aWM, oldWM, 0);
mOrigin = mOrigin.ConvertTo(aWM, oldWM, aContainerWidth);
mWritingMode = aWM;
mOffset += aDOffset;
mOrigin += aDOrigin;
return oldWM;
}
/*
* Set the translation offset to a specified value instead of
* Set the translation origin to a specified value instead of
* translating by a delta.
*/
void SetTranslation(mozilla::WritingMode aWM,
mozilla::LogicalPoint aOffset)
mozilla::LogicalPoint aOrigin)
{
mWritingMode = aWM;
mOffset = aOffset;
mOrigin = aOrigin;
}
void Untranslate(mozilla::WritingMode aWM,
mozilla::LogicalPoint aDOffset)
mozilla::LogicalPoint aDOrigin,
nscoord aContainerWidth)
{
mOffset -= aDOffset;
mOffset = mOffset.ConvertTo(aWM, mWritingMode, 0);
mOrigin -= aDOrigin;
mOrigin = mOrigin.ConvertTo(aWM, mWritingMode, aContainerWidth);
mWritingMode = aWM;
}
@ -143,10 +145,10 @@ public:
* Translate().
*/
void GetTranslation(mozilla::WritingMode& aWM,
mozilla::LogicalPoint& aOffset) const
mozilla::LogicalPoint& aOrigin) const
{
aWM = mWritingMode;
aOffset = mOffset;
aOrigin = mOrigin;
}
/**
@ -255,15 +257,15 @@ public:
void IncludeInDamage(mozilla::WritingMode aWM,
nscoord aIntervalBegin, nscoord aIntervalEnd)
{
mFloatDamage.IncludeInterval(aIntervalBegin + mOffset.B(aWM),
aIntervalEnd + mOffset.B(aWM));
mFloatDamage.IncludeInterval(aIntervalBegin + mOrigin.B(aWM),
aIntervalEnd + mOrigin.B(aWM));
}
bool IntersectsDamage(mozilla::WritingMode aWM,
nscoord aIntervalBegin, nscoord aIntervalEnd) const
{
return mFloatDamage.Intersects(aIntervalBegin + mOffset.B(aWM),
aIntervalEnd + mOffset.B(aWM));
return mFloatDamage.Intersects(aIntervalBegin + mOrigin.B(aWM),
aIntervalEnd + mOrigin.B(aWM));
}
/**
@ -318,7 +320,7 @@ public:
void AssertStateMatches(SavedState *aState) const
{
NS_ASSERTION(aState->mWritingMode == mWritingMode &&
aState->mOffset == mOffset &&
aState->mOrigin == mOrigin &&
aState->mPushedLeftFloatPastBreak ==
mPushedLeftFloatPastBreak &&
aState->mPushedRightFloatPastBreak ==
@ -357,7 +359,7 @@ private:
};
mozilla::WritingMode mWritingMode;
mozilla::LogicalPoint mOffset; // translation from local to global
mozilla::LogicalPoint mOrigin; // translation from local to global
// coordinate space
nsTArray<FloatInfo> mFloats;

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

@ -943,7 +943,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
metrics.BSize(lineWM) = nscoord(0xdeadbeef);
#endif
LogicalPoint tPt = pfd->mBounds.Origin(lineWM);
WritingMode oldWM = mFloatManager->Translate(lineWM, tPt);
WritingMode oldWM = mFloatManager->Translate(lineWM, tPt, ContainerWidth());
int32_t savedOptionalBreakOffset;
gfxBreakPriority savedOptionalBreakPriority;
@ -1029,7 +1029,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
pfd->mIsEmpty = isEmpty;
mFloatManager->Untranslate(oldWM, tPt);
mFloatManager->Untranslate(oldWM, tPt, ContainerWidth());
NS_ASSERTION(metrics.ISize(lineWM) >= 0, "bad inline size");
NS_ASSERTION(metrics.BSize(lineWM) >= 0,"bad block size");