b=24343 r=karnaze@netscape.com Changes so we properly lay out after changing

the font using the pref UI. Block and table code changed to handle
eReflowReason_StyleChange
This commit is contained in:
troy%netscape.com 2000-03-15 15:16:03 +00:00
parent b7899506e9
commit 4f7d1e3f2a
12 changed files with 50 additions and 10 deletions

View File

@ -1649,9 +1649,8 @@ PresShell::StyleChangeReflow()
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
if (NS_FAILED(rv)) return rv;
// XXX We should be using eReflowReason_StyleChange
nsHTMLReflowState reflowState(mPresContext, rootFrame,
eReflowReason_Resize, rcx, maxSize);
eReflowReason_StyleChange, rcx, maxSize);
nsIView* view;
rootFrame->WillReflow(mPresContext);

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -561,9 +561,11 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.descent = 0;
}
// If this is a resize reflow or the initial reflow, then do a repaint
// If this is an initial reflow, resize reflow, or style change reflow
// then do a repaint
if ((eReflowReason_Initial == aReflowState.reason) ||
(eReflowReason_Resize == aReflowState.reason)) {
(eReflowReason_Resize == aReflowState.reason) ||
(eReflowReason_StyleChange == aReflowState.reason)) {
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
Invalidate(aPresContext, damageRect, PR_FALSE);
}

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -1553,6 +1553,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
break;
case eReflowReason_StyleChange:
rv = PrepareStyleChangedReflow(state);
break;
case eReflowReason_Resize:
default:
#ifdef NOISY_REFLOW_REASON

View File

@ -1649,9 +1649,8 @@ PresShell::StyleChangeReflow()
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
if (NS_FAILED(rv)) return rv;
// XXX We should be using eReflowReason_StyleChange
nsHTMLReflowState reflowState(mPresContext, rootFrame,
eReflowReason_Resize, rcx, maxSize);
eReflowReason_StyleChange, rcx, maxSize);
nsIView* view;
rootFrame->WillReflow(mPresContext);

View File

@ -561,9 +561,11 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.descent = 0;
}
// If this is a resize reflow or the initial reflow, then do a repaint
// If this is an initial reflow, resize reflow, or style change reflow
// then do a repaint
if ((eReflowReason_Initial == aReflowState.reason) ||
(eReflowReason_Resize == aReflowState.reason)) {
(eReflowReason_Resize == aReflowState.reason) ||
(eReflowReason_StyleChange == aReflowState.reason)) {
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
Invalidate(aPresContext, damageRect, PR_FALSE);
}

View File

@ -1531,14 +1531,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
// If this is a style change reflow, then invalidate the pass 1 cache
if (eReflowReason_StyleChange == aReflowState.reason) {
InvalidateFirstPassCache();
}
// NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow
if (NeedsReflow(aReflowState)) {
PRBool needsRecalc = PR_FALSE;
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) ||
(PR_FALSE==IsFirstPassValid())) {
nsReflowReason reason = aReflowState.reason;
if (eReflowReason_Initial != reason)
if ((eReflowReason_Initial != reason) &&
(eReflowReason_StyleChange != reason)) {
reason = eReflowReason_Resize;
}
if (mBorderCollapser) {
mBorderCollapser->ComputeVerticalBorders(aPresContext, 0, -1);
}

View File

@ -1531,14 +1531,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
// If this is a style change reflow, then invalidate the pass 1 cache
if (eReflowReason_StyleChange == aReflowState.reason) {
InvalidateFirstPassCache();
}
// NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow
if (NeedsReflow(aReflowState)) {
PRBool needsRecalc = PR_FALSE;
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) ||
(PR_FALSE==IsFirstPassValid())) {
nsReflowReason reason = aReflowState.reason;
if (eReflowReason_Initial != reason)
if ((eReflowReason_Initial != reason) &&
(eReflowReason_StyleChange != reason)) {
reason = eReflowReason_Resize;
}
if (mBorderCollapser) {
mBorderCollapser->ComputeVerticalBorders(aPresContext, 0, -1);
}