mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851379 part 1: Rename ComputeWidthDependentValue to ComputeCBDependentValue. r=mats
This commit is contained in:
parent
abf0204513
commit
2e9d4d47f3
@ -2971,17 +2971,16 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsLayoutUtils::ComputeWidthDependentValue(
|
||||
nscoord aContainingBlockWidth,
|
||||
const nsStyleCoord& aCoord)
|
||||
nsLayoutUtils::ComputeCBDependentValue(nscoord aPercentBasis,
|
||||
const nsStyleCoord& aCoord)
|
||||
{
|
||||
NS_WARN_IF_FALSE(aContainingBlockWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"have unconstrained width; this should only result from "
|
||||
"very large sizes, not attempts at intrinsic width "
|
||||
"calculation");
|
||||
NS_WARN_IF_FALSE(aPercentBasis != NS_UNCONSTRAINEDSIZE,
|
||||
"have unconstrained width or height; this should only "
|
||||
"result from very large sizes, not attempts at intrinsic "
|
||||
"size calculation");
|
||||
|
||||
if (aCoord.IsCoordPercentCalcUnit()) {
|
||||
return nsRuleNode::ComputeCoordPercentCalc(aCoord, aContainingBlockWidth);
|
||||
return nsRuleNode::ComputeCoordPercentCalc(aCoord, aPercentBasis);
|
||||
}
|
||||
NS_ASSERTION(aCoord.GetUnit() == eStyleUnit_None ||
|
||||
aCoord.GetUnit() == eStyleUnit_Auto,
|
||||
|
@ -947,11 +947,12 @@ public:
|
||||
|
||||
/*
|
||||
* Convert nsStyleCoord to nscoord when percentages depend on the
|
||||
* containing block width.
|
||||
* containing block size.
|
||||
* @param aPercentBasis The width or height of the containing block
|
||||
* (whichever the client wants to use for resolving percentages).
|
||||
*/
|
||||
static nscoord ComputeWidthDependentValue(
|
||||
nscoord aContainingBlockWidth,
|
||||
const nsStyleCoord& aCoord);
|
||||
static nscoord ComputeCBDependentValue(nscoord aPercentBasis,
|
||||
const nsStyleCoord& aCoord);
|
||||
|
||||
/*
|
||||
* Convert nsStyleCoord to nscoord when percentages depend on the
|
||||
|
@ -766,8 +766,8 @@ nsHTMLReflowState::ComputeRelativeOffsets(uint8_t aCBDirection,
|
||||
} else {
|
||||
// 'Right' isn't 'auto' so compute its value
|
||||
aComputedOffsets.right = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
position->mOffset.GetRight());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
position->mOffset.GetRight());
|
||||
|
||||
// Computed value for 'left' is minus the value of 'right'
|
||||
aComputedOffsets.left = -aComputedOffsets.right;
|
||||
@ -778,8 +778,8 @@ nsHTMLReflowState::ComputeRelativeOffsets(uint8_t aCBDirection,
|
||||
|
||||
// 'Left' isn't 'auto' so compute its value
|
||||
aComputedOffsets.left = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
position->mOffset.GetLeft());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
position->mOffset.GetLeft());
|
||||
|
||||
// Computed value for 'right' is minus the value of 'left'
|
||||
aComputedOffsets.right = -aComputedOffsets.left;
|
||||
@ -944,11 +944,11 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(
|
||||
if (!mStylePadding->GetPadding(padding)) {
|
||||
// We have to compute the left and right values
|
||||
padding.left = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeft());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeft());
|
||||
padding.right = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRight());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRight());
|
||||
}
|
||||
|
||||
// See if the style system can provide us the margin directly
|
||||
@ -959,16 +959,16 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(
|
||||
margin.left = 0; // just ignore
|
||||
} else {
|
||||
margin.left = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeft());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeft());
|
||||
}
|
||||
if (eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit()) {
|
||||
// XXX FIXME (or does CalculateBlockSideMargins do this?)
|
||||
margin.right = 0; // just ignore
|
||||
} else {
|
||||
margin.right = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRight());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRight());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1309,16 +1309,16 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
leftIsAuto = true;
|
||||
} else {
|
||||
mComputedOffsets.left = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(containingBlockWidth,
|
||||
mStylePosition->mOffset.GetLeft());
|
||||
ComputeCBDependentValue(containingBlockWidth,
|
||||
mStylePosition->mOffset.GetLeft());
|
||||
}
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = 0;
|
||||
rightIsAuto = true;
|
||||
} else {
|
||||
mComputedOffsets.right = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(containingBlockWidth,
|
||||
mStylePosition->mOffset.GetRight());
|
||||
ComputeCBDependentValue(containingBlockWidth,
|
||||
mStylePosition->mOffset.GetRight());
|
||||
}
|
||||
|
||||
// Use the horizontal component of the hypothetical box in the cases
|
||||
@ -2432,22 +2432,22 @@ nsCSSOffsetState::ComputeMargin(nscoord aContainingBlockWidth)
|
||||
if (isWidthDependent) {
|
||||
// We have to compute the value
|
||||
mComputedMargin.left = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetLeft());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetLeft());
|
||||
mComputedMargin.right = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetRight());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetRight());
|
||||
|
||||
// According to the CSS2 spec, margin percentages are
|
||||
// calculated with respect to the *width* of the containing
|
||||
// block, even for margin-top and margin-bottom.
|
||||
// XXX This isn't true for page boxes, if we implement them.
|
||||
mComputedMargin.top = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetTop());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetTop());
|
||||
mComputedMargin.bottom = nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetBottom());
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
styleMargin->mMargin.GetBottom());
|
||||
}
|
||||
|
||||
nscoord marginAdjustment = FontSizeInflationListMarginAdjustment(frame);
|
||||
@ -2482,20 +2482,20 @@ nsCSSOffsetState::ComputePadding(nscoord aContainingBlockWidth, nsIAtom* aFrameT
|
||||
// We have to compute the value
|
||||
// clamp negative calc() results to 0
|
||||
mComputedPadding.left = std::max(0, nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetLeft()));
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetLeft()));
|
||||
mComputedPadding.right = std::max(0, nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetRight()));
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetRight()));
|
||||
|
||||
// According to the CSS2 spec, percentages are calculated with respect to
|
||||
// containing block width for padding-top and padding-bottom
|
||||
mComputedPadding.top = std::max(0, nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetTop()));
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetTop()));
|
||||
mComputedPadding.bottom = std::max(0, nsLayoutUtils::
|
||||
ComputeWidthDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetBottom()));
|
||||
ComputeCBDependentValue(aContainingBlockWidth,
|
||||
stylePadding->mPadding.GetBottom()));
|
||||
}
|
||||
return isWidthDependent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user