Bug 312777. Don't insert negative-width rects into the space manager; correct negative-margin-box floats, preserving the right edge of left floats and the left edge of right floats. r+sr=dbaron,a=mtschrep

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@184045 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2005-11-02 19:52:37 +00:00
parent 520c144e98
commit 0a40ee138f
3 changed files with 27 additions and 4 deletions

View File

@@ -983,6 +983,20 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
}
nsRect region(floatX, floatY, floatSize.width, floatSize.height);
// Don't send rectangles with negative margin-box width or height to
// the space manager; it can't deal with them.
if (region.width < 0) {
// Preserve the right margin-edge for left floats and the left
// margin-edge for right floats
if (isLeftFloat) {
region.x = region.XMost();
}
region.width = 0;
}
if (region.height < 0) {
region.height = 0;
}
#ifdef DEBUG
nsresult rv =
#endif
@@ -1022,8 +1036,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
// Set the origin of the float frame, in frame coordinates. These
// coordinates are <b>not</b> relative to the spacemanager
// translation, therefore we have to factor in our border/padding.
nscoord x = borderPadding.left + aFloatCache->mMargins.left + region.x;
nscoord y = borderPadding.top + aFloatCache->mMargins.top + region.y;
nscoord x = borderPadding.left + aFloatCache->mMargins.left + floatX;
nscoord y = borderPadding.top + aFloatCache->mMargins.top + floatY;
// If float is relatively positioned, factor that in as well
// XXXldb Should this be done after handling the combined area