bug 28811

r=karnaze
The problem was we were over-eager in optimizing away a resize reflow for lines
that contain %-aware children.  We were only looking at the first-level children
of a line, not all the children.  Now, we compute a bit for each inline container
based on it's children, true if any of them are %-aware wrt any width measurement.
We propogate this bit upwards to a bit on the line itself, and check this bit during reflow.


git-svn-id: svn://10.0.0.236/trunk@78755 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
buster%netscape.com
2000-09-11 20:46:44 +00:00
parent f6edad2f99
commit f407725c66
16 changed files with 374 additions and 104 deletions

View File

@@ -549,6 +549,41 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
return rv;
}
static
void SetContainsPercentAwareChild(nsIFrame *aFrame)
{
nsFrameState myFrameState;
aFrame->GetFrameState(&myFrameState);
aFrame->SetFrameState(myFrameState | NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD);
}
static
void MarkPercentAwareFrame(nsIPresContext *aPresContext,
nsInlineFrame *aInline,
nsIFrame *aFrame)
{
nsFrameState childFrameState;
aFrame->GetFrameState(&childFrameState);
if (childFrameState & NS_FRAME_REPLACED_ELEMENT)
{ // aFrame is a replaced element, check it's style
if (nsLineLayout::IsPercentageAwareReplacedElement(aPresContext, aFrame)) {
SetContainsPercentAwareChild(aInline);
}
}
else
{
nsIFrame *child;
aFrame->FirstChild(aPresContext, nsnull, &child);
if (child)
{ // aFrame is an inline container frame, check my frame state
if (childFrameState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
SetContainsPercentAwareChild(aInline); // if a child container is effected, so am I
}
}
// else frame is a leaf that we don't care about
}
}
nsresult
nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
@@ -561,6 +596,15 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
PRBool pushedFrame;
nsresult rv = lineLayout->ReflowFrame(aFrame, &irs.mNextRCFrame, aStatus,
nsnull, pushedFrame);
/* This next block is for bug 28811
Test the child frame for %-awareness,
and mark this frame with a bit if it is %-aware.
Don't bother if this frame is already marked
*/
if (!(mState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD)) {
MarkPercentAwareFrame(aPresContext, this, aFrame);
}
if (NS_FAILED(rv)) {
return rv;
}