зеркало из https://github.com/mozilla/pjs.git
Convert text-shadow and box-shadow storage from nsStyleCoord to nscoord. (Bug 443057) r+sr=bzbarsky
This commit is contained in:
Родитель
1960035a02
Коммит
3f9161d33a
|
@ -1190,9 +1190,8 @@ nsCSSRendering::PaintBoxShadow(nsPresContext* aPresContext,
|
|||
for (PRUint32 i = styleBorder->mBoxShadow->Length(); i > 0; --i) {
|
||||
nsCSSShadowItem* shadowItem = styleBorder->mBoxShadow->ShadowAt(i - 1);
|
||||
gfxRect shadowRect(frameRect.x, frameRect.y, frameRect.width, frameRect.height);
|
||||
shadowRect.MoveBy(gfxPoint(shadowItem->mXOffset.GetCoordValue(),
|
||||
shadowItem->mYOffset.GetCoordValue()));
|
||||
shadowRect.Outset(shadowItem->mSpread.GetCoordValue());
|
||||
shadowRect.MoveBy(gfxPoint(shadowItem->mXOffset, shadowItem->mYOffset));
|
||||
shadowRect.Outset(shadowItem->mSpread);
|
||||
|
||||
gfxRect shadowRectPlusBlur = shadowRect;
|
||||
shadowRect.ScaleInverse(twipsPerPixel);
|
||||
|
@ -1200,7 +1199,7 @@ nsCSSRendering::PaintBoxShadow(nsPresContext* aPresContext,
|
|||
|
||||
// shadowRect won't include the blur, so make an extra rect here that includes the blur
|
||||
// for use in the even-odd rule below.
|
||||
nscoord blurRadius = shadowItem->mRadius.GetCoordValue();
|
||||
nscoord blurRadius = shadowItem->mRadius;
|
||||
shadowRectPlusBlur.Outset(blurRadius);
|
||||
shadowRectPlusBlur.ScaleInverse(twipsPerPixel);
|
||||
shadowRectPlusBlur.RoundOut();
|
||||
|
|
|
@ -1349,12 +1349,9 @@ nsLayoutUtils::GetTextShadowRectsUnion(const nsRect& aTextAndDecorationsRect,
|
|||
for (PRUint32 i = 0; i < textStyle->mTextShadow->Length(); ++i) {
|
||||
nsRect tmpRect(aTextAndDecorationsRect);
|
||||
nsCSSShadowItem* shadow = textStyle->mTextShadow->ShadowAt(i);
|
||||
nscoord xOffset = shadow->mXOffset.GetCoordValue();
|
||||
nscoord yOffset = shadow->mYOffset.GetCoordValue();
|
||||
nscoord blurRadius = shadow->mRadius.GetCoordValue();
|
||||
|
||||
tmpRect.MoveBy(nsPoint(xOffset, yOffset));
|
||||
tmpRect.Inflate(blurRadius, blurRadius);
|
||||
tmpRect.MoveBy(nsPoint(shadow->mXOffset, shadow->mYOffset));
|
||||
tmpRect.Inflate(shadow->mRadius, shadow->mRadius);
|
||||
|
||||
resultRect.UnionRect(resultRect, tmpRect);
|
||||
}
|
||||
|
|
|
@ -3682,12 +3682,9 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
|
|||
for (PRUint32 i = 0; i < boxShadows->Length(); ++i) {
|
||||
nsRect tmpRect = r;
|
||||
nsCSSShadowItem* shadow = boxShadows->ShadowAt(i);
|
||||
nscoord xOffset = shadow->mXOffset.GetCoordValue();
|
||||
nscoord yOffset = shadow->mYOffset.GetCoordValue();
|
||||
nscoord outsetRadius = shadow->mRadius.GetCoordValue() +
|
||||
shadow->mSpread.GetCoordValue();
|
||||
nscoord outsetRadius = shadow->mRadius + shadow->mSpread;
|
||||
|
||||
tmpRect.MoveBy(nsPoint(xOffset, yOffset));
|
||||
tmpRect.MoveBy(nsPoint(shadow->mXOffset, shadow->mYOffset));
|
||||
tmpRect.Inflate(outsetRadius, outsetRadius);
|
||||
|
||||
shadows.UnionRect(shadows, tmpRect);
|
||||
|
|
|
@ -270,7 +270,7 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
if (textStyle->mTextShadow) {
|
||||
for (PRUint32 i = textStyle->mTextShadow->Length(); i > 0; --i) {
|
||||
nsCSSShadowItem* shadow = textStyle->mTextShadow->ShadowAt(i - 1);
|
||||
nscoord blurRadius = shadow->mRadius.GetCoordValue();
|
||||
nscoord blurRadius = shadow->mRadius;
|
||||
nscolor shadowColor;
|
||||
|
||||
if (shadow->mHasColor)
|
||||
|
@ -278,8 +278,7 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
else
|
||||
shadowColor = GetStyleColor()->mColor;
|
||||
|
||||
gfxPoint offset = gfxPoint(shadow->mXOffset.GetCoordValue(),
|
||||
shadow->mYOffset.GetCoordValue());
|
||||
gfxPoint offset = gfxPoint(shadow->mXOffset, shadow->mYOffset);
|
||||
|
||||
// Add it to the display list so it is painted underneath the text and all decorations
|
||||
nsresult rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
|
|
|
@ -4103,9 +4103,8 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength,
|
|||
const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt,
|
||||
gfxContext* aCtx, const nscolor& aForegroundColor)
|
||||
{
|
||||
gfxPoint shadowOffset(aShadowDetails->mXOffset.GetCoordValue(),
|
||||
aShadowDetails->mYOffset.GetCoordValue());
|
||||
nscoord blurRadius = PR_MAX(aShadowDetails->mRadius.GetCoordValue(), 0);
|
||||
gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
|
||||
nscoord blurRadius = PR_MAX(aShadowDetails->mRadius, 0);
|
||||
|
||||
gfxTextRun::Metrics shadowMetrics =
|
||||
mTextRun->MeasureText(aOffset, aLength, PR_FALSE,
|
||||
|
|
|
@ -1623,20 +1623,20 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
static nsStyleCoord nsCSSShadowItem::* const shadowValuesNoSpread[] = {
|
||||
static nscoord nsCSSShadowItem::* const shadowValuesNoSpread[] = {
|
||||
&nsCSSShadowItem::mXOffset,
|
||||
&nsCSSShadowItem::mYOffset,
|
||||
&nsCSSShadowItem::mRadius
|
||||
};
|
||||
|
||||
static nsStyleCoord nsCSSShadowItem::* const shadowValuesWithSpread[] = {
|
||||
static nscoord nsCSSShadowItem::* const shadowValuesWithSpread[] = {
|
||||
&nsCSSShadowItem::mXOffset,
|
||||
&nsCSSShadowItem::mYOffset,
|
||||
&nsCSSShadowItem::mRadius,
|
||||
&nsCSSShadowItem::mSpread
|
||||
};
|
||||
|
||||
nsStyleCoord nsCSSShadowItem::* const * shadowValues;
|
||||
nscoord nsCSSShadowItem::* const * shadowValues;
|
||||
PRUint32 shadowValuesLength;
|
||||
if (aUsesSpread) {
|
||||
shadowValues = shadowValuesWithSpread;
|
||||
|
@ -1682,7 +1682,7 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|||
delete valueList;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
SetValueToCoord(val, item->*(shadowValues[i]));
|
||||
val->SetAppUnits(item->*(shadowValues[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2728,37 +2728,49 @@ nsRuleNode::GetShadowData(nsCSSValueList* aList,
|
|||
if (!shadowList)
|
||||
return nsnull;
|
||||
|
||||
nsStyleCoord tempCoord;
|
||||
PRBool unitOK;
|
||||
for (nsCSSShadowItem* item = shadowList->ShadowAt(0);
|
||||
aList;
|
||||
aList = aList->mNext, ++item) {
|
||||
nsCSSValue::Array *arr = aList->mValue.GetArrayValue();
|
||||
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
|
||||
SetCoord(arr->Item(0), item->mXOffset, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
SetCoord(arr->Item(1), item->mYOffset, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
NS_ASSERTION(unitOK, "unexpected unit");
|
||||
item->mXOffset = tempCoord.GetCoordValue();
|
||||
|
||||
unitOK = SetCoord(arr->Item(1), tempCoord, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
NS_ASSERTION(unitOK, "unexpected unit");
|
||||
item->mYOffset = tempCoord.GetCoordValue();
|
||||
|
||||
// Blur radius is optional in the current box-shadow spec
|
||||
if (arr->Item(2).GetUnit() != eCSSUnit_Null) {
|
||||
SetCoord(arr->Item(2), item->mRadius, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
unitOK = SetCoord(arr->Item(2), tempCoord, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
NS_ASSERTION(unitOK, "unexpected unit");
|
||||
item->mRadius = tempCoord.GetCoordValue();
|
||||
} else {
|
||||
item->mRadius.SetCoordValue(0);
|
||||
item->mRadius = 0;
|
||||
}
|
||||
|
||||
// Find the spread radius
|
||||
if (aUsesSpread && arr->Item(3).GetUnit() != eCSSUnit_Null) {
|
||||
SetCoord(arr->Item(3), item->mSpread, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
unitOK = SetCoord(arr->Item(3), tempCoord, nsStyleCoord(),
|
||||
SETCOORD_LENGTH, aContext, mPresContext, inherited);
|
||||
NS_ASSERTION(unitOK, "unexpected unit");
|
||||
item->mSpread = tempCoord.GetCoordValue();
|
||||
} else {
|
||||
item->mSpread.SetCoordValue(0);
|
||||
item->mSpread = 0;
|
||||
}
|
||||
|
||||
if (arr->Item(4).GetUnit() != eCSSUnit_Null) {
|
||||
item->mHasColor = PR_TRUE;
|
||||
// 2nd argument can be bogus since inherit is not a valid color
|
||||
SetColor(arr->Item(4), 0, mPresContext, aContext, item->mColor,
|
||||
inherited);
|
||||
unitOK = SetColor(arr->Item(4), 0, mPresContext, aContext, item->mColor,
|
||||
inherited);
|
||||
NS_ASSERTION(unitOK, "unexpected unit");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,10 +304,10 @@ struct nsBorderColors {
|
|||
};
|
||||
|
||||
struct nsCSSShadowItem {
|
||||
nsStyleCoord mXOffset; // length (coord, chars)
|
||||
nsStyleCoord mYOffset; // length (coord, chars)
|
||||
nsStyleCoord mRadius; // length (coord, chars)
|
||||
nsStyleCoord mSpread; // length (coord, chars)
|
||||
nscoord mXOffset;
|
||||
nscoord mYOffset;
|
||||
nscoord mRadius;
|
||||
nscoord mSpread;
|
||||
|
||||
nscolor mColor;
|
||||
PRPackedBool mHasColor; // Whether mColor should be used
|
||||
|
|
Загрузка…
Ссылка в новой задаче