Bug 1153140 - Include borderPadding width in the containerWidth for grid item placement. r=mats

This commit is contained in:
Jonathan Kew 2015-04-10 16:56:23 +01:00
parent cb00f3ba31
commit 3f6e6d70c0
3 changed files with 12 additions and 7 deletions

View File

@ -947,7 +947,7 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerWidth != NS_UNCONSTRAINEDSIZE,
"FinishReflowChild with unconstrained container width!");
"ReflowChild with unconstrained container width!");
}
// Position the child frame and its view if requested.

View File

@ -235,10 +235,12 @@ public:
* If the reflow status after reflowing the child is FULLY_COMPLETE then any
* next-in-flows are deleted using DeleteNextInFlowChild().
*
* @param aContainerWidth width of the border-box of the containing frame
*
* Flags:
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
* don't want to automatically sync the frame and view
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aX and aY are ignored in this
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aPos is ignored in this
* case. Also implies NS_FRAME_NO_MOVE_VIEW
*/
void ReflowChild(nsIFrame* aChildFrame,
@ -262,8 +264,10 @@ public:
* - sets the view's visibility, opacity, content transparency, and clip
* - invoked the DidReflow() function
*
* @param aContainerWidth width of the border-box of the containing frame
*
* Flags:
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aX and aY are ignored in this
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aPos is ignored in this
* case. Also implies NS_FRAME_NO_MOVE_VIEW
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
* don't want to automatically sync the frame and view

View File

@ -1104,7 +1104,8 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
{
WritingMode wm = aReflowState.GetWritingMode();
const LogicalPoint gridOrigin(aContentArea.Origin(wm));
const nscoord gridWidth = aContentArea.Width(wm);
const nscoord containerWidth = aContentArea.Width(wm) +
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
nsPresContext* pc = PresContext();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
@ -1128,9 +1129,9 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
nsHTMLReflowMetrics childSize(childRS);
nsReflowStatus childStatus;
ReflowChild(child, pc, childSize, childRS, wm, childPos,
gridWidth, 0, childStatus);
containerWidth, 0, childStatus);
FinishReflowChild(child, pc, childSize, &childRS, wm, childPos,
gridWidth, 0);
containerWidth, 0);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, child);
// XXX deal with 'childStatus' not being COMPLETE
}
@ -1160,7 +1161,7 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
cb = new nsRect;
child->Properties().Set(GridItemContainingBlockRect(), cb);
}
*cb = itemCB.GetPhysicalRect(wm, gridWidth);
*cb = itemCB.GetPhysicalRect(wm, containerWidth);
}
// This rect isn't used at all for layout so we use it to optimize
// away the virtual GetType() call in the callee in most cases.