mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 511339 - part 1 - implement -moz-font-feature-settings and -moz-font-language-override in CSS. r=dbaron
This commit is contained in:
parent
8e9b38fd58
commit
1341e3f276
@ -2355,7 +2355,9 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
|||||||
fontStyle->mFont.sizeAdjust,
|
fontStyle->mFont.sizeAdjust,
|
||||||
fontStyle->mFont.systemFont,
|
fontStyle->mFont.systemFont,
|
||||||
fontStyle->mFont.familyNameQuirks,
|
fontStyle->mFont.familyNameQuirks,
|
||||||
printerFont);
|
printerFont,
|
||||||
|
fontStyle->mFont.featureSettings,
|
||||||
|
fontStyle->mFont.languageOverride);
|
||||||
|
|
||||||
CurrentState().fontGroup =
|
CurrentState().fontGroup =
|
||||||
gfxPlatform::GetPlatform()->CreateFontGroup(fontStyle->mFont.name,
|
gfxPlatform::GetPlatform()->CreateFontGroup(fontStyle->mFont.name,
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "nsIDOMSVGCSS2Properties.idl"
|
#include "nsIDOMSVGCSS2Properties.idl"
|
||||||
|
|
||||||
[scriptable, uuid(29B6104D-933F-4DD0-8FC8-BDEC0514469D)]
|
[scriptable, uuid(C8FA5710-8E47-4E76-9EBD-87E2ACF4F46C)]
|
||||||
interface nsIDOMNSCSS2Properties : nsIDOMSVGCSS2Properties
|
interface nsIDOMNSCSS2Properties : nsIDOMSVGCSS2Properties
|
||||||
{
|
{
|
||||||
/* Non-DOM 2 extensions */
|
/* Non-DOM 2 extensions */
|
||||||
@ -121,6 +121,12 @@ interface nsIDOMNSCSS2Properties : nsIDOMSVGCSS2Properties
|
|||||||
attribute DOMString MozFloatEdge;
|
attribute DOMString MozFloatEdge;
|
||||||
// raises(DOMException) on setting
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
|
attribute DOMString MozFontFeatureSettings;
|
||||||
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
|
attribute DOMString MozFontLanguageOverride;
|
||||||
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
attribute DOMString MozForceBrokenImageIcon;
|
attribute DOMString MozForceBrokenImageIcon;
|
||||||
// raises(DOMException) on setting
|
// raises(DOMException) on setting
|
||||||
|
|
||||||
|
@ -42,7 +42,9 @@
|
|||||||
|
|
||||||
nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||||
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
||||||
nscoord aSize, float aSizeAdjust)
|
nscoord aSize, float aSizeAdjust,
|
||||||
|
const nsString* aFeatureSettings,
|
||||||
|
const nsString* aLanguageOverride)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aName && IsASCII(nsDependentCString(aName)),
|
NS_ASSERTION(aName && IsASCII(nsDependentCString(aName)),
|
||||||
"Must only pass ASCII names here");
|
"Must only pass ASCII names here");
|
||||||
@ -56,11 +58,19 @@ nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
|||||||
decorations = aDecoration;
|
decorations = aDecoration;
|
||||||
size = aSize;
|
size = aSize;
|
||||||
sizeAdjust = aSizeAdjust;
|
sizeAdjust = aSizeAdjust;
|
||||||
|
if (aFeatureSettings) {
|
||||||
|
featureSettings = *aFeatureSettings;
|
||||||
|
}
|
||||||
|
if (aLanguageOverride) {
|
||||||
|
languageOverride = *aLanguageOverride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||||
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
||||||
nscoord aSize, float aSizeAdjust)
|
nscoord aSize, float aSizeAdjust,
|
||||||
|
const nsString* aFeatureSettings,
|
||||||
|
const nsString* aLanguageOverride)
|
||||||
: name(aName)
|
: name(aName)
|
||||||
{
|
{
|
||||||
style = aStyle;
|
style = aStyle;
|
||||||
@ -72,6 +82,12 @@ nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
|||||||
decorations = aDecoration;
|
decorations = aDecoration;
|
||||||
size = aSize;
|
size = aSize;
|
||||||
sizeAdjust = aSizeAdjust;
|
sizeAdjust = aSizeAdjust;
|
||||||
|
if (aFeatureSettings) {
|
||||||
|
featureSettings = *aFeatureSettings;
|
||||||
|
}
|
||||||
|
if (aLanguageOverride) {
|
||||||
|
languageOverride = *aLanguageOverride;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFont::nsFont(const nsFont& aOther)
|
nsFont::nsFont(const nsFont& aOther)
|
||||||
@ -86,6 +102,8 @@ nsFont::nsFont(const nsFont& aOther)
|
|||||||
decorations = aOther.decorations;
|
decorations = aOther.decorations;
|
||||||
size = aOther.size;
|
size = aOther.size;
|
||||||
sizeAdjust = aOther.sizeAdjust;
|
sizeAdjust = aOther.sizeAdjust;
|
||||||
|
featureSettings = aOther.featureSettings;
|
||||||
|
languageOverride = aOther.languageOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFont::nsFont()
|
nsFont::nsFont()
|
||||||
@ -105,7 +123,9 @@ PRBool nsFont::BaseEquals(const nsFont& aOther) const
|
|||||||
(stretch == aOther.stretch) &&
|
(stretch == aOther.stretch) &&
|
||||||
(size == aOther.size) &&
|
(size == aOther.size) &&
|
||||||
(sizeAdjust == aOther.sizeAdjust) &&
|
(sizeAdjust == aOther.sizeAdjust) &&
|
||||||
name.Equals(aOther.name, nsCaseInsensitiveStringComparator())) {
|
name.Equals(aOther.name, nsCaseInsensitiveStringComparator()) &&
|
||||||
|
(featureSettings == aOther.featureSettings) &&
|
||||||
|
(languageOverride == aOther.languageOverride)) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
@ -133,6 +153,8 @@ nsFont& nsFont::operator=(const nsFont& aOther)
|
|||||||
decorations = aOther.decorations;
|
decorations = aOther.decorations;
|
||||||
size = aOther.size;
|
size = aOther.size;
|
||||||
sizeAdjust = aOther.sizeAdjust;
|
sizeAdjust = aOther.sizeAdjust;
|
||||||
|
featureSettings = aOther.featureSettings;
|
||||||
|
languageOverride = aOther.languageOverride;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,15 +102,27 @@ struct NS_GFX nsFont {
|
|||||||
// needs to be done.
|
// needs to be done.
|
||||||
float sizeAdjust;
|
float sizeAdjust;
|
||||||
|
|
||||||
|
// Font features from CSS font-feature-settings
|
||||||
|
nsString featureSettings;
|
||||||
|
|
||||||
|
// Language system tag, to override document language;
|
||||||
|
// this is an OpenType "language system" tag represented as a 32-bit integer
|
||||||
|
// (see http://www.microsoft.com/typography/otspec/languagetags.htm).
|
||||||
|
nsString languageOverride;
|
||||||
|
|
||||||
// Initialize the font struct with an ASCII name
|
// Initialize the font struct with an ASCII name
|
||||||
nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||||
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
||||||
nscoord aSize, float aSizeAdjust=0.0f);
|
nscoord aSize, float aSizeAdjust=0.0f,
|
||||||
|
const nsString* aFeatureSettings = nsnull,
|
||||||
|
const nsString* aLanguageOverride = nsnull);
|
||||||
|
|
||||||
// Initialize the font struct with a (potentially) unicode name
|
// Initialize the font struct with a (potentially) unicode name
|
||||||
nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
|
||||||
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
PRUint16 aWeight, PRInt16 aStretch, PRUint8 aDecoration,
|
||||||
nscoord aSize, float aSizeAdjust=0.0f);
|
nscoord aSize, float aSizeAdjust=0.0f,
|
||||||
|
const nsString* aFeatureSettings = nsnull,
|
||||||
|
const nsString* aLanguageOverride = nsnull);
|
||||||
|
|
||||||
// Make a copy of the given font
|
// Make a copy of the given font
|
||||||
nsFont(const nsFont& aFont);
|
nsFont(const nsFont& aFont);
|
||||||
|
@ -83,7 +83,9 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage,
|
|||||||
size, aLanguage,
|
size, aLanguage,
|
||||||
aFont.sizeAdjust, aFont.systemFont,
|
aFont.sizeAdjust, aFont.systemFont,
|
||||||
aFont.familyNameQuirks,
|
aFont.familyNameQuirks,
|
||||||
printerFont);
|
printerFont,
|
||||||
|
aFont.featureSettings,
|
||||||
|
aFont.languageOverride);
|
||||||
|
|
||||||
mFontGroup =
|
mFontGroup =
|
||||||
gfxPlatform::GetPlatform()->CreateFontGroup(aFont.name, mFontStyle,
|
gfxPlatform::GetPlatform()->CreateFontGroup(aFont.name, mFontStyle,
|
||||||
|
@ -1699,6 +1699,7 @@ InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet,
|
|||||||
PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
||||||
PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
||||||
PRUint32 italicStyle = FONT_STYLE_NORMAL;
|
PRUint32 italicStyle = FONT_STYLE_NORMAL;
|
||||||
|
nsString featureSettings, languageOverride;
|
||||||
|
|
||||||
// set up family name
|
// set up family name
|
||||||
aRule->GetDesc(eCSSFontDesc_Family, val);
|
aRule->GetDesc(eCSSFontDesc_Family, val);
|
||||||
@ -1749,6 +1750,30 @@ InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet,
|
|||||||
"@font-face style has unexpected unit");
|
"@font-face style has unexpected unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set up font features
|
||||||
|
aRule->GetDesc(eCSSFontDesc_FontFeatureSettings, val);
|
||||||
|
unit = val.GetUnit();
|
||||||
|
if (unit == eCSSUnit_Normal) {
|
||||||
|
// empty feature string
|
||||||
|
} else if (unit == eCSSUnit_String) {
|
||||||
|
val.GetStringValue(featureSettings);
|
||||||
|
} else {
|
||||||
|
NS_ASSERTION(unit == eCSSUnit_Null,
|
||||||
|
"@font-face font-feature-settings has unexpected unit");
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up font language override
|
||||||
|
aRule->GetDesc(eCSSFontDesc_FontLanguageOverride, val);
|
||||||
|
unit = val.GetUnit();
|
||||||
|
if (unit == eCSSUnit_Normal) {
|
||||||
|
// empty feature string
|
||||||
|
} else if (unit == eCSSUnit_String) {
|
||||||
|
val.GetStringValue(languageOverride);
|
||||||
|
} else {
|
||||||
|
NS_ASSERTION(unit == eCSSUnit_Null,
|
||||||
|
"@font-face font-language-override has unexpected unit");
|
||||||
|
}
|
||||||
|
|
||||||
// set up src array
|
// set up src array
|
||||||
nsTArray<gfxFontFaceSrc> srcArray;
|
nsTArray<gfxFontFaceSrc> srcArray;
|
||||||
|
|
||||||
@ -1824,7 +1849,8 @@ InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fontfamily.IsEmpty() && srcArray.Length() > 0) {
|
if (!fontfamily.IsEmpty() && srcArray.Length() > 0) {
|
||||||
aFontSet->AddFontFace(fontfamily, srcArray, weight, stretch, italicStyle);
|
aFontSet->AddFontFace(fontfamily, srcArray, weight, stretch, italicStyle,
|
||||||
|
featureSettings, languageOverride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,6 +1030,10 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
|
|||||||
*data->ValueStorageFor(eCSSProperty_font_stretch);
|
*data->ValueStorageFor(eCSSProperty_font_stretch);
|
||||||
const nsCSSValue &sizeAdjust =
|
const nsCSSValue &sizeAdjust =
|
||||||
*data->ValueStorageFor(eCSSProperty_font_size_adjust);
|
*data->ValueStorageFor(eCSSProperty_font_size_adjust);
|
||||||
|
const nsCSSValue &featureSettings =
|
||||||
|
*data->ValueStorageFor(eCSSProperty_font_feature_settings);
|
||||||
|
const nsCSSValue &languageOverride =
|
||||||
|
*data->ValueStorageFor(eCSSProperty_font_language_override);
|
||||||
|
|
||||||
if (systemFont &&
|
if (systemFont &&
|
||||||
systemFont->GetUnit() != eCSSUnit_None &&
|
systemFont->GetUnit() != eCSSUnit_None &&
|
||||||
@ -1041,19 +1045,24 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
|
|||||||
lh.GetUnit() != eCSSUnit_System_Font ||
|
lh.GetUnit() != eCSSUnit_System_Font ||
|
||||||
family.GetUnit() != eCSSUnit_System_Font ||
|
family.GetUnit() != eCSSUnit_System_Font ||
|
||||||
stretch.GetUnit() != eCSSUnit_System_Font ||
|
stretch.GetUnit() != eCSSUnit_System_Font ||
|
||||||
sizeAdjust.GetUnit() != eCSSUnit_System_Font) {
|
sizeAdjust.GetUnit() != eCSSUnit_System_Font ||
|
||||||
|
featureSettings.GetUnit() != eCSSUnit_System_Font ||
|
||||||
|
languageOverride.GetUnit() != eCSSUnit_System_Font) {
|
||||||
// This can't be represented as a shorthand.
|
// This can't be represented as a shorthand.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
AppendCSSValueToString(eCSSProperty__x_system_font, *systemFont,
|
AppendCSSValueToString(eCSSProperty__x_system_font, *systemFont,
|
||||||
aValue);
|
aValue);
|
||||||
} else {
|
} else {
|
||||||
// The font-stretch and font-size-adjust
|
// The font-stretch, font-size-adjust,
|
||||||
|
// -moz-font-feature-settings, and -moz-font-language-override
|
||||||
// properties are reset by this shorthand property to their
|
// properties are reset by this shorthand property to their
|
||||||
// initial values, but can't be represented in its syntax.
|
// initial values, but can't be represented in its syntax.
|
||||||
if (stretch.GetUnit() != eCSSUnit_Enumerated ||
|
if (stretch.GetUnit() != eCSSUnit_Enumerated ||
|
||||||
stretch.GetIntValue() != NS_STYLE_FONT_STRETCH_NORMAL ||
|
stretch.GetIntValue() != NS_STYLE_FONT_STRETCH_NORMAL ||
|
||||||
sizeAdjust.GetUnit() != eCSSUnit_None) {
|
sizeAdjust.GetUnit() != eCSSUnit_None ||
|
||||||
|
featureSettings.GetUnit() != eCSSUnit_Normal ||
|
||||||
|
languageOverride.GetUnit() != eCSSUnit_Normal) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5963,6 +5963,10 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
|||||||
nsCSSProps::kFloatEdgeKTable);
|
nsCSSProps::kFloatEdgeKTable);
|
||||||
case eCSSProperty_font_family:
|
case eCSSProperty_font_family:
|
||||||
return ParseFamily(aValue);
|
return ParseFamily(aValue);
|
||||||
|
case eCSSProperty_font_feature_settings:
|
||||||
|
case eCSSProperty_font_language_override:
|
||||||
|
return ParseVariant(aValue, VARIANT_NORMAL | VARIANT_INHERIT |
|
||||||
|
VARIANT_STRING, nsnull);
|
||||||
case eCSSProperty_font_size:
|
case eCSSProperty_font_size:
|
||||||
return ParseNonNegativeVariant(aValue,
|
return ParseNonNegativeVariant(aValue,
|
||||||
VARIANT_HKLP | VARIANT_SYSFONT |
|
VARIANT_HKLP | VARIANT_SYSFONT |
|
||||||
@ -6241,6 +6245,10 @@ CSSParserImpl::ParseFontDescriptorValue(nsCSSFontDesc aDescID,
|
|||||||
case eCSSFontDesc_UnicodeRange:
|
case eCSSFontDesc_UnicodeRange:
|
||||||
return ParseFontRanges(aValue);
|
return ParseFontRanges(aValue);
|
||||||
|
|
||||||
|
case eCSSFontDesc_FontFeatureSettings:
|
||||||
|
case eCSSFontDesc_FontLanguageOverride:
|
||||||
|
return ParseVariant(aValue, VARIANT_NORMAL | VARIANT_STRING, nsnull);
|
||||||
|
|
||||||
case eCSSFontDesc_UNKNOWN:
|
case eCSSFontDesc_UNKNOWN:
|
||||||
case eCSSFontDesc_COUNT:
|
case eCSSFontDesc_COUNT:
|
||||||
NS_NOTREACHED("bad nsCSSFontDesc code");
|
NS_NOTREACHED("bad nsCSSFontDesc code");
|
||||||
@ -7825,6 +7833,8 @@ CSSParserImpl::ParseFont()
|
|||||||
AppendValue(eCSSProperty_line_height, family);
|
AppendValue(eCSSProperty_line_height, family);
|
||||||
AppendValue(eCSSProperty_font_stretch, family);
|
AppendValue(eCSSProperty_font_stretch, family);
|
||||||
AppendValue(eCSSProperty_font_size_adjust, family);
|
AppendValue(eCSSProperty_font_size_adjust, family);
|
||||||
|
AppendValue(eCSSProperty_font_feature_settings, family);
|
||||||
|
AppendValue(eCSSProperty_font_language_override, family);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AppendValue(eCSSProperty__x_system_font, family);
|
AppendValue(eCSSProperty__x_system_font, family);
|
||||||
@ -7837,6 +7847,8 @@ CSSParserImpl::ParseFont()
|
|||||||
AppendValue(eCSSProperty_line_height, systemFont);
|
AppendValue(eCSSProperty_line_height, systemFont);
|
||||||
AppendValue(eCSSProperty_font_stretch, systemFont);
|
AppendValue(eCSSProperty_font_stretch, systemFont);
|
||||||
AppendValue(eCSSProperty_font_size_adjust, systemFont);
|
AppendValue(eCSSProperty_font_size_adjust, systemFont);
|
||||||
|
AppendValue(eCSSProperty_font_feature_settings, systemFont);
|
||||||
|
AppendValue(eCSSProperty_font_language_override, systemFont);
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
@ -7898,6 +7910,8 @@ CSSParserImpl::ParseFont()
|
|||||||
AppendValue(eCSSProperty_font_stretch,
|
AppendValue(eCSSProperty_font_stretch,
|
||||||
nsCSSValue(NS_FONT_STRETCH_NORMAL, eCSSUnit_Enumerated));
|
nsCSSValue(NS_FONT_STRETCH_NORMAL, eCSSUnit_Enumerated));
|
||||||
AppendValue(eCSSProperty_font_size_adjust, nsCSSValue(eCSSUnit_None));
|
AppendValue(eCSSProperty_font_size_adjust, nsCSSValue(eCSSUnit_None));
|
||||||
|
AppendValue(eCSSProperty_font_feature_settings, nsCSSValue(eCSSUnit_Normal));
|
||||||
|
AppendValue(eCSSProperty_font_language_override, nsCSSValue(eCSSUnit_Normal));
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1430,6 +1430,28 @@ CSS_PROP_FONT(
|
|||||||
nsnull,
|
nsnull,
|
||||||
CSS_PROP_NO_OFFSET,
|
CSS_PROP_NO_OFFSET,
|
||||||
eStyleAnimType_None)
|
eStyleAnimType_None)
|
||||||
|
CSS_PROP_FONT(
|
||||||
|
-moz-font-feature-settings,
|
||||||
|
font_feature_settings,
|
||||||
|
MozFontFeatureSettings,
|
||||||
|
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE,
|
||||||
|
Font,
|
||||||
|
mFontFeatureSettings,
|
||||||
|
eCSSType_Value,
|
||||||
|
nsnull,
|
||||||
|
CSS_PROP_NO_OFFSET,
|
||||||
|
eStyleAnimType_None)
|
||||||
|
CSS_PROP_FONT(
|
||||||
|
-moz-font-language-override,
|
||||||
|
font_language_override,
|
||||||
|
MozFontLanguageOverride,
|
||||||
|
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE,
|
||||||
|
Font,
|
||||||
|
mFontLanguageOverride,
|
||||||
|
eCSSType_Value,
|
||||||
|
nsnull,
|
||||||
|
CSS_PROP_NO_OFFSET,
|
||||||
|
eStyleAnimType_None)
|
||||||
CSS_PROP_FONT(
|
CSS_PROP_FONT(
|
||||||
font-size,
|
font-size,
|
||||||
font_size,
|
font_size,
|
||||||
|
@ -101,6 +101,8 @@ enum nsCSSFontDesc {
|
|||||||
eCSSFontDesc_Stretch,
|
eCSSFontDesc_Stretch,
|
||||||
eCSSFontDesc_Src,
|
eCSSFontDesc_Src,
|
||||||
eCSSFontDesc_UnicodeRange,
|
eCSSFontDesc_UnicodeRange,
|
||||||
|
eCSSFontDesc_FontFeatureSettings,
|
||||||
|
eCSSFontDesc_FontLanguageOverride,
|
||||||
eCSSFontDesc_COUNT
|
eCSSFontDesc_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,7 +86,9 @@ static const char* const kCSSRawFontDescs[] = {
|
|||||||
"font-weight",
|
"font-weight",
|
||||||
"font-stretch",
|
"font-stretch",
|
||||||
"src",
|
"src",
|
||||||
"unicode-range"
|
"unicode-range",
|
||||||
|
"-moz-font-feature-settings",
|
||||||
|
"-moz-font-language-override"
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PropertyAndCount {
|
struct PropertyAndCount {
|
||||||
@ -1859,6 +1861,8 @@ static const nsCSSProperty gFontSubpropTable[] = {
|
|||||||
eCSSProperty_font_size_adjust, // XXX Added LDB.
|
eCSSProperty_font_size_adjust, // XXX Added LDB.
|
||||||
eCSSProperty_font_stretch, // XXX Added LDB.
|
eCSSProperty_font_stretch, // XXX Added LDB.
|
||||||
eCSSProperty__x_system_font,
|
eCSSProperty__x_system_font,
|
||||||
|
eCSSProperty_font_feature_settings,
|
||||||
|
eCSSProperty_font_language_override,
|
||||||
eCSSProperty_UNKNOWN
|
eCSSProperty_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1576,7 +1576,9 @@ nsCSSFontFaceStyleDecl::Fields[] = {
|
|||||||
&nsCSSFontFaceStyleDecl::mWeight,
|
&nsCSSFontFaceStyleDecl::mWeight,
|
||||||
&nsCSSFontFaceStyleDecl::mStretch,
|
&nsCSSFontFaceStyleDecl::mStretch,
|
||||||
&nsCSSFontFaceStyleDecl::mSrc,
|
&nsCSSFontFaceStyleDecl::mSrc,
|
||||||
&nsCSSFontFaceStyleDecl::mUnicodeRange
|
&nsCSSFontFaceStyleDecl::mUnicodeRange,
|
||||||
|
&nsCSSFontFaceStyleDecl::mFontFeatureSettings,
|
||||||
|
&nsCSSFontFaceStyleDecl::mFontLanguageOverride
|
||||||
};
|
};
|
||||||
|
|
||||||
DOMCI_DATA(CSSFontFaceStyleDecl, nsCSSFontFaceStyleDecl)
|
DOMCI_DATA(CSSFontFaceStyleDecl, nsCSSFontFaceStyleDecl)
|
||||||
|
@ -234,6 +234,8 @@ protected:
|
|||||||
nsCSSValue mStretch;
|
nsCSSValue mStretch;
|
||||||
nsCSSValue mSrc;
|
nsCSSValue mSrc;
|
||||||
nsCSSValue mUnicodeRange;
|
nsCSSValue mUnicodeRange;
|
||||||
|
nsCSSValue mFontFeatureSettings;
|
||||||
|
nsCSSValue mFontLanguageOverride;
|
||||||
|
|
||||||
static nsCSSValue nsCSSFontFaceStyleDecl::* const Fields[];
|
static nsCSSValue nsCSSFontFaceStyleDecl::* const Fields[];
|
||||||
inline nsCSSFontFaceRule* ContainingRule();
|
inline nsCSSFontFaceRule* ContainingRule();
|
||||||
|
@ -283,6 +283,8 @@ struct nsCSSFont : public nsCSSStruct {
|
|||||||
nsCSSValue mSize;
|
nsCSSValue mSize;
|
||||||
nsCSSValue mSizeAdjust; // NEW
|
nsCSSValue mSizeAdjust; // NEW
|
||||||
nsCSSValue mStretch; // NEW
|
nsCSSValue mStretch; // NEW
|
||||||
|
nsCSSValue mFontFeatureSettings;
|
||||||
|
nsCSSValue mFontLanguageOverride;
|
||||||
|
|
||||||
#ifdef MOZ_MATHML
|
#ifdef MOZ_MATHML
|
||||||
nsCSSValue mScriptLevel; // Integer values mean "relative", Number values mean "absolute"
|
nsCSSValue mScriptLevel; // Integer values mean "relative", Number values mean "absolute"
|
||||||
|
@ -1318,6 +1318,40 @@ nsComputedDOMStyle::GetFontVariant(nsIDOMCSSValue** aValue)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsComputedDOMStyle::GetMozFontFeatureSettings(nsIDOMCSSValue** aValue)
|
||||||
|
{
|
||||||
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||||
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
const nsStyleFont* font = GetStyleFont();
|
||||||
|
if (font->mFont.featureSettings.IsEmpty()) {
|
||||||
|
val->SetIdent(eCSSKeyword_normal);
|
||||||
|
} else {
|
||||||
|
nsString str;
|
||||||
|
nsStyleUtil::AppendEscapedCSSString(font->mFont.featureSettings, str);
|
||||||
|
val->SetString(str);
|
||||||
|
}
|
||||||
|
return CallQueryInterface(val, aValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsComputedDOMStyle::GetMozFontLanguageOverride(nsIDOMCSSValue** aValue)
|
||||||
|
{
|
||||||
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||||
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
const nsStyleFont* font = GetStyleFont();
|
||||||
|
if (font->mFont.languageOverride.IsEmpty()) {
|
||||||
|
val->SetIdent(eCSSKeyword_normal);
|
||||||
|
} else {
|
||||||
|
nsString str;
|
||||||
|
nsStyleUtil::AppendEscapedCSSString(font->mFont.languageOverride, str);
|
||||||
|
val->SetString(str);
|
||||||
|
}
|
||||||
|
return CallQueryInterface(val, aValue);
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
|
nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
|
||||||
PRUint32 nsStyleBackground::* aCount,
|
PRUint32 nsStyleBackground::* aCount,
|
||||||
@ -4764,6 +4798,8 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||||||
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_width, ColumnRuleWidth),
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_width, ColumnRuleWidth),
|
||||||
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_style, ColumnRuleStyle),
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_style, ColumnRuleStyle),
|
||||||
COMPUTED_STYLE_MAP_ENTRY(float_edge, FloatEdge),
|
COMPUTED_STYLE_MAP_ENTRY(float_edge, FloatEdge),
|
||||||
|
COMPUTED_STYLE_MAP_ENTRY(font_feature_settings, MozFontFeatureSettings),
|
||||||
|
COMPUTED_STYLE_MAP_ENTRY(font_language_override, MozFontLanguageOverride),
|
||||||
COMPUTED_STYLE_MAP_ENTRY(force_broken_image_icon, ForceBrokenImageIcon),
|
COMPUTED_STYLE_MAP_ENTRY(force_broken_image_icon, ForceBrokenImageIcon),
|
||||||
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
||||||
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||||
|
@ -183,6 +183,8 @@ private:
|
|||||||
/* Font properties */
|
/* Font properties */
|
||||||
nsresult GetColor(nsIDOMCSSValue** aValue);
|
nsresult GetColor(nsIDOMCSSValue** aValue);
|
||||||
nsresult GetFontFamily(nsIDOMCSSValue** aValue);
|
nsresult GetFontFamily(nsIDOMCSSValue** aValue);
|
||||||
|
nsresult GetMozFontFeatureSettings(nsIDOMCSSValue** aValue);
|
||||||
|
nsresult GetMozFontLanguageOverride(nsIDOMCSSValue** aValue);
|
||||||
nsresult GetFontSize(nsIDOMCSSValue** aValue);
|
nsresult GetFontSize(nsIDOMCSSValue** aValue);
|
||||||
nsresult GetFontSizeAdjust(nsIDOMCSSValue** aValue);
|
nsresult GetFontSizeAdjust(nsIDOMCSSValue** aValue);
|
||||||
nsresult GetFontStretch(nsIDOMCSSValue** aValue);
|
nsresult GetFontStretch(nsIDOMCSSValue** aValue);
|
||||||
|
@ -3275,6 +3275,32 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// font-feature-settings
|
||||||
|
if (eCSSUnit_Inherit == aFontData.mFontFeatureSettings.GetUnit()) {
|
||||||
|
aCanStoreInRuleTree = PR_FALSE;
|
||||||
|
aFont->mFont.featureSettings = aParentFont->mFont.featureSettings;
|
||||||
|
} else if (eCSSUnit_Normal == aFontData.mFontFeatureSettings.GetUnit() ||
|
||||||
|
eCSSUnit_Initial == aFontData.mFontFeatureSettings.GetUnit()) {
|
||||||
|
aFont->mFont.featureSettings.Truncate();
|
||||||
|
} else if (eCSSUnit_System_Font == aFontData.mFontFeatureSettings.GetUnit()) {
|
||||||
|
aFont->mFont.featureSettings = systemFont.featureSettings;
|
||||||
|
} else if (eCSSUnit_String == aFontData.mFontFeatureSettings.GetUnit()) {
|
||||||
|
aFontData.mFontFeatureSettings.GetStringValue(aFont->mFont.featureSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// font-language-override
|
||||||
|
if (eCSSUnit_Inherit == aFontData.mFontLanguageOverride.GetUnit()) {
|
||||||
|
aCanStoreInRuleTree = PR_FALSE;
|
||||||
|
aFont->mFont.languageOverride = aParentFont->mFont.languageOverride;
|
||||||
|
} else if (eCSSUnit_Normal == aFontData.mFontLanguageOverride.GetUnit() ||
|
||||||
|
eCSSUnit_Initial == aFontData.mFontLanguageOverride.GetUnit()) {
|
||||||
|
aFont->mFont.languageOverride.Truncate();
|
||||||
|
} else if (eCSSUnit_System_Font == aFontData.mFontLanguageOverride.GetUnit()) {
|
||||||
|
aFont->mFont.languageOverride = systemFont.languageOverride;
|
||||||
|
} else if (eCSSUnit_String == aFontData.mFontLanguageOverride.GetUnit()) {
|
||||||
|
aFontData.mFontLanguageOverride.GetStringValue(aFont->mFont.languageOverride);
|
||||||
|
}
|
||||||
|
|
||||||
// font-size: enum, length, percent, inherit
|
// font-size: enum, length, percent, inherit
|
||||||
nscoord scriptLevelAdjustedParentSize = aParentFont->mSize;
|
nscoord scriptLevelAdjustedParentSize = aParentFont->mSize;
|
||||||
#ifdef MOZ_MATHML
|
#ifdef MOZ_MATHML
|
||||||
|
@ -210,7 +210,9 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
|
|||||||
(aFont1.familyNameQuirks == aFont2.familyNameQuirks) &&
|
(aFont1.familyNameQuirks == aFont2.familyNameQuirks) &&
|
||||||
(aFont1.weight == aFont2.weight) &&
|
(aFont1.weight == aFont2.weight) &&
|
||||||
(aFont1.stretch == aFont2.stretch) &&
|
(aFont1.stretch == aFont2.stretch) &&
|
||||||
(aFont1.name == aFont2.name)) {
|
(aFont1.name == aFont2.name) &&
|
||||||
|
(aFont1.featureSettings == aFont2.featureSettings) &&
|
||||||
|
(aFont1.languageOverride == aFont2.languageOverride)) {
|
||||||
if ((aFont1.decorations == aFont2.decorations)) {
|
if ((aFont1.decorations == aFont2.decorations)) {
|
||||||
return NS_STYLE_HINT_NONE;
|
return NS_STYLE_HINT_NONE;
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1471,7 @@ var gCSSProperties = {
|
|||||||
domProp: "font",
|
domProp: "font",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_TRUE_SHORTHAND,
|
type: CSS_TYPE_TRUE_SHORTHAND,
|
||||||
subproperties: [ "font-style", "font-variant", "font-weight", "font-size", "line-height", "font-family", "font-stretch", "font-size-adjust" ],
|
subproperties: [ "font-style", "font-variant", "font-weight", "font-size", "line-height", "font-family", "font-stretch", "font-size-adjust", "-moz-font-feature-settings", "-moz-font-language-override" ],
|
||||||
/* XXX could be sans-serif */
|
/* XXX could be sans-serif */
|
||||||
initial_values: [ "medium serif" ],
|
initial_values: [ "medium serif" ],
|
||||||
other_values: [ "large serif", "9px fantasy", "bold italic small-caps 24px/1.4 Times New Roman, serif", "caption", "icon", "menu", "message-box", "small-caption", "status-bar" ],
|
other_values: [ "large serif", "9px fantasy", "bold italic small-caps 24px/1.4 Times New Roman, serif", "caption", "icon", "menu", "message-box", "small-caption", "status-bar" ],
|
||||||
@ -1485,6 +1485,22 @@ var gCSSProperties = {
|
|||||||
other_values: [ "sans-serif", "Times New Roman, serif", "'Times New Roman', serif", "cursive", "fantasy", "\"Times New Roman", "Times, \"Times New Roman" ],
|
other_values: [ "sans-serif", "Times New Roman, serif", "'Times New Roman', serif", "cursive", "fantasy", "\"Times New Roman", "Times, \"Times New Roman" ],
|
||||||
invalid_values: [ "\"Times New\" Roman" ]
|
invalid_values: [ "\"Times New\" Roman" ]
|
||||||
},
|
},
|
||||||
|
"-moz-font-feature-settings": {
|
||||||
|
domProp: "MozFontFeatureSettings",
|
||||||
|
inherited: true,
|
||||||
|
type: CSS_TYPE_LONGHAND,
|
||||||
|
initial_values: [ "normal" ],
|
||||||
|
other_values: [ "'liga=1'", "\"liga=1\"", "'foo,bar=\"hello\"'" ],
|
||||||
|
invalid_values: [ "liga=1", "foo,bar=\"hello\"" ]
|
||||||
|
},
|
||||||
|
"-moz-font-language-override": {
|
||||||
|
domProp: "MozFontLanguageOverride",
|
||||||
|
inherited: true,
|
||||||
|
type: CSS_TYPE_LONGHAND,
|
||||||
|
initial_values: [ "normal" ],
|
||||||
|
other_values: [ "'TRK'", "\"TRK\"", "'N\\'Ko'" ],
|
||||||
|
invalid_values: [ "TRK" ]
|
||||||
|
},
|
||||||
"font-size": {
|
"font-size": {
|
||||||
domProp: "fontSize",
|
domProp: "fontSize",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
|
@ -58,7 +58,9 @@ var all_but_one = {
|
|||||||
"font-weight": "bold",
|
"font-weight": "bold",
|
||||||
"font-size": "small",
|
"font-size": "small",
|
||||||
"font-size-adjust": "none", // has to be default value
|
"font-size-adjust": "none", // has to be default value
|
||||||
"font-stretch": "normal" // has to be default value
|
"font-stretch": "normal", // has to be default value
|
||||||
|
"-moz-font-feature-settings": "normal", // has to be default value
|
||||||
|
"-moz-font-language-override": "normal" // has to be default value
|
||||||
};
|
};
|
||||||
for (var prop in all_but_one) {
|
for (var prop in all_but_one) {
|
||||||
s.setProperty(prop, all_but_one[prop], "");
|
s.setProperty(prop, all_but_one[prop], "");
|
||||||
|
@ -48,7 +48,7 @@ is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;"
|
|||||||
is(e.style.font, "", "font getter returns nothing");
|
is(e.style.font, "", "font getter returns nothing");
|
||||||
|
|
||||||
e.setAttribute("style", "font: inherit; font-family: Helvetica;");
|
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; font-family: Helvetica;", "don't serialize system font for font:inherit");
|
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");
|
||||||
is(e.style.font, "", "font getter returns nothing");
|
is(e.style.font, "", "font getter returns nothing");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1501,7 +1501,9 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale,
|
|||||||
mStyleContext->GetStyleVisibility()->mLanguage,
|
mStyleContext->GetStyleVisibility()->mLanguage,
|
||||||
font.sizeAdjust, font.systemFont,
|
font.sizeAdjust, font.systemFont,
|
||||||
font.familyNameQuirks,
|
font.familyNameQuirks,
|
||||||
printerFont);
|
printerFont,
|
||||||
|
font.featureSettings,
|
||||||
|
font.languageOverride);
|
||||||
|
|
||||||
nsRefPtr<gfxFontGroup> fontGroup =
|
nsRefPtr<gfxFontGroup> fontGroup =
|
||||||
gfxPlatform::GetPlatform()->CreateFontGroup(font.name, &fontStyle, presContext->GetUserFontSet());
|
gfxPlatform::GetPlatform()->CreateFontGroup(font.name, &fontStyle, presContext->GetUserFontSet());
|
||||||
|
Loading…
Reference in New Issue
Block a user