Bug 812995 Support 'blink' value at -moz-text-decoration-line and drop -moz-text-blink r=dbaron

This commit is contained in:
Masayuki Nakano 2013-08-06 23:02:34 +09:00
Родитель 5aaa7da647
Коммит 38ea6c4763
14 изменённых файлов: 40 добавлений и 149 удалений

Просмотреть файл

@ -245,7 +245,6 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
case eCSSProperty_stroke_opacity:
case eCSSProperty_stroke_width:
case eCSSProperty_text_anchor:
case eCSSProperty_text_blink:
case eCSSProperty_text_decoration:
case eCSSProperty_text_decoration_line:
case eCSSProperty_text_rendering:

Просмотреть файл

@ -682,35 +682,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
return;
}
const nsCSSValue *textBlink =
data->ValueFor(eCSSProperty_text_blink);
const nsCSSValue *decorationLine =
data->ValueFor(eCSSProperty_text_decoration_line);
NS_ABORT_IF_FALSE(textBlink->GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString("bad text-blink unit %d",
textBlink->GetUnit()).get());
NS_ABORT_IF_FALSE(decorationLine->GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString("bad text-decoration-line unit %d",
decorationLine->GetUnit()).get());
bool blinkNone = (textBlink->GetIntValue() == NS_STYLE_TEXT_BLINK_NONE);
bool lineNone =
(decorationLine->GetIntValue() == NS_STYLE_TEXT_DECORATION_LINE_NONE);
if (blinkNone && lineNone) {
AppendValueToString(eCSSProperty_text_decoration_line, aValue);
} else {
if (!blinkNone) {
AppendValueToString(eCSSProperty_text_blink, aValue);
}
if (!lineNone) {
if (!aValue.IsEmpty()) {
aValue.Append(PRUnichar(' '));
}
AppendValueToString(eCSSProperty_text_decoration_line, aValue);
}
}
AppendValueToString(eCSSProperty_text_decoration_line, aValue);
break;
}
case eCSSProperty_transition: {

Просмотреть файл

@ -9555,7 +9555,7 @@ CSSParserImpl::ParseTextDecoration()
return false;
}
nsCSSValue blink, line, style, color;
nsCSSValue line, style, color;
switch (value.GetUnit()) {
case eCSSUnit_Enumerated: {
// We shouldn't accept decoration line style and color via
@ -9567,7 +9567,6 @@ CSSParserImpl::ParseTextDecoration()
int32_t intValue = value.GetIntValue();
if (intValue == eDecorationNone) {
blink.SetIntValue(NS_STYLE_TEXT_BLINK_NONE, eCSSUnit_Enumerated);
line.SetIntValue(NS_STYLE_TEXT_DECORATION_LINE_NONE,
eCSSUnit_Enumerated);
break;
@ -9589,18 +9588,14 @@ CSSParserImpl::ParseTextDecoration()
intValue |= newValue;
}
blink.SetIntValue((intValue & eDecorationBlink) != 0 ?
NS_STYLE_TEXT_BLINK_BLINK : NS_STYLE_TEXT_BLINK_NONE,
eCSSUnit_Enumerated);
line.SetIntValue((intValue & ~eDecorationBlink), eCSSUnit_Enumerated);
line.SetIntValue(intValue, eCSSUnit_Enumerated);
break;
}
default:
blink = line = color = style = value;
line = color = style = value;
break;
}
AppendValue(eCSSProperty_text_blink, blink);
AppendValue(eCSSProperty_text_decoration_line, line);
AppendValue(eCSSProperty_text_decoration_color, color);
AppendValue(eCSSProperty_text_decoration_style, style);
@ -9618,7 +9613,7 @@ CSSParserImpl::ParseTextDecorationLine(nsCSSValue& aValue)
// look for more keywords
nsCSSValue keyword;
int32_t index;
for (index = 0; index < 2; index++) {
for (index = 0; index < 3; index++) {
if (ParseEnum(keyword, nsCSSProps::kTextDecorationLineKTable)) {
int32_t newValue = keyword.GetIntValue();
if (newValue == NS_STYLE_TEXT_DECORATION_LINE_NONE ||

Просмотреть файл

@ -2745,18 +2745,6 @@ CSS_PROP_SHORTHAND(
TextDecoration,
CSS_PROPERTY_PARSE_FUNCTION,
"")
CSS_PROP_TEXTRESET(
-moz-text-blink,
text_blink,
CSS_PROP_DOMPROP_PREFIXED(TextBlink),
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"",
VARIANT_HK,
kTextBlinkKTable,
offsetof(nsStyleTextReset, mTextBlink),
eStyleAnimType_EnumU8)
CSS_PROP_TEXTRESET(
-moz-text-decoration-color,
text_decoration_color,

Просмотреть файл

@ -1435,17 +1435,12 @@ const int32_t nsCSSProps::kTextAlignLastKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kTextBlinkKTable[] = {
eCSSKeyword_none, NS_STYLE_TEXT_BLINK_NONE,
eCSSKeyword_blink, NS_STYLE_TEXT_BLINK_BLINK,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kTextDecorationLineKTable[] = {
eCSSKeyword_none, NS_STYLE_TEXT_DECORATION_LINE_NONE,
eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_LINE_OVERLINE,
eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_LINE_BLINK,
eCSSKeyword__moz_anchor_decoration, NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
eCSSKeyword_UNKNOWN,-1
};
@ -2364,7 +2359,6 @@ static const nsCSSProperty gPaddingEndSubpropTable[] = {
};
static const nsCSSProperty gTextDecorationSubpropTable[] = {
eCSSProperty_text_blink,
eCSSProperty_text_decoration_color,
eCSSProperty_text_decoration_line,
eCSSProperty_text_decoration_style,

Просмотреть файл

@ -529,7 +529,6 @@ public:
static const int32_t kTableLayoutKTable[];
static const int32_t kTextAlignKTable[];
static const int32_t kTextAlignLastKTable[];
static const int32_t kTextBlinkKTable[];
static const int32_t kTextDecorationLineKTable[];
static const int32_t kTextDecorationStyleKTable[];
static const int32_t kTextOverflowKTable[];

Просмотреть файл

@ -2644,18 +2644,6 @@ nsComputedDOMStyle::DoGetTextAlignLast()
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetMozTextBlink()
{
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleTextReset()->mTextBlink,
nsCSSProps::kTextBlinkKTable));
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetTextDecoration()
{
@ -2686,25 +2674,14 @@ nsComputedDOMStyle::DoGetTextDecoration()
// don't want these to appear in the computed style.
line &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS |
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
uint8_t blink = textReset->mTextBlink;
if (blink == NS_STYLE_TEXT_BLINK_NONE &&
line == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
if (line == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
val->SetIdent(eCSSKeyword_none);
} else {
nsAutoString str;
if (line != NS_STYLE_TEXT_DECORATION_LINE_NONE) {
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, str);
}
if (blink != NS_STYLE_TEXT_BLINK_NONE) {
if (!str.IsEmpty()) {
str.Append(PRUnichar(' '));
}
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_blink, blink,
NS_STYLE_TEXT_BLINK_BLINK, NS_STYLE_TEXT_BLINK_BLINK, str);
}
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
NS_STYLE_TEXT_DECORATION_LINE_BLINK, str);
val->SetString(str);
}
@ -2745,7 +2722,7 @@ nsComputedDOMStyle::DoGetTextDecorationLine()
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
intValue, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, decorationLineString);
NS_STYLE_TEXT_DECORATION_LINE_BLINK, decorationLineString);
val->SetString(decorationLineString);
}
@ -5140,7 +5117,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
COMPUTED_STYLE_MAP_ENTRY(stack_sizing, StackSizing),
COMPUTED_STYLE_MAP_ENTRY(_moz_tab_size, TabSize),
COMPUTED_STYLE_MAP_ENTRY(text_align_last, TextAlignLast),
COMPUTED_STYLE_MAP_ENTRY(text_blink, MozTextBlink),
COMPUTED_STYLE_MAP_ENTRY(text_decoration_color, TextDecorationColor),
COMPUTED_STYLE_MAP_ENTRY(text_decoration_line, TextDecorationLine),
COMPUTED_STYLE_MAP_ENTRY(text_decoration_style, TextDecorationStyle),

Просмотреть файл

@ -307,7 +307,6 @@ private:
mozilla::dom::CSSValue* DoGetLineHeight();
mozilla::dom::CSSValue* DoGetTextAlign();
mozilla::dom::CSSValue* DoGetTextAlignLast();
mozilla::dom::CSSValue* DoGetMozTextBlink();
mozilla::dom::CSSValue* DoGetTextDecoration();
mozilla::dom::CSSValue* DoGetTextDecorationColor();
mozilla::dom::CSSValue* DoGetTextDecorationLine();

Просмотреть файл

@ -4012,11 +4012,6 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
}
}
// text-blink: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForTextBlink(), text->mTextBlink,
canStoreInRuleTree, SETDSC_ENUMERATED, parentText->mTextBlink,
NS_STYLE_TEXT_BLINK_NONE, 0, 0, 0, 0);
// text-decoration-line: enum (bit field), inherit, initial
const nsCSSValue* decorationLineValue =
aRuleData->ValueForTextDecorationLine();

