From aca03413bf7990e8cd5ca105adcce610a55993bb Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 21 Oct 2003 04:30:10 +0000 Subject: [PATCH] Make style-change reflows on the table correctly reflow the caption. Bug 222864, r=bernd, sr=dbaron git-svn-id: svn://10.0.0.236/trunk@148192 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/table/src/nsTableOuterFrame.cpp | 10 +++++++--- mozilla/layout/tables/nsTableOuterFrame.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index a23151ba8b7..347bb291f36 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -1667,7 +1667,8 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, // If the incremental reflow command is a StyleChanged reflow and // it's target is the current frame, then make sure we send // StyleChange reflow reasons down to the children so that they - // don't over-optimize their reflow. + // don't over-optimize their reflow. Also make sure we reflow the caption. + PRBool reflowCaption = PR_FALSE; nsReflowReason reflowReason = eReflowReason_Incremental; nsHTMLReflowCommand* command = aOuterRS.path->mReflowCommand; if (command) { @@ -1675,6 +1676,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, command->GetType(type); if (eReflowType_StyleChanged == type) { reflowReason = eReflowReason_StyleChange; + reflowCaption = PR_TRUE; } } nscoord capMin = mMinCaptionWidth; @@ -1698,9 +1700,11 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsPoint captionOrigin; nsRect prevCaptionRect = mCaptionFrame->GetRect(); - if (priorInnerSize.width != innerMet.width) { + reflowCaption = reflowCaption || + priorInnerSize.width != innerMet.width; + + if (reflowCaption) { nsMargin ignorePadding; - // XXX only need to reflow if the caption is auto width nsHTMLReflowMetrics captionMet(eReflowReason_StyleChange == reflowReason); nscoord availWidth = GetCaptionAvailWidth(aPresContext, mCaptionFrame, aOuterRS, captionMargin, ignorePadding, &innerSize.width, &innerMarginNoAuto); diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index a23151ba8b7..347bb291f36 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -1667,7 +1667,8 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, // If the incremental reflow command is a StyleChanged reflow and // it's target is the current frame, then make sure we send // StyleChange reflow reasons down to the children so that they - // don't over-optimize their reflow. + // don't over-optimize their reflow. Also make sure we reflow the caption. + PRBool reflowCaption = PR_FALSE; nsReflowReason reflowReason = eReflowReason_Incremental; nsHTMLReflowCommand* command = aOuterRS.path->mReflowCommand; if (command) { @@ -1675,6 +1676,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, command->GetType(type); if (eReflowType_StyleChanged == type) { reflowReason = eReflowReason_StyleChange; + reflowCaption = PR_TRUE; } } nscoord capMin = mMinCaptionWidth; @@ -1698,9 +1700,11 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsPoint captionOrigin; nsRect prevCaptionRect = mCaptionFrame->GetRect(); - if (priorInnerSize.width != innerMet.width) { + reflowCaption = reflowCaption || + priorInnerSize.width != innerMet.width; + + if (reflowCaption) { nsMargin ignorePadding; - // XXX only need to reflow if the caption is auto width nsHTMLReflowMetrics captionMet(eReflowReason_StyleChange == reflowReason); nscoord availWidth = GetCaptionAvailWidth(aPresContext, mCaptionFrame, aOuterRS, captionMargin, ignorePadding, &innerSize.width, &innerMarginNoAuto);