Bug 1248708 - Part1: parse and compute -webkit-text-stroke property. r=heycam

This commit is contained in:
Jeremy Chen
2016-04-23 01:40:39 +08:00
parent 12db17691a
commit 753e4f7268
15 changed files with 222 additions and 5 deletions

View File

@@ -3573,6 +3573,7 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
mTextAlignLastTrue = false;
mTextEmphasisColorForeground = true;
mWebkitTextFillColorForeground = true;
mWebkitTextStrokeColorForeground = true;
mTextTransform = NS_STYLE_TEXT_TRANSFORM_NONE;
mWhiteSpace = NS_STYLE_WHITESPACE_NORMAL;
mWordBreak = NS_STYLE_WORDBREAK_NORMAL;
@@ -3591,12 +3592,14 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT;
mTextEmphasisColor = aContext.DefaultColor();
mWebkitTextFillColor = aContext.DefaultColor();
mWebkitTextStrokeColor = aContext.DefaultColor();
mControlCharacterVisibility = nsCSSParser::ControlCharVisibilityDefault();
mWordSpacing.SetCoordValue(0);
mLetterSpacing.SetNormalValue();
mLineHeight.SetNormalValue();
mTextIndent.SetCoordValue(0);
mWebkitTextStrokeWidth.SetCoordValue(0);
mTextShadow = nullptr;
mTabSize = NS_STYLE_TABSIZE_INITIAL;
@@ -3609,6 +3612,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
mTextAlignLastTrue(false),
mTextEmphasisColorForeground(aSource.mTextEmphasisColorForeground),
mWebkitTextFillColorForeground(aSource.mWebkitTextFillColorForeground),
mWebkitTextStrokeColorForeground(aSource.mWebkitTextStrokeColorForeground),
mTextTransform(aSource.mTextTransform),
mWhiteSpace(aSource.mWhiteSpace),
mWordBreak(aSource.mWordBreak),
@@ -3625,10 +3629,12 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
mTabSize(aSource.mTabSize),
mTextEmphasisColor(aSource.mTextEmphasisColor),
mWebkitTextFillColor(aSource.mWebkitTextFillColor),
mWebkitTextStrokeColor(aSource.mWebkitTextStrokeColor),
mWordSpacing(aSource.mWordSpacing),
mLetterSpacing(aSource.mLetterSpacing),
mLineHeight(aSource.mLineHeight),
mTextIndent(aSource.mTextIndent),
mWebkitTextStrokeWidth(aSource.mWebkitTextStrokeWidth),
mTextShadow(aSource.mTextShadow),
mTextEmphasisStyleString(aSource.mTextEmphasisStyleString)
{
@@ -3692,7 +3698,8 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const
if (!AreShadowArraysEqual(mTextShadow, aOther.mTextShadow) ||
mTextEmphasisStyle != aOther.mTextEmphasisStyle ||
mTextEmphasisStyleString != aOther.mTextEmphasisStyleString) {
mTextEmphasisStyleString != aOther.mTextEmphasisStyleString ||
mWebkitTextStrokeWidth != aOther.mWebkitTextStrokeWidth) {
hint |= nsChangeHint_UpdateSubtreeOverflow |
nsChangeHint_SchedulePaint |
nsChangeHint_RepaintFrame;
@@ -3709,7 +3716,9 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const
if (mTextEmphasisColorForeground != aOther.mTextEmphasisColorForeground ||
mTextEmphasisColor != aOther.mTextEmphasisColor ||
mWebkitTextFillColorForeground != aOther.mWebkitTextFillColorForeground ||
mWebkitTextFillColor != aOther.mWebkitTextFillColor) {
mWebkitTextFillColor != aOther.mWebkitTextFillColor ||
mWebkitTextStrokeColorForeground != aOther.mWebkitTextStrokeColorForeground ||
mWebkitTextStrokeColor != aOther.mWebkitTextStrokeColor) {
NS_UpdateHint(hint, nsChangeHint_SchedulePaint);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
}