Bug 549861. Parse simple font-variant subproperties. r=dbaron

This commit is contained in:
John Daggett 2013-05-13 18:45:36 +09:00
parent 2d8bb34591
commit a00ecfde45
14 changed files with 779 additions and 19 deletions

View File

@ -537,6 +537,20 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
*data->ValueFor(eCSSProperty_font_feature_settings);
const nsCSSValue &languageOverride =
*data->ValueFor(eCSSProperty_font_language_override);
const nsCSSValue &fontKerning =
*data->ValueFor(eCSSProperty_font_kerning);
const nsCSSValue &fontSynthesis =
*data->ValueFor(eCSSProperty_font_synthesis);
const nsCSSValue &fontVariantCaps =
*data->ValueFor(eCSSProperty_font_variant_caps);
const nsCSSValue &fontVariantEastAsian =
*data->ValueFor(eCSSProperty_font_variant_east_asian);
const nsCSSValue &fontVariantLigatures =
*data->ValueFor(eCSSProperty_font_variant_ligatures);
const nsCSSValue &fontVariantNumeric =
*data->ValueFor(eCSSProperty_font_variant_numeric);
const nsCSSValue &fontVariantPosition =
*data->ValueFor(eCSSProperty_font_variant_position);
if (systemFont &&
systemFont->GetUnit() != eCSSUnit_None &&
@ -550,21 +564,37 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
stretch.GetUnit() != eCSSUnit_System_Font ||
sizeAdjust.GetUnit() != eCSSUnit_System_Font ||
featureSettings.GetUnit() != eCSSUnit_System_Font ||
languageOverride.GetUnit() != eCSSUnit_System_Font) {
languageOverride.GetUnit() != eCSSUnit_System_Font ||
fontKerning.GetUnit() != eCSSUnit_System_Font ||
fontSynthesis.GetUnit() != eCSSUnit_System_Font ||
fontVariantCaps.GetUnit() != eCSSUnit_System_Font ||
fontVariantEastAsian.GetUnit() != eCSSUnit_System_Font ||
fontVariantLigatures.GetUnit() != eCSSUnit_System_Font ||
fontVariantNumeric.GetUnit() != eCSSUnit_System_Font ||
fontVariantPosition.GetUnit() != eCSSUnit_System_Font) {
// This can't be represented as a shorthand.
return;
}
systemFont->AppendToString(eCSSProperty__x_system_font, aValue);
} else {
// The font-stretch, font-size-adjust,
// -moz-font-feature-settings, and -moz-font-language-override
// properties are reset by this shorthand property to their
// -moz-font-feature-settings, -moz-font-language-override
// along with kerning, synthesis and other font-variant
// subproperties are reset by this shorthand property to their
// initial values, but can't be represented in its syntax.
if (stretch.GetUnit() != eCSSUnit_Enumerated ||
stretch.GetIntValue() != NS_STYLE_FONT_STRETCH_NORMAL ||
sizeAdjust.GetUnit() != eCSSUnit_None ||
featureSettings.GetUnit() != eCSSUnit_Normal ||
languageOverride.GetUnit() != eCSSUnit_Normal) {
languageOverride.GetUnit() != eCSSUnit_Normal ||
fontKerning.GetIntValue() != NS_FONT_KERNING_AUTO ||
fontSynthesis.GetIntValue() !=
(NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE) ||
fontVariantCaps.GetUnit() != eCSSUnit_Normal ||
fontVariantEastAsian.GetUnit() != eCSSUnit_Normal ||
fontVariantLigatures.GetUnit() != eCSSUnit_Normal ||
fontVariantNumeric.GetUnit() != eCSSUnit_Normal ||
fontVariantPosition.GetUnit() != eCSSUnit_Normal) {
return;
}

View File

@ -163,7 +163,9 @@ CSS_KEY(activeborder, activeborder)
CSS_KEY(activecaption, activecaption)
CSS_KEY(alias, alias)
CSS_KEY(all, all)
CSS_KEY(all-petite-caps, all_petite_caps)
CSS_KEY(all-scroll, all_scroll)
CSS_KEY(all-small-caps, all_small_caps)
CSS_KEY(alpha, alpha)
CSS_KEY(alternate, alternate)
CSS_KEY(alternate-reverse, alternate_reverse)
@ -209,6 +211,7 @@ CSS_KEY(closest-side, closest_side)
CSS_KEY(cm, cm)
CSS_KEY(col-resize, col_resize)
CSS_KEY(collapse, collapse)
CSS_KEY(common-ligatures, common_ligatures)
CSS_KEY(column, column)
CSS_KEY(column-reverse, column_reverse)
CSS_KEY(condensed, condensed)
@ -217,6 +220,7 @@ CSS_KEY(content-box, content_box)
CSS_KEY(context-menu, context_menu)
CSS_KEY(continuous, continuous)
CSS_KEY(copy, copy)
CSS_KEY(contextual, contextual)
CSS_KEY(cover, cover)
CSS_KEY(crop, crop)
CSS_KEY(cross, cross)
@ -227,9 +231,11 @@ CSS_KEY(decimal, decimal)
CSS_KEY(decimal-leading-zero, decimal_leading_zero)
CSS_KEY(default, default)
CSS_KEY(deg, deg)
CSS_KEY(diagonal-fractions, diagonal_fractions)
CSS_KEY(dialog, dialog)
CSS_KEY(disabled, disabled)
CSS_KEY(disc, disc)
CSS_KEY(discretionary-ligatures, discretionary_ligatures)
CSS_KEY(dotted, dotted)
CSS_KEY(double, double)
CSS_KEY(e-resize, e_resize)
@ -273,6 +279,7 @@ CSS_KEY(highlight, highlight)
CSS_KEY(highlighttext, highlighttext)
CSS_KEY(hiragana, hiragana)
CSS_KEY(hiragana-iroha, hiragana_iroha)
CSS_KEY(historical-ligatures, historical_ligatures)
CSS_KEY(horizontal, horizontal)
CSS_KEY(hz, hz)
CSS_KEY(icon, icon)
@ -297,6 +304,10 @@ CSS_KEY(inset, inset)
CSS_KEY(inside, inside)
CSS_KEY(interpolatematrix, interpolatematrix)
CSS_KEY(italic, italic)
CSS_KEY(jis78, jis78)
CSS_KEY(jis83, jis83)
CSS_KEY(jis90, jis90)
CSS_KEY(jis04, jis04)
CSS_KEY(justify, justify)
CSS_KEY(katakana, katakana)
CSS_KEY(katakana-iroha, katakana_iroha)
@ -309,6 +320,7 @@ CSS_KEY(left, left)
CSS_KEY(lighter, lighter)
CSS_KEY(line-through, line_through)
CSS_KEY(linear, linear)
CSS_KEY(lining-nums, lining_nums)
CSS_KEY(list-item, list_item)
CSS_KEY(logical, logical)
CSS_KEY(lower-alpha, lower_alpha)
@ -337,7 +349,11 @@ CSS_KEY(narrower, narrower)
CSS_KEY(ne-resize, ne_resize)
CSS_KEY(nesw-resize, nesw_resize)
CSS_KEY(no-close-quote, no_close_quote)
CSS_KEY(no-common-ligatures, no_common_ligatures)
CSS_KEY(no-contextual, no_contextual)
CSS_KEY(no-discretionary-ligatures, no_discretionary_ligatures)
CSS_KEY(no-drop, no_drop)
CSS_KEY(no-historical-ligatures, no_historical_ligatures)
CSS_KEY(no-open-quote, no_open_quote)
CSS_KEY(no-repeat, no_repeat)
CSS_KEY(none, none)
@ -348,7 +364,9 @@ CSS_KEY(ns-resize, ns_resize)
CSS_KEY(nw-resize, nw_resize)
CSS_KEY(nwse-resize, nwse_resize)
CSS_KEY(oblique, oblique)
CSS_KEY(oldstyle-nums, oldstyle_nums)
CSS_KEY(open-quote, open_quote)
CSS_KEY(ordinal, ordinal)
CSS_KEY(outset, outset)
CSS_KEY(outside, outside)
CSS_KEY(overline, overline)
@ -357,6 +375,7 @@ CSS_KEY(painted, painted)
CSS_KEY(paused, paused)
CSS_KEY(pc, pc)
CSS_KEY(perspective, perspective)
CSS_KEY(petite-caps, petite_caps)
CSS_KEY(physical, physical)
CSS_KEY(pointer, pointer)
CSS_KEY(portrait, portrait)
@ -366,6 +385,8 @@ CSS_KEY(pre-line, pre_line)
CSS_KEY(preserve-3d, preserve_3d)
CSS_KEY(progress, progress)
CSS_KEY(progressive, progressive)
CSS_KEY(proportional-nums, proportional_nums)
CSS_KEY(proportional-width, proportional_width)
CSS_KEY(pt, pt)
CSS_KEY(px, px)
CSS_KEY(rad, rad)
@ -388,6 +409,7 @@ CSS_KEY(row, row)
CSS_KEY(row-resize, row_resize)
CSS_KEY(row-reverse, row_reverse)
CSS_KEY(rtl, rtl)
CSS_KEY(ruby, ruby)
CSS_KEY(running, running)
CSS_KEY(s, s)
CSS_KEY(s-resize, s_resize)
@ -409,9 +431,11 @@ CSS_KEY(semi-condensed, semi_condensed)
CSS_KEY(semi-expanded, semi_expanded)
CSS_KEY(separate, separate)
CSS_KEY(show, show)
CSS_KEY(simplified, simplified)
CSS_KEY(skew, skew)
CSS_KEY(skewx, skewx)
CSS_KEY(skewy, skewy)
CSS_KEY(slashed-zero, slashed_zero)
CSS_KEY(small, small)
CSS_KEY(small-caps, small_caps)
CSS_KEY(small-caption, small_caption)
@ -421,6 +445,7 @@ CSS_KEY(solid, solid)
CSS_KEY(space-around, space_around)
CSS_KEY(space-between, space_between)
CSS_KEY(square, square)
CSS_KEY(stacked-fractions, stacked_fractions)
CSS_KEY(start, start)
CSS_KEY(static, static)
CSS_KEY(status-bar, status_bar)
@ -429,6 +454,7 @@ CSS_KEY(step-start, step_start)
CSS_KEY(stretch, stretch)
CSS_KEY(stretch-to-fit, stretch_to_fit)
CSS_KEY(stroke, stroke)
CSS_KEY(style, style)
CSS_KEY(sub, sub)
CSS_KEY(super, super)
CSS_KEY(sw-resize, sw_resize)
@ -441,6 +467,7 @@ CSS_KEY(table-footer-group, table_footer_group)
CSS_KEY(table-header-group, table_header_group)
CSS_KEY(table-row, table_row)
CSS_KEY(table-row-group, table_row_group)
CSS_KEY(tabular-nums, tabular_nums)
CSS_KEY(text, text)
CSS_KEY(text-bottom, text_bottom)
CSS_KEY(text-top, text_top)
@ -451,9 +478,11 @@ CSS_KEY(threedface, threedface)
CSS_KEY(threedhighlight, threedhighlight)
CSS_KEY(threedlightshadow, threedlightshadow)
CSS_KEY(threedshadow, threedshadow)
CSS_KEY(titling-caps, titling_caps)
CSS_KEY(toggle, toggle)
CSS_KEY(top, top)
CSS_KEY(top-outside, top_outside)
CSS_KEY(traditional, traditional)
CSS_KEY(translate, translate)
CSS_KEY(translate3d, translate3d)
CSS_KEY(translatex, translatex)
@ -464,6 +493,7 @@ CSS_KEY(tri-state, tri_state)
CSS_KEY(ultra-condensed, ultra_condensed)
CSS_KEY(ultra-expanded, ultra_expanded)
CSS_KEY(underline, underline)
CSS_KEY(unicase, unicase)
CSS_KEY(upper-alpha, upper_alpha)
CSS_KEY(upper-latin, upper_latin)
CSS_KEY(upper-roman, upper_roman)
@ -477,6 +507,7 @@ CSS_KEY(visiblestroke, visiblestroke)
CSS_KEY(w-resize, w_resize)
CSS_KEY(wait, wait)
CSS_KEY(wavy, wavy)
CSS_KEY(weight, weight)
CSS_KEY(wider, wider)
CSS_KEY(window, window)
CSS_KEY(windowframe, windowframe)

View File

@ -562,6 +562,12 @@ protected:
bool ParseCounterData(nsCSSProperty aPropID);
bool ParseCursor();
bool ParseFont();
bool ParseFontSynthesis(nsCSSValue& aValue);
bool ParseBitmaskValues(nsCSSValue& aValue, const int32_t aKeywordTable[],
const int32_t aMasks[]);
bool ParseFontVariantEastAsian(nsCSSValue& aValue);
bool ParseFontVariantLigatures(nsCSSValue& aValue);
bool ParseFontVariantNumeric(nsCSSValue& aValue);
bool ParseFontWeight(nsCSSValue& aValue);
bool ParseOneFamily(nsAString& aFamily, bool& aOneKeyword);
bool ParseFamily(nsCSSValue& aValue);
@ -6370,6 +6376,14 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
switch (aPropID) {
case eCSSProperty_font_family:
return ParseFamily(aValue);
case eCSSProperty_font_synthesis:
return ParseFontSynthesis(aValue);
case eCSSProperty_font_variant_east_asian:
return ParseFontVariantEastAsian(aValue);
case eCSSProperty_font_variant_ligatures:
return ParseFontVariantLigatures(aValue);
case eCSSProperty_font_variant_numeric:
return ParseFontVariantNumeric(aValue);
case eCSSProperty_font_feature_settings:
return ParseFontFeatureSettings(aValue);
case eCSSProperty_font_weight:
@ -8303,6 +8317,13 @@ CSSParserImpl::ParseFont()
AppendValue(eCSSProperty_font_size_adjust, family);
AppendValue(eCSSProperty_font_feature_settings, family);
AppendValue(eCSSProperty_font_language_override, family);
AppendValue(eCSSProperty_font_kerning, family);
AppendValue(eCSSProperty_font_synthesis, family);
AppendValue(eCSSProperty_font_variant_caps, family);
AppendValue(eCSSProperty_font_variant_east_asian, family);
AppendValue(eCSSProperty_font_variant_ligatures, family);
AppendValue(eCSSProperty_font_variant_numeric, family);
AppendValue(eCSSProperty_font_variant_position, family);
}
else {
AppendValue(eCSSProperty__x_system_font, family);
@ -8317,6 +8338,13 @@ CSSParserImpl::ParseFont()
AppendValue(eCSSProperty_font_size_adjust, systemFont);
AppendValue(eCSSProperty_font_feature_settings, systemFont);
AppendValue(eCSSProperty_font_language_override, systemFont);
AppendValue(eCSSProperty_font_kerning, systemFont);
AppendValue(eCSSProperty_font_synthesis, systemFont);
AppendValue(eCSSProperty_font_variant_caps, systemFont);
AppendValue(eCSSProperty_font_variant_east_asian, systemFont);
AppendValue(eCSSProperty_font_variant_ligatures, systemFont);
AppendValue(eCSSProperty_font_variant_numeric, systemFont);
AppendValue(eCSSProperty_font_variant_position, systemFont);
}
return true;
}
@ -8380,12 +8408,170 @@ CSSParserImpl::ParseFont()
AppendValue(eCSSProperty_font_size_adjust, nsCSSValue(eCSSUnit_None));
AppendValue(eCSSProperty_font_feature_settings, nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_language_override, nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_kerning,
nsCSSValue(NS_FONT_KERNING_AUTO, eCSSUnit_Enumerated));
AppendValue(eCSSProperty_font_synthesis,
nsCSSValue(NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE,
eCSSUnit_Enumerated));
AppendValue(eCSSProperty_font_variant_caps, nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_variant_east_asian,
nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_variant_ligatures,
nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_variant_numeric,
nsCSSValue(eCSSUnit_Normal));
AppendValue(eCSSProperty_font_variant_position,
nsCSSValue(eCSSUnit_Normal));
return true;
}
}
return false;
}
bool
CSSParserImpl::ParseFontSynthesis(nsCSSValue& aValue)
{
if (!ParseVariant(aValue, VARIANT_HK | VARIANT_NONE,
nsCSSProps::kFontSynthesisKTable)) {
return false;
}
// first value 'none' ==> done
if (eCSSUnit_None == aValue.GetUnit() ||
eCSSUnit_Initial == aValue.GetUnit() ||
eCSSUnit_Inherit == aValue.GetUnit())
{
return true;
}
// look for a second value
int32_t intValue = aValue.GetIntValue();
nsCSSValue nextValue;
if (ParseEnum(nextValue, nsCSSProps::kFontSynthesisKTable)) {
int32_t nextIntValue = nextValue.GetIntValue();
if (nextIntValue == 0 || nextIntValue & intValue) {
return false;
}
aValue.SetIntValue(nextIntValue | intValue, eCSSUnit_Enumerated);
}
return true;
}
#define MASK_END_VALUE -1
// aMasks - array of masks for mutually-exclusive property values,
// e.g. proportial-nums, tabular-nums
bool
CSSParserImpl::ParseBitmaskValues(nsCSSValue& aValue,
const int32_t aKeywordTable[],
const int32_t aMasks[])
{
if (!ParseVariant(aValue, VARIANT_HMK, aKeywordTable)) {
return false;
}
// first value 'normal', 'inherit', 'initial' ==> done
if (eCSSUnit_Normal == aValue.GetUnit() ||
eCSSUnit_Initial == aValue.GetUnit() ||
eCSSUnit_Inherit == aValue.GetUnit())
{
return true;
}
// look for more values
nsCSSValue nextValue;
int32_t mergedValue = aValue.GetIntValue();
while (ParseEnum(nextValue, aKeywordTable))
{
int32_t nextIntValue = nextValue.GetIntValue();
// check to make sure value not already set
if (nextIntValue & mergedValue) {
return false;
}
const int32_t *m = aMasks;
int32_t c = 0;
int32_t other = ~nextIntValue & mergedValue;
while (*m != MASK_END_VALUE) {
if (*m & nextIntValue) {
c = other & *m;
break;
}
m++;
}
if (c) {
return false;
}
mergedValue |= nextIntValue;
}
aValue.SetIntValue(mergedValue, eCSSUnit_Enumerated);
return true;
}
const int32_t maskEastAsian[] = {
NS_FONT_VARIANT_EAST_ASIAN_VARIANT_MASK,
NS_FONT_VARIANT_EAST_ASIAN_WIDTH_MASK,
MASK_END_VALUE
};
bool
CSSParserImpl::ParseFontVariantEastAsian(nsCSSValue& aValue)
{
NS_ASSERTION(maskEastAsian[NS_ARRAY_LENGTH(maskEastAsian) - 1] ==
MASK_END_VALUE,
"incorrectly terminated array");
return ParseBitmaskValues(aValue, nsCSSProps::kFontVariantEastAsianKTable,
maskEastAsian);
}
const int32_t maskLigatures[] = {
NS_FONT_VARIANT_LIGATURES_COMMON_MASK,
NS_FONT_VARIANT_LIGATURES_DISCRETIONARY_MASK,
NS_FONT_VARIANT_LIGATURES_HISTORICAL_MASK,
NS_FONT_VARIANT_LIGATURES_CONTEXTUAL_MASK,
MASK_END_VALUE
};
bool
CSSParserImpl::ParseFontVariantLigatures(nsCSSValue& aValue)
{
NS_ASSERTION(maskLigatures[NS_ARRAY_LENGTH(maskLigatures) - 1] ==
MASK_END_VALUE,
"incorrectly terminated array");
return ParseBitmaskValues(aValue, nsCSSProps::kFontVariantLigaturesKTable,
maskLigatures);
}
const int32_t maskNumeric[] = {
NS_FONT_VARIANT_NUMERIC_FIGURE_MASK,
NS_FONT_VARIANT_NUMERIC_SPACING_MASK,
NS_FONT_VARIANT_NUMERIC_FRACTION_MASK,
MASK_END_VALUE
};
bool
CSSParserImpl::ParseFontVariantNumeric(nsCSSValue& aValue)
{
NS_ASSERTION(maskNumeric[NS_ARRAY_LENGTH(maskNumeric) - 1] ==
MASK_END_VALUE,
"incorrectly terminated array");
return ParseBitmaskValues(aValue, nsCSSProps::kFontVariantNumericKTable,
maskNumeric);
}
bool
CSSParserImpl::ParseFontWeight(nsCSSValue& aValue)
{

View File

@ -1709,6 +1709,18 @@ CSS_PROP_FONT(
nullptr,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-kerning,
font_kerning,
FontKerning,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
VARIANT_HK,
kFontKerningKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
-moz-font-language-override,
font_language_override,
@ -1774,6 +1786,19 @@ CSS_PROP_FONT(
kFontStyleKTable,
offsetof(nsStyleFont, mFont.style),
eStyleAnimType_EnumU8)
CSS_PROP_FONT(
font-synthesis,
font_synthesis,
FontSynthesis,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
0,
kFontSynthesisKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-variant,
font_variant,
@ -1786,6 +1811,69 @@ CSS_PROP_FONT(
kFontVariantKTable,
offsetof(nsStyleFont, mFont.variant),
eStyleAnimType_EnumU8)
CSS_PROP_FONT(
font-variant-caps,
font_variant_caps,
FontVariantCaps,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
VARIANT_HMK,
kFontVariantCapsKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-variant-east-asian,
font_variant_east_asian,
FontVariantEastAsian,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
0,
kFontVariantEastAsianKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-variant-ligatures,
font_variant_ligatures,
FontVariantLigatures,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
0,
kFontVariantLigaturesKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-variant-numeric,
font_variant_numeric,
FontVariantNumeric,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
0,
kFontVariantNumericKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-variant-position,
font_variant_position,
FontVariantPosition,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
"layout.css.font-features.enabled",
VARIANT_HMK,
kFontVariantPositionKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_FONT(
font-weight,
font_weight,

View File

@ -1013,6 +1013,13 @@ const int32_t nsCSSProps::kFontKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontKerningKTable[] = {
eCSSKeyword_auto, NS_FONT_KERNING_AUTO,
eCSSKeyword_none, NS_FONT_KERNING_NONE,
eCSSKeyword_normal, NS_FONT_KERNING_NORMAL,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontSizeKTable[] = {
eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL,
eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL,
@ -1046,12 +1053,72 @@ const int32_t nsCSSProps::kFontStyleKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontSynthesisKTable[] = {
eCSSKeyword_weight, NS_FONT_SYNTHESIS_WEIGHT,
eCSSKeyword_style, NS_FONT_SYNTHESIS_STYLE,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantKTable[] = {
eCSSKeyword_normal, NS_STYLE_FONT_VARIANT_NORMAL,
eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantCapsKTable[] = {
eCSSKeyword_small_caps, NS_FONT_VARIANT_CAPS_SMALLCAPS,
eCSSKeyword_all_small_caps, NS_FONT_VARIANT_CAPS_ALLSMALL,
eCSSKeyword_petite_caps, NS_FONT_VARIANT_CAPS_PETITECAPS,
eCSSKeyword_all_petite_caps, NS_FONT_VARIANT_CAPS_ALLPETITE,
eCSSKeyword_titling_caps, NS_FONT_VARIANT_CAPS_TITLING,
eCSSKeyword_unicase, NS_FONT_VARIANT_CAPS_UNICASE,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantEastAsianKTable[] = {
eCSSKeyword_jis78, NS_FONT_VARIANT_EAST_ASIAN_JIS78,
eCSSKeyword_jis83, NS_FONT_VARIANT_EAST_ASIAN_JIS83,
eCSSKeyword_jis90, NS_FONT_VARIANT_EAST_ASIAN_JIS90,
eCSSKeyword_jis04, NS_FONT_VARIANT_EAST_ASIAN_JIS04,
eCSSKeyword_simplified, NS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED,
eCSSKeyword_traditional, NS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL,
eCSSKeyword_full_width, NS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH,
eCSSKeyword_proportional_width, NS_FONT_VARIANT_EAST_ASIAN_PROP_WIDTH,
eCSSKeyword_ruby, NS_FONT_VARIANT_EAST_ASIAN_RUBY,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantLigaturesKTable[] = {
eCSSKeyword_common_ligatures, NS_FONT_VARIANT_LIGATURES_COMMON,
eCSSKeyword_no_common_ligatures, NS_FONT_VARIANT_LIGATURES_NO_COMMON,
eCSSKeyword_discretionary_ligatures, NS_FONT_VARIANT_LIGATURES_DISCRETIONARY,
eCSSKeyword_no_discretionary_ligatures, NS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY,
eCSSKeyword_historical_ligatures, NS_FONT_VARIANT_LIGATURES_HISTORICAL,
eCSSKeyword_no_historical_ligatures, NS_FONT_VARIANT_LIGATURES_NO_HISTORICAL,
eCSSKeyword_contextual, NS_FONT_VARIANT_LIGATURES_CONTEXTUAL,
eCSSKeyword_no_contextual, NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantNumericKTable[] = {
eCSSKeyword_lining_nums, NS_FONT_VARIANT_NUMERIC_LINING,
eCSSKeyword_oldstyle_nums, NS_FONT_VARIANT_NUMERIC_OLDSTYLE,
eCSSKeyword_proportional_nums, NS_FONT_VARIANT_NUMERIC_PROPORTIONAL,
eCSSKeyword_tabular_nums, NS_FONT_VARIANT_NUMERIC_TABULAR,
eCSSKeyword_diagonal_fractions, NS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS,
eCSSKeyword_stacked_fractions, NS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS,
eCSSKeyword_slashed_zero, NS_FONT_VARIANT_NUMERIC_SLASHZERO,
eCSSKeyword_ordinal, NS_FONT_VARIANT_NUMERIC_ORDINAL,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontVariantPositionKTable[] = {
eCSSKeyword_super, NS_FONT_VARIANT_POSITION_SUPER,
eCSSKeyword_sub, NS_FONT_VARIANT_POSITION_SUB,
eCSSKeyword_UNKNOWN,-1
};
const int32_t nsCSSProps::kFontWeightKTable[] = {
eCSSKeyword_normal, NS_STYLE_FONT_WEIGHT_NORMAL,
eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD,
@ -2072,11 +2139,18 @@ static const nsCSSProperty gFontSubpropTable[] = {
eCSSProperty_font_weight,
eCSSProperty_font_size,
eCSSProperty_line_height,
eCSSProperty_font_size_adjust, // XXX Added LDB.
eCSSProperty_font_stretch, // XXX Added LDB.
eCSSProperty_font_size_adjust,
eCSSProperty_font_stretch,
eCSSProperty__x_system_font,
eCSSProperty_font_feature_settings,
eCSSProperty_font_language_override,
eCSSProperty_font_kerning,
eCSSProperty_font_synthesis,
eCSSProperty_font_variant_caps,
eCSSProperty_font_variant_east_asian,
eCSSProperty_font_variant_ligatures,
eCSSProperty_font_variant_numeric,
eCSSProperty_font_variant_position,
eCSSProperty_UNKNOWN
};

View File

@ -192,7 +192,7 @@ public:
static nsCSSProperty OtherNameFor(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the
// Return back a const nsString& representation of the
// value. Return back nullstr if no value is found
static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, int32_t aValue);
@ -398,10 +398,17 @@ public:
static const int32_t kFloatKTable[];
static const int32_t kFloatEdgeKTable[];
static const int32_t kFontKTable[];
static const int32_t kFontKerningKTable[];
static const int32_t kFontSizeKTable[];
static const int32_t kFontStretchKTable[];
static const int32_t kFontStyleKTable[];
static const int32_t kFontSynthesisKTable[];
static const int32_t kFontVariantKTable[];
static const int32_t kFontVariantCapsKTable[];
static const int32_t kFontVariantEastAsianKTable[];
static const int32_t kFontVariantLigaturesKTable[];
static const int32_t kFontVariantNumericKTable[];
static const int32_t kFontVariantPositionKTable[];
static const int32_t kFontWeightKTable[];
static const int32_t kIMEModeKTable[];
static const int32_t kLineHeightKTable[];

View File

@ -806,8 +806,10 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
aResult.AppendInt(GetIntValue(), 10);
}
else if (eCSSUnit_Enumerated == unit) {
if (eCSSProperty_text_decoration_line == aProperty) {
int32_t intValue = GetIntValue();
int32_t intValue = GetIntValue();
switch(aProperty) {
case eCSSProperty_text_decoration_line:
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
aResult);
@ -821,9 +823,9 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
aResult);
}
}
else if (eCSSProperty_marks == aProperty) {
int32_t intValue = GetIntValue();
break;
case eCSSProperty_marks:
if (intValue == NS_STYLE_PAGE_MARKS_NONE) {
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
aResult);
@ -833,17 +835,53 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
NS_STYLE_PAGE_MARKS_REGISTER,
aResult);
}
}
else if (eCSSProperty_paint_order == aProperty) {
break;
case eCSSProperty_paint_order:
MOZ_STATIC_ASSERT
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE <= 8,
"SVGStyleStruct::mPaintOrder and the following cast not big enough");
nsStyleUtil::AppendPaintOrderValue(static_cast<uint8_t>(GetIntValue()),
aResult);
}
else {
const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, GetIntValue());
break;
case eCSSProperty_font_synthesis:
if (intValue == 0) {
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
aResult);
} else {
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_FONT_SYNTHESIS_WEIGHT,
NS_FONT_SYNTHESIS_STYLE,
aResult);
}
break;
case eCSSProperty_font_variant_east_asian:
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_FONT_VARIANT_EAST_ASIAN_JIS78,
NS_FONT_VARIANT_EAST_ASIAN_RUBY,
aResult);
break;
case eCSSProperty_font_variant_ligatures:
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_FONT_VARIANT_LIGATURES_COMMON,
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL,
aResult);
break;
case eCSSProperty_font_variant_numeric:
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_FONT_VARIANT_NUMERIC_LINING,
NS_FONT_VARIANT_NUMERIC_ORDINAL,
aResult);
break;
default:
const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, intValue);
AppendASCIItoUTF16(name, aResult);
break;
}
}
else if (eCSSUnit_EnumColor == unit) {

View File

@ -1332,6 +1332,16 @@ nsComputedDOMStyle::DoGetFontFeatureSettings()
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontKerning()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.kerning,
nsCSSProps::kFontKerningKTable));
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontLanguageOverride()
{
@ -1348,6 +1358,126 @@ nsComputedDOMStyle::DoGetFontLanguageOverride()
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontSynthesis()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.synthesis;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_none);
} else {
nsAutoString valueStr;
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_synthesis,
intValue, NS_FONT_SYNTHESIS_WEIGHT,
NS_FONT_SYNTHESIS_STYLE, valueStr);
val->SetString(valueStr);
}
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontVariantCaps()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.variantCaps;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(intValue,
nsCSSProps::kFontVariantCapsKTable));
}
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontVariantEastAsian()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.variantEastAsian;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
nsAutoString valueStr;
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_east_asian,
intValue, NS_FONT_VARIANT_EAST_ASIAN_JIS78,
NS_FONT_VARIANT_EAST_ASIAN_RUBY, valueStr);
val->SetString(valueStr);
}
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontVariantLigatures()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.variantLigatures;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
nsAutoString valueStr;
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_ligatures,
intValue, NS_FONT_VARIANT_LIGATURES_COMMON,
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL, valueStr);
val->SetString(valueStr);
}
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontVariantNumeric()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.variantNumeric;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
nsAutoString valueStr;
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_numeric,
intValue, NS_FONT_VARIANT_NUMERIC_LINING,
NS_FONT_VARIANT_NUMERIC_ORDINAL, valueStr);
val->SetString(valueStr);
}
return val;
}
CSSValue*
nsComputedDOMStyle::DoGetFontVariantPosition()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
int32_t intValue = StyleFont()->mFont.variantPosition;
if (0 == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(intValue,
nsCSSProps::kFontVariantPositionKTable));
}
return val;
}
CSSValue*
nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
uint32_t nsStyleBackground::* aCount,
@ -4761,11 +4891,18 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
COMPUTED_STYLE_MAP_ENTRY(float, Float),
//// COMPUTED_STYLE_MAP_ENTRY(font, Font),
COMPUTED_STYLE_MAP_ENTRY(font_family, FontFamily),
COMPUTED_STYLE_MAP_ENTRY(font_kerning, FontKerning),
COMPUTED_STYLE_MAP_ENTRY(font_size, FontSize),
COMPUTED_STYLE_MAP_ENTRY(font_size_adjust, FontSizeAdjust),
COMPUTED_STYLE_MAP_ENTRY(font_stretch, FontStretch),
COMPUTED_STYLE_MAP_ENTRY(font_style, FontStyle),
COMPUTED_STYLE_MAP_ENTRY(font_synthesis, FontSynthesis),
COMPUTED_STYLE_MAP_ENTRY(font_variant, FontVariant),
COMPUTED_STYLE_MAP_ENTRY(font_variant_caps, FontVariantCaps),
COMPUTED_STYLE_MAP_ENTRY(font_variant_east_asian, FontVariantEastAsian),
COMPUTED_STYLE_MAP_ENTRY(font_variant_ligatures, FontVariantLigatures),
COMPUTED_STYLE_MAP_ENTRY(font_variant_numeric, FontVariantNumeric),
COMPUTED_STYLE_MAP_ENTRY(font_variant_position, FontVariantPosition),
COMPUTED_STYLE_MAP_ENTRY(font_weight, FontWeight),
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(height, Height),
COMPUTED_STYLE_MAP_ENTRY(ime_mode, IMEMode),

