Bug 789096 patch 9: use logical coordinates in nsHTMLReflowState available size. r=jfkthame

This commit is contained in:
Simon Montagu
2014-07-24 01:28:46 -07:00
parent 2f544c748c
commit 0132cc9646
48 changed files with 489 additions and 270 deletions

View File

@@ -244,12 +244,14 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// which occupies part of the button's content-box area:
const nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();
nsSize availSize(aButtonReflowState.ComputedWidth(), NS_INTRINSICSIZE);
WritingMode wm = aFirstKid->GetWritingMode();
LogicalSize availSize = aButtonReflowState.ComputedSize(GetWritingMode());
availSize.BSize(wm) = NS_INTRINSICSIZE;
// Indent the child inside us by the focus border. We must do this separate
// from the regular border.
availSize.width -= focusPadding.LeftRight();
availSize.ISize(wm) -= LogicalMargin(wm, focusPadding).IStartEnd(wm);
// See whether out availSize's width is big enough. If it's smaller than our
// intrinsic min width, that means that the kid wouldn't really fit; for a
// better look in such cases we adjust the available width and our left
@@ -262,15 +264,15 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
nscoord extraleft = extrawidth / 2;
nscoord extraright = extrawidth - extraleft;
NS_ASSERTION(extraright >=0, "How'd that happen?");
// Do not allow the extras to be bigger than the relevant padding
extraleft = std::min(extraleft, aButtonReflowState.ComputedPhysicalPadding().left);
extraright = std::min(extraright, aButtonReflowState.ComputedPhysicalPadding().right);
xoffset -= extraleft;
availSize.width += extraleft + extraright;
availSize.SetWidth(wm, availSize.Width(wm) + extraleft + extraright);
}
availSize.width = std::max(availSize.width,0);
availSize.SetWidth(wm, std::max(availSize.Width(wm), 0));
// Give child a clone of the button's reflow state, with height/width reduced
// by focusPadding, so that descendants with height:100% don't protrude.
nsHTMLReflowState adjustedButtonReflowState =