Просмотреть файл

@ -659,10 +659,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
// Note: make sure that the largest NS_STYLE_TEXT_ALIGN_* value is smaller than
// the smallest NS_STYLE_VERTICAL_ALIGN_* value below!
// See nsStyleText
#define NS_STYLE_TEXT_BLINK_NONE 0
#define NS_STYLE_TEXT_BLINK_BLINK 1
// See nsStyleText, nsStyleFont
#define NS_STYLE_TEXT_DECORATION_LINE_NONE 0
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE NS_FONT_DECORATION_UNDERLINE

Просмотреть файл

@ -2826,7 +2826,6 @@ nsStyleTextReset::nsStyleTextReset(void)
{
MOZ_COUNT_CTOR(nsStyleTextReset);
mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE, eStyleUnit_Enumerated);
mTextBlink = NS_STYLE_TEXT_BLINK_NONE;
mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE;
mTextDecorationColor = NS_RGB(0,0,0);
mTextDecorationStyle =

Просмотреть файл

@ -1281,7 +1281,6 @@ struct nsStyleTextReset {
nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h)
nsStyleTextOverflow mTextOverflow; // [reset] enum, string
uint8_t mTextBlink; // [reset] see nsStyleConsts.h
uint8_t mTextDecorationLine; // [reset] see nsStyleConsts.h
uint8_t mUnicodeBidi; // [reset] see nsStyleConsts.h
protected:

