Bug 1320239 - use nscoord instead of nsStyleCoord for -webkit-text-stroke-width. r=heycam

MozReview-Commit-ID: 94fL7YgZqCl

--HG--
extra : rebase_source : ad651ab9270a9e19a21401b81745808cc7a8a74b
This commit is contained in:
Jeremy Chen 2016-11-29 20:08:08 +08:00
parent 8679794758
commit 7e8439ba23
5 changed files with 13 additions and 22 deletions

View File

@ -344,7 +344,7 @@ public:
if (mFrame->IsSVGText()) {
return 0.0f;
}
nscoord coord = mFrame->StyleText()->mWebkitTextStrokeWidth.GetCoordValue();
nscoord coord = mFrame->StyleText()->mWebkitTextStrokeWidth;
return mFrame->PresContext()->AppUnitsToFloatDevPixels(coord);
}
@ -5701,7 +5701,7 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
}
// text-stroke overflows
nscoord textStrokeWidth = StyleText()->mWebkitTextStrokeWidth.GetCoordValue();
nscoord textStrokeWidth = StyleText()->mWebkitTextStrokeWidth;
if (textStrokeWidth > 0) {
nsRect strokeRect = *aVisualOverflowRect;
strokeRect.x -= textStrokeWidth;

View File

@ -4064,7 +4064,7 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetWebkitTextStrokeWidth()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(StyleText()->mWebkitTextStrokeWidth.GetCoordValue());
val->SetAppUnits(StyleText()->mWebkitTextStrokeWidth);
return val.forget();
}

View File

@ -4965,22 +4965,13 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
&nsStyleText::mWebkitTextStrokeColor);
// -webkit-text-stroke-width: length, inherit, initial, enum
const nsCSSValue*
webkitTextStrokeWidthValue = aRuleData->ValueForWebkitTextStrokeWidth();
if (webkitTextStrokeWidthValue->GetUnit() == eCSSUnit_Enumerated) {
NS_ASSERTION(webkitTextStrokeWidthValue->GetIntValue() == NS_STYLE_BORDER_WIDTH_THIN ||
webkitTextStrokeWidthValue->GetIntValue() == NS_STYLE_BORDER_WIDTH_MEDIUM ||
webkitTextStrokeWidthValue->GetIntValue() == NS_STYLE_BORDER_WIDTH_THICK,
"Unexpected enum value");
text->mWebkitTextStrokeWidth.SetCoordValue(
nsPresContext::GetBorderWidthForKeyword(webkitTextStrokeWidthValue->GetIntValue()));
} else {
SetCoord(*webkitTextStrokeWidthValue, text->mWebkitTextStrokeWidth,
parentText->mWebkitTextStrokeWidth,
SETCOORD_LH | SETCOORD_CALC_LENGTH_ONLY |
SETCOORD_CALC_CLAMP_NONNEGATIVE |
SETCOORD_INITIAL_ZERO | SETCOORD_UNSET_INHERIT,
aContext, mPresContext, conditions);
Maybe<nscoord> coord =
ComputeLineWidthValue<eUnsetInherit>(
*aRuleData->ValueForWebkitTextStrokeWidth(),
parentText->mWebkitTextStrokeWidth, 0,
aContext, mPresContext, conditions);
if (coord.isSome()) {
text->mWebkitTextStrokeWidth = *coord;
}
// -moz-control-character-visibility: enum, inherit, initial

View File

@ -3791,7 +3791,7 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
, mLetterSpacing(eStyleUnit_Normal)
, mLineHeight(eStyleUnit_Normal)
, mTextIndent(0, nsStyleCoord::CoordConstructor)
, mWebkitTextStrokeWidth(0, nsStyleCoord::CoordConstructor)
, mWebkitTextStrokeWidth(0)
, mTextShadow(nullptr)
{
MOZ_COUNT_CTOR(nsStyleText);

View File

@ -2092,7 +2092,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
nsStyleCoord mLetterSpacing; // [inherited] coord, normal
nsStyleCoord mLineHeight; // [inherited] coord, factor, normal
nsStyleCoord mTextIndent; // [inherited] coord, percent, calc
nsStyleCoord mWebkitTextStrokeWidth; // [inherited] coord
nscoord mWebkitTextStrokeWidth; // [inherited] coord
RefPtr<nsCSSShadowArray> mTextShadow; // [inherited] nullptr in case of a zero-length
@ -2138,7 +2138,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
}
bool HasWebkitTextStroke() const {
return mWebkitTextStrokeWidth.GetCoordValue() > 0;
return mWebkitTextStrokeWidth > 0;
}
// These are defined in nsStyleStructInlines.h.