Bug 794693, part 2: Perform parent reflow state calculation at the box-block interface before setting up child reflow state to prevent crashing when a parent reflow state is assumed to be non-null. [r=dbaron]

This commit is contained in:
Scott Johnson 2013-09-07 19:02:11 -05:00
parent c1e8429b4d
commit 3b3b31593d
4 changed files with 27 additions and 21 deletions

View File

@ -0,0 +1,9 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body style="display: -moz-box;">
<font style="display: table; float: left;">
<span style="display: table;">
text text
</span>
</font>
</body>
</html>

View File

@ -466,6 +466,7 @@ load 769303-2.html
load 769120.html
load 786740-1.html
asserts(0-4) test-pref(font.size.inflation.emPerLine,15) load 791601.xhtml # 3 counts of bug 871327, 1 bug 367185
pref(font.size.inflation.minTwips,120) load 794693.html
asserts(8) test-pref(layout.css.flexbox.enabled,true) load 798020-1.html
test-pref(layout.css.flexbox.enabled,true) load 798235-1.html
test-pref(layout.css.flexbox.enabled,true) load 799207-1.html

View File

@ -7770,15 +7770,6 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
gIndent2++;
#endif
//printf("width=%d, height=%d\n", aWidth, aHeight);
/*
nsIFrame* parent;
GetParentBox(&parent);
// if (parent->GetStateBits() & NS_STATE_CURRENTLY_IN_DEBUG)
// printf("In debug\n");
*/
nsBoxLayoutMetrics *metrics = BoxMetrics();
nsReflowStatus status = NS_FRAME_COMPLETE;
@ -7855,30 +7846,35 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
parentReflowState.mComputedBorderPadding +=
parentReflowState.mComputedPadding;
// XXX Is it OK that this reflow state has no parent reflow state?
// (It used to have a bogus parent, skipping all the boxes).
nsSize availSize(aWidth, NS_INTRINSICSIZE);
nsHTMLReflowState reflowState(aPresContext, this, aRenderingContext,
availSize,
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
// Construct the parent chain manually since constructing it normally
// messes up dimensions.
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
NS_ASSERTION(!outerReflowState || outerReflowState->frame != this,
"in and out of XUL on a single frame?");
const nsHTMLReflowState* parentRS;
if (outerReflowState && outerReflowState->frame == parentFrame) {
// We're a frame (such as a text control frame) that jumps into
// box reflow and then straight out of it on the child frame.
// This means we actually have a real parent reflow state.
// nsLayoutUtils::InflationMinFontSizeFor used to need this to be
// linked up correctly for text control frames, so do so here).
reflowState.parentReflowState = outerReflowState;
reflowState.mCBReflowState = outerReflowState;
parentRS = outerReflowState;
} else {
reflowState.parentReflowState = &parentReflowState;
reflowState.mCBReflowState = &parentReflowState;
parentRS = &parentReflowState;
}
// XXX Is it OK that this reflow state has only one ancestor?
// (It used to have a bogus parent, skipping all the boxes).
nsSize availSize(aWidth, NS_INTRINSICSIZE);
nsHTMLReflowState reflowState(aPresContext, *parentRS, this,
availSize, -1, -1,
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
// XXX_jwir3: This is somewhat fishy. If this is actually changing the value
// here (which it might be), then we should make sure that it's
// correct the first time around, rather than changing it later.
reflowState.mCBReflowState = parentRS;
reflowState.mReflowDepth = aState.GetReflowDepth();
// mComputedWidth and mComputedHeight are content-box, not

View File

@ -1845,7 +1845,7 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
// If this is a reflow root, then set the computed width and
// height equal to the available space
if (nullptr == parentReflowState) {
if (nullptr == parentReflowState || mFlags.mDummyParentReflowState) {
// XXXldb This doesn't mean what it used to!
InitOffsets(aContainingBlockWidth,
VerticalOffsetPercentBasis(frame, aContainingBlockWidth,