mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-01 12:03:08 +00:00
Fixed column's incremental reflow function to properly handle margins
This commit is contained in:
parent
d61f7585c3
commit
2e70be499e
@ -1181,6 +1181,10 @@ PRBool nsContainerFrame::IsChild(const nsIFrame* aChild) const
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX Turn back on once all frame code has been changed to always add
|
||||
// a child frame to the sibling list before reflowing the child. Right now
|
||||
// that's not true for inline and column when reflowing unmapped children...
|
||||
#if 0
|
||||
// Check that aChild is in our sibling list
|
||||
PRInt32 index;
|
||||
|
||||
@ -1188,6 +1192,7 @@ PRBool nsContainerFrame::IsChild(const nsIFrame* aChild) const
|
||||
if (-1 == index) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1048,17 +1048,9 @@ NS_METHOD ColumnFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
||||
state.prevMaxPosBottomMargin = bottomMargin;
|
||||
}
|
||||
} else {
|
||||
// Get style info
|
||||
nsIStyleContext* kidSC;
|
||||
|
||||
kidFrame->GetStyleContext(aPresContext, kidSC);
|
||||
nsStyleMolecule* kidMol =
|
||||
(nsStyleMolecule*)kidSC->GetData(kStyleMoleculeSID);
|
||||
nscoord topMargin = kidMol->margin.top;
|
||||
NS_RELEASE(kidSC);
|
||||
|
||||
// Initialize y to start after the top margin
|
||||
state.y = topMargin;
|
||||
state.prevMaxNegBottomMargin = 0;
|
||||
state.prevMaxPosBottomMargin = 0;
|
||||
state.y = 0;
|
||||
}
|
||||
|
||||
aSpaceManager->Translate(0, state.y);
|
||||
@ -1079,13 +1071,20 @@ NS_METHOD ColumnFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
||||
kidFrame->GetStyleContext(aPresContext, kidSC);
|
||||
nsStyleMolecule* kidMol =
|
||||
(nsStyleMolecule*)kidSC->GetData(kStyleMoleculeSID);
|
||||
nscoord topMargin = GetTopMarginFor(aPresContext, state, kidFrame, kidMol);
|
||||
|
||||
nsRect kidRect;
|
||||
nsSize kidAvailSize(state.availSize);
|
||||
|
||||
if (PR_FALSE == state.unconstrainedHeight) {
|
||||
kidAvailSize.height -= topMargin;
|
||||
}
|
||||
|
||||
// Reflow the child
|
||||
state.spaceManager->Translate(0, topMargin);
|
||||
aStatus = ReflowChild(kidFrame, aPresContext, kidMol, state.spaceManager,
|
||||
kidAvailSize, kidRect, nsnull);
|
||||
state.spaceManager->Translate(0, -topMargin);
|
||||
|
||||
// Did it fit?
|
||||
if ((kidFrame != mFirstChild) &&
|
||||
@ -1100,6 +1099,8 @@ NS_METHOD ColumnFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Place the child
|
||||
state.y += topMargin;
|
||||
state.spaceManager->Translate(0, topMargin);
|
||||
nsSize kidMaxElementSize; // XXX unused
|
||||
kidRect.x += kidMol->margin.left;
|
||||
kidRect.y += state.y;
|
||||
|
Loading…
x
Reference in New Issue
Block a user