mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout bug 549861 (changesets 27fb48df15ce:7ecd4e3863b4) for insufficient review.
This commit is contained in:
parent
00a68469c0
commit
e0c18984a5
@ -913,8 +913,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
#ifdef MOZ_TIME_MANAGER
|
||||
NS_DEFINE_CLASSINFO_DATA(MozTimeManager, nsDOMGenericSH,
|
||||
@ -2306,10 +2304,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSFontFeatureValuesRule, nsIDOMCSSFontFeatureValuesRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFeatureValuesRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_TIME_MANAGER
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozTimeManager, nsIDOMMozTimeManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozTimeManager)
|
||||
|
@ -237,8 +237,6 @@ DOMCI_CLASS(AsyncScrollEventDetail)
|
||||
|
||||
DOMCI_CLASS(LockedFile)
|
||||
|
||||
DOMCI_CLASS(CSSFontFeatureValuesRule)
|
||||
|
||||
#ifdef MOZ_TIME_MANAGER
|
||||
DOMCI_CLASS(MozTimeManager)
|
||||
#endif
|
||||
|
@ -69,7 +69,6 @@ interface nsIDOMCSSPrimitiveValue;
|
||||
interface nsIDOMCSSRule;
|
||||
interface nsIDOMCSSRuleList;
|
||||
interface nsIDOMMozCSSKeyframeRule;
|
||||
interface nsIDOMCSSFontFeatureValuesRule;
|
||||
interface nsIDOMCSSStyleSheet;
|
||||
interface nsIDOMCSSStyleDeclaration;
|
||||
interface nsIDOMCounter;
|
||||
|
@ -8,7 +8,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMCSSCharsetRule.idl',
|
||||
'nsIDOMCSSConditionRule.idl',
|
||||
'nsIDOMCSSFontFaceRule.idl',
|
||||
'nsIDOMCSSFontFeatureValuesRule.idl',
|
||||
'nsIDOMCSSGroupingRule.idl',
|
||||
'nsIDOMCSSImportRule.idl',
|
||||
'nsIDOMCSSMediaRule.idl',
|
||||
|
@ -1,48 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Daggett <jdaggett@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMCSSRule.idl"
|
||||
|
||||
[scriptable, uuid(f4cb1776-389d-4f52-a4d8-68bea5bd00c1)]
|
||||
interface nsIDOMCSSFontFeatureValuesRule : nsIDOMCSSRule
|
||||
{
|
||||
attribute DOMString fontFamily;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString valueText;
|
||||
// raises(DOMException) on setting
|
||||
};
|
@ -32,7 +32,6 @@ interface nsIDOMCSSRule : nsISupports
|
||||
const unsigned short MOZ_KEYFRAME_RULE = 8;
|
||||
const unsigned short NAMESPACE_RULE = 10;
|
||||
const unsigned short SUPPORTS_RULE = 12;
|
||||
const unsigned short FONT_FEATURE_VALUES_RULE = 14;
|
||||
|
||||
readonly attribute unsigned short type;
|
||||
attribute DOMString cssText;
|
||||
|
@ -115,17 +115,6 @@ PEMQExpectedFeatureValue=Found invalid value for media feature.
|
||||
PEBadFontBlockStart=Expected '{' to begin @font-face rule but found '%1$S'.
|
||||
PEBadFontBlockEnd=Expected '}' to end @font-face rule but found '%1$S'.
|
||||
PEAnonBoxNotAlone=Did not expect anonymous box.
|
||||
PEFFVUnexpectedEOF=Unexpected end of @font-feature-values rule.
|
||||
PEFFVBlockStart=Expected opening { of @font-feature-values rule but found '%1$S'.
|
||||
PEFFVValueSetStart=Expected opening { of feature value set but found '%1$S'.
|
||||
PEFFVNoFamily=Expected font family list for @font-feature-values rule but found '%1$S'.
|
||||
PEFFVUnexpectedBlockEnd=Expected '}' to end @font-feature-values rule but found '%1$S'.
|
||||
PEFFVUnknownFontVariantPropValue=Unknown font-variant property value '%1$S'.
|
||||
PEFFVExpectedIdent=Expected identifier but found '%1$S'.
|
||||
PEFFVExpectedValue=Expected non-negative integer value but found '%1$S'.
|
||||
PEFFVTooManyValues=Too many values for feature type '%1$S'.
|
||||
PEFFVGenericInFamilyList=Family list cannot contain generic font family name.
|
||||
PEFFVValueDefinitionTrailing=Expected end of value definition but found '%1$S'.
|
||||
PEBadDirValue=Expected 'ltr' or 'rtl' in direction selector but found '%1$S'.
|
||||
PESupportsConditionStartEOF2='not', '(', or function
|
||||
PESupportsConditionInParensEOF=')'
|
||||
|
@ -492,7 +492,6 @@ var interfaceNamesInGlobalScope =
|
||||
"CloseEvent",
|
||||
"IDBCursorWithValue",
|
||||
"CSSFontFaceRule",
|
||||
"CSSFontFeatureValuesRule",
|
||||
"XMLHttpRequestEventTarget",
|
||||
"CompositionEvent",
|
||||
"HTMLOutputElement",
|
||||
|
@ -11,7 +11,8 @@
|
||||
|
||||
nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize)
|
||||
nscoord aSize, float aSizeAdjust,
|
||||
const nsString* aLanguageOverride)
|
||||
{
|
||||
NS_ASSERTION(aName && IsASCII(nsDependentCString(aName)),
|
||||
"Must only pass ASCII names here");
|
||||
@ -23,21 +24,16 @@ nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
|
||||
stretch = aStretch;
|
||||
decorations = aDecoration;
|
||||
size = aSize;
|
||||
sizeAdjust = 0.0;
|
||||
kerning = NS_FONT_KERNING_AUTO;
|
||||
synthesis = NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE;
|
||||
|
||||
variantAlternates = 0;
|
||||
variantCaps = NS_FONT_VARIANT_CAPS_NORMAL;
|
||||
variantEastAsian = 0;
|
||||
variantLigatures = 0;
|
||||
variantNumeric = 0;
|
||||
variantPosition = NS_FONT_VARIANT_POSITION_NORMAL;
|
||||
sizeAdjust = aSizeAdjust;
|
||||
if (aLanguageOverride) {
|
||||
languageOverride = *aLanguageOverride;
|
||||
}
|
||||
}
|
||||
|
||||
nsFont::nsFont(const nsSubstring& aName, uint8_t aStyle, uint8_t aVariant,
|
||||
nsFont::nsFont(const nsString& aName, uint8_t aStyle, uint8_t aVariant,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize)
|
||||
nscoord aSize, float aSizeAdjust,
|
||||
const nsString* aLanguageOverride)
|
||||
: name(aName)
|
||||
{
|
||||
style = aStyle;
|
||||
@ -47,16 +43,10 @@ nsFont::nsFont(const nsSubstring& aName, uint8_t aStyle, uint8_t aVariant,
|
||||
stretch = aStretch;
|
||||
decorations = aDecoration;
|
||||
size = aSize;
|
||||
sizeAdjust = 0.0;
|
||||
kerning = NS_FONT_KERNING_AUTO;
|
||||
synthesis = NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE;
|
||||
|
||||
variantAlternates = 0;
|
||||
variantCaps = NS_FONT_VARIANT_CAPS_NORMAL;
|
||||
variantEastAsian = 0;
|
||||
variantLigatures = 0;
|
||||
variantNumeric = 0;
|
||||
variantPosition = NS_FONT_VARIANT_POSITION_NORMAL;
|
||||
sizeAdjust = aSizeAdjust;
|
||||
if (aLanguageOverride) {
|
||||
languageOverride = *aLanguageOverride;
|
||||
}
|
||||
}
|
||||
|
||||
nsFont::nsFont(const nsFont& aOther)
|
||||
@ -70,18 +60,8 @@ nsFont::nsFont(const nsFont& aOther)
|
||||
decorations = aOther.decorations;
|
||||
size = aOther.size;
|
||||
sizeAdjust = aOther.sizeAdjust;
|
||||
kerning = aOther.kerning;
|
||||
synthesis = aOther.synthesis;
|
||||
fontFeatureSettings = aOther.fontFeatureSettings;
|
||||
languageOverride = aOther.languageOverride;
|
||||
variantAlternates = aOther.variantAlternates;
|
||||
variantCaps = aOther.variantCaps;
|
||||
variantEastAsian = aOther.variantEastAsian;
|
||||
variantLigatures = aOther.variantLigatures;
|
||||
variantNumeric = aOther.variantNumeric;
|
||||
variantPosition = aOther.variantPosition;
|
||||
alternateValues = aOther.alternateValues;
|
||||
featureValueLookup = aOther.featureValueLookup;
|
||||
fontFeatureSettings = aOther.fontFeatureSettings;
|
||||
}
|
||||
|
||||
nsFont::nsFont()
|
||||
@ -101,18 +81,8 @@ bool nsFont::BaseEquals(const nsFont& aOther) const
|
||||
(size == aOther.size) &&
|
||||
(sizeAdjust == aOther.sizeAdjust) &&
|
||||
name.Equals(aOther.name, nsCaseInsensitiveStringComparator()) &&
|
||||
(kerning == aOther.kerning) &&
|
||||
(synthesis == aOther.synthesis) &&
|
||||
(fontFeatureSettings == aOther.fontFeatureSettings) &&
|
||||
(languageOverride == aOther.languageOverride) &&
|
||||
(variantAlternates == aOther.variantAlternates) &&
|
||||
(variantCaps == aOther.variantCaps) &&
|
||||
(variantEastAsian == aOther.variantEastAsian) &&
|
||||
(variantLigatures == aOther.variantLigatures) &&
|
||||
(variantNumeric == aOther.variantNumeric) &&
|
||||
(variantPosition == aOther.variantPosition) &&
|
||||
(alternateValues == aOther.alternateValues) &&
|
||||
(featureValueLookup == aOther.featureValueLookup)) {
|
||||
(fontFeatureSettings == aOther.fontFeatureSettings)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -139,27 +109,16 @@ nsFont& nsFont::operator=(const nsFont& aOther)
|
||||
decorations = aOther.decorations;
|
||||
size = aOther.size;
|
||||
sizeAdjust = aOther.sizeAdjust;
|
||||
kerning = aOther.kerning;
|
||||
synthesis = aOther.synthesis;
|
||||
fontFeatureSettings = aOther.fontFeatureSettings;
|
||||
languageOverride = aOther.languageOverride;
|
||||
variantAlternates = aOther.variantAlternates;
|
||||
variantCaps = aOther.variantCaps;
|
||||
variantEastAsian = aOther.variantEastAsian;
|
||||
variantLigatures = aOther.variantLigatures;
|
||||
variantNumeric = aOther.variantNumeric;
|
||||
variantPosition = aOther.variantPosition;
|
||||
alternateValues = aOther.alternateValues;
|
||||
featureValueLookup = aOther.featureValueLookup;
|
||||
fontFeatureSettings = aOther.fontFeatureSettings;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
nsFont::CopyAlternates(const nsFont& aOther)
|
||||
nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const
|
||||
{
|
||||
variantAlternates = aOther.variantAlternates;
|
||||
alternateValues = aOther.alternateValues;
|
||||
featureValueLookup = aOther.featureValueLookup;
|
||||
// simple copy for now, font-variant implementation will expand
|
||||
aStyle->featureSettings.AppendElements(fontFeatureSettings);
|
||||
}
|
||||
|
||||
static bool IsGenericFontFamily(const nsString& aFamily)
|
||||
@ -225,199 +184,6 @@ bool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const
|
||||
return true;
|
||||
}
|
||||
|
||||
// mapping from bitflag to font feature tag/value pair
|
||||
//
|
||||
// these need to be kept in sync with the constants listed
|
||||
// in gfxFontConstants.h (e.g. NS_FONT_VARIANT_EAST_ASIAN_JIS78)
|
||||
|
||||
// NS_FONT_VARIANT_EAST_ASIAN_xxx values
|
||||
const gfxFontFeature eastAsianDefaults[] = {
|
||||
{ TRUETYPE_TAG('j','p','7','8'), 1 },
|
||||
{ TRUETYPE_TAG('j','p','8','3'), 1 },
|
||||
{ TRUETYPE_TAG('j','p','9','0'), 1 },
|
||||
{ TRUETYPE_TAG('j','p','0','4'), 1 },
|
||||
{ TRUETYPE_TAG('s','m','p','l'), 1 },
|
||||
{ TRUETYPE_TAG('t','r','a','d'), 1 },
|
||||
{ TRUETYPE_TAG('f','w','i','d'), 1 },
|
||||
{ TRUETYPE_TAG('p','w','i','d'), 1 },
|
||||
{ TRUETYPE_TAG('r','u','b','y'), 1 }
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(eastAsianDefaults) ==
|
||||
eFeatureEastAsian_numFeatures);
|
||||
|
||||
// NS_FONT_VARIANT_LIGATURES_xxx values
|
||||
const gfxFontFeature ligDefaults[] = {
|
||||
{ TRUETYPE_TAG('l','i','g','a'), 1 },
|
||||
{ TRUETYPE_TAG('l','i','g','a'), 0 },
|
||||
{ TRUETYPE_TAG('d','l','i','g'), 1 },
|
||||
{ TRUETYPE_TAG('d','l','i','g'), 0 },
|
||||
{ TRUETYPE_TAG('h','l','i','g'), 1 },
|
||||
{ TRUETYPE_TAG('h','l','i','g'), 0 },
|
||||
{ TRUETYPE_TAG('c','a','l','t'), 1 },
|
||||
{ TRUETYPE_TAG('c','a','l','t'), 0 }
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(ligDefaults) ==
|
||||
eFeatureLigatures_numFeatures);
|
||||
|
||||
// NS_FONT_VARIANT_NUMERIC_xxx values
|
||||
const gfxFontFeature numericDefaults[] = {
|
||||
{ TRUETYPE_TAG('l','n','u','m'), 1 },
|
||||
{ TRUETYPE_TAG('o','n','u','m'), 1 },
|
||||
{ TRUETYPE_TAG('p','n','u','m'), 1 },
|
||||
{ TRUETYPE_TAG('t','n','u','m'), 1 },
|
||||
{ TRUETYPE_TAG('f','r','a','c'), 1 },
|
||||
{ TRUETYPE_TAG('a','f','r','c'), 1 },
|
||||
{ TRUETYPE_TAG('z','e','r','o'), 1 },
|
||||
{ TRUETYPE_TAG('o','r','d','n'), 1 }
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(numericDefaults) ==
|
||||
eFeatureNumeric_numFeatures);
|
||||
|
||||
static void
|
||||
AddFontFeaturesBitmask(uint32_t aValue, uint32_t aMin, uint32_t aMax,
|
||||
const gfxFontFeature aFeatureDefaults[],
|
||||
nsTArray<gfxFontFeature>& aFeaturesOut)
|
||||
|
||||
{
|
||||
uint32_t i, m;
|
||||
|
||||
for (i = 0, m = aMin; m <= aMax; i++, m <<= 1) {
|
||||
if (m & aValue) {
|
||||
const gfxFontFeature& feature = aFeatureDefaults[i];
|
||||
aFeaturesOut.AppendElement(feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const
|
||||
{
|
||||
// add in font-variant features
|
||||
gfxFontFeature setting;
|
||||
|
||||
// -- kerning
|
||||
setting.mTag = TRUETYPE_TAG('k','e','r','n');
|
||||
switch (kerning) {
|
||||
case NS_FONT_KERNING_NONE:
|
||||
setting.mValue = 0;
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
case NS_FONT_KERNING_NORMAL:
|
||||
setting.mValue = 1;
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
default:
|
||||
// auto case implies use user agent default
|
||||
break;
|
||||
}
|
||||
|
||||
// -- alternates
|
||||
if (variantAlternates & NS_FONT_VARIANT_ALTERNATES_HISTORICAL) {
|
||||
setting.mValue = 1;
|
||||
setting.mTag = TRUETYPE_TAG('h','i','s','t');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
}
|
||||
|
||||
|
||||
// -- copy font-specific alternate info into style
|
||||
// (this will be resolved after font-matching occurs)
|
||||
aStyle->alternateValues.AppendElements(alternateValues);
|
||||
aStyle->featureValueLookup = featureValueLookup;
|
||||
|
||||
// -- caps
|
||||
setting.mValue = 1;
|
||||
switch (variantCaps) {
|
||||
case NS_FONT_VARIANT_CAPS_ALLSMALL:
|
||||
setting.mTag = TRUETYPE_TAG('c','2','s','c');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
// fall through to the small-caps case
|
||||
case NS_FONT_VARIANT_CAPS_SMALLCAPS:
|
||||
setting.mTag = TRUETYPE_TAG('s','m','c','p');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
case NS_FONT_VARIANT_CAPS_ALLPETITE:
|
||||
setting.mTag = TRUETYPE_TAG('c','2','p','c');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
// fall through to the petite-caps case
|
||||
case NS_FONT_VARIANT_CAPS_PETITECAPS:
|
||||
setting.mTag = TRUETYPE_TAG('p','c','a','p');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
case NS_FONT_VARIANT_CAPS_TITLING:
|
||||
setting.mTag = TRUETYPE_TAG('t','i','t','l');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
case NS_FONT_VARIANT_CAPS_UNICASE:
|
||||
setting.mTag = TRUETYPE_TAG('u','n','i','c');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// -- east-asian
|
||||
if (variantEastAsian) {
|
||||
AddFontFeaturesBitmask(variantEastAsian,
|
||||
NS_FONT_VARIANT_EAST_ASIAN_JIS78,
|
||||
NS_FONT_VARIANT_EAST_ASIAN_RUBY,
|
||||
eastAsianDefaults, aStyle->featureSettings);
|
||||
}
|
||||
|
||||
// -- ligatures
|
||||
if (variantLigatures) {
|
||||
AddFontFeaturesBitmask(variantLigatures,
|
||||
NS_FONT_VARIANT_LIGATURES_COMMON,
|
||||
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL,
|
||||
ligDefaults, aStyle->featureSettings);
|
||||
|
||||
// special case common ligs, which also enable/disable clig
|
||||
if (variantLigatures & NS_FONT_VARIANT_LIGATURES_COMMON) {
|
||||
setting.mTag = TRUETYPE_TAG('c','l','i','g');
|
||||
setting.mValue = 1;
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
} else if (variantLigatures & NS_FONT_VARIANT_LIGATURES_NO_COMMON) {
|
||||
setting.mTag = TRUETYPE_TAG('c','l','i','g');
|
||||
setting.mValue = 0;
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
}
|
||||
}
|
||||
|
||||
// -- numeric
|
||||
if (variantNumeric) {
|
||||
AddFontFeaturesBitmask(variantNumeric,
|
||||
NS_FONT_VARIANT_NUMERIC_LINING,
|
||||
NS_FONT_VARIANT_NUMERIC_ORDINAL,
|
||||
numericDefaults, aStyle->featureSettings);
|
||||
}
|
||||
|
||||
// -- position
|
||||
setting.mTag = 0;
|
||||
setting.mValue = 1;
|
||||
switch (variantPosition) {
|
||||
case NS_FONT_VARIANT_POSITION_SUPER:
|
||||
setting.mTag = TRUETYPE_TAG('s','u','p','s');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
case NS_FONT_VARIANT_POSITION_SUB:
|
||||
setting.mTag = TRUETYPE_TAG('s','u','b','s');
|
||||
aStyle->featureSettings.AppendElement(setting);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// add in features from font-feature-settings
|
||||
aStyle->featureSettings.AppendElements(fontFeatureSettings);
|
||||
}
|
||||
|
||||
static bool FontEnumCallback(const nsString& aFamily, bool aGeneric, void *aData)
|
||||
{
|
||||
*((nsString*)aData) = aFamily;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "gfxFontConstants.h"
|
||||
#include "gfxFontFeatures.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
// XXX we need a method to enumerate all of the possible fonts on the
|
||||
// system across family, weight, style, size, etc. But not here!
|
||||
@ -51,22 +50,6 @@ struct NS_GFX nsFont {
|
||||
// The variant of the font (normal, small-caps)
|
||||
uint8_t variant;
|
||||
|
||||
// Variant subproperties
|
||||
// (currently -moz- versions, will replace variant above eventually)
|
||||
uint8_t variantCaps;
|
||||
uint8_t variantLigatures;
|
||||
uint8_t variantNumeric;
|
||||
uint8_t variantPosition;
|
||||
|
||||
uint16_t variantEastAsian;
|
||||
|
||||
// Some font-variant-alternates property values require
|
||||
// font-specific settings defined via @font-feature-values rules.
|
||||
// These are resolved *after* font matching occurs.
|
||||
|
||||
// -- bitmask for both enumerated and functional propvals
|
||||
uint16_t variantAlternates;
|
||||
|
||||
// The decorations on the font (underline, overline,
|
||||
// line-through). The decorations can be binary or'd together.
|
||||
uint8_t decorations;
|
||||
@ -87,12 +70,6 @@ struct NS_GFX nsFont {
|
||||
// needs to be done.
|
||||
float sizeAdjust;
|
||||
|
||||
// -- list of value tags for font-specific alternate features
|
||||
nsTArray<gfxAlternateValue> alternateValues;
|
||||
|
||||
// -- object used to look these up once the font is matched
|
||||
nsRefPtr<gfxFontFeatureValueSet> featureValueLookup;
|
||||
|
||||
// Font features from CSS font-feature-settings
|
||||
nsTArray<gfxFontFeature> fontFeatureSettings;
|
||||
|
||||
@ -101,21 +78,17 @@ struct NS_GFX nsFont {
|
||||
// (see http://www.microsoft.com/typography/otspec/languagetags.htm).
|
||||
nsString languageOverride;
|
||||
|
||||
// Kerning
|
||||
uint8_t kerning;
|
||||
|
||||
// Synthesis setting, controls use of fake bolding/italics
|
||||
uint8_t synthesis;
|
||||
|
||||
// Initialize the font struct with an ASCII name
|
||||
nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize);
|
||||
nscoord aSize, float aSizeAdjust=0.0f,
|
||||
const nsString* aLanguageOverride = nullptr);
|
||||
|
||||
// Initialize the font struct with a (potentially) unicode name
|
||||
nsFont(const nsSubstring& aName, uint8_t aStyle, uint8_t aVariant,
|
||||
nsFont(const nsString& aName, uint8_t aStyle, uint8_t aVariant,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize);
|
||||
nscoord aSize, float aSizeAdjust=0.0f,
|
||||
const nsString* aLanguageOverride = nullptr);
|
||||
|
||||
// Make a copy of the given font
|
||||
nsFont(const nsFont& aFont);
|
||||
@ -133,8 +106,6 @@ struct NS_GFX nsFont {
|
||||
|
||||
nsFont& operator=(const nsFont& aOther);
|
||||
|
||||
void CopyAlternates(const nsFont& aOther);
|
||||
|
||||
// Add featureSettings into style
|
||||
void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const;
|
||||
|
||||
|
@ -80,6 +80,7 @@ SetupTests()
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING("en")),
|
||||
0.0,
|
||||
false, false, false,
|
||||
NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
gfxFontStyle style_western_bold_16 (FONT_STYLE_NORMAL,
|
||||
@ -89,6 +90,7 @@ SetupTests()
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING("en")),
|
||||
0.0,
|
||||
false, false, false,
|
||||
NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
/* Test 0 */
|
||||
|
@ -66,6 +66,7 @@ RunTest (TestEntry *test, gfxContext *ctx) {
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING("en")),
|
||||
0.0,
|
||||
false, false, false,
|
||||
NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
fontGroup = gfxPlatform::GetPlatform()->CreateFontGroup(NS_ConvertUTF8toUTF16(test->mFamilies), &style_western_normal_16, nullptr);
|
||||
|
@ -124,6 +124,7 @@ main (int argc, char **argv) {
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING("en")),
|
||||
0.0,
|
||||
false, false, false,
|
||||
NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
nsRefPtr<gfxFontGroup> fontGroup =
|
||||
|
@ -33,7 +33,6 @@ CPPSRCS = \
|
||||
gfxDrawable.cpp \
|
||||
gfxImageSurface.cpp \
|
||||
gfxFont.cpp \
|
||||
gfxFontFeatures.cpp \
|
||||
gfxFontMissingGlyphs.cpp \
|
||||
gfxFontTest.cpp \
|
||||
gfxFontUtils.cpp \
|
||||
|
@ -1372,111 +1372,17 @@ gfxFontCache::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
|
||||
SizeOfExcludingThis(aMallocSizeOf, aSizes);
|
||||
}
|
||||
|
||||
#define MAX_SSXX_VALUE 99
|
||||
#define MAX_CVXX_VALUE 99
|
||||
|
||||
static void
|
||||
LookupAlternateValues(gfxFontFeatureValueSet *featureLookup,
|
||||
const nsAString& aFamily,
|
||||
const nsTArray<gfxAlternateValue>& altValue,
|
||||
nsTArray<gfxFontFeature>& aFontFeatures)
|
||||
{
|
||||
uint32_t numAlternates = altValue.Length();
|
||||
for (uint32_t i = 0; i < numAlternates; i++) {
|
||||
const gfxAlternateValue& av = altValue.ElementAt(i);
|
||||
nsAutoTArray<uint32_t,4> values;
|
||||
|
||||
// map <family, name, feature> ==> <values>
|
||||
bool found =
|
||||
featureLookup->GetFontFeatureValuesFor(aFamily, av.alternate,
|
||||
av.value, values);
|
||||
uint32_t numValues = values.Length();
|
||||
|
||||
// nothing defined, skip
|
||||
if (!found || numValues == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gfxFontFeature feature;
|
||||
if (av.alternate == NS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT) {
|
||||
NS_ASSERTION(numValues <= 2,
|
||||
"too many values allowed for character-variant");
|
||||
// character-variant(12 3) ==> 'cv12' = 3
|
||||
uint32_t nn = values.ElementAt(0);
|
||||
// ignore values greater than 99
|
||||
if (nn == 0 || nn > MAX_CVXX_VALUE) {
|
||||
continue;
|
||||
}
|
||||
feature.mValue = 1;
|
||||
if (numValues > 1) {
|
||||
feature.mValue = values.ElementAt(1);
|
||||
}
|
||||
feature.mTag = HB_TAG('c','v',('0' + nn / 10), ('0' + nn % 10));
|
||||
aFontFeatures.AppendElement(feature);
|
||||
|
||||
} else if (av.alternate == NS_FONT_VARIANT_ALTERNATES_STYLESET) {
|
||||
// styleset(1 2 7) ==> 'ss01' = 1, 'ss02' = 1, 'ss07' = 1
|
||||
feature.mValue = 1;
|
||||
for (uint32_t v = 0; v < numValues; v++) {
|
||||
uint32_t nn = values.ElementAt(v);
|
||||
if (nn == 0 || nn > MAX_SSXX_VALUE) {
|
||||
continue;
|
||||
}
|
||||
feature.mTag = HB_TAG('s','s',('0' + nn / 10), ('0' + nn % 10));
|
||||
aFontFeatures.AppendElement(feature);
|
||||
}
|
||||
|
||||
} else {
|
||||
NS_ASSERTION(numValues == 1,
|
||||
"too many values for font-specific font-variant-alternates");
|
||||
feature.mValue = values.ElementAt(0);
|
||||
|
||||
switch (av.alternate) {
|
||||
case NS_FONT_VARIANT_ALTERNATES_STYLISTIC: // salt
|
||||
feature.mTag = HB_TAG('s','a','l','t');
|
||||
break;
|
||||
case NS_FONT_VARIANT_ALTERNATES_SWASH: // swsh, cswh
|
||||
feature.mTag = HB_TAG('s','w','s','h');
|
||||
aFontFeatures.AppendElement(feature);
|
||||
feature.mTag = HB_TAG('c','s','w','h');
|
||||
break;
|
||||
case NS_FONT_VARIANT_ALTERNATES_ORNAMENTS: // ornm
|
||||
feature.mTag = HB_TAG('o','r','n','m');
|
||||
break;
|
||||
case NS_FONT_VARIANT_ALTERNATES_ANNOTATION: // nalt
|
||||
feature.mTag = HB_TAG('n','a','l','t');
|
||||
break;
|
||||
default:
|
||||
feature.mTag = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
NS_ASSERTION(feature.mTag, "unsupported alternate type");
|
||||
if (!feature.mTag) {
|
||||
continue;
|
||||
}
|
||||
aFontFeatures.AppendElement(feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
gfxFontShaper::MergeFontFeatures(
|
||||
const gfxFontStyle *aStyle,
|
||||
const nsTArray<gfxFontFeature>& aStyleRuleFeatures,
|
||||
const nsTArray<gfxFontFeature>& aFontFeatures,
|
||||
bool aDisableLigatures,
|
||||
const nsAString& aFamilyName,
|
||||
nsDataHashtable<nsUint32HashKey,uint32_t>& aMergedFeatures)
|
||||
{
|
||||
uint32_t numAlts = aStyle->alternateValues.Length();
|
||||
const nsTArray<gfxFontFeature>& styleRuleFeatures =
|
||||
aStyle->featureSettings;
|
||||
|
||||
// bail immediately if nothing to do
|
||||
if (styleRuleFeatures.IsEmpty() &&
|
||||
if (aStyleRuleFeatures.IsEmpty() &&
|
||||
aFontFeatures.IsEmpty() &&
|
||||
!aDisableLigatures &&
|
||||
numAlts == 0) {
|
||||
!aDisableLigatures) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1498,25 +1404,10 @@ gfxFontShaper::MergeFontFeatures(
|
||||
aMergedFeatures.Put(feature.mTag, feature.mValue);
|
||||
}
|
||||
|
||||
// add font-specific feature values from style rules
|
||||
if (aStyle->featureValueLookup && numAlts > 0) {
|
||||
nsAutoTArray<gfxFontFeature,4> featureList;
|
||||
|
||||
// insert list of alternate feature settings
|
||||
LookupAlternateValues(aStyle->featureValueLookup, aFamilyName,
|
||||
aStyle->alternateValues, featureList);
|
||||
|
||||
count = featureList.Length();
|
||||
for (i = 0; i < count; i++) {
|
||||
const gfxFontFeature& feature = featureList.ElementAt(i);
|
||||
aMergedFeatures.Put(feature.mTag, feature.mValue);
|
||||
}
|
||||
}
|
||||
|
||||
// add feature values from style rules
|
||||
count = styleRuleFeatures.Length();
|
||||
count = aStyleRuleFeatures.Length();
|
||||
for (i = 0; i < count; i++) {
|
||||
const gfxFontFeature& feature = styleRuleFeatures.ElementAt(i);
|
||||
const gfxFontFeature& feature = aStyleRuleFeatures.ElementAt(i);
|
||||
aMergedFeatures.Put(feature.mTag, feature.mValue);
|
||||
}
|
||||
|
||||
@ -4905,7 +4796,6 @@ gfxFontStyle::gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
|
||||
|
||||
gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
|
||||
language(aStyle.language),
|
||||
featureValueLookup(aStyle.featureValueLookup),
|
||||
size(aStyle.size), sizeAdjust(aStyle.sizeAdjust),
|
||||
languageOverride(aStyle.languageOverride),
|
||||
weight(aStyle.weight), stretch(aStyle.stretch),
|
||||
@ -4913,7 +4803,6 @@ gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
|
||||
style(aStyle.style)
|
||||
{
|
||||
featureSettings.AppendElements(aStyle.featureSettings);
|
||||
alternateValues.AppendElements(aStyle.alternateValues);
|
||||
}
|
||||
|
||||
int8_t
|
||||
|
@ -73,23 +73,9 @@ struct THEBES_API gfxFontStyle {
|
||||
// or inferred from the charset
|
||||
nsRefPtr<nsIAtom> language;
|
||||
|
||||
// Features are composed of (1) features from style rules (2) features
|
||||
// from feature setttings rules and (3) family-specific features. (1) and
|
||||
// (3) are guaranteed to be mutually exclusive
|
||||
|
||||
// custom opentype feature settings
|
||||
nsTArray<gfxFontFeature> featureSettings;
|
||||
|
||||
// Some font-variant property values require font-specific settings
|
||||
// defined via @font-feature-values rules. These are resolved after
|
||||
// font matching occurs.
|
||||
|
||||
// -- list of value tags for specific alternate features
|
||||
nsTArray<gfxAlternateValue> alternateValues;
|
||||
|
||||
// -- object used to look these up once the font is matched
|
||||
nsRefPtr<gfxFontFeatureValueSet> featureValueLookup;
|
||||
|
||||
// The logical size of the font, in pixels
|
||||
gfxFloat size;
|
||||
|
||||
@ -158,9 +144,7 @@ struct THEBES_API gfxFontStyle {
|
||||
(*reinterpret_cast<const uint32_t*>(&sizeAdjust) ==
|
||||
*reinterpret_cast<const uint32_t*>(&other.sizeAdjust)) &&
|
||||
(featureSettings == other.featureSettings) &&
|
||||
(languageOverride == other.languageOverride) &&
|
||||
(alternateValues == other.alternateValues) &&
|
||||
(featureValueLookup == other.featureValueLookup);
|
||||
(languageOverride == other.languageOverride);
|
||||
}
|
||||
|
||||
static void ParseFontFeatureSettings(const nsString& aFeatureString,
|
||||
@ -1163,10 +1147,9 @@ public:
|
||||
|
||||
// returns true if features exist in output, false otherwise
|
||||
static bool
|
||||
MergeFontFeatures(const gfxFontStyle *aStyle,
|
||||
MergeFontFeatures(const nsTArray<gfxFontFeature>& aStyleRuleFeatures,
|
||||
const nsTArray<gfxFontFeature>& aFontFeatures,
|
||||
bool aDisableLigatures,
|
||||
const nsAString& aFamilyName,
|
||||
nsDataHashtable<nsUint32HashKey,uint32_t>& aMergedFeatures);
|
||||
|
||||
protected:
|
||||
@ -1597,10 +1580,6 @@ public:
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
|
||||
{ return gfxPlatform::GetPlatform()->GetScaledFontForFont(aTarget, this); }
|
||||
|
||||
bool KerningDisabled() {
|
||||
return mKerningSet && !mKerningEnabled;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
bool HasSubstitutionRulesWithSpaceLookups(int32_t aRunScript) {
|
||||
|
@ -30,165 +30,4 @@
|
||||
#define NS_FONT_STRETCH_EXTRA_EXPANDED 3
|
||||
#define NS_FONT_STRETCH_ULTRA_EXPANDED 4
|
||||
|
||||
#define NS_FONT_KERNING_AUTO 0
|
||||
#define NS_FONT_KERNING_NONE 1
|
||||
#define NS_FONT_KERNING_NORMAL 2
|
||||
|
||||
#define NS_FONT_SYNTHESIS_WEIGHT 0x1
|
||||
#define NS_FONT_SYNTHESIS_STYLE 0x2
|
||||
|
||||
enum {
|
||||
eFeatureAlternates_historical,
|
||||
eFeatureAlternates_stylistic,
|
||||
eFeatureAlternates_styleset,
|
||||
eFeatureAlternates_character_variant,
|
||||
eFeatureAlternates_swash,
|
||||
eFeatureAlternates_ornaments,
|
||||
eFeatureAlternates_annotation,
|
||||
|
||||
eFeatureAlternates_numFeatures
|
||||
};
|
||||
|
||||
// alternates - simple enumerated values
|
||||
#define NS_FONT_VARIANT_ALTERNATES_HISTORICAL (1 << eFeatureAlternates_historical)
|
||||
|
||||
// alternates - values that use functional syntax
|
||||
#define NS_FONT_VARIANT_ALTERNATES_STYLISTIC (1 << eFeatureAlternates_stylistic)
|
||||
#define NS_FONT_VARIANT_ALTERNATES_STYLESET (1 << eFeatureAlternates_styleset)
|
||||
#define NS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT (1 << eFeatureAlternates_character_variant)
|
||||
#define NS_FONT_VARIANT_ALTERNATES_SWASH (1 << eFeatureAlternates_swash)
|
||||
#define NS_FONT_VARIANT_ALTERNATES_ORNAMENTS (1 << eFeatureAlternates_ornaments)
|
||||
#define NS_FONT_VARIANT_ALTERNATES_ANNOTATION (1 << eFeatureAlternates_annotation)
|
||||
|
||||
#define NS_FONT_VARIANT_ALTERNATES_ENUMERATED_MASK \
|
||||
NS_FONT_VARIANT_ALTERNATES_HISTORICAL
|
||||
|
||||
#define NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK ( \
|
||||
NS_FONT_VARIANT_ALTERNATES_STYLISTIC | \
|
||||
NS_FONT_VARIANT_ALTERNATES_STYLESET | \
|
||||
NS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT | \
|
||||
NS_FONT_VARIANT_ALTERNATES_SWASH | \
|
||||
NS_FONT_VARIANT_ALTERNATES_ORNAMENTS | \
|
||||
NS_FONT_VARIANT_ALTERNATES_ANNOTATION )
|
||||
|
||||
#define NS_FONT_VARIANT_CAPS_NORMAL 0
|
||||
#define NS_FONT_VARIANT_CAPS_SMALLCAPS 1
|
||||
#define NS_FONT_VARIANT_CAPS_ALLSMALL 2
|
||||
#define NS_FONT_VARIANT_CAPS_PETITECAPS 3
|
||||
#define NS_FONT_VARIANT_CAPS_ALLPETITE 4
|
||||
#define NS_FONT_VARIANT_CAPS_TITLING 5
|
||||
#define NS_FONT_VARIANT_CAPS_UNICASE 6
|
||||
|
||||
enum {
|
||||
eFeatureEastAsian_jis78,
|
||||
eFeatureEastAsian_jis83,
|
||||
eFeatureEastAsian_jis90,
|
||||
eFeatureEastAsian_jis04,
|
||||
eFeatureEastAsian_simplified,
|
||||
eFeatureEastAsian_traditional,
|
||||
eFeatureEastAsian_full_width,
|
||||
eFeatureEastAsian_prop_width,
|
||||
eFeatureEastAsian_ruby,
|
||||
|
||||
eFeatureEastAsian_numFeatures
|
||||
};
|
||||
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_JIS78 (1 << eFeatureEastAsian_jis78)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_JIS83 (1 << eFeatureEastAsian_jis83)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_JIS90 (1 << eFeatureEastAsian_jis90)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_JIS04 (1 << eFeatureEastAsian_jis04)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED (1 << eFeatureEastAsian_simplified)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL (1 << eFeatureEastAsian_traditional)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH (1 << eFeatureEastAsian_full_width)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_PROP_WIDTH (1 << eFeatureEastAsian_prop_width)
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_RUBY (1 << eFeatureEastAsian_ruby)
|
||||
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_VARIANT_MASK ( \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_JIS78 | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_JIS83 | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_JIS90 | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_JIS04 | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL )
|
||||
|
||||
#define NS_FONT_VARIANT_EAST_ASIAN_WIDTH_MASK ( \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH | \
|
||||
NS_FONT_VARIANT_EAST_ASIAN_PROP_WIDTH )
|
||||
|
||||
enum {
|
||||
eFeatureLigatures_common,
|
||||
eFeatureLigatures_no_common,
|
||||
eFeatureLigatures_discretionary,
|
||||
eFeatureLigatures_no_discretionary,
|
||||
eFeatureLigatures_historical,
|
||||
eFeatureLigatures_no_historical,
|
||||
eFeatureLigatures_contextual,
|
||||
eFeatureLigatures_no_contextual,
|
||||
|
||||
eFeatureLigatures_numFeatures
|
||||
};
|
||||
|
||||
#define NS_FONT_VARIANT_LIGATURES_COMMON (1 << eFeatureLigatures_common)
|
||||
#define NS_FONT_VARIANT_LIGATURES_NO_COMMON (1 << eFeatureLigatures_no_common)
|
||||
#define NS_FONT_VARIANT_LIGATURES_DISCRETIONARY (1 << eFeatureLigatures_discretionary)
|
||||
#define NS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY (1 << eFeatureLigatures_no_discretionary)
|
||||
#define NS_FONT_VARIANT_LIGATURES_HISTORICAL (1 << eFeatureLigatures_historical)
|
||||
#define NS_FONT_VARIANT_LIGATURES_NO_HISTORICAL (1 << eFeatureLigatures_no_historical)
|
||||
#define NS_FONT_VARIANT_LIGATURES_CONTEXTUAL (1 << eFeatureLigatures_contextual)
|
||||
#define NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL (1 << eFeatureLigatures_no_contextual)
|
||||
|
||||
#define NS_FONT_VARIANT_LIGATURES_COMMON_MASK ( \
|
||||
NS_FONT_VARIANT_LIGATURES_COMMON | \
|
||||
NS_FONT_VARIANT_LIGATURES_NO_COMMON )
|
||||
|
||||
#define NS_FONT_VARIANT_LIGATURES_DISCRETIONARY_MASK ( \
|
||||
NS_FONT_VARIANT_LIGATURES_DISCRETIONARY | \
|
||||
NS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY )
|
||||
|
||||
#define NS_FONT_VARIANT_LIGATURES_HISTORICAL_MASK ( \
|
||||
NS_FONT_VARIANT_LIGATURES_HISTORICAL | \
|
||||
NS_FONT_VARIANT_LIGATURES_NO_HISTORICAL )
|
||||
|
||||
#define NS_FONT_VARIANT_LIGATURES_CONTEXTUAL_MASK \
|
||||
NS_FONT_VARIANT_LIGATURES_CONTEXTUAL | \
|
||||
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL
|
||||
|
||||
enum {
|
||||
eFeatureNumeric_lining,
|
||||
eFeatureNumeric_oldstyle,
|
||||
eFeatureNumeric_proportional,
|
||||
eFeatureNumeric_tabular,
|
||||
eFeatureNumeric_diagonal_fractions,
|
||||
eFeatureNumeric_stacked_fractions,
|
||||
eFeatureNumeric_slashedzero,
|
||||
eFeatureNumeric_ordinal,
|
||||
|
||||
eFeatureNumeric_numFeatures
|
||||
};
|
||||
|
||||
#define NS_FONT_VARIANT_NUMERIC_LINING (1 << eFeatureNumeric_lining)
|
||||
#define NS_FONT_VARIANT_NUMERIC_OLDSTYLE (1 << eFeatureNumeric_oldstyle)
|
||||
#define NS_FONT_VARIANT_NUMERIC_PROPORTIONAL (1 << eFeatureNumeric_proportional)
|
||||
#define NS_FONT_VARIANT_NUMERIC_TABULAR (1 << eFeatureNumeric_tabular)
|
||||
#define NS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS (1 << eFeatureNumeric_diagonal_fractions)
|
||||
#define NS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS (1 << eFeatureNumeric_stacked_fractions)
|
||||
#define NS_FONT_VARIANT_NUMERIC_SLASHZERO (1 << eFeatureNumeric_slashedzero)
|
||||
#define NS_FONT_VARIANT_NUMERIC_ORDINAL (1 << eFeatureNumeric_ordinal)
|
||||
|
||||
#define NS_FONT_VARIANT_NUMERIC_FIGURE_MASK \
|
||||
NS_FONT_VARIANT_NUMERIC_LINING | \
|
||||
NS_FONT_VARIANT_NUMERIC_OLDSTYLE
|
||||
|
||||
#define NS_FONT_VARIANT_NUMERIC_SPACING_MASK \
|
||||
NS_FONT_VARIANT_NUMERIC_PROPORTIONAL | \
|
||||
NS_FONT_VARIANT_NUMERIC_TABULAR
|
||||
|
||||
#define NS_FONT_VARIANT_NUMERIC_FRACTION_MASK \
|
||||
NS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS | \
|
||||
NS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS
|
||||
|
||||
#define NS_FONT_VARIANT_POSITION_NORMAL 0
|
||||
#define NS_FONT_VARIANT_POSITION_SUPER 1
|
||||
#define NS_FONT_VARIANT_POSITION_SUB 2
|
||||
|
||||
#endif
|
||||
|
@ -1,81 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "gfxFontFeatures.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
gfxFontFeatureValueSet::gfxFontFeatureValueSet()
|
||||
{
|
||||
mFontFeatureValues.Init(10);
|
||||
}
|
||||
|
||||
bool
|
||||
gfxFontFeatureValueSet::GetFontFeatureValuesFor(const nsAString& aFamily,
|
||||
uint32_t aVariantProperty,
|
||||
const nsAString& aName,
|
||||
nsTArray<uint32_t>& aValues)
|
||||
{
|
||||
nsAutoString family(aFamily), name(aName);
|
||||
ToLowerCase(family);
|
||||
ToLowerCase(name);
|
||||
FeatureValueHashKey key(family, aVariantProperty, name);
|
||||
|
||||
aValues.Clear();
|
||||
FeatureValueHashEntry *entry = mFontFeatureValues.GetEntry(key);
|
||||
if (entry) {
|
||||
NS_ASSERTION(entry->mValues.Length() > 0,
|
||||
"null array of font feature values");
|
||||
aValues.AppendElements(entry->mValues);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gfxFontFeatureValueSet::AddFontFeatureValues(const nsAString& aFamily,
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aValues)
|
||||
{
|
||||
nsAutoString family(aFamily);
|
||||
ToLowerCase(family);
|
||||
|
||||
uint32_t i, numFeatureValues = aValues.Length();
|
||||
for (i = 0; i < numFeatureValues; i++) {
|
||||
const FeatureValues& fv = aValues.ElementAt(i);
|
||||
uint32_t alternate = fv.alternate;
|
||||
uint32_t j, numValues = fv.valuelist.Length();
|
||||
for (j = 0; j < numValues; j++) {
|
||||
const ValueList& v = fv.valuelist.ElementAt(j);
|
||||
nsAutoString name(v.name);
|
||||
ToLowerCase(name);
|
||||
FeatureValueHashKey key(family, alternate, name);
|
||||
FeatureValueHashEntry *entry = mFontFeatureValues.PutEntry(key);
|
||||
entry->mKey = key;
|
||||
entry->mValues = v.featureSelectors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
gfxFontFeatureValueSet::FeatureValueHashEntry::KeyEquals(
|
||||
const KeyTypePointer aKey) const
|
||||
{
|
||||
return aKey->mPropVal == mKey.mPropVal &&
|
||||
aKey->mFamily.Equals(mKey.mFamily) &&
|
||||
aKey->mName.Equals(mKey.mName);
|
||||
}
|
||||
|
||||
PLDHashNumber
|
||||
gfxFontFeatureValueSet::FeatureValueHashEntry::HashKey(
|
||||
const KeyTypePointer aKey)
|
||||
{
|
||||
return HashString(aKey->mFamily) + HashString(aKey->mName) +
|
||||
aKey->mPropVal * uint32_t(0xdeadbeef);
|
||||
}
|
||||
|
@ -7,11 +7,6 @@
|
||||
#ifndef GFX_FONT_FEATURES_H
|
||||
#define GFX_FONT_FEATURES_H
|
||||
|
||||
#include "gfxTypes.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// An OpenType feature tag and value pair
|
||||
struct gfxFontFeature {
|
||||
uint32_t mTag; // see http://www.microsoft.com/typography/otspec/featuretags.htm
|
||||
@ -31,95 +26,4 @@ operator==(const gfxFontFeature& a, const gfxFontFeature& b)
|
||||
return (a.mTag == b.mTag) && (a.mValue == b.mValue);
|
||||
}
|
||||
|
||||
struct gfxAlternateValue {
|
||||
uint32_t alternate; // constants in gfxFontConstants.h
|
||||
nsString value; // string value to be looked up
|
||||
};
|
||||
|
||||
inline bool
|
||||
operator<(const gfxAlternateValue& a, const gfxAlternateValue& b)
|
||||
{
|
||||
return (a.alternate < b.alternate) ||
|
||||
((a.alternate == b.alternate) && (a.value < b.value));
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator==(const gfxAlternateValue& a, const gfxAlternateValue& b)
|
||||
{
|
||||
return (a.alternate == b.alternate) && (a.value == b.value);
|
||||
}
|
||||
|
||||
class THEBES_API gfxFontFeatureValueSet {
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(gfxFontFeatureValueSet)
|
||||
|
||||
gfxFontFeatureValueSet();
|
||||
virtual ~gfxFontFeatureValueSet() {}
|
||||
|
||||
struct ValueList {
|
||||
ValueList(const nsAString& aName, const nsTArray<uint32_t>& aSelectors)
|
||||
: name(aName), featureSelectors(aSelectors)
|
||||
{}
|
||||
nsString name;
|
||||
nsTArray<uint32_t> featureSelectors;
|
||||
};
|
||||
|
||||
struct FeatureValues {
|
||||
uint32_t alternate;
|
||||
nsTArray<ValueList> valuelist;
|
||||
};
|
||||
|
||||
// returns true if found, false otherwise
|
||||
bool
|
||||
GetFontFeatureValuesFor(const nsAString& aFamily,
|
||||
uint32_t aVariantProperty,
|
||||
const nsAString& aName,
|
||||
nsTArray<uint32_t>& aValues);
|
||||
void
|
||||
AddFontFeatureValues(const nsAString& aFamily,
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aValues);
|
||||
|
||||
protected:
|
||||
struct FeatureValueHashKey {
|
||||
nsString mFamily;
|
||||
uint32_t mPropVal;
|
||||
nsString mName;
|
||||
|
||||
FeatureValueHashKey()
|
||||
: mPropVal(0)
|
||||
{ }
|
||||
FeatureValueHashKey(const nsAString& aFamily,
|
||||
uint32_t aPropVal,
|
||||
const nsAString& aName)
|
||||
: mFamily(aFamily), mPropVal(aPropVal), mName(aName)
|
||||
{ }
|
||||
FeatureValueHashKey(const FeatureValueHashKey& aKey)
|
||||
: mFamily(aKey.mFamily), mPropVal(aKey.mPropVal), mName(aKey.mName)
|
||||
{ }
|
||||
};
|
||||
|
||||
class FeatureValueHashEntry : public PLDHashEntryHdr {
|
||||
public:
|
||||
typedef const FeatureValueHashKey &KeyType;
|
||||
typedef const FeatureValueHashKey *KeyTypePointer;
|
||||
|
||||
FeatureValueHashEntry(KeyTypePointer aKey) { }
|
||||
FeatureValueHashEntry(const FeatureValueHashEntry& toCopy)
|
||||
{
|
||||
NS_ERROR("Should not be called");
|
||||
}
|
||||
~FeatureValueHashEntry() { }
|
||||
|
||||
bool KeyEquals(const KeyTypePointer aKey) const;
|
||||
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
|
||||
static PLDHashNumber HashKey(const KeyTypePointer aKey);
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
FeatureValueHashKey mKey;
|
||||
nsTArray<uint32_t> mValues;
|
||||
};
|
||||
|
||||
nsTHashtable<FeatureValueHashEntry> mFontFeatureValues;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -192,13 +192,8 @@ gfxGraphiteShaper::ShapeText(gfxContext *aContext,
|
||||
|
||||
nsDataHashtable<nsUint32HashKey,uint32_t> mergedFeatures;
|
||||
|
||||
// if style contains font-specific features
|
||||
if (MergeFontFeatures(style,
|
||||
mFont->GetFontEntry()->mFeatureSettings,
|
||||
aShapedText->DisableLigatures(),
|
||||
mFont->GetFontEntry()->FamilyName(),
|
||||
mergedFeatures))
|
||||
{
|
||||
if (MergeFontFeatures(style->featureSettings, entry->mFeatureSettings,
|
||||
aShapedText->DisableLigatures(), mergedFeatures)) {
|
||||
// enumerate result and insert into Graphite feature list
|
||||
GrFontFeatures f = {mGrFace, grFeatures};
|
||||
mergedFeatures.Enumerate(AddFeature, &f);
|
||||
|
@ -99,14 +99,12 @@ HBGetTable(hb_face_t *face, hb_tag_t aTag, void *aUserData)
|
||||
*/
|
||||
|
||||
struct FontCallbackData {
|
||||
FontCallbackData(gfxHarfBuzzShaper *aShaper, gfxContext *aContext,
|
||||
bool aKerning)
|
||||
: mShaper(aShaper), mContext(aContext), mKerning(aKerning)
|
||||
FontCallbackData(gfxHarfBuzzShaper *aShaper, gfxContext *aContext)
|
||||
: mShaper(aShaper), mContext(aContext)
|
||||
{ }
|
||||
|
||||
gfxHarfBuzzShaper *mShaper;
|
||||
gfxContext *mContext;
|
||||
bool mKerning;
|
||||
};
|
||||
|
||||
#define UNICODE_BMP_LIMIT 0x10000
|
||||
@ -646,13 +644,7 @@ HBGetHKerning(hb_font_t *font, void *font_data,
|
||||
{
|
||||
const FontCallbackData *fcd =
|
||||
static_cast<const FontCallbackData*>(font_data);
|
||||
|
||||
// return 0 if kerning is explicitly disabled
|
||||
if (fcd->mKerning) {
|
||||
return fcd->mShaper->GetHKerning(first_glyph, second_glyph);
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
return fcd->mShaper->GetHKerning(first_glyph, second_glyph);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -964,9 +956,7 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext,
|
||||
return false;
|
||||
}
|
||||
|
||||
const gfxFontStyle *style = mFont->GetStyle();
|
||||
// kerning is enabled *except* when explicitly disabled (font-kerning: none)
|
||||
FontCallbackData fcd(this, aContext, !mFont->KerningDisabled());
|
||||
FontCallbackData fcd(this, aContext);
|
||||
hb_font_t *font = hb_font_create(mHBFace);
|
||||
hb_font_set_funcs(font, sHBFontFuncs, &fcd, nullptr);
|
||||
hb_font_set_ppem(font, mFont->GetAdjustedSize(), mFont->GetAdjustedSize());
|
||||
@ -976,15 +966,13 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext,
|
||||
nsAutoTArray<hb_feature_t,20> features;
|
||||
|
||||
gfxFontEntry *entry = mFont->GetFontEntry();
|
||||
const gfxFontStyle *style = mFont->GetStyle();
|
||||
|
||||
nsDataHashtable<nsUint32HashKey,uint32_t> mergedFeatures;
|
||||
|
||||
if (MergeFontFeatures(style,
|
||||
mFont->GetFontEntry()->mFeatureSettings,
|
||||
aShapedText->DisableLigatures(),
|
||||
mFont->GetFontEntry()->FamilyName(),
|
||||
mergedFeatures))
|
||||
{
|
||||
if (MergeFontFeatures(style->featureSettings,
|
||||
mFont->GetFontEntry()->mFeatureSettings,
|
||||
aShapedText->DisableLigatures(), mergedFeatures)) {
|
||||
// enumerate result and insert into hb_feature array
|
||||
mergedFeatures.Enumerate(AddFeature, &features);
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 800%;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
div { margin: 0 20px; }
|
||||
span {
|
||||
-moz-font-feature-settings: "ss05"; /* crossed W */
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div><span id="test1">W</span> <span id="test2">W</span> <span id="test3">W</span></div>
|
||||
<div><span id="test4">W</span> <span id="test5">W</span> <span id="test6">W</span></div>
|
||||
<div><span id="test7">W</span> <span id="test8">W</span> <span id="test9">W</span></div>
|
||||
</body>
|
||||
</html>
|
@ -1,116 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: fontA;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
-moz-font-feature-settings: "ss05" on;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: fontB;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
-moz-font-feature-settings: "ss05" off;
|
||||
}
|
||||
|
||||
@font-feature-values libertine {
|
||||
@styleset {
|
||||
crossed-doubleu: 5;
|
||||
somethingElse: 4;
|
||||
}
|
||||
}
|
||||
|
||||
@font-feature-values fontA {
|
||||
@styleset { aLtW: 5; }
|
||||
}
|
||||
|
||||
@font-feature-values fontB {
|
||||
@styleset { crossedW: 5; several: 1 3 5; }
|
||||
@styleset { altW: 4; }
|
||||
}
|
||||
|
||||
@font-feature-values fontB {
|
||||
@styleset {
|
||||
AlTw: 5;
|
||||
defined-for-fontB: 5;
|
||||
scriptJ: 3;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 800%;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
/* -moz-font-feature-settings: "ss05"; crossed W */
|
||||
|
||||
div { margin: 0 20px; }
|
||||
|
||||
#test1 {
|
||||
font-variant-alternates: styleset(crossed-doubleu);
|
||||
}
|
||||
|
||||
#test2 {
|
||||
/* testing case-insensitivity of styleset name */
|
||||
font-family: fontB;
|
||||
font-variant-alternates: styleset(altW);
|
||||
}
|
||||
|
||||
#test3 {
|
||||
/* testing case-insensitivity of styleset name */
|
||||
font-family: fontB;
|
||||
font-variant-alternates: styleset(ALTW);
|
||||
}
|
||||
|
||||
#test4 {
|
||||
/* testing escapes in styleset name */
|
||||
font-family: fontB;
|
||||
font-variant-alternates: styleset(\41 ltW);
|
||||
}
|
||||
|
||||
#test5 {
|
||||
/* testing font-specificity of feature value rule */
|
||||
font-family: fontA;
|
||||
font-variant-alternates: styleset(defined-for-fontB);
|
||||
}
|
||||
|
||||
#test6 {
|
||||
/* testing one feature doesn't affect another */
|
||||
font-variant-alternates: styleset(somethingElse);
|
||||
-moz-font-feature-settings: "ss05" on;
|
||||
}
|
||||
|
||||
#test7 {
|
||||
/* testing font-specificity of feature value rule */
|
||||
font-family: fontA;
|
||||
font-variant-alternates: styleset(scriptJ);
|
||||
-moz-font-feature-settings: "ss06";
|
||||
}
|
||||
|
||||
#test8 {
|
||||
/* testing that an undefined value doesn't affect the results */
|
||||
font-family: fontB;
|
||||
font-variant-alternates: styleset(scriptJ, somethingUndefined, defined-for-fontB);
|
||||
}
|
||||
|
||||
#test9 {
|
||||
/* testing matching of font name with escape */
|
||||
font-family: font\62 ;
|
||||
font-variant-alternates: styleset(defined-for-fontB);
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div><span id="test1">W</span> <span id="test2">W</span> <span id="test3">W</span></div>
|
||||
<div><span id="test4">W</span> <span id="test5">W</span> <span id="test6">W</span></div>
|
||||
<div><span id="test7">W</span> <span id="test8">W</span> <span id="test9">W</span></div>
|
||||
</body>
|
||||
</html>
|
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Annotations test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
margin: 20px;
|
||||
font-size: 800%;
|
||||
font-family: Hiragino Maru Gothic ProN, Meiryo;
|
||||
}
|
||||
|
||||
/* for platforms without these fonts the default glyphs will show */
|
||||
|
||||
@font-face {
|
||||
font-family: testMeiryo-circled;
|
||||
src: local(Meiryo);
|
||||
-moz-font-feature-settings: "nalt" 4;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: testMeiryo-black-circled;
|
||||
src: local(Meiryo);
|
||||
-moz-font-feature-settings: "nalt" 5;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: testMeiryo-rounded-box;
|
||||
src: local(Meiryo);
|
||||
-moz-font-feature-settings: "nalt" 9;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: testHiraginoMaru-circled;
|
||||
src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
|
||||
-moz-font-feature-settings: "nalt" 1;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: testHiraginoMaru-black-circled;
|
||||
src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
|
||||
-moz-font-feature-settings: "nalt" 4;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: testHiraginoMaru-rounded-box;
|
||||
src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
|
||||
-moz-font-feature-settings: "nalt" 10;
|
||||
}
|
||||
|
||||
#test1 {
|
||||
font-family: testHiraginoMaru-circled, testMeiryo-circled;
|
||||
}
|
||||
|
||||
#test2 {
|
||||
font-family: testHiraginoMaru-black-circled, testMeiryo-black-circled;
|
||||
}
|
||||
|
||||
#test3 {
|
||||
font-family: testHiraginoMaru-rounded-box, testMeiryo-rounded-box;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="test1">1</span> <span id="test2">2</span> <span id="test3">3</span></div>
|
||||
</body>
|
||||
</html>
|
@ -1,51 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Annotations test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
margin: 20px;
|
||||
font-size: 800%;
|
||||
font-family: Hiragino Maru Gothic ProN, Meiryo;
|
||||
}
|
||||
|
||||
/* for platforms without these fonts the default glyphs will show */
|
||||
|
||||
@font-feature-values Hiragino Maru Gothic ProN {
|
||||
@annotation { circled: 1; }
|
||||
@annotation { black-circled: 4; }
|
||||
@annotation { black-box: 8; }
|
||||
@annotation { black-rounded-box: 10; }
|
||||
}
|
||||
|
||||
@font-feature-values Meiryo {
|
||||
@annotation {
|
||||
circled: 4;
|
||||
black-circled: 5;
|
||||
black-box: 7;
|
||||
black-rounded-box: 9;
|
||||
}
|
||||
}
|
||||
|
||||
#test1 {
|
||||
font-variant-alternates: annotation(circled);
|
||||
}
|
||||
|
||||
#test2 {
|
||||
font-variant-alternates: annotation(black-circled);
|
||||
}
|
||||
|
||||
#test3 {
|
||||
font-variant-alternates: annotation(black-rounded-box);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div><span id="test1">1</span> <span id="test2">2</span> <span id="test3">3</span></div>
|
||||
</body>
|
||||
</html>
|
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
-moz-font-feature-settings: "liga" on, "hlig" on;
|
||||
}
|
||||
body {
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 400%;
|
||||
line-height: 2em;
|
||||
/* font feature settings property should override font setting */
|
||||
-moz-font-feature-settings: "liga" off, "hlig" off;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
fastest firefox
|
||||
</body>
|
||||
</html>
|
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
font-feature-settings: "liga" on, "hlig" on;
|
||||
}
|
||||
body {
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 400%;
|
||||
line-height: 2em;
|
||||
/* font variant property should override font setting */
|
||||
font-variant-ligatures: no-common-ligatures no-historical-ligatures;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
fastest firefox
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
font-feature-settings: "liga" on, "hlig" on;
|
||||
}
|
||||
body {
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 400%;
|
||||
line-height: 2em;
|
||||
/* font variant property should override font setting but font feature
|
||||
settings property should override that */
|
||||
font-variant-ligatures: no-common-ligatures no-historical-ligatures;
|
||||
font-feature-settings: "liga" on, "hlig" on;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
fastest firefox
|
||||
</body>
|
||||
</html>
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
/* font-feature-settings should take precedence over font-kerning,
|
||||
so kerning should be DISabled here */
|
||||
font-feature-settings: "kern" off;
|
||||
font-kerning: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
/* font-feature-settings should take precedence over font-kerning,
|
||||
so kerning should be ENabled here. */
|
||||
font-feature-settings: "kern" on;
|
||||
font-kerning: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
font-feature-settings: "kern" off;
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-kerning: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-feature-settings: "kern" on;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-feature-settings: "kern" off;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-kerning: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: libertine;
|
||||
src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: libertine, sans-serif;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-kerning: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: gentium;
|
||||
/* font that has an old-style 'kern' table rather than GPOS 'kern' feature */
|
||||
src: url(../fonts/sil/GenR102.ttf);
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: gentium;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-kerning: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: gentium;
|
||||
src: url(../fonts/sil/GenR102.ttf);
|
||||
}
|
||||
body {
|
||||
margin: 10px;
|
||||
font-family: gentium;
|
||||
font-size: 600%;
|
||||
line-height: 1.2em;
|
||||
font-kerning: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en">
|
||||
<div>Ta To</div>
|
||||
<div>AVA</div>
|
||||
<div>AWAY</div>
|
||||
</body>
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-alternates test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
|
||||
<style type="text/css">
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-alternates", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-alternates test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
|
||||
<style type="text/css">
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-alternates", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-caps test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-caps", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-caps test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-caps", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "all", false, true));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-east-asian test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-east-asian", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-east-asian test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-east-asian", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,63 +0,0 @@
|
||||
body { margin: 10px; }
|
||||
|
||||
@font-face {
|
||||
font-family: gsub-test;
|
||||
src: url(../fonts/gsubtest/gsubtest-lookup3.otf);
|
||||
}
|
||||
|
||||
td.prop {
|
||||
font-family: Menlo, monospace;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
td.features {
|
||||
font-family: gsub-test;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@font-feature-values gsub-test {
|
||||
@styleset { ok-alt-a: 1 3 5; ok-alt-b: 19; }
|
||||
@character-variant { ok-1: 78 2; }
|
||||
@character-variant { ok-3: 23; }
|
||||
@character-variant { not-good: 0 2; }
|
||||
@annotation { ok-4: 1; }
|
||||
@annotation { bogus-font-doesnt-support: 23; }
|
||||
@annotation { circled: 1; }
|
||||
@character-variant { multi-def: 4; }
|
||||
@annotation { multi-def: 3; }
|
||||
@styleset { multi-def2: 3 4 5; }
|
||||
@styleset { MULTI-def2: 2 6; }
|
||||
@styleset { out-of-bounds1: 0; out-of-bounds2: 100; }
|
||||
}
|
||||
|
||||
@font-feature-values bogus-family {
|
||||
@styleset { bogus: 3 4 7; }
|
||||
}
|
||||
|
||||
@font-feature-values GSUB-tEsT {
|
||||
@styleset { mixed-case: 3 4 7; }
|
||||
}
|
||||
|
||||
@font-feature-values gSuB-tEsT {
|
||||
@styleset { 3blah: 1 3; }
|
||||
}
|
||||
|
||||
@font-feature-values gSuB-tEsT {
|
||||
@styleset { moxie: 14; }
|
||||
@styleset { 3blah: 1; }
|
||||
}
|
||||
|
||||
@font-feature-values gSUB-TeST {
|
||||
@styleset { moxie2: 14; }
|
||||
@bongo { blah: 1; }
|
||||
}
|
||||
|
||||
@font-feature-values gSUB-TEst {
|
||||
@bongo { blah2: 1; }
|
||||
@styleset { moxie3: 14; }
|
||||
}
|
@ -1,220 +0,0 @@
|
||||
|
||||
// data associated with gsubtest test font for testing font features
|
||||
|
||||
// prefix
|
||||
gPrefix = "";
|
||||
|
||||
// equivalent properties
|
||||
// setting prop: value should match the specific feature settings listed
|
||||
//
|
||||
// each of these tests evaluate whether a given feature is enabled as required
|
||||
// and also whether features that shouldn't be enabled are or not.
|
||||
var gPropertyData = [
|
||||
// font-variant-caps
|
||||
// valid values
|
||||
{ prop: "font-variant-caps", value: "normal", features: {"smcp": 0} },
|
||||
{ prop: "font-variant-caps", value: "small-caps", features: {"smcp": 1, "c2sc": 0} },
|
||||
{ prop: "font-variant-caps", value: "all-small-caps", features: {"smcp": 1, "c2sc": 1, "pcap": 0} },
|
||||
{ prop: "font-variant-caps", value: "petite-caps", features: {"pcap": 1, "smcp": 0} },
|
||||
{ prop: "font-variant-caps", value: "all-petite-caps", features: {"c2pc": 1, "pcap": 1, "smcp": 0} },
|
||||
{ prop: "font-variant-caps", value: "titling-caps", features: {"titl": 1, "smcp": 0} },
|
||||
{ prop: "font-variant-caps", value: "unicase", features: {"unic": 1, "titl": 0} },
|
||||
|
||||
// invalid values
|
||||
{ prop: "font-variant-caps", value: "normal small-caps", features: {"smcp": 0}, invalid: true },
|
||||
{ prop: "font-variant-caps", value: "small-caps potato", features: {"smcp": 0}, invalid: true },
|
||||
{ prop: "font-variant-caps", value: "small-caps petite-caps", features: {"smcp": 0, "pcap": 0}, invalid: true },
|
||||
{ prop: "font-variant-caps", value: "small-caps all-small-caps", features: {"smcp": 0, "c2sc": 0}, invalid: true },
|
||||
{ prop: "font-variant-caps", value: "small-cap", features: {"smcp": 0}, invalid: true },
|
||||
|
||||
// font-variant-east-asian
|
||||
// valid values
|
||||
{ prop: "font-variant-east-asian", value: "jis78", features: {"jp78": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "jis83", features: {"jp83": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "jis90", features: {"jp90": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "jis04", features: {"jp04": 1, "jp78": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "simplified", features: {"smpl": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "traditional", features: {"trad": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "full-width", features: {"fwid": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "proportional-width", features: {"pwid": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "ruby", features: {"ruby": 1, "jp04": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "jis78 full-width", features: {"jp78": 1, "fwid": 1, "jp83": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "jis78 full-width ruby", features: {"jp78": 1, "fwid": 1, "jp83": 0, "ruby": 1} },
|
||||
{ prop: "font-variant-east-asian", value: "simplified proportional-width", features: {"smpl": 1, "pwid": 1, "jp83": 0} },
|
||||
{ prop: "font-variant-east-asian", value: "ruby simplified", features: {"ruby": 1, "smpl": 1, "trad": 0} },
|
||||
|
||||
// invalid values
|
||||
{ prop: "font-variant-east-asian", value: "ruby normal", features: {"ruby": 0}, invalid: true },
|
||||
{ prop: "font-variant-east-asian", value: "jis90 jis04", features: {"jp90": 0, "jp04": 0}, invalid: true },
|
||||
{ prop: "font-variant-east-asian", value: "simplified traditional", features: {"smpl": 0, "trad": 0}, invalid: true },
|
||||
{ prop: "font-variant-east-asian", value: "full-width proportional-width", features: {"fwid": 0, "pwid": 0}, invalid: true },
|
||||
{ prop: "font-variant-east-asian", value: "ruby simplified ruby", features: {"ruby": 0, "smpl": 0, "jp04": 0}, invalid: true },
|
||||
{ prop: "font-variant-east-asian", value: "jis78 ruby simplified", features: {"ruby": 0, "smpl": 0, "jp78": 0}, invalid: true },
|
||||
|
||||
// font-variant-ligatures
|
||||
// valid values
|
||||
{ prop: "font-variant-ligatures", value: "normal", features: {"liga": 1, "dlig": 0} },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "no-common-ligatures", features: {"liga": 0, "clig": 0, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 1, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "no-discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 1, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "no-historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "no-contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 0} },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "historical-ligatures no-common-ligatures", features: {"clig": 0, "liga": 0, "dlig": 0, "hlig": 1, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "no-historical-ligatures discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 1, "hlig": 0, "calt": 1} },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures historical-ligatures no-contextual", features: {"clig": 1, "dlig": 0, "hlig": 1, "liga": 1, "calt": 0} },
|
||||
|
||||
// invalid values
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures normal", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures no-common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "no-historical-ligatures historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "no-contextual contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "no-discretionary-ligatures discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
|
||||
{ prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures no-common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
|
||||
|
||||
// font-variant-numeric
|
||||
// valid values
|
||||
{ prop: "font-variant-numeric", value: "normal", features: {"lnum": 0, "tnum": 0, "pnum": 0, "onum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "lining-nums", features: {"lnum": 1, "onum": 0, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "oldstyle-nums", features: {"lnum": 0, "onum": 1, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "proportional-nums", features: {"lnum": 0, "onum": 0, "pnum": 1, "tnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "proportional-nums oldstyle-nums", features: {"lnum": 0, "onum": 1, "pnum": 1, "tnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "tabular-nums", features: {"tnum": 1, "onum": 0, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "diagonal-fractions", features: {"frac": 1, "afrc": 0, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "stacked-fractions", features: {"frac": 0, "afrc": 1, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "slashed-zero", features: {"zero": 1, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "ordinal", features: {"ordn": 1, "pnum": 0} },
|
||||
{ prop: "font-variant-numeric", value: "lining-nums diagonal-fractions", features: {"frac": 1, "afrc": 0, "lnum": 1} },
|
||||
{ prop: "font-variant-numeric", value: "tabular-nums stacked-fractions", features: {"frac": 0, "afrc": 1, "tnum": 1} },
|
||||
{ prop: "font-variant-numeric", value: "tabular-nums slashed-zero stacked-fractions", features: {"frac": 0, "afrc": 1, "tnum": 1, "zero": 1} },
|
||||
{ prop: "font-variant-numeric", value: "proportional-nums slashed-zero diagonal-fractions oldstyle-nums ordinal", features: {"frac": 1, "afrc": 0, "tnum": 0, "pnum": 1, "onum": 1, "ordn": 1, "zero": 1} },
|
||||
|
||||
// invalid values
|
||||
{ prop: "font-variant-numeric", value: "lining-nums normal", features: {"lnum": 0, "onum": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "lining-nums oldstyle-nums", features: {"lnum": 0, "onum": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "lining-nums normal slashed-zero ordinal", features: {"lnum": 0, "onum": 0, "zero": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "proportional-nums tabular-nums", features: {"pnum": 0, "tnum": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "diagonal-fractions stacked-fractions", features: {"frac": 0, "afrc": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "slashed-zero diagonal-fractions slashed-zero", features: {"frac": 0, "afrc": 0, "zero": 0}, invalid: true },
|
||||
{ prop: "font-variant-numeric", value: "lining-nums slashed-zero diagonal-fractions oldstyle-nums", features: {"frac": 0, "afrc": 0, "zero": 0, "onum": 0}, invalid: true },
|
||||
|
||||
// font-variant-position
|
||||
// valid values
|
||||
{ prop: "font-variant-position", value: "normal", features: {"subs": 0, "sups": 0} },
|
||||
{ prop: "font-variant-position", value: "super", features: {"subs": 0, "sups": 1} },
|
||||
{ prop: "font-variant-position", value: "sub", features: {"subs": 1, "sups": 0} },
|
||||
|
||||
// invalid values
|
||||
{ prop: "font-variant-position", value: "super sub", features: {"subs": 0, "sups": 0}, invalid: true },
|
||||
];
|
||||
|
||||
// note: the code below requires an array "gFeatures" from :
|
||||
// layout/reftests/fonts/gsubtest/gsubtest-features.js
|
||||
|
||||
// The font defines feature lookups for all OpenType features for a
|
||||
// specific set of PUA codepoints, as listed in the gFeatures array.
|
||||
// Using these codepoints and feature combinations, tests can be
|
||||
// constructed to detect when certain features are enabled or not.
|
||||
|
||||
// return a created table containing tests for a given property
|
||||
//
|
||||
// Ex: { prop: "font-variant-ligatures", value: "common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0} }
|
||||
//
|
||||
// This means that for the property 'font-variant-ligatures' with the value 'common-ligatures', the features listed should
|
||||
// either be explicitly enabled or disabled.
|
||||
|
||||
// propData is the prop/value list with corresponding feature assertions
|
||||
// whichProp is either "all" or a specific subproperty (i.e. "font-variant-position")
|
||||
// isRef is true when this is the reference
|
||||
// debug outputs the prop/value pair along with the tests
|
||||
|
||||
function createFeatureTestTable(propData, whichProp, isRef, debug)
|
||||
{
|
||||
var table = document.createElement("table");
|
||||
|
||||
if (typeof(isRef) == "undefined") {
|
||||
isRef = false;
|
||||
}
|
||||
|
||||
if (typeof(debug) == "undefined") {
|
||||
debug = false;
|
||||
}
|
||||
|
||||
var doAll = (whichProp == "all");
|
||||
for (var i in propData) {
|
||||
var data = propData[i];
|
||||
|
||||
if (!doAll && data.prop != whichProp) continue;
|
||||
|
||||
var row = document.createElement("tr");
|
||||
var invalid = false;
|
||||
if ("invalid" in data) {
|
||||
invalid = true;
|
||||
row.className = "invalid";
|
||||
}
|
||||
|
||||
var cell = document.createElement("td");
|
||||
cell.className = "prop";
|
||||
var styledecl = gPrefix + data.prop + ": " + data.value + ";";
|
||||
cell.innerHTML = styledecl;
|
||||
row.appendChild(cell);
|
||||
if (debug) {
|
||||
table.appendChild(row);
|
||||
}
|
||||
|
||||
row = document.createElement("tr");
|
||||
if (invalid) {
|
||||
row.className = "invalid";
|
||||
}
|
||||
|
||||
cell = document.createElement("td");
|
||||
cell.className = "features";
|
||||
if (!isRef) {
|
||||
cell.style.cssText = styledecl;
|
||||
}
|
||||
|
||||
for (var f in data.features) {
|
||||
var feature = data.features[f];
|
||||
|
||||
var cp, unsupported = "F".charCodeAt(0);
|
||||
var basecp = gFeatures[f];
|
||||
|
||||
if (typeof(basecp) == "undefined") {
|
||||
cp = unsupported;
|
||||
} else {
|
||||
switch(feature) {
|
||||
case 0:
|
||||
cp = basecp;
|
||||
break;
|
||||
case 1:
|
||||
cp = basecp + 1;
|
||||
break;
|
||||
case 2:
|
||||
cp = basecp + 2;
|
||||
break;
|
||||
case 3:
|
||||
cp = basecp + 3;
|
||||
break;
|
||||
default:
|
||||
cp = basecp + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var span = document.createElement("span");
|
||||
span.innerHTML = (isRef ? "P " : "&#x" + cp.toString(16) + "; ");
|
||||
span.title = f + "=" + feature;
|
||||
cell.appendChild(span);
|
||||
}
|
||||
row.appendChild(cell);
|
||||
table.appendChild(row);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-ligatures test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-ligatures", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-ligatures test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-ligatures", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-numeric test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-numeric", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-numeric test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-numeric", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-position test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-position", true, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>font-variant-position test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
|
||||
<script type="text/javascript" src="font-variant-features.js"></script>
|
||||
<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-position", false, false));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -51,38 +51,6 @@ skip-if(B2G) HTTP(..) == font-features-turkish-override-5.html font-features-tur
|
||||
HTTP(..) == font-features-order-1.html font-features-ref.html
|
||||
HTTP(..) == font-features-order-2.html font-features-noliga.html
|
||||
|
||||
# check priority of feature settings vs. font-variant subproperty
|
||||
HTTP(..) == font-features-order-3.html font-features-noliga.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-features-order-4.html font-features-noliga.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-features-order-5.html font-features-hlig.html
|
||||
|
||||
# check priority involving feature settings and font-variant-alternates
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == alternates-order.html alternates-order-ref.html
|
||||
|
||||
# check that font-specific values line up with @font-face feature settings
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == annotations.html annotations-ref.html
|
||||
|
||||
# font-variant subproperties
|
||||
# test for specific features being on and others off, based on prop values
|
||||
# (debug problems with font-variant-debug.html which displays all props)
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-alternates.html font-variant-alternates-ref.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-caps.html font-variant-caps-ref.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-east-asian.html font-variant-east-asian-ref.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-ligatures.html font-variant-ligatures-ref.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-numeric.html font-variant-numeric-ref.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-variant-position.html font-variant-position-ref.html
|
||||
|
||||
# font-kerning
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) != font-kerning-normal.html font-kerning-none.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) != font-kerning-auto.html font-kerning-none.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-auto.html font-kerning-normal.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-normal.html font-kerning-kern.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-none.html font-kerning-nokern.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-1.html font-kerning-none.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-2.html font-kerning-normal.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) == font-kerning-3.html font-kerning-none.html
|
||||
pref(layout.css.font-features.enabled,true) HTTP(..) != font-kerning-table-none.html font-kerning-table-normal.html
|
||||
|
||||
# sanity check for kerning - with no spaces, kerning should occur
|
||||
HTTP(..) == kerning-sanity-check-kern.html kerning-sanity-check-default.html
|
||||
HTTP(..) != kerning-sanity-check-nokern.html kerning-sanity-check-default.html
|
||||
|
@ -537,22 +537,6 @@ 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 &fontVariantAlternates =
|
||||
*data->ValueFor(eCSSProperty_font_variant_alternates);
|
||||
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 &&
|
||||
@ -566,39 +550,21 @@ 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 ||
|
||||
fontKerning.GetUnit() != eCSSUnit_System_Font ||
|
||||
fontSynthesis.GetUnit() != eCSSUnit_System_Font ||
|
||||
fontVariantAlternates.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) {
|
||||
languageOverride.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, -moz-font-language-override
|
||||
// along with kerning, synthesis and other font-variant
|
||||
// subproperties are reset by this shorthand property to their
|
||||
// -moz-font-feature-settings, and -moz-font-language-override
|
||||
// properties 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 ||
|
||||
fontKerning.GetIntValue() != NS_FONT_KERNING_AUTO ||
|
||||
fontSynthesis.GetIntValue() !=
|
||||
(NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE) ||
|
||||
fontVariantAlternates.GetUnit() != eCSSUnit_Normal ||
|
||||
fontVariantCaps.GetUnit() != eCSSUnit_Normal ||
|
||||
fontVariantEastAsian.GetUnit() != eCSSUnit_Normal ||
|
||||
fontVariantLigatures.GetUnit() != eCSSUnit_Normal ||
|
||||
fontVariantNumeric.GetUnit() != eCSSUnit_Normal ||
|
||||
fontVariantPosition.GetUnit() != eCSSUnit_Normal) {
|
||||
languageOverride.GetUnit() != eCSSUnit_Normal) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,7 @@ public:
|
||||
KEYFRAME_RULE,
|
||||
KEYFRAMES_RULE,
|
||||
DOCUMENT_RULE,
|
||||
SUPPORTS_RULE,
|
||||
FONT_FEATURE_VALUES_RULE
|
||||
SUPPORTS_RULE
|
||||
};
|
||||
|
||||
virtual int32_t GetType() const = 0;
|
||||
|
@ -9,8 +9,5 @@ CSS_FONT_DESC(font-weight, Weight)
|
||||
CSS_FONT_DESC(font-stretch, Stretch)
|
||||
CSS_FONT_DESC(src, Src)
|
||||
CSS_FONT_DESC(unicode-range, UnicodeRange)
|
||||
|
||||
/* Note: the parsing code explicitly also accepts font-feature-settings
|
||||
and font-language-override. */
|
||||
CSS_FONT_DESC(-moz-font-feature-settings, FontFeatureSettings)
|
||||
CSS_FONT_DESC(-moz-font-language-override, FontLanguageOverride)
|
||||
|
@ -163,14 +163,11 @@ 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)
|
||||
CSS_KEY(always, always)
|
||||
CSS_KEY(annotation, annotation)
|
||||
CSS_KEY(appworkspace, appworkspace)
|
||||
CSS_KEY(armenian, armenian)
|
||||
CSS_KEY(auto, auto)
|
||||
@ -203,7 +200,6 @@ CSS_KEY(captiontext, captiontext)
|
||||
CSS_KEY(cell, cell)
|
||||
CSS_KEY(center, center)
|
||||
CSS_KEY(ch, ch)
|
||||
CSS_KEY(character-variant, character_variant)
|
||||
CSS_KEY(circle, circle)
|
||||
CSS_KEY(cjk-ideographic, cjk_ideographic)
|
||||
CSS_KEY(clip, clip)
|
||||
@ -213,7 +209,6 @@ 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)
|
||||
@ -222,7 +217,6 @@ 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)
|
||||
@ -233,11 +227,9 @@ 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)
|
||||
@ -281,8 +273,6 @@ CSS_KEY(highlight, highlight)
|
||||
CSS_KEY(highlighttext, highlighttext)
|
||||
CSS_KEY(hiragana, hiragana)
|
||||
CSS_KEY(hiragana-iroha, hiragana_iroha)
|
||||
CSS_KEY(historical-forms, historical_forms)
|
||||
CSS_KEY(historical-ligatures, historical_ligatures)
|
||||
CSS_KEY(horizontal, horizontal)
|
||||
CSS_KEY(hz, hz)
|
||||
CSS_KEY(icon, icon)
|
||||
@ -307,10 +297,6 @@ 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)
|
||||
@ -323,7 +309,6 @@ 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)
|
||||
@ -352,11 +337,7 @@ 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)
|
||||
@ -367,10 +348,7 @@ 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(ornaments, ornaments)
|
||||
CSS_KEY(outset, outset)
|
||||
CSS_KEY(outside, outside)
|
||||
CSS_KEY(overline, overline)
|
||||
@ -379,7 +357,6 @@ 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)
|
||||
@ -389,8 +366,6 @@ 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)
|
||||
@ -413,7 +388,6 @@ 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)
|
||||
@ -435,11 +409,9 @@ 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)
|
||||
@ -449,7 +421,6 @@ 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)
|
||||
@ -458,13 +429,9 @@ 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(styleset, styleset)
|
||||
CSS_KEY(stylistic, stylistic)
|
||||
CSS_KEY(sub, sub)
|
||||
CSS_KEY(super, super)
|
||||
CSS_KEY(sw-resize, sw_resize)
|
||||
CSS_KEY(swash, swash)
|
||||
CSS_KEY(table, table)
|
||||
CSS_KEY(table-caption, table_caption)
|
||||
CSS_KEY(table-cell, table_cell)
|
||||
@ -474,7 +441,6 @@ 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)
|
||||
@ -485,11 +451,9 @@ 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)
|
||||
@ -500,7 +464,6 @@ 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)
|
||||
@ -514,7 +477,6 @@ 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)
|
||||
|
@ -375,9 +375,6 @@ protected:
|
||||
void* aProcessData);
|
||||
|
||||
bool ParseFontFaceRule(RuleAppendFunc aAppendFunc, void* aProcessData);
|
||||
bool ParseFontFeatureValuesRule(RuleAppendFunc aAppendFunc,
|
||||
void* aProcessData);
|
||||
bool ParseFontFeatureValueSet(nsCSSFontFeatureValuesRule *aRule);
|
||||
bool ParseFontDescriptor(nsCSSFontFaceRule* aRule);
|
||||
bool ParseFontDescriptorValue(nsCSSFontDesc aDescID,
|
||||
nsCSSValue& aValue);
|
||||
@ -565,14 +562,6 @@ protected:
|
||||
bool ParseCounterData(nsCSSProperty aPropID);
|
||||
bool ParseCursor();
|
||||
bool ParseFont();
|
||||
bool ParseFontSynthesis(nsCSSValue& aValue);
|
||||
bool ParseSingleAlternate(int32_t& aWhichFeature, nsCSSValue& aValue);
|
||||
bool ParseFontVariantAlternates(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);
|
||||
@ -676,13 +665,12 @@ protected:
|
||||
/* Functions for transform Parsing */
|
||||
bool ParseSingleTransform(bool aIsPrefixed, nsCSSValue& aValue, bool& aIs3D);
|
||||
bool ParseFunction(const nsString &aFunction, const int32_t aAllowedTypes[],
|
||||
int32_t aVariantMaskAll, uint16_t aMinElems,
|
||||
uint16_t aMaxElems, nsCSSValue &aValue);
|
||||
uint16_t aMinElems, uint16_t aMaxElems,
|
||||
nsCSSValue &aValue);
|
||||
bool ParseFunctionInternals(const int32_t aVariantMask[],
|
||||
int32_t aVariantMaskAll,
|
||||
uint16_t aMinElems,
|
||||
uint16_t aMaxElems,
|
||||
InfallibleTArray<nsCSSValue>& aOutput);
|
||||
uint16_t aMinElems,
|
||||
uint16_t aMaxElems,
|
||||
InfallibleTArray<nsCSSValue>& aOutput);
|
||||
|
||||
/* Functions for transform-origin/perspective-origin Parsing */
|
||||
bool ParseTransformOrigin(bool aPerspective);
|
||||
@ -1638,11 +1626,6 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
|
||||
parseFunc = &CSSParserImpl::ParseFontFaceRule;
|
||||
newSection = eCSSSection_General;
|
||||
|
||||
} else if (mToken.mIdent.LowerCaseEqualsLiteral("font-feature-values") &&
|
||||
nsCSSFontFeatureValuesRule::PrefEnabled()) {
|
||||
parseFunc = &CSSParserImpl::ParseFontFeatureValuesRule;
|
||||
newSection = eCSSSection_General;
|
||||
|
||||
} else if (mToken.mIdent.LowerCaseEqualsLiteral("page")) {
|
||||
parseFunc = &CSSParserImpl::ParsePageRule;
|
||||
newSection = eCSSSection_General;
|
||||
@ -2368,233 +2351,6 @@ CSSParserImpl::ParseFontDescriptor(nsCSSFontFaceRule* aRule)
|
||||
return true;
|
||||
}
|
||||
|
||||
// @font-feature-values <font-family># {
|
||||
// @<feature-type> {
|
||||
// <feature-ident> : <feature-index>+;
|
||||
// <feature-ident> : <feature-index>+;
|
||||
// ...
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseFontFeatureValuesRule(RuleAppendFunc aAppendFunc,
|
||||
void* aData)
|
||||
{
|
||||
nsRefPtr<nsCSSFontFeatureValuesRule>
|
||||
valuesRule(new nsCSSFontFeatureValuesRule());
|
||||
|
||||
// parse family list
|
||||
nsCSSValue familyValue;
|
||||
|
||||
if (!ParseFamily(familyValue) ||
|
||||
familyValue.GetUnit() != eCSSUnit_Families)
|
||||
{
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVNoFamily);
|
||||
return false;
|
||||
}
|
||||
|
||||
// add family to rule
|
||||
nsAutoString familyList;
|
||||
bool hasGeneric;
|
||||
familyValue.GetStringValue(familyList);
|
||||
valuesRule->SetFamilyList(familyList, hasGeneric);
|
||||
|
||||
// family list has generic ==> parse error
|
||||
if (hasGeneric) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVGenericInFamilyList);
|
||||
return false;
|
||||
}
|
||||
|
||||
// open brace
|
||||
if (!ExpectSymbol('{', true)) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVBlockStart);
|
||||
return false;
|
||||
}
|
||||
|
||||
// list of sets of feature values, each set bound to a specific
|
||||
// feature-type (e.g. swash, annotation)
|
||||
for (;;) {
|
||||
if (!GetToken(true)) {
|
||||
REPORT_UNEXPECTED_EOF(PEFFVUnexpectedEOF);
|
||||
break;
|
||||
}
|
||||
if (mToken.IsSymbol('}')) { // done!
|
||||
UngetToken();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ParseFontFeatureValueSet(valuesRule)) {
|
||||
if (!SkipAtRule(false)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ExpectSymbol('}', true)) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVUnexpectedBlockEnd);
|
||||
SkipUntil('}');
|
||||
return false;
|
||||
}
|
||||
|
||||
(*aAppendFunc)(valuesRule, aData);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define NUMVALUES_NO_LIMIT 0xFFFF
|
||||
|
||||
// parse a single value set containing name-value pairs for a single feature type
|
||||
// @<feature-type> { [ <feature-ident> : <feature-index>+ ; ]* }
|
||||
// Ex: @swash { flowing: 1; delicate: 2; }
|
||||
bool
|
||||
CSSParserImpl::ParseFontFeatureValueSet(nsCSSFontFeatureValuesRule
|
||||
*aFeatureValuesRule)
|
||||
{
|
||||
// -- @keyword (e.g. swash, styleset)
|
||||
if (eCSSToken_AtKeyword != mToken.mType) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFontFeatureValuesNoAt);
|
||||
OUTPUT_ERROR();
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
// which font-specific variant of font-variant-alternates
|
||||
int32_t whichVariant;
|
||||
nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent);
|
||||
if (keyword == eCSSKeyword_UNKNOWN ||
|
||||
!nsCSSProps::FindKeyword(keyword,
|
||||
nsCSSProps::kFontVariantAlternatesFuncsKTable,
|
||||
whichVariant))
|
||||
{
|
||||
if (!NonMozillaVendorIdentifier(mToken.mIdent)) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVUnknownFontVariantPropValue);
|
||||
OUTPUT_ERROR();
|
||||
}
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString featureType(mToken.mIdent);
|
||||
|
||||
// open brace
|
||||
if (!ExpectSymbol('{', true)) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVValueSetStart);
|
||||
return false;
|
||||
}
|
||||
|
||||
// styleset and character-variant can be multi-valued, otherwise single value
|
||||
int32_t limitNumValues;
|
||||
|
||||
switch (keyword) {
|
||||
case eCSSKeyword_styleset:
|
||||
limitNumValues = NUMVALUES_NO_LIMIT;
|
||||
break;
|
||||
case eCSSKeyword_character_variant:
|
||||
limitNumValues = 2;
|
||||
break;
|
||||
default:
|
||||
limitNumValues = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// -- ident integer+ [, ident integer+]
|
||||
nsAutoTArray<gfxFontFeatureValueSet::ValueList, 5> values;
|
||||
|
||||
// list of font-feature-values-declaration's
|
||||
for (;;) {
|
||||
nsAutoString valueId;
|
||||
|
||||
if (!GetToken(true)) {
|
||||
REPORT_UNEXPECTED_EOF(PEFFVUnexpectedEOF);
|
||||
break;
|
||||
}
|
||||
|
||||
// ignore extra semicolons
|
||||
if (mToken.IsSymbol(';')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// close brace ==> done
|
||||
if (mToken.IsSymbol('}')) {
|
||||
break;
|
||||
}
|
||||
|
||||
// ident
|
||||
if (eCSSToken_Ident != mToken.mType) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVExpectedIdent);
|
||||
if (!SkipDeclaration(true)) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
valueId.Assign(mToken.mIdent);
|
||||
|
||||
// colon
|
||||
if (!ExpectSymbol(':', true)) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEParseDeclarationNoColon);
|
||||
OUTPUT_ERROR();
|
||||
if (!SkipDeclaration(true)) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// value list
|
||||
nsAutoTArray<uint32_t,4> featureSelectors;
|
||||
|
||||
nsCSSValue intValue;
|
||||
while (ParseNonNegativeVariant(intValue, VARIANT_INTEGER, nullptr)) {
|
||||
featureSelectors.AppendElement(uint32_t(intValue.GetIntValue()));
|
||||
}
|
||||
|
||||
int32_t numValues = featureSelectors.Length();
|
||||
|
||||
if (numValues == 0) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVExpectedValue);
|
||||
OUTPUT_ERROR();
|
||||
if (!SkipDeclaration(true)) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (numValues > limitNumValues) {
|
||||
REPORT_UNEXPECTED_P(PEFFVTooManyValues, featureType);
|
||||
OUTPUT_ERROR();
|
||||
if (!SkipDeclaration(true)) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetToken(true)) {
|
||||
REPORT_UNEXPECTED_EOF(PEFFVUnexpectedEOF);
|
||||
gfxFontFeatureValueSet::ValueList v(valueId, featureSelectors);
|
||||
values.AppendElement(v);
|
||||
break;
|
||||
}
|
||||
|
||||
// ';' or '}' to end definition
|
||||
if (!mToken.IsSymbol(';') && !mToken.IsSymbol('}')) {
|
||||
REPORT_UNEXPECTED_TOKEN(PEFFVValueDefinitionTrailing);
|
||||
OUTPUT_ERROR();
|
||||
if (!SkipDeclaration(true)) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
gfxFontFeatureValueSet::ValueList v(valueId, featureSelectors);
|
||||
values.AppendElement(v);
|
||||
|
||||
if (mToken.IsSymbol('}')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aFeatureValuesRule->AddValueList(whichVariant, values);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseKeyframesRule(RuleAppendFunc aAppendFunc, void* aData)
|
||||
@ -6614,16 +6370,6 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
||||
switch (aPropID) {
|
||||
case eCSSProperty_font_family:
|
||||
return ParseFamily(aValue);
|
||||
case eCSSProperty_font_synthesis:
|
||||
return ParseFontSynthesis(aValue);
|
||||
case eCSSProperty_font_variant_alternates:
|
||||
return ParseFontVariantAlternates(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:
|
||||
@ -8247,7 +7993,7 @@ CSSParserImpl::ParseCalcTerm(nsCSSValue& aValue, int32_t& aVariantMask)
|
||||
// ... or just a value
|
||||
UngetToken();
|
||||
// Always pass VARIANT_NUMBER to ParseVariant so that unitless zero
|
||||
// always gets picked up
|
||||
// always gets picked up
|
||||
if (!ParseVariant(aValue, aVariantMask | VARIANT_NUMBER, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
@ -8557,14 +8303,6 @@ 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_alternates, 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);
|
||||
@ -8579,14 +8317,6 @@ 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_alternates, 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;
|
||||
}
|
||||
@ -8650,287 +8380,12 @@ 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_alternates,
|
||||
nsCSSValue(eCSSUnit_Normal));
|
||||
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 & intValue) {
|
||||
return false;
|
||||
}
|
||||
aValue.SetIntValue(nextIntValue | intValue, eCSSUnit_Enumerated);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// font-variant-alternates allows for a combination of multiple
|
||||
// simple enumerated values and functional values. Functional values have
|
||||
// parameter lists with one or more idents which are later resolved
|
||||
// based on values defined in @font-feature-value rules.
|
||||
//
|
||||
// font-variant-alternates: swash(flowing), historical-forms, styleset(alt-g, alt-m);
|
||||
//
|
||||
// So for this the nsCSSValue is set to a pair value, with one
|
||||
// value for a bitmask of both simple and functional property values
|
||||
// and another value containing a ValuePairList with lists of idents
|
||||
// for each functional property value.
|
||||
//
|
||||
// pairValue
|
||||
// o intValue
|
||||
// NS_FONT_VARIANT_ALTERNATES_SWASH |
|
||||
// NS_FONT_VARIANT_ALTERNATES_STYLESET
|
||||
// o valuePairList, each element with
|
||||
// - intValue - indicates which alternate
|
||||
// - string or valueList of strings
|
||||
//
|
||||
// Note: when only 'historical-forms' is specified, there are no
|
||||
// functional values to store, in which case the valuePairList is a
|
||||
// single element dummy list. In all other cases, the length of the
|
||||
// list will match the number of functional values.
|
||||
|
||||
#define MAX_ALLOWED_FEATURES 512
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseSingleAlternate(int32_t& aWhichFeature,
|
||||
nsCSSValue& aValue)
|
||||
{
|
||||
if (!GetToken(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isIdent = (mToken.mType == eCSSToken_Ident);
|
||||
if (mToken.mType != eCSSToken_Function && !isIdent) {
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
// ident ==> simple enumerated prop val (e.g. historical-forms)
|
||||
// function ==> e.g. swash(flowing) styleset(alt-g, alt-m)
|
||||
|
||||
nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent);
|
||||
if (!(eCSSKeyword_UNKNOWN < keyword &&
|
||||
nsCSSProps::FindKeyword(keyword,
|
||||
(isIdent ?
|
||||
nsCSSProps::kFontVariantAlternatesKTable :
|
||||
nsCSSProps::kFontVariantAlternatesFuncsKTable),
|
||||
aWhichFeature)))
|
||||
{
|
||||
// failed, pop token
|
||||
UngetToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isIdent) {
|
||||
aValue.SetIntValue(aWhichFeature, eCSSUnit_Enumerated);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t maxElems = 1;
|
||||
if (keyword == eCSSKeyword_styleset ||
|
||||
keyword == eCSSKeyword_character_variant) {
|
||||
maxElems = MAX_ALLOWED_FEATURES;
|
||||
}
|
||||
return ParseFunction(mToken.mIdent, nullptr, VARIANT_IDENTIFIER,
|
||||
1, maxElems, aValue);
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseFontVariantAlternates(nsCSSValue& aValue)
|
||||
{
|
||||
if (ParseVariant(aValue, VARIANT_INHERIT | VARIANT_NORMAL, nullptr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// iterate through parameters
|
||||
nsCSSValue listValue;
|
||||
int32_t feature, featureFlags = 0;
|
||||
|
||||
// if no functional values, this may be a list with a single, unused element
|
||||
listValue.SetListValue();
|
||||
|
||||
nsCSSValueList* list = nullptr;
|
||||
nsCSSValue value;
|
||||
while (ParseSingleAlternate(feature, value)) {
|
||||
|
||||
// check to make sure value not already set
|
||||
if (feature == 0 ||
|
||||
feature & featureFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
featureFlags |= feature;
|
||||
|
||||
// if function, need to add to the list of functions
|
||||
if (value.GetUnit() == eCSSUnit_Function) {
|
||||
if (!list) {
|
||||
list = listValue.GetListValue();
|
||||
} else {
|
||||
list->mNext = new nsCSSValueList;
|
||||
list = list->mNext;
|
||||
}
|
||||
list->mValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
nsCSSValue featureValue;
|
||||
featureValue.SetIntValue(featureFlags, eCSSUnit_Enumerated);
|
||||
aValue.SetPairValue(featureValue, listValue);
|
||||
|
||||
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;
|
||||
|
||||
while (*m != MASK_END_VALUE) {
|
||||
if (*m & nextIntValue) {
|
||||
c = mergedValue & *m;
|
||||
break;
|
||||
}
|
||||
m++;
|
||||
}
|
||||
|
||||
if (c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mergedValue |= nextIntValue;
|
||||
}
|
||||
|
||||
aValue.SetIntValue(mergedValue, eCSSUnit_Enumerated);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
|
||||
static 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)
|
||||
{
|
||||
@ -9702,21 +9157,14 @@ CSSParserImpl::ParseTextOverflow(nsCSSValue& aValue)
|
||||
*/
|
||||
bool
|
||||
CSSParserImpl::ParseFunctionInternals(const int32_t aVariantMask[],
|
||||
int32_t aVariantMaskAll,
|
||||
uint16_t aMinElems,
|
||||
uint16_t aMaxElems,
|
||||
InfallibleTArray<nsCSSValue> &aOutput)
|
||||
{
|
||||
NS_ASSERTION((aVariantMask && !aVariantMaskAll) ||
|
||||
(!aVariantMask && aVariantMaskAll),
|
||||
"only one of the two variant mask parameters can be set");
|
||||
|
||||
for (uint16_t index = 0; index < aMaxElems; ++index) {
|
||||
nsCSSValue newValue;
|
||||
int32_t m = aVariantMaskAll ? aVariantMaskAll : aVariantMask[index];
|
||||
if (!ParseVariant(newValue, m, nullptr)) {
|
||||
if (!ParseVariant(newValue, aVariantMask[index], nullptr))
|
||||
return false;
|
||||
}
|
||||
|
||||
aOutput.AppendElement(newValue);
|
||||
|
||||
@ -9744,8 +9192,7 @@ CSSParserImpl::ParseFunctionInternals(const int32_t aVariantMask[],
|
||||
* types for each element in the function. The zeroth element in the
|
||||
* array corresponds to the first function parameter, etc. The length
|
||||
* of this array _must_ be greater than or equal to aMaxElems or the
|
||||
* behavior is undefined. If not null, aAllowTypesAll must be 0.
|
||||
* @param aAllowedTypesAll If set, every element tested for these types
|
||||
* behavior is undefined.
|
||||
* @param aMinElems Minimum number of elements to read. Reading fewer than
|
||||
* this many elements will result in the function failing.
|
||||
* @param aMaxElems Maximum number of elements to read. Reading more than
|
||||
@ -9755,13 +9202,9 @@ CSSParserImpl::ParseFunctionInternals(const int32_t aVariantMask[],
|
||||
bool
|
||||
CSSParserImpl::ParseFunction(const nsString &aFunction,
|
||||
const int32_t aAllowedTypes[],
|
||||
int32_t aAllowedTypesAll,
|
||||
uint16_t aMinElems, uint16_t aMaxElems,
|
||||
nsCSSValue &aValue)
|
||||
{
|
||||
NS_ASSERTION((aAllowedTypes && !aAllowedTypesAll) ||
|
||||
(!aAllowedTypes && aAllowedTypesAll),
|
||||
"only one of the two allowed type parameter can be set");
|
||||
typedef InfallibleTArray<nsCSSValue>::size_type arrlen_t;
|
||||
|
||||
/* 2^16 - 2, so that if we have 2^16 - 2 transforms, we have 2^16 - 1
|
||||
@ -9779,10 +9222,9 @@ CSSParserImpl::ParseFunction(const nsString &aFunction,
|
||||
* it's out of bounds.
|
||||
*/
|
||||
InfallibleTArray<nsCSSValue> foundValues;
|
||||
if (!ParseFunctionInternals(aAllowedTypes, aAllowedTypesAll, aMinElems,
|
||||
aMaxElems, foundValues)) {
|
||||
if (!ParseFunctionInternals(aAllowedTypes, aMinElems, aMaxElems,
|
||||
foundValues))
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Now, convert this array into an nsCSSValue::Array object.
|
||||
* We'll need N + 1 spots, one for the function name and the rest for the
|
||||
@ -10057,8 +9499,7 @@ CSSParserImpl::ParseSingleTransform(bool aIsPrefixed,
|
||||
break;
|
||||
}
|
||||
|
||||
return ParseFunction(mToken.mIdent, variantMask, 0, minElems,
|
||||
maxElems, aValue);
|
||||
return ParseFunction(mToken.mIdent, variantMask, minElems, maxElems, aValue);
|
||||
}
|
||||
|
||||
/* Parses a transform property list by continuously reading in properties
|
||||
|
@ -55,5 +55,3 @@ CSS_PROP_ALIAS(-moz-animation-iteration-count, animation_iteration_count, MozAni
|
||||
CSS_PROP_ALIAS(-moz-animation-name, animation_name, MozAnimationName, "layout.css.prefixes.animations")
|
||||
CSS_PROP_ALIAS(-moz-animation-play-state, animation_play_state, MozAnimationPlayState, "layout.css.prefixes.animations")
|
||||
CSS_PROP_ALIAS(-moz-animation-timing-function, animation_timing_function, MozAnimationTimingFunction, "layout.css.prefixes.animations")
|
||||
CSS_PROP_ALIAS(font-feature-settings, font_feature_settings, FontFeatureSettings, "layout.css.font-features.enabled")
|
||||
CSS_PROP_ALIAS(font-language-override, font_language_override, FontLanguageOverride, "layout.css.font-features.enabled")
|
||||
|
@ -1709,18 +1709,6 @@ 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,
|
||||
@ -1786,19 +1774,6 @@ 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,
|
||||
@ -1811,82 +1786,6 @@ CSS_PROP_FONT(
|
||||
kFontVariantKTable,
|
||||
offsetof(nsStyleFont, mFont.variant),
|
||||
eStyleAnimType_EnumU8)
|
||||
CSS_PROP_FONT(
|
||||
font-variant-alternates,
|
||||
font_variant_alternates,
|
||||
FontVariantAlternates,
|
||||
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",
|
||||
VARIANT_HK,
|
||||
kFontVariantAlternatesKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
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,
|
||||
|
@ -410,17 +410,7 @@ nsCSSFontDesc
|
||||
nsCSSProps::LookupFontDesc(const nsAString& aFontDesc)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(gFontDescTable, "no lookup table, needs addref");
|
||||
nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
|
||||
|
||||
// check for unprefixed font-feature-settings/font-language-override
|
||||
if (which == eCSSFontDesc_UNKNOWN &&
|
||||
mozilla::Preferences::GetBool("layout.css.font-features.enabled")) {
|
||||
nsAutoString prefixedProp;
|
||||
prefixedProp.AppendLiteral("-moz-");
|
||||
prefixedProp.Append(aFontDesc);
|
||||
which = nsCSSFontDesc(gFontDescTable->Lookup(prefixedProp));
|
||||
}
|
||||
return which;
|
||||
return nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
|
||||
}
|
||||
|
||||
const nsAFlatCString&
|
||||
@ -1023,13 +1013,6 @@ 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,
|
||||
@ -1063,87 +1046,12 @@ 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::kFontVariantAlternatesKTable[] = {
|
||||
eCSSKeyword_historical_forms, NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
const int32_t nsCSSProps::kFontVariantAlternatesFuncsKTable[] = {
|
||||
eCSSKeyword_stylistic, NS_FONT_VARIANT_ALTERNATES_STYLISTIC,
|
||||
eCSSKeyword_styleset, NS_FONT_VARIANT_ALTERNATES_STYLESET,
|
||||
eCSSKeyword_character_variant, NS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT,
|
||||
eCSSKeyword_swash, NS_FONT_VARIANT_ALTERNATES_SWASH,
|
||||
eCSSKeyword_ornaments, NS_FONT_VARIANT_ALTERNATES_ORNAMENTS,
|
||||
eCSSKeyword_annotation, NS_FONT_VARIANT_ALTERNATES_ANNOTATION,
|
||||
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,
|
||||
@ -2164,19 +2072,11 @@ static const nsCSSProperty gFontSubpropTable[] = {
|
||||
eCSSProperty_font_weight,
|
||||
eCSSProperty_font_size,
|
||||
eCSSProperty_line_height,
|
||||
eCSSProperty_font_size_adjust,
|
||||
eCSSProperty_font_stretch,
|
||||
eCSSProperty_font_size_adjust, // XXX Added LDB.
|
||||
eCSSProperty_font_stretch, // XXX Added LDB.
|
||||
eCSSProperty__x_system_font,
|
||||
eCSSProperty_font_feature_settings,
|
||||
eCSSProperty_font_language_override,
|
||||
eCSSProperty_font_kerning,
|
||||
eCSSProperty_font_synthesis,
|
||||
eCSSProperty_font_variant_alternates,
|
||||
eCSSProperty_font_variant_caps,
|
||||
eCSSProperty_font_variant_east_asian,
|
||||
eCSSProperty_font_variant_ligatures,
|
||||
eCSSProperty_font_variant_numeric,
|
||||
eCSSProperty_font_variant_position,
|
||||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
|
@ -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,19 +398,10 @@ 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 kFontVariantAlternatesKTable[];
|
||||
static const int32_t kFontVariantAlternatesFuncsKTable[];
|
||||
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[];
|
||||
|
@ -649,7 +649,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
|
||||
}
|
||||
AppendRuleToTagTable(&mTagTable, selector->mLowercaseTag, ruleValue);
|
||||
RULE_HASH_STAT_INCREMENT(mTagSelectors);
|
||||
if (selector->mCasedTag &&
|
||||
if (selector->mCasedTag &&
|
||||
selector->mCasedTag != selector->mLowercaseTag) {
|
||||
AppendRuleToTagTable(&mTagTable, selector->mCasedTag, ruleValue);
|
||||
RULE_HASH_STAT_INCREMENT(mTagSelectors);
|
||||
@ -978,7 +978,6 @@ struct RuleCascadeData {
|
||||
|
||||
nsTArray<nsFontFaceRuleContainer> mFontFaceRules;
|
||||
nsTArray<nsCSSKeyframesRule*> mKeyframesRules;
|
||||
nsTArray<nsCSSFontFeatureValuesRule*> mFontFeatureValuesRules;
|
||||
nsTArray<nsCSSPageRule*> mPageRules;
|
||||
|
||||
// Looks up or creates the appropriate list in |mAttributeSelectors|.
|
||||
@ -1030,7 +1029,6 @@ RuleCascadeData::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
|
||||
n += mFontFaceRules.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mKeyframesRules.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mFontFeatureValuesRules.SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mPageRules.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
return n;
|
||||
@ -1439,11 +1437,11 @@ static bool AttrMatchesValue(const nsAttrSelector* aAttrSelector,
|
||||
: static_cast<const nsStringComparator&>(ciComparator);
|
||||
|
||||
switch (aAttrSelector->mFunction) {
|
||||
case NS_ATTR_FUNC_EQUALS:
|
||||
case NS_ATTR_FUNC_EQUALS:
|
||||
return aValue.Equals(aAttrSelector->mValue, comparator);
|
||||
case NS_ATTR_FUNC_INCLUDES:
|
||||
case NS_ATTR_FUNC_INCLUDES:
|
||||
return ValueIncludes(aValue, aAttrSelector->mValue, comparator);
|
||||
case NS_ATTR_FUNC_DASHMATCH:
|
||||
case NS_ATTR_FUNC_DASHMATCH:
|
||||
return nsStyleUtil::DashMatchCompare(aValue, aAttrSelector->mValue, comparator);
|
||||
case NS_ATTR_FUNC_ENDSMATCH:
|
||||
return StringEndsWith(aValue, aAttrSelector->mValue, comparator);
|
||||
@ -2751,21 +2749,6 @@ nsCSSRuleProcessor::AppendPageRules(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsCSSRuleProcessor::AppendFontFeatureValuesRules(
|
||||
nsPresContext *aPresContext,
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& aArray)
|
||||
{
|
||||
RuleCascadeData* cascade = GetRuleCascade(aPresContext);
|
||||
|
||||
if (cascade) {
|
||||
if (!aArray.AppendElements(cascade->mFontFeatureValuesRules))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSRuleProcessor::ClearRuleCascades()
|
||||
{
|
||||
@ -3064,14 +3047,12 @@ struct CascadeEnumData {
|
||||
CascadeEnumData(nsPresContext* aPresContext,
|
||||
nsTArray<nsFontFaceRuleContainer>& aFontFaceRules,
|
||||
nsTArray<nsCSSKeyframesRule*>& aKeyframesRules,
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& aFontFeatureValuesRules,
|
||||
nsTArray<nsCSSPageRule*>& aPageRules,
|
||||
nsMediaQueryResultCacheKey& aKey,
|
||||
uint8_t aSheetType)
|
||||
: mPresContext(aPresContext),
|
||||
mFontFaceRules(aFontFaceRules),
|
||||
mKeyframesRules(aKeyframesRules),
|
||||
mFontFeatureValuesRules(aFontFeatureValuesRules),
|
||||
mPageRules(aPageRules),
|
||||
mCacheKey(aKey),
|
||||
mSheetType(aSheetType)
|
||||
@ -3095,7 +3076,6 @@ struct CascadeEnumData {
|
||||
nsPresContext* mPresContext;
|
||||
nsTArray<nsFontFaceRuleContainer>& mFontFaceRules;
|
||||
nsTArray<nsCSSKeyframesRule*>& mKeyframesRules;
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& mFontFeatureValuesRules;
|
||||
nsTArray<nsCSSPageRule*>& mPageRules;
|
||||
nsMediaQueryResultCacheKey& mCacheKey;
|
||||
PLArenaPool mArena;
|
||||
@ -3113,9 +3093,7 @@ struct CascadeEnumData {
|
||||
* but kept in order per-weight, and
|
||||
* (2) add any @font-face rules, in order, into data->mFontFaceRules.
|
||||
* (3) add any @keyframes rules, in order, into data->mKeyframesRules.
|
||||
* (4) add any @font-feature-value rules, in order,
|
||||
* into data->mFontFeatureValuesRules.
|
||||
* (5) add any @page rules, in order, into data->mPageRules.
|
||||
* (4) add any @page rules, in order, into data->mPageRules.
|
||||
*/
|
||||
static bool
|
||||
CascadeRuleEnumFunc(css::Rule* aRule, void* aData)
|
||||
@ -3168,13 +3146,6 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (css::Rule::FONT_FEATURE_VALUES_RULE == type) {
|
||||
nsCSSFontFeatureValuesRule *fontFeatureValuesRule =
|
||||
static_cast<nsCSSFontFeatureValuesRule*>(aRule);
|
||||
if (!data->mFontFeatureValuesRules.AppendElement(fontFeatureValuesRule)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (css::Rule::PAGE_RULE == type) {
|
||||
nsCSSPageRule* pageRule = static_cast<nsCSSPageRule*>(aRule);
|
||||
if (!data->mPageRules.AppendElement(pageRule)) {
|
||||
@ -3281,7 +3252,6 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext)
|
||||
if (newCascade) {
|
||||
CascadeEnumData data(aPresContext, newCascade->mFontFaceRules,
|
||||
newCascade->mKeyframesRules,
|
||||
newCascade->mFontFeatureValuesRules,
|
||||
newCascade->mPageRules,
|
||||
newCascade->mCacheKey,
|
||||
mSheetType);
|
||||
|
@ -128,9 +128,6 @@ public:
|
||||
bool AppendPageRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSPageRule*>& aArray);
|
||||
|
||||
bool AppendFontFeatureValuesRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& aArray);
|
||||
|
||||
/**
|
||||
* Returns the scope element for the scoped style sheets this rule
|
||||
* processor is for. If this is not a rule processor for scoped style
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
|
||||
#include "StyleRule.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -719,7 +718,7 @@ GroupRule::AppendRulesToCssText(nsAString& aCssText)
|
||||
}
|
||||
|
||||
aCssText.AppendLiteral("}");
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1911,255 +1910,6 @@ nsCSSFontFaceRule::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------
|
||||
// nsCSSFontFeatureValuesRule
|
||||
//
|
||||
|
||||
/* virtual */ already_AddRefed<css::Rule>
|
||||
nsCSSFontFeatureValuesRule::Clone() const
|
||||
{
|
||||
nsRefPtr<css::Rule> clone = new nsCSSFontFeatureValuesRule(*this);
|
||||
return clone.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsCSSFontFeatureValuesRule)
|
||||
NS_IMPL_RELEASE(nsCSSFontFeatureValuesRule)
|
||||
|
||||
DOMCI_DATA(CSSFontFeatureValuesRule, nsCSSFontFeatureValuesRule)
|
||||
|
||||
// QueryInterface implementation for nsCSSFontFeatureValuesRule
|
||||
NS_INTERFACE_MAP_BEGIN(nsCSSFontFeatureValuesRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSFontFeatureValuesRule)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStyleRule)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSFontFeatureValuesRule)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
IMPL_STYLE_RULE_INHERIT(nsCSSFontFeatureValuesRule, Rule)
|
||||
|
||||
static void
|
||||
FamilyListToString(const nsTArray<nsString>& aFamilyList, nsAString& aOutStr)
|
||||
{
|
||||
uint32_t i, n = aFamilyList.Length();
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
nsStyleUtil::AppendEscapedCSSString(aFamilyList[i], aOutStr);
|
||||
if (i != n - 1) {
|
||||
aOutStr.AppendLiteral(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FeatureValuesToString(
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aFeatureValues,
|
||||
nsAString& aOutStr)
|
||||
{
|
||||
uint32_t i, n;
|
||||
|
||||
// append values
|
||||
n = aFeatureValues.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
const gfxFontFeatureValueSet::FeatureValues& fv = aFeatureValues[i];
|
||||
|
||||
// @alternate
|
||||
aOutStr.AppendLiteral(" @");
|
||||
nsAutoString functAlt;
|
||||
nsStyleUtil::GetFunctionalAlternatesName(fv.alternate, functAlt);
|
||||
aOutStr.Append(functAlt);
|
||||
aOutStr.AppendLiteral(" {");
|
||||
|
||||
// for each ident-values tuple
|
||||
uint32_t j, numValues = fv.valuelist.Length();
|
||||
for (j = 0; j < numValues; j++) {
|
||||
aOutStr.AppendLiteral(" ");
|
||||
const gfxFontFeatureValueSet::ValueList& vlist = fv.valuelist[j];
|
||||
nsStyleUtil::AppendEscapedCSSIdent(vlist.name, aOutStr);
|
||||
aOutStr.AppendLiteral(":");
|
||||
|
||||
uint32_t k, numSelectors = vlist.featureSelectors.Length();
|
||||
for (k = 0; k < numSelectors; k++) {
|
||||
aOutStr.AppendLiteral(" ");
|
||||
aOutStr.AppendInt(vlist.featureSelectors[k]);
|
||||
}
|
||||
|
||||
aOutStr.AppendLiteral(";");
|
||||
}
|
||||
aOutStr.AppendLiteral(" }\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FontFeatureValuesRuleToString(
|
||||
const nsTArray<nsString>& aFamilyList,
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& aFeatureValues,
|
||||
nsAString& aOutStr)
|
||||
{
|
||||
aOutStr.AssignLiteral("@font-feature-values ");
|
||||
nsAutoString familyListStr, valueTextStr;
|
||||
FamilyListToString(aFamilyList, familyListStr);
|
||||
aOutStr.Append(familyListStr);
|
||||
aOutStr.AppendLiteral(" {\n");
|
||||
FeatureValuesToString(aFeatureValues, valueTextStr);
|
||||
aOutStr.Append(valueTextStr);
|
||||
aOutStr.AppendLiteral("}");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsCSSFontFeatureValuesRule::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
nsAutoString text;
|
||||
FontFeatureValuesRuleToString(mFamilyList, mFeatureValues, text);
|
||||
NS_ConvertUTF16toUTF8 utf8(text);
|
||||
|
||||
// replace newlines with newlines plus indent spaces
|
||||
char* indent = new char[(aIndent + 1) * 2];
|
||||
int32_t i;
|
||||
for (i = 1; i < (aIndent + 1) * 2 - 1; i++) {
|
||||
indent[i] = 0x20;
|
||||
}
|
||||
indent[0] = 0xa;
|
||||
indent[aIndent * 2 + 1] = 0;
|
||||
utf8.ReplaceSubstring("\n", indent);
|
||||
delete [] indent;
|
||||
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
fprintf(out, "%s\n", utf8.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
/* virtual */ int32_t
|
||||
nsCSSFontFeatureValuesRule::GetType() const
|
||||
{
|
||||
return Rule::FONT_FEATURE_VALUES_RULE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetType(uint16_t* aType)
|
||||
{
|
||||
*aType = nsIDOMCSSRule::FONT_FEATURE_VALUES_RULE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetCssText(nsAString& aCssText)
|
||||
{
|
||||
FontFeatureValuesRuleToString(mFamilyList, mFeatureValues, aCssText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::SetCssText(const nsAString& aCssText)
|
||||
{
|
||||
// FIXME: implement???
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet)
|
||||
{
|
||||
return Rule::GetParentStyleSheet(aSheet);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetParentRule(nsIDOMCSSRule** aParentRule)
|
||||
{
|
||||
return Rule::GetParentRule(aParentRule);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetFontFamily(nsAString& aFontFamily)
|
||||
{
|
||||
FamilyListToString(mFamilyList, aFontFamily);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::SetFontFamily(const nsAString& aFontFamily)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::GetValueText(nsAString& aValueText)
|
||||
{
|
||||
FeatureValuesToString(mFeatureValues, aValueText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFontFeatureValuesRule::SetValueText(const nsAString& aValueText)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
struct MakeFamilyArray {
|
||||
MakeFamilyArray(nsTArray<nsString>& aFamilyArray)
|
||||
: familyArray(aFamilyArray), hasGeneric(false)
|
||||
{}
|
||||
|
||||
static bool
|
||||
AddFamily(const nsString& aFamily, bool aGeneric, void* aData)
|
||||
{
|
||||
MakeFamilyArray *familyArr = reinterpret_cast<MakeFamilyArray*> (aData);
|
||||
if (!aGeneric && !aFamily.IsEmpty()) {
|
||||
familyArr->familyArray.AppendElement(aFamily);
|
||||
}
|
||||
if (aGeneric) {
|
||||
familyArr->hasGeneric = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsTArray<nsString>& familyArray;
|
||||
bool hasGeneric;
|
||||
};
|
||||
|
||||
void
|
||||
nsCSSFontFeatureValuesRule::SetFamilyList(const nsAString& aFamilyList,
|
||||
bool& aContainsGeneric)
|
||||
{
|
||||
nsFont font(aFamilyList, 0, 0, 0, 0, 0, 0);
|
||||
MakeFamilyArray families(mFamilyList);
|
||||
font.EnumerateFamilies(MakeFamilyArray::AddFamily, (void*) &families);
|
||||
aContainsGeneric = families.hasGeneric;
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFontFeatureValuesRule::AddValueList(int32_t aVariantAlternate,
|
||||
nsTArray<gfxFontFeatureValueSet::ValueList>& aValueList)
|
||||
{
|
||||
uint32_t i, len = mFeatureValues.Length();
|
||||
bool foundAlternate = false;
|
||||
|
||||
// add to an existing list for a given property value
|
||||
for (i = 0; i < len; i++) {
|
||||
gfxFontFeatureValueSet::FeatureValues& f = mFeatureValues.ElementAt(i);
|
||||
|
||||
if (f.alternate == uint32_t(aVariantAlternate)) {
|
||||
f.valuelist.AppendElements(aValueList);
|
||||
foundAlternate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create a new list for a given property value
|
||||
if (!foundAlternate) {
|
||||
gfxFontFeatureValueSet::FeatureValues &f = *mFeatureValues.AppendElement();
|
||||
f.alternate = aVariantAlternate;
|
||||
f.valuelist.AppendElements(aValueList);
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
nsCSSFontFeatureValuesRule::SizeOfIncludingThis(
|
||||
nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
// -------------------------------------------
|
||||
// nsCSSKeyframeStyleDeclaration
|
||||
//
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIDOMCSSConditionRule.h"
|
||||
#include "nsIDOMCSSFontFaceRule.h"
|
||||
#include "nsIDOMCSSFontFeatureValuesRule.h"
|
||||
#include "nsIDOMCSSGroupingRule.h"
|
||||
#include "nsIDOMCSSMediaRule.h"
|
||||
#include "nsIDOMCSSMozDocumentRule.h"
|
||||
@ -32,7 +31,6 @@
|
||||
#include "Declaration.h"
|
||||
#include "nsIDOMCSSPageRule.h"
|
||||
#include "StyleRule.h"
|
||||
#include "gfxFontFeatures.h"
|
||||
|
||||
class nsMediaList;
|
||||
|
||||
@ -214,7 +212,7 @@ protected:
|
||||
#include "nsCSSFontDescList.h"
|
||||
#undef CSS_FONT_DESC
|
||||
|
||||
static nsCSSValue nsCSSFontFaceStyleDecl::* const Fields[];
|
||||
static nsCSSValue nsCSSFontFaceStyleDecl::* const Fields[];
|
||||
inline nsCSSFontFaceRule* ContainingRule();
|
||||
inline const nsCSSFontFaceRule* ContainingRule() const;
|
||||
|
||||
@ -266,7 +264,7 @@ protected:
|
||||
nsCSSFontFaceStyleDecl mDecl;
|
||||
};
|
||||
|
||||
// nsFontFaceRuleContainer - used for associating sheet type with
|
||||
// nsFontFaceRuleContainer - used for associating sheet type with
|
||||
// specific @font-face rules
|
||||
struct nsFontFaceRuleContainer {
|
||||
nsRefPtr<nsCSSFontFaceRule> mRule;
|
||||
@ -287,61 +285,6 @@ nsCSSFontFaceStyleDecl::ContainingRule() const
|
||||
(reinterpret_cast<const char*>(this) - offsetof(nsCSSFontFaceRule, mDecl));
|
||||
}
|
||||
|
||||
class nsCSSFontFeatureValuesRule MOZ_FINAL :
|
||||
public mozilla::css::Rule,
|
||||
public nsIDOMCSSFontFeatureValuesRule
|
||||
{
|
||||
public:
|
||||
nsCSSFontFeatureValuesRule() {}
|
||||
|
||||
nsCSSFontFeatureValuesRule(const nsCSSFontFeatureValuesRule& aCopy)
|
||||
// copy everything except our reference count
|
||||
: mozilla::css::Rule(aCopy),
|
||||
mFamilyList(aCopy.mFamilyList),
|
||||
mFeatureValues(aCopy.mFeatureValues) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRule methods
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
// Rule methods
|
||||
DECL_STYLE_RULE_INHERIT
|
||||
|
||||
virtual int32_t GetType() const MOZ_OVERRIDE;
|
||||
virtual already_AddRefed<mozilla::css::Rule> Clone() const MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMCSSRule interface
|
||||
NS_DECL_NSIDOMCSSRULE
|
||||
|
||||
// nsIDOMCSSFontFaceRule interface
|
||||
NS_DECL_NSIDOMCSSFONTFEATUREVALUESRULE
|
||||
|
||||
const nsTArray<nsString>& GetFamilyList() { return mFamilyList; }
|
||||
void SetFamilyList(const nsAString& aFamilyList, bool& aContainsGeneric);
|
||||
|
||||
void AddValueList(int32_t aVariantAlternate,
|
||||
nsTArray<gfxFontFeatureValueSet::ValueList>& aValueList);
|
||||
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>& GetFeatureValues()
|
||||
{
|
||||
return mFeatureValues;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
static bool PrefEnabled()
|
||||
{
|
||||
return mozilla::Preferences::GetBool("layout.css.font-features.enabled");
|
||||
}
|
||||
|
||||
protected:
|
||||
nsTArray<nsString> mFamilyList;
|
||||
nsTArray<gfxFontFeatureValueSet::FeatureValues> mFeatureValues;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
||||
|
@ -806,10 +806,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
aResult.AppendInt(GetIntValue(), 10);
|
||||
}
|
||||
else if (eCSSUnit_Enumerated == unit) {
|
||||
int32_t intValue = GetIntValue();
|
||||
switch(aProperty) {
|
||||
|
||||
case eCSSProperty_text_decoration_line:
|
||||
if (eCSSProperty_text_decoration_line == aProperty) {
|
||||
int32_t intValue = GetIntValue();
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
|
||||
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
|
||||
aResult);
|
||||
@ -823,9 +821,9 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
|
||||
aResult);
|
||||
}
|
||||
break;
|
||||
|
||||
case eCSSProperty_marks:
|
||||
}
|
||||
else if (eCSSProperty_marks == aProperty) {
|
||||
int32_t intValue = GetIntValue();
|
||||
if (intValue == NS_STYLE_PAGE_MARKS_NONE) {
|
||||
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
|
||||
aResult);
|
||||
@ -835,48 +833,17 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
NS_STYLE_PAGE_MARKS_REGISTER,
|
||||
aResult);
|
||||
}
|
||||
break;
|
||||
|
||||
case eCSSProperty_paint_order:
|
||||
}
|
||||
else if (eCSSProperty_paint_order == aProperty) {
|
||||
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);
|
||||
break;
|
||||
|
||||
case eCSSProperty_font_synthesis:
|
||||
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);
|
||||
}
|
||||
else {
|
||||
const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, GetIntValue());
|
||||
AppendASCIItoUTF16(name, aResult);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (eCSSUnit_EnumColor == unit) {
|
||||
@ -1090,27 +1057,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
|
||||
aResult.AppendLiteral(")");
|
||||
} else if (eCSSUnit_Pair == unit) {
|
||||
if (eCSSProperty_font_variant_alternates == aProperty) {
|
||||
int32_t intValue = GetPairValue().mXValue.GetIntValue();
|
||||
nsAutoString out;
|
||||
|
||||
// simple, enumerated values
|
||||
nsStyleUtil::AppendBitmaskCSSValue(aProperty,
|
||||
intValue & NS_FONT_VARIANT_ALTERNATES_ENUMERATED_MASK,
|
||||
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
||||
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
||||
out);
|
||||
|
||||
// functional values
|
||||
const nsCSSValueList *list = GetPairValue().mYValue.GetListValue();
|
||||
nsAutoTArray<gfxAlternateValue,8> altValues;
|
||||
|
||||
nsStyleUtil::ComputeFunctionalAlternates(list, altValues);
|
||||
nsStyleUtil::SerializeFunctionalAlternates(altValues, out);
|
||||
aResult.Append(out);
|
||||
} else {
|
||||
GetPairValue().AppendToString(aProperty, aResult);
|
||||
}
|
||||
GetPairValue().AppendToString(aProperty, aResult);
|
||||
} else if (eCSSUnit_Triplet == unit) {
|
||||
GetTripletValue().AppendToString(aProperty, aResult);
|
||||
} else if (eCSSUnit_Rect == unit) {
|
||||
|
@ -1332,16 +1332,6 @@ nsComputedDOMStyle::DoGetFontFeatureSettings()
|
||||
return val;
|
||||
}
|
||||
|
||||
CSSValue*
|
||||
nsComputedDOMStyle::DoGetFontKerning()
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
val->SetIdent(
|
||||
nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.kerning,
|
||||
nsCSSProps::kFontKerningKTable));
|
||||
return val;
|
||||
}
|
||||
|
||||
CSSValue*
|
||||
nsComputedDOMStyle::DoGetFontLanguageOverride()
|
||||
{
|
||||
@ -1358,157 +1348,6 @@ 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::DoGetFontVariantAlternates()
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
|
||||
int32_t intValue = StyleFont()->mFont.variantAlternates;
|
||||
|
||||
if (0 == intValue) {
|
||||
val->SetIdent(eCSSKeyword_normal);
|
||||
return val;
|
||||
}
|
||||
|
||||
// first, include enumerated values
|
||||
nsAutoString valueStr;
|
||||
|
||||
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_alternates,
|
||||
intValue & NS_FONT_VARIANT_ALTERNATES_ENUMERATED_MASK,
|
||||
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
||||
NS_FONT_VARIANT_ALTERNATES_HISTORICAL, valueStr);
|
||||
|
||||
// next, include functional values if present
|
||||
if (intValue & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) {
|
||||
nsStyleUtil::SerializeFunctionalAlternates(StyleFont()->mFont.alternateValues,
|
||||
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,
|
||||
@ -4922,19 +4761,11 @@ 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_alternates, FontVariantAlternates),
|
||||
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),
|
||||
|
@ -188,21 +188,13 @@ 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* DoGetFontSynthesis();
|
||||
mozilla::dom::CSSValue* DoGetFontVariant();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantAlternates();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantCaps();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantEastAsian();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantLigatures();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantNumeric();
|
||||
mozilla::dom::CSSValue* DoGetFontVariantPosition();
|
||||
mozilla::dom::CSSValue* DoGetFontWeight();
|
||||
mozilla::dom::CSSValue* DoGetFontVariant();
|
||||
|
||||
/* Background properties */
|
||||
mozilla::dom::CSSValue* DoGetBackgroundAttachment();
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "CSSCalc.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsStyleUtil.h"
|
||||
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
|
||||
@ -3274,109 +3273,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
|
||||
aFont->mScriptLevel = 0;
|
||||
}
|
||||
|
||||
// font-kerning: none, 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: none, enum (bit field), inherit, initial, -moz-system-font
|
||||
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-alternates: normal, enum (bit field) + functions, inherit,
|
||||
// initial, -moz-system-font
|
||||
const nsCSSValue* variantAlternatesValue =
|
||||
aRuleData->ValueForFontVariantAlternates();
|
||||
int32_t variantAlternates = 0;
|
||||
|
||||
switch (variantAlternatesValue->GetUnit()) {
|
||||
case eCSSUnit_Inherit:
|
||||
aFont->mFont.CopyAlternates(aParentFont->mFont);
|
||||
aCanStoreInRuleTree = false;
|
||||
break;
|
||||
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_Normal:
|
||||
aFont->mFont.variantAlternates = 0;
|
||||
aFont->mFont.alternateValues.Clear();
|
||||
aFont->mFont.featureValueLookup = nullptr;
|
||||
break;
|
||||
|
||||
case eCSSUnit_Pair:
|
||||
NS_ASSERTION(variantAlternatesValue->GetPairValue().mXValue.GetUnit() ==
|
||||
eCSSUnit_Enumerated, "strange unit for variantAlternates");
|
||||
variantAlternates =
|
||||
variantAlternatesValue->GetPairValue().mXValue.GetIntValue();
|
||||
aFont->mFont.variantAlternates = variantAlternates;
|
||||
|
||||
if (variantAlternates & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) {
|
||||
// fetch the feature lookup object from the styleset
|
||||
aFont->mFont.featureValueLookup =
|
||||
aPresContext->StyleSet()->GetFontFeatureValuesLookup();
|
||||
|
||||
NS_ASSERTION(variantAlternatesValue->GetPairValue().mYValue.GetUnit() ==
|
||||
eCSSUnit_List, "function list not a list value");
|
||||
nsStyleUtil::ComputeFunctionalAlternates(
|
||||
variantAlternatesValue->GetPairValue().mYValue.GetListValue(),
|
||||
aFont->mFont.alternateValues);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// font-variant-caps: normal, enum, inherit, initial, -moz-system-font
|
||||
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: normal, enum (bit field), inherit, initial,
|
||||
// -moz-system-font
|
||||
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: normal, enum (bit field), inherit, initial,
|
||||
// -moz-system-font
|
||||
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: normal, enum (bit field), inherit, initial,
|
||||
// -moz-system-font
|
||||
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: normal, enum, inherit, initial,
|
||||
// -moz-system-font
|
||||
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();
|
||||
|
@ -110,7 +110,6 @@ nsStyleSet::nsStyleSet()
|
||||
mInShutdown(false),
|
||||
mAuthorStyleDisabled(false),
|
||||
mInReconstruct(false),
|
||||
mInitFontFeatureValuesLookup(true),
|
||||
mDirty(0),
|
||||
mUnusedRuleNodeCount(0)
|
||||
{
|
||||
@ -1105,7 +1104,7 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||
|
||||
if (mRuleProcessors[ePresHintSheet])
|
||||
(*aFunc)(mRuleProcessors[ePresHintSheet], aData);
|
||||
|
||||
|
||||
bool cutOffInheritance = false;
|
||||
if (mBindingManager) {
|
||||
// We can supply additional document-level sheets that should be walked.
|
||||
@ -1541,59 +1540,6 @@ nsStyleSet::AppendKeyframesRules(nsPresContext* aPresContext,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleSet::AppendFontFeatureValuesRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& aArray)
|
||||
{
|
||||
NS_ENSURE_FALSE(mInShutdown, false);
|
||||
|
||||
for (uint32_t i = 0; i < NS_ARRAY_LENGTH(gCSSSheetTypes); ++i) {
|
||||
nsCSSRuleProcessor *ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
if (ruleProc &&
|
||||
!ruleProc->AppendFontFeatureValuesRules(aPresContext, aArray))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxFontFeatureValueSet>
|
||||
nsStyleSet::GetFontFeatureValuesLookup()
|
||||
{
|
||||
if (mInitFontFeatureValuesLookup) {
|
||||
mInitFontFeatureValuesLookup = false;
|
||||
|
||||
nsTArray<nsCSSFontFeatureValuesRule*> rules;
|
||||
AppendFontFeatureValuesRules(PresContext(), rules);
|
||||
|
||||
mFontFeatureValuesLookup = new gfxFontFeatureValueSet();
|
||||
|
||||
uint32_t i, numRules = rules.Length();
|
||||
for (i = 0; i < numRules; i++) {
|
||||
nsCSSFontFeatureValuesRule *rule = rules[i];
|
||||
|
||||
const nsTArray<nsString>& familyList = rule->GetFamilyList();
|
||||
const nsTArray<gfxFontFeatureValueSet::FeatureValues>&
|
||||
featureValues = rule->GetFeatureValues();
|
||||
|
||||
// for each family
|
||||
uint32_t f, numFam;
|
||||
|
||||
numFam = familyList.Length();
|
||||
for (f = 0; f < numFam; f++) {
|
||||
const nsString& family = familyList.ElementAt(f);
|
||||
nsAutoString silly(family);
|
||||
mFontFeatureValuesLookup->AddFontFeatureValues(silly, featureValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<gfxFontFeatureValueSet> lookup = mFontFeatureValuesLookup;
|
||||
return lookup.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleSet::AppendPageRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSPageRule*>& aArray)
|
||||
@ -1866,7 +1812,7 @@ struct MOZ_STACK_CLASS AttributeData : public AttributeRuleProcessorData {
|
||||
mHint(nsRestyleHint(0))
|
||||
{}
|
||||
nsRestyleHint mHint;
|
||||
};
|
||||
};
|
||||
|
||||
static bool
|
||||
SheetHasAttributeStyle(nsIStyleRuleProcessor* aProcessor, void *aData)
|
||||
|
@ -23,12 +23,11 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "gfxFontFeatures.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsCSSFontFaceRule;
|
||||
class nsCSSKeyframesRule;
|
||||
class nsCSSFontFeatureValuesRule;
|
||||
class nsCSSPageRule;
|
||||
class nsRuleWalker;
|
||||
struct ElementDependentRuleProcessorData;
|
||||
@ -138,7 +137,7 @@ class nsStyleSet
|
||||
nsCSSPseudoElements::Type aType,
|
||||
nsStyleContext* aParentContext,
|
||||
TreeMatchContext& aTreeMatchContext);
|
||||
|
||||
|
||||
// Get a style context for an anonymous box. aPseudoTag is the
|
||||
// pseudo-tag to use and must be non-null.
|
||||
already_AddRefed<nsStyleContext>
|
||||
@ -165,14 +164,6 @@ class nsStyleSet
|
||||
bool AppendKeyframesRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSKeyframesRule*>& aArray);
|
||||
|
||||
// Fetch object for looking up font feature values
|
||||
already_AddRefed<gfxFontFeatureValueSet> GetFontFeatureValuesLookup();
|
||||
|
||||
// Append all the currently-active font feature values rules to aArray.
|
||||
// Return true for success and false for failure.
|
||||
bool AppendFontFeatureValuesRules(nsPresContext* aPresContext,
|
||||
nsTArray<nsCSSFontFeatureValuesRule*>& aArray);
|
||||
|
||||
// Append all the currently-active page rules to aArray. Return
|
||||
// true for success and false for failure.
|
||||
bool AppendPageRules(nsPresContext* aPresContext,
|
||||
@ -415,7 +406,6 @@ class nsStyleSet
|
||||
unsigned mInShutdown : 1;
|
||||
unsigned mAuthorStyleDisabled: 1;
|
||||
unsigned mInReconstruct : 1;
|
||||
unsigned mInitFontFeatureValuesLookup : 1;
|
||||
unsigned mDirty : 9; // one dirty bit is used per sheet type
|
||||
|
||||
uint32_t mUnusedRuleNodeCount; // used to batch rule node GC
|
||||
@ -433,9 +423,6 @@ class nsStyleSet
|
||||
// BeginReconstruct and EndReconstruct, but in case of bugs that cause
|
||||
// style contexts to exist too long, may last longer.
|
||||
nsTArray<nsRuleNode*> mOldRuleTrees;
|
||||
|
||||
// whether font feature values lookup object needs initialization
|
||||
nsRefPtr<gfxFontFeatureValueSet> mFontFeatureValuesLookup;
|
||||
};
|
||||
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
|
@ -192,16 +192,6 @@ 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.variantAlternates == aFont2.variantAlternates) &&
|
||||
(aFont1.alternateValues == aFont2.alternateValues) &&
|
||||
(aFont1.featureValueLookup == aFont2.featureValueLookup) &&
|
||||
(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)) {
|
||||
|
@ -269,118 +269,6 @@ nsStyleUtil::AppendFontFeatureSettings(const nsCSSValue& aSrc,
|
||||
AppendFontFeatureSettings(featureSettings, aResult);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsStyleUtil::GetFunctionalAlternatesName(int32_t aFeature,
|
||||
nsAString& aFeatureName)
|
||||
{
|
||||
aFeatureName.Truncate();
|
||||
nsCSSKeyword key =
|
||||
nsCSSProps::ValueToKeywordEnum(aFeature,
|
||||
nsCSSProps::kFontVariantAlternatesFuncsKTable);
|
||||
|
||||
NS_ASSERTION(key != eCSSKeyword_UNKNOWN, "bad alternate feature type");
|
||||
AppendUTF8toUTF16(nsCSSKeywords::GetStringValue(key), aFeatureName);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsStyleUtil::SerializeFunctionalAlternates(
|
||||
const nsTArray<gfxAlternateValue>& aAlternates,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsAutoString funcName, funcParams;
|
||||
uint32_t numValues = aAlternates.Length();
|
||||
|
||||
uint32_t feature = 0;
|
||||
for (uint32_t i = 0; i < numValues; i++) {
|
||||
const gfxAlternateValue& v = aAlternates.ElementAt(i);
|
||||
if (feature != v.alternate) {
|
||||
feature = v.alternate;
|
||||
if (!funcName.IsEmpty() && !funcParams.IsEmpty()) {
|
||||
if (!aResult.IsEmpty()) {
|
||||
aResult.Append(PRUnichar(' '));
|
||||
}
|
||||
|
||||
// append the previous functional value
|
||||
aResult.Append(funcName);
|
||||
aResult.Append(PRUnichar('('));
|
||||
aResult.Append(funcParams);
|
||||
aResult.Append(PRUnichar(')'));
|
||||
}
|
||||
|
||||
// function name
|
||||
GetFunctionalAlternatesName(v.alternate, funcName);
|
||||
NS_ASSERTION(!funcName.IsEmpty(), "unknown property value name");
|
||||
|
||||
// function params
|
||||
AppendEscapedCSSIdent(v.value, funcParams);
|
||||
} else {
|
||||
if (!funcParams.IsEmpty()) {
|
||||
funcParams.Append(NS_LITERAL_STRING(", "));
|
||||
}
|
||||
AppendEscapedCSSIdent(v.value, funcParams);
|
||||
}
|
||||
}
|
||||
|
||||
// append the previous functional value
|
||||
if (!funcName.IsEmpty() && !funcParams.IsEmpty()) {
|
||||
if (!aResult.IsEmpty()) {
|
||||
aResult.Append(PRUnichar(' '));
|
||||
}
|
||||
|
||||
aResult.Append(funcName);
|
||||
aResult.Append(PRUnichar('('));
|
||||
aResult.Append(funcParams);
|
||||
aResult.Append(PRUnichar(')'));
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsStyleUtil::ComputeFunctionalAlternates(const nsCSSValueList* aList,
|
||||
nsTArray<gfxAlternateValue>& aAlternateValues)
|
||||
{
|
||||
gfxAlternateValue v;
|
||||
|
||||
aAlternateValues.Clear();
|
||||
for (const nsCSSValueList* curr = aList; curr != nullptr; curr = curr->mNext) {
|
||||
// list contains function units
|
||||
if (curr->mValue.GetUnit() != eCSSUnit_Function) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// element 0 is the propval in ident form
|
||||
const nsCSSValue::Array *func = curr->mValue.GetArrayValue();
|
||||
|
||||
// lookup propval
|
||||
nsAutoString keywordStr;
|
||||
func->Item(0).GetStringValue(keywordStr);
|
||||
nsCSSKeyword key = nsCSSKeywords::LookupKeyword(keywordStr);
|
||||
NS_ASSERTION(key != eCSSKeyword_UNKNOWN, "unknown alternate property value");
|
||||
|
||||
int32_t alternate;
|
||||
if (key == eCSSKeyword_UNKNOWN ||
|
||||
!nsCSSProps::FindKeyword(key,
|
||||
nsCSSProps::kFontVariantAlternatesFuncsKTable,
|
||||
alternate)) {
|
||||
NS_NOTREACHED("keyword not a font-variant-alternates value");
|
||||
}
|
||||
v.alternate = alternate;
|
||||
|
||||
// other elements are the idents associated with the propval
|
||||
// append one alternate value for each one
|
||||
uint32_t numElems = func->Count();
|
||||
for (uint32_t i = 1; i < numElems; i++) {
|
||||
const nsCSSValue& value = func->Item(i);
|
||||
NS_ASSERTION(value.GetUnit() == eCSSUnit_Ident,
|
||||
"weird unit found in variant alternate");
|
||||
if (value.GetUnit() != eCSSUnit_Ident) {
|
||||
continue;
|
||||
}
|
||||
value.GetStringValue(v.value);
|
||||
aAlternateValues.AppendElement(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ float
|
||||
nsStyleUtil::ColorComponentToFloat(uint8_t aAlpha)
|
||||
{
|
||||
|
@ -7,13 +7,11 @@
|
||||
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSProperty.h"
|
||||
#include "gfxFontFeatures.h"
|
||||
|
||||
class nsCSSValue;
|
||||
class nsStringComparator;
|
||||
class nsIContent;
|
||||
struct gfxFontFeature;
|
||||
class nsCSSValueList;
|
||||
template <class E> class nsTArray;
|
||||
|
||||
// Style utility functions
|
||||
@ -51,20 +49,6 @@ public:
|
||||
static void AppendFontFeatureSettings(const nsCSSValue& src,
|
||||
nsAString& aResult);
|
||||
|
||||
// convert bitmask value to keyword name for a functional alternate
|
||||
static void GetFunctionalAlternatesName(int32_t aFeature,
|
||||
nsAString& aFeatureName);
|
||||
|
||||
// Append functional font-variant-alternates values to string
|
||||
static void
|
||||
SerializeFunctionalAlternates(const nsTArray<gfxAlternateValue>& aAlternates,
|
||||
nsAString& aResult);
|
||||
|
||||
// List of functional font-variant-alternates values to feature/value pairs
|
||||
static void
|
||||
ComputeFunctionalAlternates(const nsCSSValueList* aList,
|
||||
nsTArray<gfxAlternateValue>& aAlternateValues);
|
||||
|
||||
/*
|
||||
* Convert an author-provided floating point number to an integer (0
|
||||
* ... 255) appropriate for use in the alpha component of a color.
|
||||
|
@ -101,7 +101,6 @@ MOCHITEST_FILES = test_acid3_test46.html \
|
||||
test_dont_use_document_colors.html \
|
||||
test_font_face_parser.html \
|
||||
test_font_family_parsing.html \
|
||||
test_font_feature_values_parsing.html \
|
||||
test_garbage_at_end_of_declarations.html \
|
||||
test_group_insertRule.html \
|
||||
test_html_attribute_computed_values.html \
|
||||
|
@ -2491,7 +2491,7 @@ var gCSSProperties = {
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [ "small-caps" ],
|
||||
invalid_values: [ "small-caps normal" ]
|
||||
invalid_values: []
|
||||
},
|
||||
"font-weight": {
|
||||
domProp: "fontWeight",
|
||||
@ -4257,129 +4257,6 @@ 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-alternates": {
|
||||
domProp: "fontVariantAlternates",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [ "historical-forms",
|
||||
"styleset(alt-a, alt-b)", "character-variant(a, b, c)", "annotation(circled)",
|
||||
"swash(squishy)", "styleset(complex\\ blob, a)", "annotation(\\62 lah)" ],
|
||||
invalid_values: [ "historical-forms normal", "historical-forms historical-forms",
|
||||
"swash", "swash(3)", "annotation(a, b)", "ornaments(a,b)",
|
||||
"styleset(1234blah)", "annotation(a), annotation(b)", "annotation(a) normal" ]
|
||||
},
|
||||
"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: [ "normal small-caps", "petite-caps normal", "unicase unicase" ]
|
||||
},
|
||||
"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", "diagonal-fractions diagonal-fractions" ]
|
||||
},
|
||||
"font-variant-position": {
|
||||
domProp: "fontVariantPosition",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [ "super", "sub" ],
|
||||
invalid_values: [ "normal sub", "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", "weight weight", "style style" ]
|
||||
},
|
||||
// aliases for prefixed properties
|
||||
"font-feature-settings": {
|
||||
domProp: "fontFeatureSettings",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
alias_for: "-moz-font-feature-settings",
|
||||
subproperties: [ "-moz-font-feature-settings" ],
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [
|
||||
"'liga' on", "'liga'", "\"liga\" 1", "'liga', 'clig' 1",
|
||||
"\"liga\" off", "\"liga\" 0", '"cv01" 3, "cv02" 4',
|
||||
'"cswh", "smcp" off, "salt" 4', '"cswh" 1, "smcp" off, "salt" 4',
|
||||
'"cswh" 0, \'blah\', "liga", "smcp" off, "salt" 4',
|
||||
'"liga" ,"smcp" 0 , "blah"'
|
||||
],
|
||||
invalid_values: [
|
||||
'liga', 'liga 1', 'liga normal', '"liga" normal', 'normal liga',
|
||||
'normal "liga"', 'normal, "liga"', '"liga=1"', "'foobar' on",
|
||||
'"blahblah" 0', '"liga" 3.14', '"liga" 1 3.14', '"liga" 1 normal',
|
||||
'"liga" 1 off', '"liga" on off', '"liga" , 0 "smcp"', '"liga" "smcp"'
|
||||
]
|
||||
},
|
||||
"font-language-override": {
|
||||
domProp: "fontLanguageOverride",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
alias_for: "-moz-font-language-override",
|
||||
subproperties: [ "-moz-font-language-override" ],
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [ "'ENG'", "'TRK'", "\"TRK\"", "'N\\'Ko'" ],
|
||||
invalid_values: [ "TRK", "ja" ]
|
||||
}
|
||||
};
|
||||
for (var prop in fontFeatureProperties) {
|
||||
gCSSProperties[prop] = fontFeatureProperties[prop];
|
||||
}
|
||||
var fontAdditions = [ "font-kerning", "font-synthesis", "font-variant-alternates", "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",
|
||||
|
@ -61,21 +61,6 @@ 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-alternates": "normal", // 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], "");
|
||||
}
|
||||
|
@ -1,356 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<title>@font-feature-values rule parsing tests</title>
|
||||
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
|
||||
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-feature-values" />
|
||||
<meta name="assert" content="tests that valid @font-feature-values rules parse and invalid ones don't" />
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=549861 -->
|
||||
<script type="text/javascript" src="/resources/testharness.js"></script>
|
||||
<script type="text/javascript" src="/resources/testharnessreport.js"></script>
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<pre id="display"></pre>
|
||||
<style type="text/css" id="testbox"></style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var gPrefix = "";
|
||||
var kFontFeatureValuesRuleType = 14;
|
||||
|
||||
function ruleName() { return "@" + gPrefix + "font-feature-values"; }
|
||||
function makeRule(f, v) {
|
||||
return ruleName() + " " + f + " { " + v + " }";
|
||||
}
|
||||
|
||||
function _()
|
||||
{
|
||||
var i, decl = [];
|
||||
for (i = 0; i < arguments.length; i++) {
|
||||
decl.push(arguments[i]);
|
||||
}
|
||||
return makeRule("bongo", decl.join(" "));
|
||||
}
|
||||
|
||||
// note: because of bugs in the way family names are serialized,
|
||||
// 'serializationSame' only implies that the value definition block
|
||||
// is the same (i.e. not including the family name list)
|
||||
|
||||
var testrules = [
|
||||
|
||||
/* basic syntax */
|
||||
{ rule: ruleName() + ";", invalid: true },
|
||||
{ rule: ruleName() + " bongo;", invalid: true },
|
||||
{ rule: ruleName().replace("values", "value") + " {;}", invalid: true },
|
||||
{ rule: ruleName().replace("feature", "features") + " {;}", invalid: true },
|
||||
{ rule: makeRule("bongo", ""), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", ";"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", ",;"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", ";,"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", ",;,"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset;"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset,;"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset abc;"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { ;;abc }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc;; }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc: }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc,: }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc:, }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc:,; }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { a,b }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { a;b }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { a:;b: }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { a:,;b: }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { a:1,;b: }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc 1 2 3 }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc:, 1 2 3 }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc:; 1 2 3 }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc:; 1 2 3 }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc: 1 2 3a }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@styleset { abc: 1 2 3, def: 1; }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@blah @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@blah } @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
|
||||
{ rule: makeRule("bongo", "@blah , @styleset { abc: 1 2 3; }"), serializationNoValueDefn: true },
|
||||
{ rule: ruleName() + " bongo { @styleset { abc: 1 2 3; }", serialization: _("@styleset { abc: 1 2 3; }") },
|
||||
{ rule: ruleName() + " bongo { @styleset { abc: 1 2 3 }", serialization: _("@styleset { abc: 1 2 3; }") },
|
||||
{ rule: ruleName() + " bongo { @styleset { abc: 1 2 3;", serialization: _("@styleset { abc: 1 2 3; }") },
|
||||
{ rule: ruleName() + " bongo { @styleset { abc: 1 2 3", serialization: _("@styleset { abc: 1 2 3; }") },
|
||||
{ rule: _("@styleset { ok-1: 1; }"), serializationSame: true },
|
||||
{ rule: _("@annotation { ok-1: 3; }"), serializationSame: true },
|
||||
{ rule: _("@stylistic { blah: 3; }"), serializationSame: true },
|
||||
{ rule: makeRule("bongo", "\n@styleset\n { blah: 3; super-blah: 4 5;\n more-blah: 5 6 7;\n }"), serializationSame: true },
|
||||
{ rule: makeRule("bongo", "\n@styleset\n {\n blah:\n 3\n;\n super-blah:\n 4\n 5\n;\n more-blah:\n 5 6\n 7;\n }"), serializationSame: true },
|
||||
|
||||
/* limits on number of values */
|
||||
{ rule: _("@stylistic { blah: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { blah: 1 2 3 4; }"), serializationSame: true },
|
||||
{ rule: _("@character-variant { blah: 1 2; }"), serializationSame: true },
|
||||
{ rule: _("@swash { blah: 1; }"), serializationSame: true },
|
||||
{ rule: _("@ornaments { blah: 1; }"), serializationSame: true },
|
||||
{ rule: _("@annotation { blah: 1; }"), serializationSame: true },
|
||||
|
||||
/* values ignored when used */
|
||||
{ rule: _("@styleset { blah: 0; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { blah: 120 124; }"), serializationSame: true },
|
||||
{ rule: _("@character-variant { blah: 0; }"), serializationSame: true },
|
||||
{ rule: _("@character-variant { blah: 111; }"), serializationSame: true },
|
||||
{ rule: _("@character-variant { blah: 111 13; }"), serializationSame: true },
|
||||
|
||||
/* invalid value name */
|
||||
{ rulesrc: ["styleset { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["stylistic { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["character-variant { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["swash { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["ornaments { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["annotation { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@bongo { blah: 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@bongo { blah: 1 2 3 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@bongo { blah: 1 2 3; burp: 1;;; }"], serializationNoValueDefn: true },
|
||||
|
||||
/* values */
|
||||
{ rulesrc: ["@styleset { blah: -1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1 -1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1.5 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 15px }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: red }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: (1) }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah:(1) }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah:, 1 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: <1> }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1! }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1,, }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1 1 1 1; }"], serializationSame: true },
|
||||
|
||||
/* limits on number of values */
|
||||
{ rulesrc: ["@stylistic { blah: 1 2 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@character-variant { blah: 1 2 3 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@swash { blah: 1 2 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@ornaments { blah: 1 2 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@annotation { blah: 1 2 }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { blah: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; }"], serializationSame: true },
|
||||
|
||||
/* family names */
|
||||
{ rule: makeRule("bongo", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("\"bongo\"", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("'bongo'", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("\\62 ongo", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("bongo, super bongo, bongo the supreme", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("bongo,, super bongo", "@styleset { blah: 1; }"), invalid: true },
|
||||
{ rule: makeRule("bongo,*", "@styleset { blah: 1; }"), invalid: true },
|
||||
{ rule: makeRule("bongo, sans-serif", "@styleset { blah: 1; }"), invalid: true },
|
||||
{ rule: makeRule("serif, sans-serif", "@styleset { blah: 1; }"), invalid: true },
|
||||
{ rule: makeRule("'serif', 'sans-serif'", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("bongo, \"super bongo\", 'bongo the supreme'", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("毎日カレーを食べたい!", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
{ rule: makeRule("毎日カレーを食べたい!, 納豆嫌い", "@styleset { blah: 1; }"), serializationSame: true },
|
||||
|
||||
{ rule: makeRule("bongo, \"super\" bongo, bongo the supreme", "@styleset { blah: 1; }"), invalid: true },
|
||||
{ rule: makeRule("--bongo", "@styleset { blah: 1; }"), invalid: true },
|
||||
|
||||
/* ident tests */
|
||||
{ rule: _("@styleset { blah: 1; blah: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { blah: 1; de-blah: 1; blah: 2; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { \\tra-la: 1; }"), serialization: _("@styleset { tra-la: 1; }") },
|
||||
{ rule: _("@styleset { b\\lah: 1; }"), serialization: _("@styleset { blah: 1; }") },
|
||||
{ rule: _("@styleset { \\62 lah: 1; }"), serialization: _("@styleset { blah: 1; }") },
|
||||
{ rule: _("@styleset { \\:blah: 1; }"), serialization: _("@styleset { \\:blah: 1; }") },
|
||||
{ rule: _("@styleset { \\;blah: 1; }"), serialization: _("@styleset { \\;blah: 1; }") },
|
||||
{ rule: _("@styleset { complex\\20 blah: 1; }"), serialization: _("@styleset { complex\\ blah: 1; }") },
|
||||
{ rule: _("@styleset { complex\\ blah: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { Håkon: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { Åквариум: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { \\1f449\\1f4a9\\1f448: 1; }"), serialization: _("@styleset { 👉💩👈: 1; }") },
|
||||
{ rule: _("@styleset { 魅力: 1; }"), serializationSame: true },
|
||||
{ rule: _("@styleset { 毎日カレーを食べたい!: 1; }"), serializationSame: true },
|
||||
/* from http://en.wikipedia.org/wiki/Metal_umlaut */
|
||||
{ rule: _("@styleset { TECHNICIÄNS\\ ÖF\\ SPÅCE\\ SHIP\\ EÅRTH\\ THIS\\ IS\\ YÖÜR\\ CÄPTÅIN\\ SPEÄKING\\ YÖÜR\\ ØÅPTÅIN\\ IS\\ DEA̋D: 1; }"), serializationSame: true },
|
||||
|
||||
{ rulesrc: ["@styleset { 123blah: 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { :123blah 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { :123blah: 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { ?123blah: 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { \"blah\": 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { complex blah: 1; }"], serializationNoValueDefn: true },
|
||||
{ rulesrc: ["@styleset { complex\\ blah: 1; }"], serializationNoValueDefn: true }
|
||||
|
||||
];
|
||||
|
||||
// test that invalid value declarations don't affect the parsing of surrounding
|
||||
// declarations. So before + invalid + after should match the serialization
|
||||
// given in s.
|
||||
|
||||
var gSurroundingTests = [
|
||||
// -- invalid, valid ==> valid
|
||||
{ before: "", after: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }") },
|
||||
|
||||
// -- valid, invalid ==> valid
|
||||
{ before: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 7; }", after: "", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 7; }") },
|
||||
|
||||
// -- valid, invalid, valid ==> valid, valid
|
||||
{ before: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; }", after: "@character-variant { whatchamacallit-2: 23 4; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 3; } @character-variant { whatchamacallit-2: 23 4; }") },
|
||||
|
||||
// -- invalid, valid, invalid ==> valid
|
||||
{ between: "@ornaments { whatchamacallit-1: 23; thingy-dingy: 4; }", s: _("@ornaments { whatchamacallit-1: 23; thingy-dingy: 4; }") }
|
||||
];
|
||||
|
||||
/* strip out just values, along with empty value blocks (e.g. @swash { })*/
|
||||
function valuesText(ruletext)
|
||||
{
|
||||
var t = ruletext.replace(/@[a-zA-Z0-9\-]+[ \n]*{[ \n]*}/g, "");
|
||||
t = t.replace(/[ \n]+/g, " ");
|
||||
t = t.replace(/^[^{]+{[ \n]*/, "");
|
||||
t = t.replace(/[ \n]*}[^}]*$/, "");
|
||||
t = t.replace(/[ \n]*;/g, ";");
|
||||
return t;
|
||||
}
|
||||
|
||||
function testParse(rulesrc)
|
||||
{
|
||||
var sheet = document.styleSheets[1];
|
||||
var rule = _.apply(this, rulesrc);
|
||||
|
||||
while(sheet.cssRules.length > 0)
|
||||
sheet.deleteRule(0);
|
||||
try {
|
||||
sheet.insertRule(rule, 0);
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
|
||||
if (sheet.cssRules.length == 1 && sheet.cssRules[0].type == kFontFeatureValuesRuleType) {
|
||||
return sheet.cssRules[0].cssText.replace(/[ \n]+/g, " ");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function testOneRule(testrule) {
|
||||
var sheet = document.styleSheets[1];
|
||||
var rule;
|
||||
|
||||
if ("rulesrc" in testrule) {
|
||||
rule = _.apply(this, testrule.rulesrc);
|
||||
} else {
|
||||
rule = testrule.rule;
|
||||
}
|
||||
|
||||
var parseErr = false;
|
||||
var expectedErr = false;
|
||||
var invalid = false;
|
||||
if ("invalid" in testrule && testrule.invalid) invalid = true;
|
||||
|
||||
while(sheet.cssRules.length > 0)
|
||||
sheet.deleteRule(0);
|
||||
try {
|
||||
sheet.insertRule(rule, 0);
|
||||
} catch (e) {
|
||||
expectedErr = (e.name == "SyntaxError"
|
||||
&& e instanceof DOMException
|
||||
&& e.code == DOMException.SYNTAX_ERR
|
||||
&& invalid);
|
||||
parseErr = true;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
assert_true(!parseErr || expectedErr, "unexpected syntax error");
|
||||
if (!parseErr) {
|
||||
assert_equals(sheet.cssRules.length, 1, "bad rule count");
|
||||
assert_equals(sheet.cssRules[0].type, kFontFeatureValuesRuleType, "bad rule type");
|
||||
}
|
||||
}, "basic parse tests - " + rule);
|
||||
|
||||
var sanitizedRule = rule.replace(/[ \n]+/g, " ");
|
||||
if (parseErr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// should result in one @font-feature-values rule constructed
|
||||
|
||||
// serialization matches expectation
|
||||
// -- note: due to inconsistent font family serialization problems,
|
||||
// only the serialization of the values is tested currently
|
||||
|
||||
var ruleValues = valuesText(rule);
|
||||
var serialized = sheet.cssRules[0].cssText;
|
||||
var serializedValues = valuesText(serialized);
|
||||
var haveSerialization = true;
|
||||
|
||||
if (testrule.serializationSame) {
|
||||
test(function() {
|
||||
assert_equals(serializedValues, ruleValues, "canonical cssText serialization doesn't match");
|
||||
}, "serialization check - " + rule);
|
||||
} else if ("serialization" in testrule) {
|
||||
var s = valuesText(testrule.serialization);
|
||||
test(function() {
|
||||
assert_equals(serializedValues, s, "non-canonical cssText serialization doesn't match - ");
|
||||
}, "serialization check - " + rule);
|
||||
} else if (testrule.serializationNoValueDefn) {
|
||||
test(function() {
|
||||
assert_equals(serializedValues, "", "cssText serialization should have no value defintions - ");
|
||||
}, "no value definitions in serialization - " + rule);
|
||||
|
||||
haveSerialization = false;
|
||||
|
||||
if ("rulesrc" in testrule) {
|
||||
test(function() {
|
||||
var j, rulesrc = testrule.rulesrc;
|
||||
|
||||
// invalid value definitions shouldn't affect the parsing of valid
|
||||
// definitions before or after an invalid one
|
||||
for (var j = 0; j < gSurroundingTests.length; j++) {
|
||||
var t = gSurroundingTests[j];
|
||||
var srulesrc = [];
|
||||
|
||||
if ("between" in t) {
|
||||
srulesrc = srulesrc.concat(rulesrc);
|
||||
srulesrc = srulesrc.concat(t.between);
|
||||
srulesrc = srulesrc.concat(rulesrc);
|
||||
} else {
|
||||
if (t.before != "")
|
||||
srulesrc = srulesrc.concat(t.before);
|
||||
srulesrc = srulesrc.concat(rulesrc);
|
||||
if (t.after != "")
|
||||
srulesrc = srulesrc.concat(t.after);
|
||||
}
|
||||
|
||||
var result = testParse(srulesrc);
|
||||
assert_equals(valuesText(result), valuesText(t.s), "invalid declarations should not affect valid ones - ");
|
||||
}
|
||||
}, "invalid declarations don't affect valid ones - " + rule);
|
||||
}
|
||||
}
|
||||
|
||||
// if serialization non-empty, serialization should round-trip to itself
|
||||
if (haveSerialization) {
|
||||
var roundTripText = testParse([serializedValues]);
|
||||
test(function() {
|
||||
assert_equals(valuesText(roundTripText), serializedValues,
|
||||
"serialization should round-trip to itself - ");
|
||||
}, "serialization round-trip - " + rule);
|
||||
}
|
||||
}
|
||||
|
||||
function testFontFeatureValuesRuleParsing() {
|
||||
var i;
|
||||
for (i = 0; i < testrules.length; i++) {
|
||||
var testrule = testrules[i];
|
||||
var rule;
|
||||
|
||||
if ("rulesrc" in testrule) {
|
||||
rule = _.apply(this, testrule.rulesrc);
|
||||
} else {
|
||||
rule = testrule.rule;
|
||||
}
|
||||
|
||||
testOneRule(testrule);
|
||||
//test(function() { testOneRule(testrule); }, "parsing " + rule);
|
||||
}
|
||||
}
|
||||
|
||||
testFontFeatureValuesRuleParsing();
|
||||
</script>
|
||||
</body></html>
|
@ -47,13 +47,7 @@ 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;");
|
||||
|
||||
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-alternates: 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.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");
|
||||
|
||||
</script>
|
||||
|
@ -1739,19 +1739,6 @@ pref("layout.css.supports-rule.enabled", true);
|
||||
// Is support for CSS Flexbox enabled?
|
||||
pref("layout.css.flexbox.enabled", true);
|
||||
|
||||
// Is support for CSS3 Fonts features enabled?
|
||||
// (includes font-variant-*, font-kerning, font-synthesis
|
||||
// and the @font-feature-values rule)
|
||||
// Note: with this enabled, font-feature-settings is aliased
|
||||
// to -moz-font-feature-settings. When unprefixing, this should
|
||||
// be reversed, -moz-font-feature-settings should alias to
|
||||
// font-feature-settings.
|
||||
#ifdef RELEASE_BUILD
|
||||
pref("layout.css.font-features.enabled", false);
|
||||
#else
|
||||
pref("layout.css.font-features.enabled", true);
|
||||
#endif
|
||||
|
||||
// Are sets of prefixed properties supported?
|
||||
pref("layout.css.prefixes.border-image", true);
|
||||
pref("layout.css.prefixes.transforms", true);
|
||||
|
Loading…
Reference in New Issue
Block a user