Bug 1319672 Part 2 - Check the line direction is not changed.
Since the line direction affects the interpretation of float right or left,
we should check aWM has the same line direction as mWritingMode. And this
also guarantees that float added by AddFloat() has the same line direction
as when querying the available space via GetFlowArea().
MozReview-Commit-ID: FGxVFbo910g
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -111,27 +111,28 @@ void nsFloatManager::Shutdown()
if (floatManager)
free(floatManager);
}
// Disable further caching.
sCachedFloatManagerCount = -1;
}
-#define CHECK_BLOCK_DIR(aWM) \
- NS_ASSERTION((aWM).GetBlockDir() == mWritingMode.GetBlockDir(), \
- "incompatible writing modes")
+#define CHECK_BLOCK_AND_LINE_DIR(aWM) \
+ NS_ASSERTION((aWM).GetBlockDir() == mWritingMode.GetBlockDir() && \
+ (aWM).IsLineInverted() == mWritingMode.IsLineInverted(), \
+ "incompatible writing modes")
nsFlowAreaRect
nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBCoord, nscoord aBSize,
BandInfoType aBandInfoType, ShapeType aShapeType,
LogicalRect aContentArea, SavedState* aState,
const nsSize& aContainerSize) const
{
- CHECK_BLOCK_DIR(aWM);
+ CHECK_BLOCK_AND_LINE_DIR(aWM);
NS_ASSERTION(aBSize >= 0, "unexpected max block size");
NS_ASSERTION(aContentArea.ISize(aWM) >= 0,
"unexpected content area inline size");
nscoord blockStart = aBCoord + mBlockStart;
if (blockStart < nscoord_MIN) {
NS_WARNING("bad value");
blockStart = nscoord_MIN;
@@ -259,17 +260,17 @@ nsFloatManager::GetFlowArea(WritingMode
return nsFlowAreaRect(aWM, inlineStart, blockStart - mBlockStart,
lineRight - lineLeft, blockSize, haveFloats);
}
nsresult
nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
WritingMode aWM, const nsSize& aContainerSize)
{
- CHECK_BLOCK_DIR(aWM);
+ CHECK_BLOCK_AND_LINE_DIR(aWM);
NS_ASSERTION(aMarginRect.ISize(aWM) >= 0, "negative inline size!");
NS_ASSERTION(aMarginRect.BSize(aWM) >= 0, "negative block size!");
FloatInfo info(aFloatFrame, mLineLeft, mBlockStart, aMarginRect, aWM,
aContainerSize);
// Set mLeftBEnd and mRightBEnd.
if (HasAnyFloats()) {