зеркало из https://github.com/mozilla/gecko-dev.git
Preliminary support for negative top/bottom margins
This commit is contained in:
Родитель
52e4538d7f
Коммит
2515fa9945
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ nsInlineFrame::CalculateMargins(nsInlineReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineReflow.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
|
||||
// If this frame is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -476,7 +476,8 @@ nsInlineFrame::CalculateMargins(nsInlineReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineReflow.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
haveCarriedMargins = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2145,9 +2145,9 @@ nsBlockFrame::RecoverLineMargins(nsBlockReflowState& aState,
|
|||
|
||||
// Collapse the carried-out-margins with the childs margins
|
||||
aBottomMarginResult =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
aTopMarginResult =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -2189,8 +2189,9 @@ nsBlockFrame::FrameAppendedReflow(nsBlockReflowState& aState)
|
|||
if (0 == firstDirtyLine->mBounds.height) {
|
||||
// For zero height lines, collapse the lines top and bottom
|
||||
// margins together to produce the effective bottomMargin value.
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = PR_MAX(aState.mPrevBottomMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
bottomMargin);
|
||||
}
|
||||
aState.mPrevBottomMargin = bottomMargin;
|
||||
|
||||
|
@ -2809,7 +2810,7 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineContext ? 0 : ir.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin, childsTopMargin);
|
||||
if (isFirstNonEmptyLine) {
|
||||
// If this block is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -2827,7 +2828,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// For secondary lines we also collpase the sibling margins. The
|
||||
// previous lines bottom margin is collapsed with the current
|
||||
// lines collapsed top margin.
|
||||
collapsedTopMargin = PR_MAX(aState.mPrevBottomMargin, collapsedTopMargin);
|
||||
collapsedTopMargin = nsInlineReflow::MaxMargin(aState.mPrevBottomMargin,
|
||||
collapsedTopMargin);
|
||||
}
|
||||
aTopMarginResult = collapsedTopMargin;
|
||||
|
||||
|
@ -2836,7 +2838,8 @@ nsBlockFrame::CalculateMargins(nsBlockReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineContext ? 0 : ir.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
}
|
||||
//ListTag(stdout); printf(": line=%p topMargin=%d bottomMargin=%d [%s,%s]\n", aLine, aTopMarginResult, aBottomMarginResult, isFirstNonEmptyLine ? "first" : "!first", aState.mIsMarginRoot ? "root" : "!root");
|
||||
|
@ -2924,7 +2927,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3300,7 +3303,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
// height then collapse the carried margins down into a single
|
||||
// (bottom margin) value.
|
||||
if (0 == aLine->mBounds.height) {
|
||||
bottomMargin = PR_MAX(topMargin, bottomMargin);
|
||||
bottomMargin = nsInlineReflow::MaxMargin(topMargin, bottomMargin);
|
||||
topMargin = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ nsInlineFrame::CalculateMargins(nsInlineReflowState& aState,
|
|||
// its carried out top margin.
|
||||
nscoord childsTopMargin = aInlineReflow.GetTopMargin();
|
||||
nscoord collapsedTopMargin =
|
||||
PR_MAX(childsCarriedOutTopMargin, childsTopMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutTopMargin, childsTopMargin);
|
||||
|
||||
// If this frame is a root for margins then we will apply the
|
||||
// collapsed top margin value ourselves. Otherwise, we pass it out
|
||||
|
@ -476,7 +476,8 @@ nsInlineFrame::CalculateMargins(nsInlineReflowState& aState,
|
|||
// up being placed in this block frame.
|
||||
nscoord childsBottomMargin = aInlineReflow.GetBottomMargin();
|
||||
nscoord collapsedBottomMargin =
|
||||
PR_MAX(childsCarriedOutBottomMargin, childsBottomMargin);
|
||||
nsInlineReflow::MaxMargin(childsCarriedOutBottomMargin,
|
||||
childsBottomMargin);
|
||||
aBottomMarginResult = collapsedBottomMargin;
|
||||
haveCarriedMargins = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -539,11 +539,6 @@ nsInlineReflow::PlaceFrame(nsHTMLReflowMetrics& aMetrics, nsRect& aBounds)
|
|||
// Compute collapsed margin information
|
||||
mCarriedOutTopMargin = aMetrics.mCarriedOutTopMargin;
|
||||
mCarriedOutBottomMargin = aMetrics.mCarriedOutBottomMargin;
|
||||
#if 0
|
||||
//XXX
|
||||
mCarriedOutTopMargin = PR_MAX(mCarriedOutTopMargin, mMargin.top);
|
||||
mCarriedOutBottomMargin = PR_MAX(mCarriedOutBottomMargin, mMargin.bottom);
|
||||
#endif
|
||||
|
||||
// Advance to next X coordinate
|
||||
mX = aBounds.XMost() + mRightMargin;
|
||||
|
|
|
@ -81,6 +81,8 @@ public:
|
|||
const nsStyleSpacing* aSpacing,
|
||||
nsMargin& aMargin);
|
||||
|
||||
static nscoord MaxMargin(nscoord a, nscoord b);
|
||||
|
||||
protected:
|
||||
void SetFrame(nsIFrame* aFrame);
|
||||
|
||||
|
@ -173,4 +175,21 @@ protected:
|
|||
nscoord mBottomEdge;
|
||||
};
|
||||
|
||||
inline nscoord
|
||||
nsInlineReflow::MaxMargin(nscoord a, nscoord b)
|
||||
{
|
||||
if (a < 0) {
|
||||
if (b < 0) {
|
||||
if (a < b) return a;
|
||||
return b;
|
||||
}
|
||||
return b + a;
|
||||
}
|
||||
else if (b < 0) {
|
||||
return a + b;
|
||||
}
|
||||
if (a > b) return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
#endif /* nsInlineReflow_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче