Bug 1309467 Part 2 - Convert BandInfoType to an enum class.
Also exchange the order of the second argument |aBSize| and the third
argument |aBandInfo| for GetFlowArea() so that aBCoord and aBSize are
grouped together. And it'll be prettier to add ShapeInfo behind BandInfo
in later part.
MozReview-Commit-ID: cusdomjUyu
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -340,19 +340,19 @@ BlockReflowInput::GetFloatAvailableSpace
NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
"bad coord system");
#endif
nscoord blockSize = (mContentArea.BSize(wm) == nscoord_MAX)
? nscoord_MAX : std::max(mContentArea.BEnd(wm) - aBCoord, 0);
nsFlowAreaRect result =
- mFloatManager->GetFlowArea(wm, aBCoord, nsFloatManager::BAND_FROM_POINT,
- blockSize, mContentArea, aState,
- ContainerSize());
+ mFloatManager->GetFlowArea(wm, aBCoord, blockSize,
+ nsFloatManager::BandInfoType::BandFromPoint,
+ mContentArea, aState, ContainerSize());
// Keep the inline size >= 0 for compatibility with nsSpaceManager.
if (result.mRect.ISize(wm) < 0) {
result.mRect.ISize(wm) = 0;
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
@@ -374,18 +374,19 @@ BlockReflowInput::GetFloatAvailableSpace
// Verify that the caller setup the coordinate system properly
nscoord wI, wB;
mFloatManager->GetTranslation(wI, wB);
NS_ASSERTION((wI == mFloatManagerI) && (wB == mFloatManagerB),
"bad coord system");
#endif
nsFlowAreaRect result =
- mFloatManager->GetFlowArea(wm, aBCoord, nsFloatManager::WIDTH_WITHIN_HEIGHT,
- aBSize, mContentArea, aState, ContainerSize());
+ mFloatManager->GetFlowArea(wm, aBCoord, aBSize,
+ nsFloatManager::BandInfoType::WidthWithinHeight,
+ mContentArea, aState, ContainerSize());
// Keep the width >= 0 for compatibility with nsSpaceManager.
if (result.mRect.ISize(wm) < 0) {
result.mRect.ISize(wm) = 0;
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -116,18 +116,18 @@ void nsFloatManager::Shutdown()
sCachedFloatManagerCount = -1;
}
#define CHECK_BLOCK_DIR(aWM) \
NS_ASSERTION((aWM).GetBlockDir() == mWritingMode.GetBlockDir(), \
"incompatible writing modes")
nsFlowAreaRect
-nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBCoord,
- BandInfoType aInfoType, nscoord aBSize,
+nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBCoord, nscoord aBSize,
+ BandInfoType aBandInfoType,
LogicalRect aContentArea, SavedState* aState,
const nsSize& aContainerSize) const
{
CHECK_BLOCK_DIR(aWM);
NS_ASSERTION(aBSize >= 0, "unexpected max block size");
NS_ASSERTION(aContentArea.ISize(aWM) >= 0,
"unexpected content area inline size");
@@ -156,17 +156,17 @@ nsFloatManager::GetFlowArea(WritingMode
return nsFlowAreaRect(aWM, aContentArea.IStart(aWM), aBCoord,
aContentArea.ISize(aWM), aBSize, false);
}
nscoord blockEnd;
if (aBSize == nscoord_MAX) {
// This warning (and the two below) are possible to hit on pages
// with really large objects.
- NS_WARNING_ASSERTION(aInfoType == BAND_FROM_POINT, "bad height");
+ NS_WARNING_ASSERTION(aBandInfoType == BandInfoType::BandFromPoint, "bad height");
blockEnd = nscoord_MAX;
} else {
blockEnd = blockStart + aBSize;
if (blockEnd < blockStart || blockEnd > nscoord_MAX) {
NS_WARNING("bad value");
blockEnd = nscoord_MAX;
}
}
@@ -190,34 +190,34 @@ nsFloatManager::GetFlowArea(WritingMode
// For compatibility, ignore floats with empty rects, even though it
// disagrees with the spec. (We might want to fix this in the
// future, though.)
continue;
}
nscoord floatBStart = fi.BStart();
nscoord floatBEnd = fi.BEnd();
- if (blockStart < floatBStart && aInfoType == BAND_FROM_POINT) {
+ if (blockStart < floatBStart && aBandInfoType == BandInfoType::BandFromPoint) {
// This float is below our band. Shrink our band's height if needed.
if (floatBStart < blockEnd) {
blockEnd = floatBStart;
}
}
- // If blockStart == blockEnd (which happens only with WIDTH_WITHIN_HEIGHT),
+ // If blockStart == blockEnd (which happens only with WidthWithinHeight),
// we include floats that begin at our 0-height vertical area. We
- // need to to this to satisfy the invariant that a
- // WIDTH_WITHIN_HEIGHT call is at least as narrow on both sides as a
- // BAND_WITHIN_POINT call beginning at its blockStart.
+ // need to do this to satisfy the invariant that a
+ // WidthWithinHeight call is at least as narrow on both sides as a
+ // BandFromPoint call beginning at its blockStart.
else if (blockStart < floatBEnd &&
(floatBStart < blockEnd ||
(floatBStart == blockEnd && blockStart == blockEnd))) {
// This float is in our band.
// Shrink our band's height if needed.
- if (floatBEnd < blockEnd && aInfoType == BAND_FROM_POINT) {
+ if (floatBEnd < blockEnd && aBandInfoType == BandInfoType::BandFromPoint) {
blockEnd = floatBEnd;
}
// Shrink our band's width if needed.
StyleFloat floatStyle = fi.mFrame->StyleDisplay()->PhysicalFloats(aWM);
if (floatStyle == StyleFloat::Left) {
// A left float
nscoord lineRightEdge = fi.LineRight();
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -119,27 +119,27 @@ public:
{
aLineLeft = mLineLeft;
aBlockStart = mBlockStart;
}
/**
* Get information about the area available to content that flows
* around floats. Two different types of space can be requested:
- * BAND_FROM_POINT: returns the band containing block-dir coordinate
+ * BandFromPoint: returns the band containing block-dir coordinate
* |aBCoord| (though actually with the top truncated to begin at
* aBCoord), but up to at most |aBSize| (which may be nscoord_MAX).
* This will return the tallest rectangle whose block start is
* |aBCoord| and in which there are no changes in what floats are
* on the sides of that rectangle, but will limit the block size
* of the rectangle to |aBSize|. The inline start and end edges
* of the rectangle give the area available for line boxes in that
* space. The inline size of this resulting rectangle will not be
* negative.
- * WIDTH_WITHIN_HEIGHT: This returns a rectangle whose block start
+ * WidthWithinHeight: This returns a rectangle whose block start
* is aBCoord and whose block size is exactly aBSize. Its inline
* start and end edges give the corresponding edges of the space
* that can be used for line boxes *throughout* that space. (It
* is possible that more inline space could be used in part of the
* space if a float begins or ends in it.) The inline size of the
* resulting rectangle can be negative.
*
* @param aBCoord [in] block-dir coordinate for block start of
@@ -154,20 +154,21 @@ public:
* extend beyond aContentArea's inline bounds, but may be
* narrower when floats are present.
* mBandHasFloats is whether there are floats at the sides of the
* return value including those that do not reduce the line box
* inline size at all (because they are entirely in the margins)
*
* aBCoord and aAvailSpace are positioned relative to the current translation
*/
- enum BandInfoType { BAND_FROM_POINT, WIDTH_WITHIN_HEIGHT };
+ enum class BandInfoType { BandFromPoint, WidthWithinHeight };
nsFlowAreaRect GetFlowArea(mozilla::WritingMode aWM,
- nscoord aBCoord, BandInfoType aInfoType,
- nscoord aBSize, mozilla::LogicalRect aContentArea,
+ nscoord aBCoord, nscoord aBSize,
+ BandInfoType aBandInfoType,
+ mozilla::LogicalRect aContentArea,
SavedState* aState,
const nsSize& aContainerSize) const;
/**
* Add a float that comes after all floats previously added. Its
* block start must be even with or below the top of all previous
* floats.
*