Bug 471643: Make vertical percentages in border-radius relative to box height. r=dbaron
This commit is contained in:
@@ -628,8 +628,9 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
||||
return;
|
||||
}
|
||||
|
||||
GetBorderRadiusTwips(aStyleBorder.mBorderRadius, aForFrame->GetSize().width,
|
||||
twipsRadii);
|
||||
nsSize frameSize = aForFrame->GetSize();
|
||||
GetBorderRadiusTwips(aStyleBorder.mBorderRadius, frameSize.width,
|
||||
frameSize.height, twipsRadii);
|
||||
|
||||
// Turn off rendering for all of the zero sized sides
|
||||
if (aSkipSides & SIDE_BIT_TOP) border.top = 0;
|
||||
@@ -750,7 +751,7 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
|
||||
|
||||
// get the radius for our outline
|
||||
GetBorderRadiusTwips(ourOutline->mOutlineRadius, aBorderArea.width,
|
||||
twipsRadii);
|
||||
aBorderArea.height, twipsRadii);
|
||||
|
||||
// When the outline property is set on :-moz-anonymous-block or
|
||||
// :-moz-anonyomus-positioned-block pseudo-elements, it inherited that
|
||||
@@ -1139,18 +1140,20 @@ nsCSSRendering::DidPaint()
|
||||
|
||||
PRBool
|
||||
nsCSSRendering::GetBorderRadiusTwips(const nsStyleCorners& aBorderRadius,
|
||||
const nscoord& aFrameWidth,
|
||||
const nscoord aFrameWidth,
|
||||
const nscoord aFrameHeight,
|
||||
nscoord aRadii[8])
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
// Convert percentage values
|
||||
// Percentages are relative to whichever side they're on.
|
||||
NS_FOR_CSS_HALF_CORNERS(i) {
|
||||
const nsStyleCoord c = aBorderRadius.Get(i);
|
||||
nscoord axis = NS_HALF_CORNER_IS_X(i) ? aFrameWidth : aFrameHeight;
|
||||
|
||||
switch (c.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
aRadii[i] = (nscoord)(c.GetPercentValue() * aFrameWidth);
|
||||
aRadii[i] = (nscoord)(c.GetPercentValue() * axis);
|
||||
break;
|
||||
|
||||
case eStyleUnit_Coord:
|
||||
@@ -1185,7 +1188,9 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
||||
// Get any border radius, since box-shadow must also have rounded corners if the frame does
|
||||
nscoord twipsRadii[8];
|
||||
PRBool hasBorderRadius = GetBorderRadiusTwips(styleBorder->mBorderRadius,
|
||||
aFrameArea.width, twipsRadii);
|
||||
aFrameArea.width,
|
||||
aFrameArea.height,
|
||||
twipsRadii);
|
||||
nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1);
|
||||
|
||||
gfxCornerSizes borderRadii;
|
||||
@@ -1312,7 +1317,9 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
|
||||
// Get any border radius, since box-shadow must also have rounded corners if the frame does
|
||||
nscoord twipsRadii[8];
|
||||
PRBool hasBorderRadius = GetBorderRadiusTwips(styleBorder->mBorderRadius,
|
||||
aFrameArea.width, twipsRadii);
|
||||
aFrameArea.width,
|
||||
aFrameArea.height,
|
||||
twipsRadii);
|
||||
nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1);
|
||||
|
||||
nsRect paddingRect = aFrameArea;
|
||||
@@ -2203,9 +2210,10 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
PRBool haveRoundedCorners;
|
||||
{
|
||||
nscoord radii[8];
|
||||
nsSize frameSize = aForFrame->GetSize();
|
||||
haveRoundedCorners =
|
||||
GetBorderRadiusTwips(aBorder.mBorderRadius, aForFrame->GetSize().width,
|
||||
radii);
|
||||
GetBorderRadiusTwips(aBorder.mBorderRadius, frameSize.width,
|
||||
frameSize.height, radii);
|
||||
if (haveRoundedCorners)
|
||||
ComputePixelRadii(radii, aBorderArea, aForFrame->GetSkipSides(),
|
||||
appUnitsPerPixel, &bgRadii);
|
||||
|
||||
Reference in New Issue
Block a user