Bug 1181087 - part 1 - Eliminate the few callers of physical-coordinate setters on the logical-coordinate geometry classes. r=smontagu

This commit is contained in:
Jonathan Kew 2015-07-07 14:20:09 +01:00
parent 8e336f499c
commit e3f1e25172
5 changed files with 23 additions and 22 deletions

View File

@ -230,10 +230,10 @@ nsMeterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
LogicalSize autoSize(wm);
autoSize.BSize(wm) = autoSize.ISize(wm) = fontMet->Font().size; // 1em
if (ResolvedOrientationIsVertical()) {
autoSize.Height(wm) *= 5; // 5em
if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
autoSize.ISize(wm) *= 5; // 5em
} else {
autoSize.Width(wm) *= 5; // 5em
autoSize.BSize(wm) *= 5; // 5em
}
return autoSize.ConvertTo(aWM, wm);

View File

@ -236,10 +236,10 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
NSToCoordRound(StyleFont()->mFont.size *
nsLayoutUtils::FontSizeInflationFor(this)); // 1em
if (ResolvedOrientationIsVertical()) {
autoSize.Height(wm) *= 10; // 10em
if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
autoSize.ISize(wm) *= 10; // 10em
} else {
autoSize.Width(wm) *= 10; // 10em
autoSize.BSize(wm) *= 10; // 10em
}
return autoSize.ConvertTo(aWM, wm);

View File

@ -215,11 +215,12 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
NS_ASSERTION(scrollableFrame, "Child must be scrollable");
if (scrollableFrame) {
nsMargin scrollbarSizes =
scrollableFrame->GetDesiredScrollbarSizes(PresContext(), aRenderingContext);
LogicalMargin scrollbarSizes(aWM,
scrollableFrame->GetDesiredScrollbarSizes(PresContext(),
aRenderingContext));
aIntrinsicSize.Width(aWM) += scrollbarSizes.LeftRight();
aIntrinsicSize.Height(aWM) += scrollbarSizes.TopBottom();
aIntrinsicSize.ISize(aWM) += scrollbarSizes.IStartEnd(aWM);
aIntrinsicSize.BSize(aWM) += scrollbarSizes.BStartEnd(aWM);
}
}

View File

@ -4328,20 +4328,20 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
GetMinimumWidgetSize(presContext, this, disp->mAppearance,
&widget, &canOverride);
// Dimensions from themed widgets are applied physically...
nsSize size;
size.width = presContext->DevPixelsToAppUnits(widget.width);
size.height = presContext->DevPixelsToAppUnits(widget.height);
// Convert themed widget's physical dimensions to logical coords
LogicalSize size(aWM,
nsSize(presContext->DevPixelsToAppUnits(widget.width),
presContext->DevPixelsToAppUnits(widget.height)));
// GMWS() returns border-box; we need content-box
size.width -= aBorder.Width(aWM) + aPadding.Width(aWM);
size.height -= aBorder.Height(aWM) + aPadding.Height(aWM);
size.ISize(aWM) -= aBorder.ISize(aWM) + aPadding.ISize(aWM);
size.BSize(aWM) -= aBorder.BSize(aWM) + aPadding.BSize(aWM);
if (size.height > result.Height(aWM) || !canOverride) {
result.Height(aWM) = size.height;
if (size.BSize(aWM) > result.BSize(aWM) || !canOverride) {
result.BSize(aWM) = size.BSize(aWM);
}
if (size.width > result.Width(aWM) || !canOverride) {
result.Width(aWM) = size.width;
if (size.ISize(aWM) > result.ISize(aWM) || !canOverride) {
result.ISize(aWM) = size.ISize(aWM);
}
}

View File

@ -1960,10 +1960,10 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(
// Note: We don't emulate this quirk for percents in calc() or in
// vertical writing modes.
if (!wm.IsVertical() &&
NS_AUTOHEIGHT == cbSize.Height(wm)) {
NS_AUTOHEIGHT == cbSize.BSize(wm)) {
if (eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
mStylePosition->mHeight.GetUnit() == eStyleUnit_Percent) {
cbSize.Height(wm) = CalcQuirkContainingBlockHeight(aContainingBlockRS);
cbSize.BSize(wm) = CalcQuirkContainingBlockHeight(aContainingBlockRS);
}
}
}