View File

@ -188,13 +188,20 @@ private:
mozilla::dom::CSSValue* DoGetColor();
mozilla::dom::CSSValue* DoGetFontFamily();
mozilla::dom::CSSValue* DoGetFontFeatureSettings();
mozilla::dom::CSSValue* DoGetFontKerning();
mozilla::dom::CSSValue* DoGetFontLanguageOverride();
mozilla::dom::CSSValue* DoGetFontSize();
mozilla::dom::CSSValue* DoGetFontSizeAdjust();
mozilla::dom::CSSValue* DoGetFontStretch();
mozilla::dom::CSSValue* DoGetFontStyle();
mozilla::dom::CSSValue* DoGetFontWeight();
mozilla::dom::CSSValue* DoGetFontSynthesis();
mozilla::dom::CSSValue* DoGetFontVariant();
mozilla::dom::CSSValue* DoGetFontVariantCaps();
mozilla::dom::CSSValue* DoGetFontVariantEastAsian();
mozilla::dom::CSSValue* DoGetFontVariantLigatures();
mozilla::dom::CSSValue* DoGetFontVariantNumeric();
mozilla::dom::CSSValue* DoGetFontVariantPosition();
mozilla::dom::CSSValue* DoGetFontWeight();
/* Background properties */
mozilla::dom::CSSValue* DoGetBackgroundAttachment();

View File

@ -3273,6 +3273,62 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
aFont->mScriptLevel = 0;
}
// font-kerning: enum, inherit, initial, -moz-system-font
SetDiscrete(*aRuleData->ValueForFontKerning(),
aFont->mFont.kerning, aCanStoreInRuleTree,
SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.kerning,
defaultVariableFont->kerning,
0, 0, 0, systemFont.kerning);
// font-synthesis: enum (bit field), inherit, initial
SetDiscrete(*aRuleData->ValueForFontSynthesis(),
aFont->mFont.synthesis, aCanStoreInRuleTree,
SETDSC_NONE | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.synthesis,
defaultVariableFont->synthesis,
0, 0, 0, systemFont.synthesis);
// font-variant-caps: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForFontVariantCaps(),
aFont->mFont.variantCaps, aCanStoreInRuleTree,
SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.variantCaps,
defaultVariableFont->variantCaps,
0, 0, 0, systemFont.variantCaps);
// font-variant-east-asian: enum (bit field), inherit, initial
SetDiscrete(*aRuleData->ValueForFontVariantEastAsian(),
aFont->mFont.variantEastAsian, aCanStoreInRuleTree,
SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.variantEastAsian,
defaultVariableFont->variantEastAsian,
0, 0, 0, systemFont.variantEastAsian);
// font-variant-ligatures: enum (bit field), inherit, initial
SetDiscrete(*aRuleData->ValueForFontVariantLigatures(),
aFont->mFont.variantLigatures, aCanStoreInRuleTree,
SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.variantLigatures,
defaultVariableFont->variantLigatures,
0, 0, 0, systemFont.variantLigatures);
// font-variant-numeric: enum (bit field), inherit, initial
SetDiscrete(*aRuleData->ValueForFontVariantNumeric(),
aFont->mFont.variantNumeric, aCanStoreInRuleTree,
SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.variantNumeric,
defaultVariableFont->variantNumeric,
0, 0, 0, systemFont.variantNumeric);
// font-variant-position: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForFontVariantPosition(),
aFont->mFont.variantPosition, aCanStoreInRuleTree,
SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT,
aParentFont->mFont.variantPosition,
defaultVariableFont->variantPosition,
0, 0, 0, systemFont.variantPosition);
// font-feature-settings
const nsCSSValue* featureSettingsValue =
aRuleData->ValueForFontFeatureSettings();

View File

@ -192,6 +192,13 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
(aFont1.weight == aFont2.weight) &&
(aFont1.stretch == aFont2.stretch) &&
(aFont1.name == aFont2.name) &&
(aFont1.kerning == aFont2.kerning) &&
(aFont1.synthesis == aFont2.synthesis) &&
(aFont1.variantCaps == aFont2.variantCaps) &&
(aFont1.variantEastAsian == aFont2.variantEastAsian) &&
(aFont1.variantLigatures == aFont2.variantLigatures) &&
(aFont1.variantNumeric == aFont2.variantNumeric) &&
(aFont1.variantPosition == aFont2.variantPosition) &&
(aFont1.fontFeatureSettings == aFont2.fontFeatureSettings) &&
(aFont1.languageOverride == aFont2.languageOverride)) {
if ((aFont1.decorations == aFont2.decorations)) {

View File

@ -4257,6 +4257,85 @@ if (SpecialPowers.getBoolPref("layout.css.flexbox.enabled")) {
gCSSProperties["display"].other_values.push("inline-flex");
}
if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
var fontFeatureProperties = {
"font-kerning": {
domProp: "fontKerning",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: [ "normal", "none" ],
invalid_values: [ "on" ]
},
"font-variant-caps": {
domProp: "fontVariantCaps",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "titling-caps", "unicase" ],
invalid_values: []
},
"font-variant-east-asian": {
domProp: "fontVariantEastAsian",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "jis78", "jis83", "jis90", "jis04", "simplified", "traditional", "full-width", "proportional-width", "ruby",
"jis78 full-width", "jis78 full-width ruby", "simplified proportional-width", "ruby simplified" ],
invalid_values: [ "jis78 normal", "jis90 jis04", "simplified traditional", "full-width proportional-width",
"ruby simplified ruby", "jis78 ruby simplified" ]
},
"font-variant-ligatures": {
domProp: "fontVariantLigatures",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures",
"historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual",
"common-ligatures no-discretionary-ligatures", "contextual no-discretionary-ligatures",
"historical-ligatures no-common-ligatures", "no-historical-ligatures discretionary-ligatures",
"common-ligatures no-discretionary-ligatures historical-ligatures no-contextual" ],
invalid_values: [ "common-ligatures normal", "common-ligatures no-common-ligatures", "common-ligatures common-ligatures",
"no-historical-ligatures historical-ligatures", "no-discretionary-ligatures discretionary-ligatures",
"no-contextual contextual", "common-ligatures no-discretionary-ligatures no-common-ligatures" ]
},
"font-variant-numeric": {
domProp: "fontVariantNumeric",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions",
"stacked-fractions", "slashed-zero", "ordinal", "lining-nums diagonal-fractions",
"tabular-nums stacked-fractions", "tabular-nums slashed-zero stacked-fractions",
"proportional-nums slashed-zero diagonal-fractions oldstyle-nums ordinal" ],
invalid_values: [ "lining-nums normal", "lining-nums oldstyle-nums", "lining-nums normal slashed-zero ordinal",
"proportional-nums tabular-nums", "diagonal-fractions stacked-fractions", "slashed-zero diagonal-fractions slashed-zero",
"lining-nums slashed-zero diagonal-fractions oldstyle-nums" ]
},
"font-variant-position": {
domProp: "fontVariantPosition",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "super", "sub" ],
invalid_values: [ "super sub" ]
},
"font-synthesis": {
domProp: "fontSynthesis",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "weight style" ],
other_values: [ "none", "weight", "style" ],
invalid_values: [ "weight none", "style none", "none style", "weight 10px" ]
}
};
for (var prop in fontFeatureProperties) {
gCSSProperties[prop] = fontFeatureProperties[prop];
}
var fontAdditions = [ "font-kerning", "font-synthesis", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position" ];
gCSSProperties["font"].subproperties = gCSSProperties["font"].subproperties.concat(fontAdditions);
}
if (SpecialPowers.getBoolPref("layout.css.masking.enabled")) {
gCSSProperties["mask-type"] = {
domProp: "maskType",

View File

@ -61,6 +61,20 @@ var all_but_one = {
"-moz-font-feature-settings": "normal", // has to be default value
"-moz-font-language-override": "normal" // has to be default value
};
if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
var featureDefs = {
"font-kerning": "auto", // has to be default value
"font-synthesis": "weight style", // has to be default value
"font-variant-caps": "normal", // has to be default value
"font-variant-east-asian": "normal", // has to be default value
"font-variant-ligatures": "normal", // has to be default value
"font-variant-numeric": "normal", // has to be default value
"font-variant-position": "normal" // has to be default value
};
for (var prop in featureDefs) {
all_but_one[prop] = featureDefs[prop];
}
}
for (var prop in all_but_one) {
s.setProperty(prop, all_but_one[prop], "");
}

View File

@ -47,7 +47,13 @@ is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;"
is(e.style.font, "", "font getter returns nothing");
e.setAttribute("style", "font: inherit; font-family: Helvetica;");
is(e.style.cssText, "font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -moz-font-feature-settings: inherit; -moz-font-language-override: inherit; font-family: Helvetica;", "don't serialize system font for font:inherit");
var cssTextStr = "font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -moz-font-feature-settings: inherit; -moz-font-language-override: inherit;";
if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
cssTextStr += " font-kerning: inherit; font-synthesis: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit;"
}
is(e.style.cssText, cssTextStr + " font-family: Helvetica;", "don't serialize system font for font:inherit");
is(e.style.font, "", "font getter returns nothing");
</script>