Backed out 8 changesets (bug 1681691) for causing wpt failures in idlharness.https.html. CLOSED TREE

Backed out changeset dda736a69ceb (bug 1681691)
Backed out changeset 64edecd0df6f (bug 1681691)
Backed out changeset a19844063d00 (bug 1681691)
Backed out changeset 5dd06c73f703 (bug 1681691)
Backed out changeset 1bc4081f95e4 (bug 1681691)
Backed out changeset e7887dc9a3c6 (bug 1681691)
Backed out changeset d9b488c09c23 (bug 1681691)
Backed out changeset b45b607fee4d (bug 1681691)
This commit is contained in:
smolnar 2021-03-23 12:00:39 +02:00
Родитель 62aacead04
Коммит 03eae2c9a5
28 изменённых файлов: 101 добавлений и 404 удалений

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

@ -21,9 +21,6 @@ dictionary FontFaceDescriptors {
UTF8String featureSettings = "normal";
UTF8String variationSettings = "normal";
UTF8String display = "auto";
UTF8String ascentOverride = "normal";
UTF8String descentOverride = "normal";
UTF8String lineGapOverride = "normal";
};
enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" };
@ -47,9 +44,6 @@ interface FontFace {
[SetterThrows] attribute UTF8String featureSettings;
[SetterThrows, Pref="layout.css.font-variations.enabled"] attribute UTF8String variationSettings;
[SetterThrows, Pref="layout.css.font-display.enabled"] attribute UTF8String display;
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String ascentOverride;
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String descentOverride;
[SetterThrows, Pref="layout.css.font-metrics-overrides.enabled"] attribute UTF8String lineGapOverride;
readonly attribute FontFaceLoadStatus status;

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

@ -3669,25 +3669,6 @@ void gfxFont::SanitizeMetrics(gfxFont::Metrics* aMetrics,
return;
}
// If the font entry has ascent/descent/lineGap-override values,
// replace the metrics from the font with the overrides.
gfxFloat adjustedSize = GetAdjustedSize();
if (mFontEntry->mAscentOverride >= 0.0) {
aMetrics->maxAscent = mFontEntry->mAscentOverride * adjustedSize;
aMetrics->maxHeight = aMetrics->maxAscent + aMetrics->maxDescent;
aMetrics->internalLeading =
std::max(0.0, aMetrics->maxHeight - aMetrics->emHeight);
}
if (mFontEntry->mDescentOverride >= 0.0) {
aMetrics->maxDescent = mFontEntry->mDescentOverride * adjustedSize;
aMetrics->maxHeight = aMetrics->maxAscent + aMetrics->maxDescent;
aMetrics->internalLeading =
std::max(0.0, aMetrics->maxHeight - aMetrics->emHeight);
}
if (mFontEntry->mLineGapOverride >= 0.0) {
aMetrics->externalLeading = mFontEntry->mLineGapOverride * adjustedSize;
}
aMetrics->underlineSize = std::max(1.0, aMetrics->underlineSize);
aMetrics->strikeoutSize = std::max(1.0, aMetrics->strikeoutSize);

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

@ -494,12 +494,6 @@ class gfxFontEntry {
StretchRange mStretchRange = StretchRange(FontStretch::Normal());
SlantStyleRange mStyleRange = SlantStyleRange(FontSlantStyle::Normal());
// Font metrics overrides (as multiples of used font size); negative values
// indicate no override to be applied.
float mAscentOverride = -1.0;
float mDescentOverride = -1.0;
float mLineGapOverride = -1.0;
// For user fonts (only), we need to record whether or not weight/stretch/
// slant variations should be clamped to the range specified in the entry
// properties. When the @font-face rule omitted one or more of these

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

@ -42,8 +42,7 @@ gfxUserFontEntry::gfxUserFontEntry(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride)
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags)
: gfxFontEntry("userfont"_ns),
mUserFontLoadState(STATUS_NOT_LOADED),
mFontDataLoadingState(NOT_LOADING),
@ -62,9 +61,6 @@ gfxUserFontEntry::gfxUserFontEntry(
mLanguageOverride = aLanguageOverride;
mCharacterMap = aUnicodeRanges;
mRangeFlags = aRangeFlags;
mAscentOverride = aAscentOverride;
mDescentOverride = aDescentOverride;
mLineGapOverride = aLineGapOverride;
}
void gfxUserFontEntry::UpdateAttributes(
@ -72,8 +68,7 @@ void gfxUserFontEntry::UpdateAttributes(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride) {
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) {
// Remove the entry from the user font cache, if present there, as the cache
// key may no longer be correct with the new attributes.
gfxUserFontSet::UserFontCache::ForgetFont(this);
@ -87,9 +82,6 @@ void gfxUserFontEntry::UpdateAttributes(
mLanguageOverride = aLanguageOverride;
mCharacterMap = aUnicodeRanges;
mRangeFlags = aRangeFlags;
mAscentOverride = aAscentOverride;
mDescentOverride = aDescentOverride;
mLineGapOverride = aLineGapOverride;
}
gfxUserFontEntry::~gfxUserFontEntry() {
@ -105,16 +97,13 @@ bool gfxUserFontEntry::Matches(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride) {
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) {
return Weight() == aWeight && Stretch() == aStretch &&
SlantStyle() == aStyle && mFeatureSettings == aFeatureSettings &&
mVariationSettings == aVariationSettings &&
mLanguageOverride == aLanguageOverride &&
mSrcList == aFontFaceSrcList && mFontDisplay == aFontDisplay &&
mRangeFlags == aRangeFlags && mAscentOverride == aAscentOverride &&
mDescentOverride == aDescentOverride &&
mLineGapOverride == aLineGapOverride &&
mRangeFlags == aRangeFlags &&
((!aUnicodeRanges && !mCharacterMap) ||
(aUnicodeRanges && mCharacterMap &&
mCharacterMap->Equals(aUnicodeRanges)));
@ -434,9 +423,6 @@ void gfxUserFontEntry::DoLoadNextSrc(bool aForceAsync) {
fe->mLanguageOverride = mLanguageOverride;
fe->mFamilyName = mFamilyName;
fe->mRangeFlags = mRangeFlags;
fe->mAscentOverride = mAscentOverride;
fe->mDescentOverride = mDescentOverride;
fe->mLineGapOverride = mLineGapOverride;
// For src:local(), we don't care whether the request is from
// a private window as there's no issue of caching resources;
// local fonts are just available all the time.
@ -731,9 +717,6 @@ bool gfxUserFontEntry::LoadPlatformFont(const uint8_t* aOriginalFontData,
fe->mLanguageOverride = mLanguageOverride;
fe->mFamilyName = mFamilyName;
fe->mRangeFlags = mRangeFlags;
fe->mAscentOverride = mAscentOverride;
fe->mDescentOverride = mDescentOverride;
fe->mLineGapOverride = mLineGapOverride;
StoreUserFontData(fe, mFontSet->GetPrivateBrowsing(), originalFullName,
&metadata, metaOrigLen, compression);
if (LOG_ENABLED()) {
@ -926,8 +909,7 @@ already_AddRefed<gfxUserFontEntry> gfxUserFontSet::FindOrCreateUserFontEntry(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride) {
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) {
RefPtr<gfxUserFontEntry> entry;
// If there's already a userfont entry in the family whose descriptors all
@ -941,14 +923,14 @@ already_AddRefed<gfxUserFontEntry> gfxUserFontSet::FindOrCreateUserFontEntry(
entry = FindExistingUserFontEntry(
family, aFontFaceSrcList, aWeight, aStretch, aStyle, aFeatureSettings,
aVariationSettings, aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags, aAscentOverride, aDescentOverride, aLineGapOverride);
aRangeFlags);
}
if (!entry) {
entry = CreateUserFontEntry(
aFontFaceSrcList, aWeight, aStretch, aStyle, aFeatureSettings,
aVariationSettings, aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags, aAscentOverride, aDescentOverride, aLineGapOverride);
entry = CreateUserFontEntry(aFontFaceSrcList, aWeight, aStretch, aStyle,
aFeatureSettings, aVariationSettings,
aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags);
entry->mFamilyName = aFamilyName;
}
@ -962,8 +944,7 @@ gfxUserFontEntry* gfxUserFontSet::FindExistingUserFontEntry(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride) {
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) {
nsTArray<RefPtr<gfxFontEntry>>& fontList = aFamily->GetFontList();
for (size_t i = 0, count = fontList.Length(); i < count; i++) {
@ -976,7 +957,7 @@ gfxUserFontEntry* gfxUserFontSet::FindExistingUserFontEntry(
if (!existingUserFontEntry->Matches(
aFontFaceSrcList, aWeight, aStretch, aStyle, aFeatureSettings,
aVariationSettings, aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags, aAscentOverride, aDescentOverride, aLineGapOverride)) {
aRangeFlags)) {
continue;
}
@ -1133,9 +1114,6 @@ bool gfxUserFontSet::UserFontCache::Entry::KeyEquals(
mFontEntry->mFeatureSettings != fe->mFeatureSettings ||
mFontEntry->mVariationSettings != fe->mVariationSettings ||
mFontEntry->mLanguageOverride != fe->mLanguageOverride ||
mFontEntry->mAscentOverride != fe->mAscentOverride ||
mFontEntry->mDescentOverride != fe->mDescentOverride ||
mFontEntry->mLineGapOverride != fe->mLineGapOverride ||
mFontEntry->mFamilyName != fe->mFamilyName) {
return false;
}

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

@ -265,9 +265,7 @@ class gfxUserFontSet {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride,
float aLineGapOverride) = 0;
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) = 0;
// creates a font face for the specified family, or returns an existing
// matching entry on the family if there is one
@ -278,8 +276,7 @@ class gfxUserFontSet {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride);
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags);
// add in a font face for which we have the gfxUserFontEntry already
void AddUserFontEntry(const nsCString& aFamilyName,
@ -528,8 +525,7 @@ class gfxUserFontSet {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride);
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags);
// creates a new gfxUserFontFamily in mFontFamilies, or returns an existing
// family if there is one
@ -577,8 +573,7 @@ class gfxUserFontEntry : public gfxFontEntry {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride);
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags);
virtual ~gfxUserFontEntry();
@ -589,8 +584,7 @@ class gfxUserFontEntry : public gfxFontEntry {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride);
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags);
// Return whether the entry matches the given list of attributes
bool Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
@ -599,9 +593,7 @@ class gfxUserFontEntry : public gfxFontEntry {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<mozilla::gfx::FontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride,
float aLineGapOverride);
mozilla::StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags);
gfxFont* CreateFontInstance(const gfxFontStyle* aFontStyle) override;

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

@ -303,36 +303,6 @@ void FontFace::SetDisplay(const nsACString& aValue, ErrorResult& aRv) {
}
}
void FontFace::GetAscentOverride(nsACString& aResult) {
GetDesc(eCSSFontDesc_AscentOverride, aResult);
}
void FontFace::SetAscentOverride(const nsACString& aValue, ErrorResult& aRv) {
if (SetDescriptor(eCSSFontDesc_AscentOverride, aValue, aRv)) {
DescriptorUpdated();
}
}
void FontFace::GetDescentOverride(nsACString& aResult) {
GetDesc(eCSSFontDesc_DescentOverride, aResult);
}
void FontFace::SetDescentOverride(const nsACString& aValue, ErrorResult& aRv) {
if (SetDescriptor(eCSSFontDesc_DescentOverride, aValue, aRv)) {
DescriptorUpdated();
}
}
void FontFace::GetLineGapOverride(nsACString& aResult) {
GetDesc(eCSSFontDesc_LineGapOverride, aResult);
}
void FontFace::SetLineGapOverride(const nsACString& aValue, ErrorResult& aRv) {
if (SetDescriptor(eCSSFontDesc_LineGapOverride, aValue, aRv)) {
DescriptorUpdated();
}
}
void FontFace::DescriptorUpdated() {
// If we haven't yet initialized mUserFontEntry, no need to do anything here;
// we'll respect the updated descriptor when the time comes to create it.
@ -561,12 +531,7 @@ bool FontFace::SetDescriptors(const nsACString& aFamily,
(StaticPrefs::layout_css_font_variations_enabled() &&
!setDesc(eCSSFontDesc_FontVariationSettings,
aDescriptors.mVariationSettings)) ||
!setDesc(eCSSFontDesc_Display, aDescriptors.mDisplay) ||
(StaticPrefs::layout_css_font_metrics_overrides_enabled() &&
(!setDesc(eCSSFontDesc_AscentOverride, aDescriptors.mAscentOverride) ||
!setDesc(eCSSFontDesc_DescentOverride, aDescriptors.mDescentOverride) ||
!setDesc(eCSSFontDesc_LineGapOverride,
aDescriptors.mLineGapOverride)))) {
!setDesc(eCSSFontDesc_Display, aDescriptors.mDisplay)) {
// XXX Handle font-variant once we support it (bug 1055385).
// If any of the descriptors failed to parse, none of them should be set
@ -670,30 +635,6 @@ Maybe<StyleFontLanguageOverride> FontFace::GetFontLanguageOverride() const {
return Some(langOverride);
}
Maybe<StylePercentage> FontFace::GetAscentOverride() const {
StylePercentage ascent{0};
if (!Servo_FontFaceRule_GetAscentOverride(GetData(), &ascent)) {
return Nothing();
}
return Some(ascent);
}
Maybe<StylePercentage> FontFace::GetDescentOverride() const {
StylePercentage descent{0};
if (!Servo_FontFaceRule_GetDescentOverride(GetData(), &descent)) {
return Nothing();
}
return Some(descent);
}
Maybe<StylePercentage> FontFace::GetLineGapOverride() const {
StylePercentage lineGap{0};
if (!Servo_FontFaceRule_GetLineGapOverride(GetData(), &lineGap)) {
return Nothing();
}
return Some(lineGap);
}
bool FontFace::HasLocalSrc() const {
AutoTArray<StyleFontFaceSourceListComponent, 8> components;
GetSources(components);

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

@ -51,13 +51,11 @@ class FontFace final : public nsISupports, public nsWrapperCache {
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride)
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags)
: gfxUserFontEntry(aFontSet, aFontFaceSrcList, aWeight, aStretch,
aStyle, aFeatureSettings, aVariationSettings,
aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags, aAscentOverride, aDescentOverride,
aLineGapOverride) {}
aRangeFlags) {}
virtual void SetLoadState(UserFontLoadState aLoadState) override;
virtual void GetUserFontSets(nsTArray<gfxUserFontSet*>& aResult) override;
@ -93,9 +91,6 @@ class FontFace final : public nsISupports, public nsWrapperCache {
void GetFontVariationSettings(nsTArray<gfxFontVariation>&) const;
void GetSources(nsTArray<StyleFontFaceSourceListComponent>&) const;
Maybe<StyleFontLanguageOverride> GetFontLanguageOverride() const;
Maybe<StylePercentage> GetAscentOverride() const;
Maybe<StylePercentage> GetDescentOverride() const;
Maybe<StylePercentage> GetLineGapOverride() const;
gfxUserFontEntry* CreateUserFontEntry();
gfxUserFontEntry* GetUserFontEntry() const { return mUserFontEntry; }
@ -176,12 +171,6 @@ class FontFace final : public nsISupports, public nsWrapperCache {
void SetVariationSettings(const nsACString& aValue, ErrorResult& aRv);
void GetDisplay(nsACString& aResult);
void SetDisplay(const nsACString& aValue, ErrorResult& aRv);
void GetAscentOverride(nsACString& aResult);
void SetAscentOverride(const nsACString& aValue, ErrorResult& aRv);
void GetDescentOverride(nsACString& aResult);
void SetDescentOverride(const nsACString& aValue, ErrorResult& aRv);
void GetLineGapOverride(nsACString& aResult);
void SetLineGapOverride(const nsACString& aValue, ErrorResult& aRv);
FontFaceLoadStatus Status();
Promise* Load(ErrorResult& aRv);

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

@ -961,9 +961,6 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(
uint32_t languageOverride = NO_FONT_LANGUAGE_OVERRIDE;
StyleFontDisplay fontDisplay = StyleFontDisplay::Auto;
float ascentOverride = -1.0;
float descentOverride = -1.0;
float lineGapOverride = -1.0;
gfxFontEntry::RangeFlags rangeFlags = gfxFontEntry::RangeFlags::eNoFlags;
@ -984,17 +981,6 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(
fontDisplay = *display;
}
// set up font metrics overrides
if (Maybe<StylePercentage> ascent = aFontFace->GetAscentOverride()) {
ascentOverride = ascent->_0;
}
if (Maybe<StylePercentage> descent = aFontFace->GetDescentOverride()) {
descentOverride = descent->_0;
}
if (Maybe<StylePercentage> lineGap = aFontFace->GetLineGapOverride()) {
lineGapOverride = lineGap->_0;
}
// set up font features
nsTArray<gfxFontFeature> featureSettings;
aFontFace->GetFontFeatureSettings(featureSettings);
@ -1018,8 +1004,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(
// rather than creating a new one.
existingEntry->UpdateAttributes(
weight, stretch, italicStyle, featureSettings, variationSettings,
languageOverride, unicodeRanges, fontDisplay, rangeFlags,
ascentOverride, descentOverride, lineGapOverride);
languageOverride, unicodeRanges, fontDisplay, rangeFlags);
// If the family name has changed, remove the entry from its current family
// and clear the mFamilyName field so it can be reset when added to a new
// family.
@ -1155,7 +1140,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(
RefPtr<gfxUserFontEntry> entry = set->mUserFontSet->FindOrCreateUserFontEntry(
aFamilyName, srcArray, weight, stretch, italicStyle, featureSettings,
variationSettings, languageOverride, unicodeRanges, fontDisplay,
rangeFlags, ascentOverride, descentOverride, lineGapOverride);
rangeFlags);
return entry.forget();
}
@ -1827,12 +1812,11 @@ FontFaceSet::UserFontSet::CreateUserFontEntry(
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride, float aLineGapOverride) {
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) {
RefPtr<gfxUserFontEntry> entry = new FontFace::Entry(
this, aFontFaceSrcList, aWeight, aStretch, aStyle, aFeatureSettings,
aVariationSettings, aLanguageOverride, aUnicodeRanges, aFontDisplay,
aRangeFlags, aAscentOverride, aDescentOverride, aLineGapOverride);
aRangeFlags);
return entry.forget();
}

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

@ -97,9 +97,7 @@ class FontFaceSet final : public DOMEventTargetHelper,
const nsTArray<gfxFontFeature>& aFeatureSettings,
const nsTArray<gfxFontVariation>& aVariationSettings,
uint32_t aLanguageOverride, gfxCharacterMap* aUnicodeRanges,
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags,
float aAscentOverride, float aDescentOverride,
float aLineGapOverride) override;
StyleFontDisplay aFontDisplay, RangeFlags aRangeFlags) override;
private:
RefPtr<FontFaceSet> mFontFaceSet;

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

@ -14,6 +14,3 @@ CSS_FONT_DESC(font-feature-settings, FontFeatureSettings)
CSS_FONT_DESC(font-variation-settings, FontVariationSettings)
CSS_FONT_DESC(font-language-override, FontLanguageOverride)
CSS_FONT_DESC(font-display, Display)
CSS_FONT_DESC(ascent-override, AscentOverride)
CSS_FONT_DESC(descent-override, DescentOverride)
CSS_FONT_DESC(line-gap-override, LineGapOverride)

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

@ -6396,13 +6396,6 @@
value: true
mirror: always
# Is support for the @font-face metrics override descriptors enabled?
- name: layout.css.font-metrics-overrides.enabled
type: RelaxedAtomicBool
value: @IS_NIGHTLY_BUILD@
mirror: always
rust: true
# Is support for variation fonts enabled?
- name: layout.css.font-variations.enabled
type: RelaxedAtomicBool

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

@ -19,7 +19,7 @@ use crate::values::specified::font::SpecifiedFontFeatureSettings;
use crate::values::specified::font::SpecifiedFontStyle;
#[cfg(feature = "gecko")]
use crate::values::specified::font::SpecifiedFontVariationSettings;
use crate::values::specified::font::{AbsoluteFontWeight, FontStretch, MetricsOverride};
use crate::values::specified::font::{AbsoluteFontWeight, FontStretch};
use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::Angle;
#[cfg(feature = "gecko")]
@ -194,7 +194,7 @@ impl FontStretchRange {
fn compute_stretch(s: &FontStretch) -> f32 {
match *s {
FontStretch::Keyword(ref kw) => kw.compute().0,
FontStretch::Stretch(ref p) => p.0.get(),
FontStretch::Stretch(ref p) => p.get(),
FontStretch::System(..) => unreachable!(),
}
}
@ -419,15 +419,6 @@ macro_rules! is_descriptor_enabled {
("font-variation-settings") => {
static_prefs::pref!("layout.css.font-variations.enabled")
};
("ascent-override") => {
static_prefs::pref!("layout.css.font-metrics-overrides.enabled")
};
("descent-override") => {
static_prefs::pref!("layout.css.font-metrics-overrides.enabled")
};
("line-gap-override") => {
static_prefs::pref!("layout.css.font-metrics-overrides.enabled")
};
($name:tt) => {
true
};
@ -586,15 +577,6 @@ font_face_descriptors! {
/// The language override of this font face.
"font-language-override" language_override / mFontLanguageOverride: font_language_override::SpecifiedValue,
/// The ascent override for this font face.
"ascent-override" ascent_override / mAscentOverride: MetricsOverride,
/// The descent override for this font face.
"descent-override" descent_override / mDescentOverride: MetricsOverride,
/// The line-gap override for this font face.
"line-gap-override" line_gap_override / mLineGapOverride: MetricsOverride,
]
}

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

@ -197,7 +197,7 @@
let font_stretch = match *self.font_stretch {
FontStretch::Keyword(kw) => kw,
FontStretch::Stretch(percentage) => {
match FontStretchKeyword::from_percentage(percentage.0.get()) {
match FontStretchKeyword::from_percentage(percentage.get()) {
Some(kw) => kw,
None => return Ok(()),
}

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

@ -17,7 +17,7 @@ use crate::values::generics::font::{self as generics, FeatureTagValue, FontSetti
use crate::values::generics::NonNegative;
use crate::values::specified::length::{FontBaseSize, AU_PER_PT, AU_PER_PX};
use crate::values::specified::{AllowQuirks, Angle, Integer, LengthPercentage};
use crate::values::specified::{NoCalcLength, NonNegativeNumber, Number, NonNegativePercentage};
use crate::values::specified::{NoCalcLength, NonNegativeNumber, Number, Percentage};
use crate::values::CustomIdent;
use crate::Atom;
use cssparser::{Parser, Token};
@ -357,11 +357,13 @@ impl ToComputedValue for FontStyle {
/// A value for the `font-stretch` property.
///
/// https://drafts.csswg.org/css-fonts-4/#font-stretch-prop
///
/// TODO(emilio): We could derive Parse if we had NonNegativePercentage.
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
#[repr(u8)]
pub enum FontStretch {
Stretch(NonNegativePercentage),
Stretch(Percentage),
Keyword(FontStretchKeyword),
#[css(skip)]
System(SystemFont),
@ -448,13 +450,32 @@ impl FontStretch {
system_font_methods!(FontStretch, font_stretch);
}
impl Parse for FontStretch {
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
// From https://drafts.csswg.org/css-fonts-4/#font-stretch-prop:
//
// Values less than 0% are not allowed and are treated as parse
// errors.
if let Ok(percentage) =
input.try_parse(|input| Percentage::parse_non_negative(context, input))
{
return Ok(FontStretch::Stretch(percentage));
}
Ok(FontStretch::Keyword(FontStretchKeyword::parse(input)?))
}
}
impl ToComputedValue for FontStretch {
type ComputedValue = computed::FontStretch;
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
match *self {
FontStretch::Stretch(ref percentage) => {
computed::FontStretch(percentage.to_computed_value(context))
computed::FontStretch(NonNegative(percentage.to_computed_value(context)))
},
FontStretch::Keyword(ref kw) => computed::FontStretch(NonNegative(kw.compute())),
FontStretch::System(_) => self.compute_system(context),
@ -462,7 +483,7 @@ impl ToComputedValue for FontStretch {
}
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
FontStretch::Stretch(NonNegativePercentage::from_computed_value(&NonNegative((computed.0).0)))
FontStretch::Stretch(Percentage::from_computed_value(&(computed.0).0))
}
}
@ -2193,37 +2214,6 @@ impl Parse for VariationValue<Number> {
}
}
/// A metrics override value for a @font-face descriptor
///
/// https://drafts.csswg.org/css-fonts/#font-metrics-override-desc
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub enum MetricsOverride {
/// A non-negative `<percentage>` of the computed font size
Override(NonNegativePercentage),
/// Normal metrics from the font.
Normal,
}
impl MetricsOverride {
#[inline]
/// Get default value with `normal`
pub fn normal() -> MetricsOverride {
MetricsOverride::Normal
}
/// The ToComputedValue implementation, used for @font-face descriptors.
///
/// Valid override percentages must be non-negative; we return -1.0 to indicate
/// the absence of an override (i.e. 'normal').
#[inline]
pub fn compute(&self) -> ComputedPercentage {
match *self {
MetricsOverride::Normal => ComputedPercentage(-1.0),
MetricsOverride::Override(percent) => ComputedPercentage(percent.0.get()),
}
}
}
#[derive(
Clone,
Copy,

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

@ -71,7 +71,7 @@ pub use self::list::Quotes;
pub use self::motion::{OffsetPath, OffsetRotate};
pub use self::outline::OutlineStyle;
pub use self::page::{Orientation, PageSize, PaperSize};
pub use self::percentage::{Percentage, NonNegativePercentage};
pub use self::percentage::Percentage;
pub use self::position::AspectRatio;
pub use self::position::{
GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto,

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

@ -7,7 +7,6 @@
use crate::parser::{Parse, ParserContext};
use crate::values::computed::percentage::Percentage as ComputedPercentage;
use crate::values::computed::{Context, ToComputedValue};
use crate::values::generics::NonNegative;
use crate::values::specified::calc::CalcNode;
use crate::values::specified::Number;
use crate::values::{serialize_percentage, CSSFloat};
@ -173,16 +172,3 @@ impl ToComputedValue for Percentage {
}
impl SpecifiedValueInfo for Percentage {}
/// A wrapper of Percentage, whose value must be >= 0.
pub type NonNegativePercentage = NonNegative<Percentage>;
impl Parse for NonNegativePercentage {
#[inline]
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Ok(NonNegative(Percentage::parse_non_negative(context, input)?))
}
}

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

@ -2865,9 +2865,6 @@ macro_rules! apply_font_desc_list {
eCSSFontDesc_FontVariationSettings => variation_settings,
eCSSFontDesc_FontLanguageOverride => language_override,
eCSSFontDesc_Display => display,
eCSSFontDesc_AscentOverride => ascent_override,
eCSSFontDesc_DescentOverride => descent_override,
eCSSFontDesc_LineGapOverride => line_gap_override,
]
invalid: [
eCSSFontDesc_UNKNOWN,
@ -2944,7 +2941,7 @@ macro_rules! simple_font_descriptor_getter_impl {
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetFontWeight(
pub unsafe extern "C" fn Servo_FontFaceRule_GetFontWeight(
rule: &RawServoFontFaceRule,
out: &mut font_face::ComputedFontWeightRange,
) -> bool {
@ -2952,7 +2949,7 @@ pub extern "C" fn Servo_FontFaceRule_GetFontWeight(
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetFontStretch(
pub unsafe extern "C" fn Servo_FontFaceRule_GetFontStretch(
rule: &RawServoFontFaceRule,
out: &mut font_face::ComputedFontStretchRange,
) -> bool {
@ -2960,7 +2957,7 @@ pub extern "C" fn Servo_FontFaceRule_GetFontStretch(
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetFontStyle(
pub unsafe extern "C" fn Servo_FontFaceRule_GetFontStyle(
rule: &RawServoFontFaceRule,
out: &mut font_face::ComputedFontStyleDescriptor,
) -> bool {
@ -2968,7 +2965,7 @@ pub extern "C" fn Servo_FontFaceRule_GetFontStyle(
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetFontDisplay(
pub unsafe extern "C" fn Servo_FontFaceRule_GetFontDisplay(
rule: &RawServoFontFaceRule,
out: &mut font_face::FontDisplay,
) -> bool {
@ -2976,43 +2973,13 @@ pub extern "C" fn Servo_FontFaceRule_GetFontDisplay(
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetFontLanguageOverride(
pub unsafe extern "C" fn Servo_FontFaceRule_GetFontLanguageOverride(
rule: &RawServoFontFaceRule,
out: &mut computed::FontLanguageOverride,
) -> bool {
simple_font_descriptor_getter_impl!(rule, out, language_override, compute_non_system)
}
// Returns a Percentage of -1.0 if the override descriptor is present but 'normal'
// rather than an actual percentage value.
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetAscentOverride(
rule: &RawServoFontFaceRule,
out: &mut computed::Percentage,
) -> bool {
simple_font_descriptor_getter_impl!(rule, out, ascent_override, compute)
}
// Returns a Percentage of -1.0 if the override descriptor is present but 'normal'
// rather than an actual percentage value.
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetDescentOverride(
rule: &RawServoFontFaceRule,
out: &mut computed::Percentage,
) -> bool {
simple_font_descriptor_getter_impl!(rule, out, descent_override, compute)
}
// Returns a Percentage of -1.0 if the override descriptor is present but 'normal'
// rather than an actual percentage value.
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetLineGapOverride(
rule: &RawServoFontFaceRule,
out: &mut computed::Percentage,
) -> bool {
simple_font_descriptor_getter_impl!(rule, out, line_gap_override, compute)
}
#[no_mangle]
pub unsafe extern "C" fn Servo_FontFaceRule_GetFamilyName(
rule: &RawServoFontFaceRule,
@ -3135,7 +3102,7 @@ pub unsafe extern "C" fn Servo_FontFaceRule_GetFeatureSettings(
}
#[no_mangle]
pub extern "C" fn Servo_FontFaceRule_GetDescriptorCssText(
pub unsafe extern "C" fn Servo_FontFaceRule_GetDescriptorCssText(
rule: &RawServoFontFaceRule,
desc: nsCSSFontDesc,
result: &mut nsACString,
@ -6780,7 +6747,7 @@ pub unsafe extern "C" fn Servo_ParseFontShorthandForMatching(
*stretch = match font.font_stretch {
FontStretch::Keyword(ref k) => k.compute().0,
FontStretch::Stretch(ref p) => p.0.get(),
FontStretch::Stretch(ref p) => p.get(),
FontStretch::System(_) => return false,
};

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

@ -2,22 +2,13 @@
expected:
if os == "win": ["TIMEOUT", "OK"]
[Initialize lineGapOverride with 'normal' should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initial value of lineGapOverride should be 'normal']
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize ascentOverride with a non-percentage should fail]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize lineGapOverride with a negative percentage should fail]
expected:
@ -30,27 +21,16 @@
if (os == "win") and debug and webrender and not swgl: ["NOTRUN", "FAIL", "TIMEOUT"]
if (os == "win") and debug and webrender and swgl: ["NOTRUN", "FAIL", "TIMEOUT"]
if (os == "win") and not debug and fission: ["TIMEOUT", "FAIL", "NOTRUN"]
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
[Initialize lineGapOverride with a percentage should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initial value of descentOverride should be 'normal']
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize descentOverride with a percentage should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize descentOverride with a non-percentage should fail]
expected:
@ -63,8 +43,6 @@
if (os == "win") and debug and not webrender and (processor == "x86_64"): ["FAIL", "TIMEOUT", "NOTRUN"]
if (os == "win") and debug and not webrender and (processor == "x86"): ["FAIL", "TIMEOUT"]
if (os == "win") and not debug and fission: ["FAIL", "TIMEOUT"]
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
[Initialize descentOverride with a negative percentage should fail]
@ -73,51 +51,28 @@
if (os == "win") and debug and (processor == "x86_64") and webrender and swgl: ["FAIL", "TIMEOUT"]
if (os == "win") and debug and (processor == "x86_64") and webrender and not swgl: ["TIMEOUT", "FAIL"]
if (os == "win") and debug and (processor == "x86_64") and not webrender: ["FAIL", "TIMEOUT"]
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
[Initialize descentOverride with 'normal' should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initial value of ascentOverride should be 'normal']
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize ascentOverride with 'normal' should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize ascentOverride with a negative percentage should fail]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Changing lineGapOverride to invalid value should fail]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Changing ascentOverride to invalid value should fail]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Changing descentOverride to invalid value should fail]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[Initialize lineGapOverride with a non-percentage should fail]
expected:
@ -126,13 +81,8 @@
if (os == "win") and debug and webrender and swgl: ["NOTRUN", "PASS", "FAIL", "TIMEOUT"]
if (os == "win") and debug and webrender and not swgl: ["NOTRUN", "PASS", "FAIL", "TIMEOUT"]
if (os == "win") and not debug: ["NOTRUN", "PASS", "FAIL", "TIMEOUT"]
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
[Initialize ascentOverride with a percentage should succeed]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL

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

@ -11,38 +11,20 @@
if (processor == "x86") and (os == "win"): FAIL
[FontFace interface: fontFace must inherit property "descentOverride" with the proper type]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[FontFace interface: attribute descentOverride]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[FontFace interface: fontFace must inherit property "lineGapOverride" with the proper type]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[FontFace interface: attribute ascentOverride]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[FontFace interface: attribute lineGapOverride]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL
[FontFace interface: fontFace must inherit property "ascentOverride" with the proper type]
expected:
if (os == "android"): PASS
if (os == "linux"): PASS
FAIL
expected: FAIL

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

@ -0,0 +1,2 @@
[ascent-descent-override.html]
expected: FAIL

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

@ -0,0 +1,2 @@
[line-gap-override.html]
expected: FAIL

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

@ -0,0 +1,4 @@
[metrics-override-normal-keyword.html]
expected:
if os == "linux": PASS
FAIL

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

@ -5,7 +5,7 @@
<link rel="match" href="fontface-override-descriptors-ref.html">
<script>
const face = new FontFace(
'Ahem',
'ahem-overridden',
'local("Ahem"), url("/fonts/Ahem.ttf")',
{ascentOverride: '100%', descentOverride: '100%', lineGapOverride: '100%'});
document.fonts.add(face);
@ -18,7 +18,7 @@ document.fonts.add(face);
<style>
#target {
position: absolute;
font-family: Ahem;
font-family: ahem-overridden;
font-size: 20px;
}
</style>

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

@ -6,7 +6,7 @@
<title>Tests the ascent-override and descent-override descriptors of @font-face</title>
<style>
@font-face {
font-family: Ahem;
font-family: custom-font;
src: local(Ahem), url(/fonts/Ahem.ttf);
/* The default ascent and descent are 80% and 20%, respectively. */
ascent-override: 100%;
@ -14,7 +14,7 @@
}
.target {
font: 20px Ahem;
font: 20px custom-font;
color: green;
position: absolute;
top: 10px;

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

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests the line-gap-override descriptor of @font-face</title>
<title>Tests the ascent-override and descent-override descriptors of @font-face</title>
<style>
.target {
position: absolute;

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

@ -6,13 +6,13 @@
<title>Tests the line-gap-override descriptor of @font-face</title>
<style>
@font-face {
font-family: Ahem;
font-family: custom-font;
src: local(Ahem), url(/fonts/Ahem.ttf);
line-gap-override: 100%;
}
.target {
font: 20px Ahem;
font: 20px custom-font;
color: green;
position: absolute;
top: 10px;

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

@ -5,15 +5,8 @@
<link rel="stylesheet" href="/fonts/ahem.css">
<title>Tests the 'normal' keyword on descriptors ascent-override, descent-override and line-gap-override</title>
<style>
@font-face {
font-family: reference-font;
src: local(Ahem), url(/fonts/Ahem.ttf);
}
</style>
<div style="font-family: Ahem">Test<br>Test</div>
<div style="font-family: reference-font">Test<br>Test</div>
<div style="font-family: Ahem">Test<br>Test</div>
<div style="font-family: reference-font">Test<br>Test</div>
<div style="font-family: reference-font">Test<br>Test</div>
<div style="font-family: Ahem">Test<br>Test</div>

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

@ -747,8 +747,6 @@ AHEM SYSTEM FONT: resource-timing/resources/all_resource_types.htm
AHEM SYSTEM FONT: resource-timing/resources/iframe-reload-TAO.sub.html
AHEM SYSTEM FONT: html/canvas/element/drawing-text-to-the-canvas/2d.text.measure.fontBoundingBox.ahem.html
AHEM SYSTEM FONT: css/css-font-loading/fontface-override-descriptors.html
AHEM SYSTEM FONT: css/css-fonts/ascent-descent-override.html
AHEM SYSTEM FONT: css/css-fonts/line-gap-override.html
# TODO: The following should be deleted along with the Ahem web font cleanup
# PR (https://github.com/web-platform-tests/wpt/pull/18702)