Просмотреть файл

@ -3089,19 +3089,11 @@ var gCSSProperties = {
other_values: [ "center", "justify", "start", "end", "left", "right" ],
invalid_values: []
},
"-moz-text-blink": {
domProp: "MozTextBlink",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "blink" ],
invalid_values: [ "underline", "overline", "line-through", "none underline", "underline blink", "blink underline" ]
},
"text-decoration": {
domProp: "textDecoration",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
subproperties: [ "-moz-text-blink", "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style" ],
subproperties: [ "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style" ],
initial_values: [ "none" ],
other_values: [ "underline", "overline", "line-through", "blink", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ],
invalid_values: [ "none none", "underline none", "none underline", "blink none", "none blink", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink",
@ -3121,7 +3113,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "underline", "overline", "line-through", "line-through underline", "underline overline line-through", "-moz-anchor-decoration", "-moz-anchor-decoration" ],
other_values: [ "underline", "overline", "line-through", "blink", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ],
invalid_values: [ "none none", "underline none", "none underline", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink" ]
},
"-moz-text-decoration-style": {

Просмотреть файл

@ -35,106 +35,100 @@ var tests = [
// When only text-decoration was specified, text-decoration should look like
// a longhand property.
{ decoration: "none",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "none", expectedCSSValue: "none" },
{ decoration: "underline",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "underline", expectedCSSValue: "underline" },
{ decoration: "overline",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "overline", expectedCSSValue: "overline" },
{ decoration: "line-through",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "line-through", expectedCSSValue: "line-through" },
{ decoration: "blink",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "blink", expectedCSSValue: "blink" },
{ decoration: "underline overline",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "underline overline",
expectedCSSValue: "underline overline" },
{ decoration: "underline line-through",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "underline line-through",
expectedCSSValue: "underline line-through" },
{ decoration: "blink underline",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "underline blink",
expectedCSSValue: "underline blink" },
{ decoration: "underline blink",
blink: null, line: null, color: null, style: null,
line: null, color: null, style: null,
expectedValue: "underline blink",
expectedCSSValue: "underline blink" },
// When only text-decoration-line or text-blink was specified,
// text-decoration should look like a longhand property.
{ decoration: null,
blink: "blink", line: null, color: null, style: null,
line: "blink", color: null, style: null,
expectedValue: "blink", expectedCSSValue: "blink" },
{ decoration: null,
blink: null, line: "underline", color: null, style: null,
line: "underline", color: null, style: null,
expectedValue: "underline", expectedCSSValue: "underline" },
{ decoration: null,
blink: null, line: "overline", color: null, style: null,
line: "overline", color: null, style: null,
expectedValue: "overline", expectedCSSValue: "overline" },
{ decoration: null,
blink: null, line: "line-through", color: null, style: null,
line: "line-through", color: null, style: null,
expectedValue: "line-through", expectedCSSValue: "line-through" },
{ decoration: null,
blink: "blink", line: "underline", color: null, style: null,
line: "blink underline", color: null, style: null,
expectedValue: "underline blink", expectedCSSValue: "underline blink" },
{ decoration: null,
blink: "none", line: "underline", color: null, style: null,
expectedValue: "underline", expectedCSSValue: "underline" },
{ decoration: null,
blink: "blink", line: "none", color: null, style: null,
expectedValue: "blink", expectedCSSValue: "blink" },
// When text-decoration-color isn't its initial value,
// text-decoration should be a shorthand property.
{ decoration: "blink",
blink: null, line: null, color: "rgb(0, 0, 0)", style: null,
line: null, color: "rgb(0, 0, 0)", style: null,
expectedValue: "", expectedCSSValue: null },
{ decoration: "underline",
blink: null, line: null, color: "black", style: null,
line: null, color: "black", style: null,
expectedValue: "", expectedCSSValue: null },
{ decoration: "overline",
blink: null, line: null, color: "#ff0000", style: null,
line: null, color: "#ff0000", style: null,
expectedValue: "", expectedCSSValue: null },
{ decoration: "line-through",
blink: null, line: null, color: "initial", style: null,
line: null, color: "initial", style: null,
expectedValue: "line-through", expectedCSSValue: "line-through" },
{ decoration: "blink underline",
blink: null, line: null, color: "currentColor", style: null,
line: null, color: "currentColor", style: null,
expectedValue: "underline blink", expectedCSSValue: "underline blink" },
{ decoration: "underline line-through",
blink: null, line: null, color: "-moz-use-text-color", style: null,
line: null, color: "-moz-use-text-color", style: null,
expectedValue: "underline line-through",
expectedCSSValue: "underline line-through" },
// When text-decoration-style isn't its initial value,
// text-decoration should be a shorthand property.
{ decoration: "blink",
blink: null, line: null, color: null, style: "-moz-none",
line: null, color: null, style: "-moz-none",
expectedValue: "", expectedCSSValue: null },
{ decoration: "underline",
blink: null, line: null, color: null, style: "dotted",
line: null, color: null, style: "dotted",
expectedValue: "", expectedCSSValue: null },
{ decoration: "overline",
blink: null, line: null, color: null, style: "dashed",
line: null, color: null, style: "dashed",
expectedValue: "", expectedCSSValue: null },
{ decoration: "line-through",
blink: null, line: null, color: null, style: "double",
line: null, color: null, style: "double",
expectedValue: "", expectedCSSValue: null },
{ decoration: "blink underline",
blink: null, line: null, color: null, style: "wavy",
line: null, color: null, style: "wavy",
expectedValue: "", expectedCSSValue: null },
{ decoration: "underline blink overline line-through",
blink: null, line: null, color: null, style: "solid",
line: null, color: null, style: "solid",
expectedValue: "underline overline line-through blink",
expectedCSSValue: "underline overline line-through blink" },
{ decoration: "line-through overline underline",
blink: null, line: null, color: null, style: "initial",
line: null, color: null, style: "initial",
expectedValue: "underline overline line-through",
expectedCSSValue: "underline overline line-through" }
];
@ -145,9 +139,6 @@ function makeDeclaration(aTest)
if (aTest.decoration) {
str += "text-decoration: " + aTest.decoration + "; ";
}
if (aTest.blink) {
str += "-moz-text-blink: " + aTest.blink + "; ";
}
if (aTest.color) {
str += "-moz-text-decoration-color: " + aTest.color + "; ";
}
@ -170,9 +161,6 @@ for (var i = 0; i < tests.length; ++i) {
if (test.decoration) {
$('t').style.textDecoration = test.decoration;
}
if (test.blink) {
$('t').style.MozTextBlink = test.blink;
}
if (test.color) {
$('t').style.MozTextDecorationColor = test.color;
}