зеркало из https://github.com/mozilla/pjs.git
Incremental reflow work-in-progress
This commit is contained in:
Родитель
7a87bf7bf6
Коммит
bec31309df
|
@ -83,8 +83,6 @@ CellData::~CellData()
|
||||||
|
|
||||||
struct InnerTableReflowState {
|
struct InnerTableReflowState {
|
||||||
|
|
||||||
// The body's style molecule
|
|
||||||
|
|
||||||
// Our reflow state
|
// Our reflow state
|
||||||
const nsReflowState& reflowState;
|
const nsReflowState& reflowState;
|
||||||
|
|
||||||
|
@ -1051,6 +1049,47 @@ PRBool nsTableFrame::NeedsReflow(const nsSize& aMaxSize)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
||||||
|
InnerTableReflowState& aState,
|
||||||
|
nsIFrame* aKidFrame,
|
||||||
|
nscoord aDeltaY)
|
||||||
|
{
|
||||||
|
nsIFrame* lastKidFrame = aKidFrame;
|
||||||
|
|
||||||
|
if (aDeltaY != 0) {
|
||||||
|
// Move the frames that follow aKidFrame by aDeltaY
|
||||||
|
nsIFrame* kidFrame;
|
||||||
|
|
||||||
|
aKidFrame->GetNextSibling(kidFrame);
|
||||||
|
while (nsnull != kidFrame) {
|
||||||
|
nsPoint origin;
|
||||||
|
|
||||||
|
// XXX We can't just slide the child if it has a next-in-flow
|
||||||
|
kidFrame->GetOrigin(origin);
|
||||||
|
origin.y += aDeltaY;
|
||||||
|
|
||||||
|
// XXX We need to send move notifications to the frame...
|
||||||
|
kidFrame->WillReflow(*aPresContext);
|
||||||
|
kidFrame->MoveTo(origin.x, origin.y);
|
||||||
|
|
||||||
|
// Get the next frame
|
||||||
|
lastKidFrame = kidFrame;
|
||||||
|
kidFrame->GetNextSibling(kidFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Get the last frame
|
||||||
|
LastChild(lastKidFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update our running y-offset to reflect the bottommost child
|
||||||
|
nsRect rect;
|
||||||
|
lastKidFrame->GetRect(rect);
|
||||||
|
aState.y = rect.YMost();
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
||||||
// SEC: TODO need to keep "first pass done" state, update it when ContentChanged notifications come in
|
// SEC: TODO need to keep "first pass done" state, update it when ContentChanged notifications come in
|
||||||
|
|
||||||
|
@ -1085,9 +1124,22 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
PreReflowCheck();
|
PreReflowCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Initialize out parameter
|
||||||
|
if (nsnull != aDesiredSize.maxElementSize) {
|
||||||
|
aDesiredSize.maxElementSize->width = 0;
|
||||||
|
aDesiredSize.maxElementSize->height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||||
|
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
||||||
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin myBorderPadding;
|
||||||
|
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
||||||
|
|
||||||
|
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
||||||
|
|
||||||
nsIFrame* target;
|
nsIFrame* target;
|
||||||
aReflowState.reflowCommand->GetTarget(target);
|
aReflowState.reflowCommand->GetTarget(target);
|
||||||
if (this == target) {
|
if (this == target) {
|
||||||
|
@ -1098,6 +1150,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
aReflowState.reflowCommand->GetNext(kidFrame);
|
aReflowState.reflowCommand->GetNext(kidFrame);
|
||||||
|
|
||||||
|
// Remember the old rect
|
||||||
|
nsRect oldKidRect;
|
||||||
|
kidFrame->GetRect(oldKidRect);
|
||||||
|
|
||||||
// Pass along the reflow command
|
// Pass along the reflow command
|
||||||
nsReflowMetrics desiredSize(nsnull);
|
nsReflowMetrics desiredSize(nsnull);
|
||||||
// XXX Correctly compute the available space...
|
// XXX Correctly compute the available space...
|
||||||
|
@ -1105,14 +1161,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->WillReflow(*aPresContext);
|
kidFrame->WillReflow(*aPresContext);
|
||||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||||
|
|
||||||
|
// Resize the row group frame
|
||||||
|
nsRect kidRect;
|
||||||
|
kidFrame->GetRect(kidRect);
|
||||||
|
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
||||||
|
|
||||||
|
#if 1
|
||||||
// XXX For the time being just fall through and treat it like a
|
// XXX For the time being just fall through and treat it like a
|
||||||
// pass 2 reflow...
|
// pass 2 reflow...
|
||||||
mPass = kPASS_SECOND;
|
mPass = kPASS_SECOND;
|
||||||
|
#else
|
||||||
#if 0
|
|
||||||
// XXX Hack...
|
// XXX Hack...
|
||||||
|
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame, desiredSize.height -
|
||||||
|
oldKidRect.height);
|
||||||
aDesiredSize.width = mRect.width;
|
aDesiredSize.width = mRect.width;
|
||||||
aDesiredSize.height = mRect.height;
|
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1146,6 +1209,17 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
// set aDesiredSize and aMaxElementSize
|
// set aDesiredSize and aMaxElementSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gsDebugNT==PR_TRUE)
|
||||||
|
{
|
||||||
|
if (nsnull!=aDesiredSize.maxElementSize)
|
||||||
|
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and aMaxElementSize=%d,%d\n",
|
||||||
|
this, aDesiredSize.width, aDesiredSize.height,
|
||||||
|
aDesiredSize.maxElementSize->width, aDesiredSize.maxElementSize->height);
|
||||||
|
else
|
||||||
|
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and NSNULL aMaxElementSize\n",
|
||||||
|
this, aDesiredSize.width, aDesiredSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
PostReflowCheck(aStatus);
|
PostReflowCheck(aStatus);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1339,6 +1413,13 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
nsReflowStatus result = NS_FRAME_COMPLETE;
|
nsReflowStatus result = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
|
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
||||||
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin myBorderPadding;
|
||||||
|
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
||||||
|
|
||||||
|
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
||||||
|
|
||||||
// now that we've computed the column width information, reflow all children
|
// now that we've computed the column width information, reflow all children
|
||||||
nsIContent* c = mContent;
|
nsIContent* c = mContent;
|
||||||
NS_ASSERTION(nsnull != c, "null kid");
|
NS_ASSERTION(nsnull != c, "null kid");
|
||||||
|
@ -1352,25 +1433,12 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
//PreReflowCheck();
|
//PreReflowCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize out parameter
|
|
||||||
if (nsnull != aDesiredSize.maxElementSize) {
|
|
||||||
aDesiredSize.maxElementSize->width = 0;
|
|
||||||
aDesiredSize.maxElementSize->height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool reflowMappedOK = PR_TRUE;
|
PRBool reflowMappedOK = PR_TRUE;
|
||||||
nsReflowStatus status = NS_FRAME_COMPLETE;
|
nsReflowStatus status = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
// Check for an overflow list
|
// Check for an overflow list
|
||||||
MoveOverflowToChildList();
|
MoveOverflowToChildList();
|
||||||
|
|
||||||
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
|
||||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
|
||||||
nsMargin myBorderPadding;
|
|
||||||
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
|
||||||
|
|
||||||
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
|
||||||
|
|
||||||
// Reflow the existing frames
|
// Reflow the existing frames
|
||||||
if (nsnull != mFirstChild) {
|
if (nsnull != mFirstChild) {
|
||||||
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||||
|
@ -1403,6 +1471,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our size and our status
|
// Return our size and our status
|
||||||
|
aDesiredSize.width = aReflowState.maxSize.width;
|
||||||
|
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
||||||
|
|
||||||
|
|
||||||
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
||||||
// Don't forget to add in the bottom margin from our last child.
|
// Don't forget to add in the bottom margin from our last child.
|
||||||
|
@ -1414,23 +1485,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our desired rect
|
|
||||||
aDesiredSize.width = aReflowState.maxSize.width;
|
|
||||||
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
|
||||||
|
|
||||||
if (gsDebugNT==PR_TRUE)
|
|
||||||
{
|
|
||||||
if (nsnull!=aDesiredSize.maxElementSize)
|
|
||||||
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and aMaxElementSize=%d,%d\n",
|
|
||||||
this, aDesiredSize.width, aDesiredSize.height,
|
|
||||||
aDesiredSize.maxElementSize->width, aDesiredSize.maxElementSize->height);
|
|
||||||
else
|
|
||||||
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and NSNULL aMaxElementSize\n",
|
|
||||||
this, aDesiredSize.width, aDesiredSize.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEC: assign our real width and height based on this reflow step and return
|
|
||||||
|
|
||||||
mPass = kPASS_UNDEFINED; // we're no longer in-process
|
mPass = kPASS_UNDEFINED; // we're no longer in-process
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
|
|
|
@ -271,6 +271,11 @@ protected:
|
||||||
PRInt32 aMinCaptionWidth,
|
PRInt32 aMinCaptionWidth,
|
||||||
PRInt32 mMaxCaptionWidth);
|
PRInt32 mMaxCaptionWidth);
|
||||||
|
|
||||||
|
nsresult AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
||||||
|
InnerTableReflowState& aState,
|
||||||
|
nsIFrame* aKidFrame,
|
||||||
|
nscoord aDeltaY);
|
||||||
|
|
||||||
nscoord GetTopMarginFor(nsIPresContext* aCX,
|
nscoord GetTopMarginFor(nsIPresContext* aCX,
|
||||||
InnerTableReflowState& aState,
|
InnerTableReflowState& aState,
|
||||||
const nsMargin& aKidMargin);
|
const nsMargin& aKidMargin);
|
||||||
|
|
|
@ -1043,25 +1043,11 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aP
|
||||||
LastChild(lastKidFrame);
|
LastChild(lastKidFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Update our running y-offset to reflect the bottommost child
|
// Update our running y-offset to reflect the bottommost child
|
||||||
nsRect rect;
|
nsRect rect;
|
||||||
|
|
||||||
lastKidFrame->GetRect(rect);
|
lastKidFrame->GetRect(rect);
|
||||||
aState.y = rect.YMost();
|
aState.y = rect.YMost();
|
||||||
|
|
||||||
// Get the bottom margin for the last child frame
|
|
||||||
const nsStyleSpacing* kidSpacing;
|
|
||||||
lastKidFrame->GetStyleData(eStyleStruct_Spacing, (nsStyleStruct *&)kidSpacing);
|
|
||||||
nsMargin margin;
|
|
||||||
kidSpacing->CalcMarginFor(lastKidFrame, margin);
|
|
||||||
if (margin.bottom < 0) {
|
|
||||||
aState.prevMaxNegBottomMargin = -margin.bottom;
|
|
||||||
} else {
|
|
||||||
aState.prevMaxPosBottomMargin = margin.bottom;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,12 +1088,14 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
aReflowState.reflowCommand->GetNext(kidFrame);
|
aReflowState.reflowCommand->GetNext(kidFrame);
|
||||||
|
|
||||||
// Pass along the reflow command
|
// Remember the old rect
|
||||||
nsRect oldKidRect;
|
nsRect oldKidRect;
|
||||||
nsReflowMetrics desiredSize(nsnull);
|
|
||||||
kidFrame->GetRect(oldKidRect);
|
kidFrame->GetRect(oldKidRect);
|
||||||
|
|
||||||
|
// Pass along the reflow command
|
||||||
// XXX Correctly compute the available space...
|
// XXX Correctly compute the available space...
|
||||||
nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize);
|
nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize);
|
||||||
|
nsReflowMetrics desiredSize(nsnull);
|
||||||
kidFrame->WillReflow(*aPresContext);
|
kidFrame->WillReflow(*aPresContext);
|
||||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||||
|
|
||||||
|
@ -1117,10 +1105,12 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
||||||
|
|
||||||
// Adjust the frames that follow...
|
// Adjust the frames that follow...
|
||||||
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame,
|
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame, desiredSize.height -
|
||||||
kidRect.YMost() - oldKidRect.YMost());
|
oldKidRect.height);
|
||||||
|
|
||||||
// XXX Compute desired size...
|
// Return of desired size
|
||||||
|
aDesiredSize.width = aReflowState.maxSize.width;
|
||||||
|
aDesiredSize.height = state.y;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PRBool reflowMappedOK = PR_TRUE;
|
PRBool reflowMappedOK = PR_TRUE;
|
||||||
|
|
|
@ -83,8 +83,6 @@ CellData::~CellData()
|
||||||
|
|
||||||
struct InnerTableReflowState {
|
struct InnerTableReflowState {
|
||||||
|
|
||||||
// The body's style molecule
|
|
||||||
|
|
||||||
// Our reflow state
|
// Our reflow state
|
||||||
const nsReflowState& reflowState;
|
const nsReflowState& reflowState;
|
||||||
|
|
||||||
|
@ -1051,6 +1049,47 @@ PRBool nsTableFrame::NeedsReflow(const nsSize& aMaxSize)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
||||||
|
InnerTableReflowState& aState,
|
||||||
|
nsIFrame* aKidFrame,
|
||||||
|
nscoord aDeltaY)
|
||||||
|
{
|
||||||
|
nsIFrame* lastKidFrame = aKidFrame;
|
||||||
|
|
||||||
|
if (aDeltaY != 0) {
|
||||||
|
// Move the frames that follow aKidFrame by aDeltaY
|
||||||
|
nsIFrame* kidFrame;
|
||||||
|
|
||||||
|
aKidFrame->GetNextSibling(kidFrame);
|
||||||
|
while (nsnull != kidFrame) {
|
||||||
|
nsPoint origin;
|
||||||
|
|
||||||
|
// XXX We can't just slide the child if it has a next-in-flow
|
||||||
|
kidFrame->GetOrigin(origin);
|
||||||
|
origin.y += aDeltaY;
|
||||||
|
|
||||||
|
// XXX We need to send move notifications to the frame...
|
||||||
|
kidFrame->WillReflow(*aPresContext);
|
||||||
|
kidFrame->MoveTo(origin.x, origin.y);
|
||||||
|
|
||||||
|
// Get the next frame
|
||||||
|
lastKidFrame = kidFrame;
|
||||||
|
kidFrame->GetNextSibling(kidFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Get the last frame
|
||||||
|
LastChild(lastKidFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update our running y-offset to reflect the bottommost child
|
||||||
|
nsRect rect;
|
||||||
|
lastKidFrame->GetRect(rect);
|
||||||
|
aState.y = rect.YMost();
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
||||||
// SEC: TODO need to keep "first pass done" state, update it when ContentChanged notifications come in
|
// SEC: TODO need to keep "first pass done" state, update it when ContentChanged notifications come in
|
||||||
|
|
||||||
|
@ -1085,9 +1124,22 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
PreReflowCheck();
|
PreReflowCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Initialize out parameter
|
||||||
|
if (nsnull != aDesiredSize.maxElementSize) {
|
||||||
|
aDesiredSize.maxElementSize->width = 0;
|
||||||
|
aDesiredSize.maxElementSize->height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||||
|
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
||||||
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin myBorderPadding;
|
||||||
|
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
||||||
|
|
||||||
|
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
||||||
|
|
||||||
nsIFrame* target;
|
nsIFrame* target;
|
||||||
aReflowState.reflowCommand->GetTarget(target);
|
aReflowState.reflowCommand->GetTarget(target);
|
||||||
if (this == target) {
|
if (this == target) {
|
||||||
|
@ -1098,6 +1150,10 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
aReflowState.reflowCommand->GetNext(kidFrame);
|
aReflowState.reflowCommand->GetNext(kidFrame);
|
||||||
|
|
||||||
|
// Remember the old rect
|
||||||
|
nsRect oldKidRect;
|
||||||
|
kidFrame->GetRect(oldKidRect);
|
||||||
|
|
||||||
// Pass along the reflow command
|
// Pass along the reflow command
|
||||||
nsReflowMetrics desiredSize(nsnull);
|
nsReflowMetrics desiredSize(nsnull);
|
||||||
// XXX Correctly compute the available space...
|
// XXX Correctly compute the available space...
|
||||||
|
@ -1105,14 +1161,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->WillReflow(*aPresContext);
|
kidFrame->WillReflow(*aPresContext);
|
||||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||||
|
|
||||||
|
// Resize the row group frame
|
||||||
|
nsRect kidRect;
|
||||||
|
kidFrame->GetRect(kidRect);
|
||||||
|
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
||||||
|
|
||||||
|
#if 1
|
||||||
// XXX For the time being just fall through and treat it like a
|
// XXX For the time being just fall through and treat it like a
|
||||||
// pass 2 reflow...
|
// pass 2 reflow...
|
||||||
mPass = kPASS_SECOND;
|
mPass = kPASS_SECOND;
|
||||||
|
#else
|
||||||
#if 0
|
|
||||||
// XXX Hack...
|
// XXX Hack...
|
||||||
|
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame, desiredSize.height -
|
||||||
|
oldKidRect.height);
|
||||||
aDesiredSize.width = mRect.width;
|
aDesiredSize.width = mRect.width;
|
||||||
aDesiredSize.height = mRect.height;
|
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1146,6 +1209,17 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
// set aDesiredSize and aMaxElementSize
|
// set aDesiredSize and aMaxElementSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gsDebugNT==PR_TRUE)
|
||||||
|
{
|
||||||
|
if (nsnull!=aDesiredSize.maxElementSize)
|
||||||
|
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and aMaxElementSize=%d,%d\n",
|
||||||
|
this, aDesiredSize.width, aDesiredSize.height,
|
||||||
|
aDesiredSize.maxElementSize->width, aDesiredSize.maxElementSize->height);
|
||||||
|
else
|
||||||
|
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and NSNULL aMaxElementSize\n",
|
||||||
|
this, aDesiredSize.width, aDesiredSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
PostReflowCheck(aStatus);
|
PostReflowCheck(aStatus);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1339,6 +1413,13 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
nsReflowStatus result = NS_FRAME_COMPLETE;
|
nsReflowStatus result = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
|
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
||||||
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin myBorderPadding;
|
||||||
|
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
||||||
|
|
||||||
|
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
||||||
|
|
||||||
// now that we've computed the column width information, reflow all children
|
// now that we've computed the column width information, reflow all children
|
||||||
nsIContent* c = mContent;
|
nsIContent* c = mContent;
|
||||||
NS_ASSERTION(nsnull != c, "null kid");
|
NS_ASSERTION(nsnull != c, "null kid");
|
||||||
|
@ -1352,25 +1433,12 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
//PreReflowCheck();
|
//PreReflowCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize out parameter
|
|
||||||
if (nsnull != aDesiredSize.maxElementSize) {
|
|
||||||
aDesiredSize.maxElementSize->width = 0;
|
|
||||||
aDesiredSize.maxElementSize->height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool reflowMappedOK = PR_TRUE;
|
PRBool reflowMappedOK = PR_TRUE;
|
||||||
nsReflowStatus status = NS_FRAME_COMPLETE;
|
nsReflowStatus status = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
// Check for an overflow list
|
// Check for an overflow list
|
||||||
MoveOverflowToChildList();
|
MoveOverflowToChildList();
|
||||||
|
|
||||||
const nsStyleSpacing* mySpacing = (const nsStyleSpacing*)
|
|
||||||
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
|
||||||
nsMargin myBorderPadding;
|
|
||||||
mySpacing->CalcBorderPaddingFor(this, myBorderPadding);
|
|
||||||
|
|
||||||
InnerTableReflowState state(aPresContext, aReflowState, myBorderPadding);
|
|
||||||
|
|
||||||
// Reflow the existing frames
|
// Reflow the existing frames
|
||||||
if (nsnull != mFirstChild) {
|
if (nsnull != mFirstChild) {
|
||||||
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||||
|
@ -1403,6 +1471,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our size and our status
|
// Return our size and our status
|
||||||
|
aDesiredSize.width = aReflowState.maxSize.width;
|
||||||
|
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
||||||
|
|
||||||
|
|
||||||
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
||||||
// Don't forget to add in the bottom margin from our last child.
|
// Don't forget to add in the bottom margin from our last child.
|
||||||
|
@ -1414,23 +1485,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our desired rect
|
|
||||||
aDesiredSize.width = aReflowState.maxSize.width;
|
|
||||||
aDesiredSize.height = state.y + myBorderPadding.top + myBorderPadding.bottom;
|
|
||||||
|
|
||||||
if (gsDebugNT==PR_TRUE)
|
|
||||||
{
|
|
||||||
if (nsnull!=aDesiredSize.maxElementSize)
|
|
||||||
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and aMaxElementSize=%d,%d\n",
|
|
||||||
this, aDesiredSize.width, aDesiredSize.height,
|
|
||||||
aDesiredSize.maxElementSize->width, aDesiredSize.maxElementSize->height);
|
|
||||||
else
|
|
||||||
printf("%p: Inner table reflow complete, returning aDesiredSize = %d,%d and NSNULL aMaxElementSize\n",
|
|
||||||
this, aDesiredSize.width, aDesiredSize.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SEC: assign our real width and height based on this reflow step and return
|
|
||||||
|
|
||||||
mPass = kPASS_UNDEFINED; // we're no longer in-process
|
mPass = kPASS_UNDEFINED; // we're no longer in-process
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
|
|
|
@ -271,6 +271,11 @@ protected:
|
||||||
PRInt32 aMinCaptionWidth,
|
PRInt32 aMinCaptionWidth,
|
||||||
PRInt32 mMaxCaptionWidth);
|
PRInt32 mMaxCaptionWidth);
|
||||||
|
|
||||||
|
nsresult AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
||||||
|
InnerTableReflowState& aState,
|
||||||
|
nsIFrame* aKidFrame,
|
||||||
|
nscoord aDeltaY);
|
||||||
|
|
||||||
nscoord GetTopMarginFor(nsIPresContext* aCX,
|
nscoord GetTopMarginFor(nsIPresContext* aCX,
|
||||||
InnerTableReflowState& aState,
|
InnerTableReflowState& aState,
|
||||||
const nsMargin& aKidMargin);
|
const nsMargin& aKidMargin);
|
||||||
|
|
|
@ -1043,25 +1043,11 @@ nsresult nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aP
|
||||||
LastChild(lastKidFrame);
|
LastChild(lastKidFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Update our running y-offset to reflect the bottommost child
|
// Update our running y-offset to reflect the bottommost child
|
||||||
nsRect rect;
|
nsRect rect;
|
||||||
|
|
||||||
lastKidFrame->GetRect(rect);
|
lastKidFrame->GetRect(rect);
|
||||||
aState.y = rect.YMost();
|
aState.y = rect.YMost();
|
||||||
|
|
||||||
// Get the bottom margin for the last child frame
|
|
||||||
const nsStyleSpacing* kidSpacing;
|
|
||||||
lastKidFrame->GetStyleData(eStyleStruct_Spacing, (nsStyleStruct *&)kidSpacing);
|
|
||||||
nsMargin margin;
|
|
||||||
kidSpacing->CalcMarginFor(lastKidFrame, margin);
|
|
||||||
if (margin.bottom < 0) {
|
|
||||||
aState.prevMaxNegBottomMargin = -margin.bottom;
|
|
||||||
} else {
|
|
||||||
aState.prevMaxPosBottomMargin = margin.bottom;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,12 +1088,14 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
nsIFrame* kidFrame;
|
nsIFrame* kidFrame;
|
||||||
aReflowState.reflowCommand->GetNext(kidFrame);
|
aReflowState.reflowCommand->GetNext(kidFrame);
|
||||||
|
|
||||||
// Pass along the reflow command
|
// Remember the old rect
|
||||||
nsRect oldKidRect;
|
nsRect oldKidRect;
|
||||||
nsReflowMetrics desiredSize(nsnull);
|
|
||||||
kidFrame->GetRect(oldKidRect);
|
kidFrame->GetRect(oldKidRect);
|
||||||
|
|
||||||
|
// Pass along the reflow command
|
||||||
// XXX Correctly compute the available space...
|
// XXX Correctly compute the available space...
|
||||||
nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize);
|
nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize);
|
||||||
|
nsReflowMetrics desiredSize(nsnull);
|
||||||
kidFrame->WillReflow(*aPresContext);
|
kidFrame->WillReflow(*aPresContext);
|
||||||
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
|
||||||
|
|
||||||
|
@ -1117,10 +1105,12 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
kidFrame->SizeTo(desiredSize.width, desiredSize.height);
|
||||||
|
|
||||||
// Adjust the frames that follow...
|
// Adjust the frames that follow...
|
||||||
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame,
|
AdjustSiblingsAfterReflow(aPresContext, state, kidFrame, desiredSize.height -
|
||||||
kidRect.YMost() - oldKidRect.YMost());
|
oldKidRect.height);
|
||||||
|
|
||||||
// XXX Compute desired size...
|
// Return of desired size
|
||||||
|
aDesiredSize.width = aReflowState.maxSize.width;
|
||||||
|
aDesiredSize.height = state.y;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PRBool reflowMappedOK = PR_TRUE;
|
PRBool reflowMappedOK = PR_TRUE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче