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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user