Bug 472950. Only do the lazy-set-parent-pointer optimization if we have no children and no next-in-flow. r=dbaron

git-svn-id: svn://10.0.0.236/trunk@257473 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu 2009-06-12 03:06:13 +00:00
parent ff93bb4fc7
commit ffd384d773
3 changed files with 32 additions and 5 deletions

View File

@ -0,0 +1,21 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>div::first-letter { color: green; }</style>
<script>
function boom()
{
var e = document.getElementById("e");
document.documentElement.style.direction = "rtl";
e.style.whiteSpace = "pre";
}
</script>
</head>
<body onload="boom();">
<div><span style="direction: rtl;" id="e"><span>
</span>A B</span></div>
</body></html></html>

View File

@ -145,4 +145,5 @@ load 431260-1.html
load 431260-2.html
load 445288.html
load 472776-1.html
load 472950-1.html
load 477928.html

View File

@ -316,14 +316,19 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext,
nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, prevOverflowFrames,
prevInFlow, this);
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
// If it's the initial reflow, then our child list must be empty, so
// just set the child list rather than calling InsertFrame(). This avoids
// having to get the last child frame in the list.
// Check if we should do the lazilySetParentPointer optimization.
// Only do it in simple cases where we're being reflowed for the
// first time, nothing (e.g. bidi resolution) has already given
// us children, and there's no next-in-flow, so all our frames
// will be taken from prevOverflowFrames.
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) && mFrames.IsEmpty() &&
!GetNextInFlow()) {
// If our child list is empty, just set the child list rather than
// calling InsertFrame(). This avoids having to get the last child
// frame in the list.
// Note that we don't set the parent pointer for the new frames. Instead wait
// to do this until we actually reflow the frame. If the overflow list contains
// thousands of frames this is a big performance issue (see bug #5588)
NS_ASSERTION(mFrames.IsEmpty(), "child list is not empty for initial reflow");
mFrames.SetFrames(prevOverflowFrames);
lazilySetParentPointer = PR_TRUE;
} else {