bug 125543 - Prevent row groups from splitting in the reflow preceeding a special height reflow. Cells are only notified that they should observe a percent height element if the element is inside the table's cell. Percent height elements inside the body will have a height based on the page height when printing. sr=kin, r=alexsavulov.

This commit is contained in:
karnaze@netscape.com
2002-04-10 21:32:41 +00:00
parent 6b41e30fe0
commit 335ac62023
18 changed files with 250 additions and 120 deletions

View File

@@ -156,7 +156,7 @@ NoComputedHeightBetween(const nsHTMLReflowState& aReflowState,
// nsIPercentHeightObserver methods
nsresult
void
nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
{
if (!NeedSpecialReflow()) {
@@ -166,17 +166,36 @@ nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
// initiating frame and the cell.
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) {
return NS_OK;
return;
}
// stop when we reach the cell frame
if (rs->frame == this) {
nsTableFrame::RequestSpecialHeightReflow(*rs);
return NS_OK;
return;
}
}
NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight");
}
return NS_OK;
}
// The cell needs to observe its block and things inside its block but nothing below that
PRBool
nsTableCellFrame::NeedsToObserve(const nsHTMLReflowState& aReflowState)
{
PRBool result = PR_FALSE;
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
if (parentRS && (parentRS->mPercentHeightObserver == this)) { // cell observes the parent
result = PR_TRUE;
parentRS = parentRS->parentReflowState;
if (parentRS && (parentRS->mPercentHeightObserver == this)) { // cell observers the grand parent
parentRS = parentRS->parentReflowState;
if (parentRS && (parentRS->mPercentHeightObserver == this)) {
// cell observes the great grand parent, so we have gone too deep
result = PR_FALSE;
}
}
}
return result;
}
nsresult
@@ -798,7 +817,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
// see if a special height reflow needs to occur due to having a pct height
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
if (!NeedSpecialReflow())
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
// this should probably be cached somewhere
nsCompatibility compatMode;
@@ -883,8 +903,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nscoord computedPaginatedHeight = 0;
if (aReflowState.mFlags.mSpecialHeightReflow ||
(HadSpecialReflow() && ((eReflowReason_Incremental == aReflowState.reason) ||
(eReflowReason_Resize == aReflowState.reason)))) {
(HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) {
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
DISPLAY_REFLOW_CHANGE();
}