mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Set x,y coordinate of frame before reflowing it
This commit is contained in:
parent
4abbc8d703
commit
a51ed32383
@ -709,6 +709,7 @@ nsLineLayout::ReflowChild(nsReflowCommand* aReflowCommand)
|
|||||||
|
|
||||||
mSpaceManager->Translate(dx, mY);
|
mSpaceManager->Translate(dx, mY);
|
||||||
kidFrame->WillReflow(*mPresContext);
|
kidFrame->WillReflow(*mPresContext);
|
||||||
|
kidFrame->MoveTo(dx, mY);
|
||||||
rv = mBlock->ReflowBlockChild(kidFrame, mPresContext,
|
rv = mBlock->ReflowBlockChild(kidFrame, mPresContext,
|
||||||
mSpaceManager, kidMetrics, kidReflowState,
|
mSpaceManager, kidMetrics, kidReflowState,
|
||||||
kidRect, kidReflowStatus);
|
kidRect, kidReflowStatus);
|
||||||
@ -721,27 +722,39 @@ nsLineLayout::ReflowChild(nsReflowCommand* aReflowCommand)
|
|||||||
kidMetrics.descent = 0;
|
kidMetrics.descent = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Apply bottom margin speculatively before reflowing the child
|
||||||
|
nscoord bottomMargin = mBlockReflowState.mPrevPosBottomMargin -
|
||||||
|
mBlockReflowState.mPrevNegBottomMargin;
|
||||||
|
if (!mMarginApplied) {
|
||||||
|
// Before we place the first inline child on this line apply
|
||||||
|
// the previous block's bottom margin.
|
||||||
|
mY += bottomMargin;
|
||||||
|
mBlockReflowState.mY += bottomMargin;
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the inline child
|
// Reflow the inline child
|
||||||
kidFrame->WillReflow(*mPresContext);
|
kidFrame->WillReflow(*mPresContext);
|
||||||
|
kidFrame->MoveTo(dx, mY);
|
||||||
rv = mBlock->ReflowInlineChild(kidFrame, mPresContext, kidMetrics,
|
rv = mBlock->ReflowInlineChild(kidFrame, mPresContext, kidMetrics,
|
||||||
kidReflowState, kidReflowStatus);
|
kidReflowState, kidReflowStatus);
|
||||||
|
|
||||||
// After we reflow the inline child we will know whether or not it
|
// See if speculative application of the margin should stick
|
||||||
// has any height/width. If it doesn't have any height/width then
|
if (!mMarginApplied) {
|
||||||
// we do not yet apply any previous block bottom margin.
|
if (0 == kidMetrics.height) {
|
||||||
if ((0 != kidMetrics.height) && !mMarginApplied) {
|
// No, undo margin application when we get a zero height child.
|
||||||
// Before we place the first inline child on this line apply
|
mY -= bottomMargin;
|
||||||
// the previous block's bottom margin.
|
mBlockReflowState.mY -= bottomMargin;
|
||||||
nscoord bottomMargin = mBlockReflowState.mPrevPosBottomMargin -
|
}
|
||||||
mBlockReflowState.mPrevNegBottomMargin;
|
else {
|
||||||
mY += bottomMargin;
|
// Yes, keep the margin application.
|
||||||
mBlockReflowState.mY += bottomMargin;
|
mMarginApplied = PR_TRUE;
|
||||||
// XXX tell block what bottomMargin ended up being so that it can
|
mBlockReflowState.mPrevPosBottomMargin = 0;
|
||||||
// undo it if it ends up pushing the line.
|
mBlockReflowState.mPrevNegBottomMargin = 0;
|
||||||
mMarginApplied = PR_TRUE;
|
// XXX tell block what bottomMargin ended up being so that it can
|
||||||
mBlockReflowState.mPrevPosBottomMargin = 0;
|
// undo it if it ends up pushing the line.
|
||||||
mBlockReflowState.mPrevNegBottomMargin = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kidRect.x = dx;
|
kidRect.x = dx;
|
||||||
kidRect.y = mY;
|
kidRect.y = mY;
|
||||||
kidRect.width = kidMetrics.width;
|
kidRect.width = kidMetrics.width;
|
||||||
|
@ -709,6 +709,7 @@ nsLineLayout::ReflowChild(nsReflowCommand* aReflowCommand)
|
|||||||
|
|
||||||
mSpaceManager->Translate(dx, mY);
|
mSpaceManager->Translate(dx, mY);
|
||||||
kidFrame->WillReflow(*mPresContext);
|
kidFrame->WillReflow(*mPresContext);
|
||||||
|
kidFrame->MoveTo(dx, mY);
|
||||||
rv = mBlock->ReflowBlockChild(kidFrame, mPresContext,
|
rv = mBlock->ReflowBlockChild(kidFrame, mPresContext,
|
||||||
mSpaceManager, kidMetrics, kidReflowState,
|
mSpaceManager, kidMetrics, kidReflowState,
|
||||||
kidRect, kidReflowStatus);
|
kidRect, kidReflowStatus);
|
||||||
@ -721,27 +722,39 @@ nsLineLayout::ReflowChild(nsReflowCommand* aReflowCommand)
|
|||||||
kidMetrics.descent = 0;
|
kidMetrics.descent = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Apply bottom margin speculatively before reflowing the child
|
||||||
|
nscoord bottomMargin = mBlockReflowState.mPrevPosBottomMargin -
|
||||||
|
mBlockReflowState.mPrevNegBottomMargin;
|
||||||
|
if (!mMarginApplied) {
|
||||||
|
// Before we place the first inline child on this line apply
|
||||||
|
// the previous block's bottom margin.
|
||||||
|
mY += bottomMargin;
|
||||||
|
mBlockReflowState.mY += bottomMargin;
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the inline child
|
// Reflow the inline child
|
||||||
kidFrame->WillReflow(*mPresContext);
|
kidFrame->WillReflow(*mPresContext);
|
||||||
|
kidFrame->MoveTo(dx, mY);
|
||||||
rv = mBlock->ReflowInlineChild(kidFrame, mPresContext, kidMetrics,
|
rv = mBlock->ReflowInlineChild(kidFrame, mPresContext, kidMetrics,
|
||||||
kidReflowState, kidReflowStatus);
|
kidReflowState, kidReflowStatus);
|
||||||
|
|
||||||
// After we reflow the inline child we will know whether or not it
|
// See if speculative application of the margin should stick
|
||||||
// has any height/width. If it doesn't have any height/width then
|
if (!mMarginApplied) {
|
||||||
// we do not yet apply any previous block bottom margin.
|
if (0 == kidMetrics.height) {
|
||||||
if ((0 != kidMetrics.height) && !mMarginApplied) {
|
// No, undo margin application when we get a zero height child.
|
||||||
// Before we place the first inline child on this line apply
|
mY -= bottomMargin;
|
||||||
// the previous block's bottom margin.
|
mBlockReflowState.mY -= bottomMargin;
|
||||||
nscoord bottomMargin = mBlockReflowState.mPrevPosBottomMargin -
|
}
|
||||||
mBlockReflowState.mPrevNegBottomMargin;
|
else {
|
||||||
mY += bottomMargin;
|
// Yes, keep the margin application.
|
||||||
mBlockReflowState.mY += bottomMargin;
|
mMarginApplied = PR_TRUE;
|
||||||
// XXX tell block what bottomMargin ended up being so that it can
|
mBlockReflowState.mPrevPosBottomMargin = 0;
|
||||||
// undo it if it ends up pushing the line.
|
mBlockReflowState.mPrevNegBottomMargin = 0;
|
||||||
mMarginApplied = PR_TRUE;
|
// XXX tell block what bottomMargin ended up being so that it can
|
||||||
mBlockReflowState.mPrevPosBottomMargin = 0;
|
// undo it if it ends up pushing the line.
|
||||||
mBlockReflowState.mPrevNegBottomMargin = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kidRect.x = dx;
|
kidRect.x = dx;
|
||||||
kidRect.y = mY;
|
kidRect.y = mY;
|
||||||
kidRect.width = kidMetrics.width;
|
kidRect.width = kidMetrics.width;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user