mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-29 01:00:41 +00:00
Use the post-reflow GetUsedMargin() value when placing the legend. b=433700 r+sr=dbaron
This commit is contained in:
parent
5009816d79
commit
86d4cc0003
@ -418,7 +418,6 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
reflowLegend = mLegendFrame != nsnull;
|
||||
} else {
|
||||
reflowContent = mContentFrame && NS_SUBTREE_DIRTY(mContentFrame);
|
||||
|
||||
reflowLegend = mLegendFrame && NS_SUBTREE_DIRTY(mLegendFrame);
|
||||
}
|
||||
|
||||
@ -438,17 +437,13 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// get our border and padding
|
||||
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
|
||||
const nsMargin &padding = aReflowState.mComputedPadding;
|
||||
nsMargin border = borderPadding - padding;
|
||||
nsMargin border = borderPadding - aReflowState.mComputedPadding;
|
||||
|
||||
// Figure out how big the legend is if there is one.
|
||||
// get the legend's margin
|
||||
nsMargin legendMargin(0,0,0,0);
|
||||
// reflow the legend only if needed
|
||||
if (reflowLegend) {
|
||||
const nsStyleMargin* marginStyle = mLegendFrame->GetStyleMargin();
|
||||
marginStyle->GetMargin(legendMargin);
|
||||
|
||||
nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
|
||||
mLegendFrame, availSize);
|
||||
|
||||
@ -460,6 +455,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
|
||||
#endif
|
||||
// figure out the legend's rectangle
|
||||
legendMargin = mLegendFrame->GetUsedMargin();
|
||||
mLegendRect.width = legendDesiredSize.width + legendMargin.left + legendMargin.right;
|
||||
mLegendRect.height = legendDesiredSize.height + legendMargin.top + legendMargin.bottom;
|
||||
mLegendRect.x = borderPadding.left;
|
||||
@ -491,7 +487,11 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
} else if (!mLegendFrame) {
|
||||
mLegendRect.Empty();
|
||||
mLegendSpace = 0;
|
||||
} // else mLegendSpace and mLegendRect haven't changed...
|
||||
} else {
|
||||
// mLegendSpace and mLegendRect haven't changed, but we need
|
||||
// the used margin when placing the legend.
|
||||
legendMargin = mLegendFrame->GetUsedMargin();
|
||||
}
|
||||
|
||||
// reflow the content frame only if needed
|
||||
if (reflowContent) {
|
||||
@ -519,7 +519,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
nsRect contentRect(0,0,0,0);
|
||||
if (mContentFrame) {
|
||||
// We don't support margins on mContentFrame, so our "content rect" is jut
|
||||
// We don't support margins on mContentFrame, so our "content rect" is just
|
||||
// its rect.
|
||||
contentRect = mContentFrame->GetRect();
|
||||
}
|
||||
@ -532,7 +532,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
if (mLegendFrame) {
|
||||
// if the content rect is larger then the legend we can align the legend
|
||||
if (contentRect.width > mLegendRect.width) {
|
||||
PRInt32 align = ((nsLegendFrame*)mLegendFrame)->GetAlign();
|
||||
PRInt32 align = static_cast<nsLegendFrame*>(mLegendFrame)->GetAlign();
|
||||
|
||||
switch(align) {
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
@ -545,7 +545,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
} else {
|
||||
//otherwise make place for the legend
|
||||
// otherwise make place for the legend
|
||||
contentRect.width = mLegendRect.width;
|
||||
}
|
||||
// place the legend
|
||||
|
Loading…
x
Reference in New Issue
Block a user