зеркало из https://github.com/mozilla/pjs.git
Fixed two incremental reflow bugs (12890)
This commit is contained in:
Родитель
b4206a6f8f
Коммит
311d2c3974
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
|
@ -159,11 +159,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
|
||||||
if (aApplyTopMargin) {
|
if (aApplyTopMargin) {
|
||||||
// Compute the childs collapsed top margin (its margin collpased
|
// Compute the childs collapsed top margin (its margin collpased
|
||||||
// with its first childs top-margin -- recursively).
|
// with its first childs top-margin -- recursively).
|
||||||
|
topMargin = ComputeCollapsedTopMargin(mPresContext, reflowState);
|
||||||
|
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
||||||
printf(": prevBottomMargin=%d\n", aPrevBottomMargin);
|
printf(": reflowing ");
|
||||||
|
nsFrame::ListTag(stdout, aFrame);
|
||||||
|
printf(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n",
|
||||||
|
aPrevBottomMargin, topMargin,
|
||||||
|
MaxMargin(topMargin, aPrevBottomMargin));
|
||||||
#endif
|
#endif
|
||||||
topMargin = ComputeCollapsedTopMargin(mPresContext, reflowState);
|
|
||||||
|
|
||||||
// Collapse that value with the previous bottom margin to perform
|
// Collapse that value with the previous bottom margin to perform
|
||||||
// the sibling to sibling collaspe.
|
// the sibling to sibling collaspe.
|
||||||
|
@ -345,8 +350,9 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
|
||||||
if ((0 == mMetrics.height) && (0 == mMetrics.mCombinedArea.height)) {
|
if ((0 == mMetrics.height) && (0 == mMetrics.mCombinedArea.height)) {
|
||||||
if (IsHTMLParagraph(mFrame)) {
|
if (IsHTMLParagraph(mFrame)) {
|
||||||
// Special "feature" for HTML compatability - empty paragraphs
|
// Special "feature" for HTML compatability - empty paragraphs
|
||||||
// collapse into nothingness, including their margins.
|
// collapse into nothingness, including their margins. Signal
|
||||||
*aBottomMarginResult = 0;
|
// the special nature here by returning -1.
|
||||||
|
*aBottomMarginResult = -1;
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
printf(" ");
|
printf(" ");
|
||||||
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
||||||
|
|
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
|
@ -159,11 +159,16 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
|
||||||
if (aApplyTopMargin) {
|
if (aApplyTopMargin) {
|
||||||
// Compute the childs collapsed top margin (its margin collpased
|
// Compute the childs collapsed top margin (its margin collpased
|
||||||
// with its first childs top-margin -- recursively).
|
// with its first childs top-margin -- recursively).
|
||||||
|
topMargin = ComputeCollapsedTopMargin(mPresContext, reflowState);
|
||||||
|
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
||||||
printf(": prevBottomMargin=%d\n", aPrevBottomMargin);
|
printf(": reflowing ");
|
||||||
|
nsFrame::ListTag(stdout, aFrame);
|
||||||
|
printf(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n",
|
||||||
|
aPrevBottomMargin, topMargin,
|
||||||
|
MaxMargin(topMargin, aPrevBottomMargin));
|
||||||
#endif
|
#endif
|
||||||
topMargin = ComputeCollapsedTopMargin(mPresContext, reflowState);
|
|
||||||
|
|
||||||
// Collapse that value with the previous bottom margin to perform
|
// Collapse that value with the previous bottom margin to perform
|
||||||
// the sibling to sibling collaspe.
|
// the sibling to sibling collaspe.
|
||||||
|
@ -345,8 +350,9 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
|
||||||
if ((0 == mMetrics.height) && (0 == mMetrics.mCombinedArea.height)) {
|
if ((0 == mMetrics.height) && (0 == mMetrics.mCombinedArea.height)) {
|
||||||
if (IsHTMLParagraph(mFrame)) {
|
if (IsHTMLParagraph(mFrame)) {
|
||||||
// Special "feature" for HTML compatability - empty paragraphs
|
// Special "feature" for HTML compatability - empty paragraphs
|
||||||
// collapse into nothingness, including their margins.
|
// collapse into nothingness, including their margins. Signal
|
||||||
*aBottomMarginResult = 0;
|
// the special nature here by returning -1.
|
||||||
|
*aBottomMarginResult = -1;
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
printf(" ");
|
printf(" ");
|
||||||
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
nsFrame::ListTag(stdout, mOuterReflowState.frame);
|
||||||
|
|
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
|
@ -758,7 +758,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Recover the top and bottom marings for this line
|
// Recover the top and bottom margins for this line
|
||||||
nscoord topMargin, bottomMargin;
|
nscoord topMargin, bottomMargin;
|
||||||
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
RecoverVerticalMargins(aLine, aApplyTopMargin,
|
||||||
&topMargin, &bottomMargin);
|
&topMargin, &bottomMargin);
|
||||||
|
@ -2844,10 +2844,32 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||||
// flow block. Since we just continued the child block frame,
|
// flow block. Since we just continued the child block frame,
|
||||||
// we know that line->mFirstChild is not the last flow block
|
// we know that line->mFirstChild is not the last flow block
|
||||||
// therefore zero out the running margin value.
|
// therefore zero out the running margin value.
|
||||||
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow incomplete, frame=");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d, setting to zero\n",
|
||||||
|
aState.mPrevBottomMargin);
|
||||||
|
#endif
|
||||||
aState.mPrevBottomMargin = 0;
|
aState.mPrevBottomMargin = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aState.mPrevBottomMargin = collapsedBottomMargin;
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
|
ListTag(stdout);
|
||||||
|
printf(": reflow complete for ");
|
||||||
|
nsFrame::ListTag(stdout, frame);
|
||||||
|
printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n",
|
||||||
|
aState.mPrevBottomMargin, collapsedBottomMargin);
|
||||||
|
#endif
|
||||||
|
if (collapsedBottomMargin >= 0) {
|
||||||
|
aState.mPrevBottomMargin = collapsedBottomMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave margin alone: it was a collapsed paragraph that
|
||||||
|
// must not interfere with the running margin calculations
|
||||||
|
// (in other words it should act like an empty line of
|
||||||
|
// whitespace).
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef NOISY_VERTICAL_MARGINS
|
#ifdef NOISY_VERTICAL_MARGINS
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
|
@ -4620,6 +4642,9 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
|
||||||
nsMargin& aMarginResult,
|
nsMargin& aMarginResult,
|
||||||
nsMargin& aComputedOffsetsResult)
|
nsMargin& aComputedOffsetsResult)
|
||||||
{
|
{
|
||||||
|
// XXX update this just
|
||||||
|
aState.GetAvailableSpace();
|
||||||
|
|
||||||
// Reflow the floater. Since floaters are continued we given them an
|
// Reflow the floater. Since floaters are continued we given them an
|
||||||
// unbounded height. Floaters with an auto width are sized to zero
|
// unbounded height. Floaters with an auto width are sized to zero
|
||||||
// according to the css2 spec.
|
// according to the css2 spec.
|
||||||
|
@ -4690,23 +4715,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||||
// Now place the floater immediately if possible. Otherwise stash it
|
// Now place the floater immediately if possible. Otherwise stash it
|
||||||
// away in mPendingFloaters and place it later.
|
// away in mPendingFloaters and place it later.
|
||||||
if (aLineLayout.CanPlaceFloaterNow()) {
|
if (aLineLayout.CanPlaceFloaterNow()) {
|
||||||
|
// Because we are in the middle of reflowing a placeholder frame
|
||||||
|
// within a line (and possibly nested in an inline frame or two
|
||||||
|
// that's a child of our block) we need to restore the space
|
||||||
|
// manager's translation to the space that the block resides in
|
||||||
|
// before placing the floater.
|
||||||
|
nscoord ox, oy;
|
||||||
|
mSpaceManager->GetTranslation(ox, oy);
|
||||||
|
nscoord dx = ox - mSpaceManagerX;
|
||||||
|
nscoord dy = oy - mSpaceManagerY;
|
||||||
|
mSpaceManager->Translate(-dx, -dy);
|
||||||
|
|
||||||
nsRect combinedArea;
|
nsRect combinedArea;
|
||||||
nsMargin floaterMargins;
|
nsMargin floaterMargins;
|
||||||
nsMargin floaterOffsets;
|
nsMargin floaterOffsets;
|
||||||
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
mBlock->ReflowFloater(*this, aPlaceholder, combinedArea, floaterMargins,
|
||||||
floaterOffsets);
|
floaterOffsets);
|
||||||
|
|
||||||
// Because we are in the middle of reflowing a placeholder frame
|
|
||||||
// within a line (and possibly nested in an inline frame or two
|
|
||||||
// that's a child of our block) we need to restore the space
|
|
||||||
// manager's translation to the space that the block resides in
|
|
||||||
// before placing the floater.
|
|
||||||
PRBool isLeftFloater;
|
PRBool isLeftFloater;
|
||||||
nscoord ox, oy;
|
|
||||||
mSpaceManager->GetTranslation(ox, oy);
|
|
||||||
nscoord dx = ox - mSpaceManagerX;
|
|
||||||
nscoord dy = oy - mSpaceManagerY;
|
|
||||||
mSpaceManager->Translate(-dx, -dy);
|
|
||||||
nsPoint origin;
|
nsPoint origin;
|
||||||
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
PlaceFloater(aPlaceholder, floaterMargins, floaterOffsets,
|
||||||
&isLeftFloater, &origin);
|
&isLeftFloater, &origin);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче