зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1708240
) for causing failures in test_css-properties-db.js CLOSED TREE
Backed out changeset 695203c0ff61 (bug1708240
) Backed out changeset e686e061b8b5 (bug1708240
) Backed out changeset eac4b88ab28d (bug1708240
) Backed out changeset e766d2a9180e (bug1708240
) Backed out changeset 79c808970af5 (bug1708240
)
This commit is contained in:
Родитель
72a3108e1e
Коммит
1bf4a97b5d
|
@ -4617,41 +4617,34 @@ gfxFontStyle::gfxFontStyle(FontSlantStyle aStyle, FontWeight aWeight,
|
|||
noFallbackVariantFeatures(true) {
|
||||
MOZ_ASSERT(!std::isnan(size));
|
||||
|
||||
switch (aSizeAdjust.tag) {
|
||||
case FontSizeAdjust::Tag::None:
|
||||
sizeAdjust = 0.0f;
|
||||
break;
|
||||
case FontSizeAdjust::Tag::ExHeight:
|
||||
sizeAdjust = aSizeAdjust.AsExHeight();
|
||||
break;
|
||||
case FontSizeAdjust::Tag::CapHeight:
|
||||
sizeAdjust = aSizeAdjust.AsCapHeight();
|
||||
break;
|
||||
case FontSizeAdjust::Tag::ChWidth:
|
||||
sizeAdjust = aSizeAdjust.AsChWidth();
|
||||
break;
|
||||
case FontSizeAdjust::Tag::IcWidth:
|
||||
sizeAdjust = aSizeAdjust.AsIcWidth();
|
||||
break;
|
||||
case FontSizeAdjust::Tag::IcHeight:
|
||||
sizeAdjust = aSizeAdjust.AsIcHeight();
|
||||
break;
|
||||
}
|
||||
MOZ_ASSERT(!std::isnan(sizeAdjust));
|
||||
|
||||
sizeAdjustBasis = uint8_t(aSizeAdjust.tag);
|
||||
// sizeAdjustBasis is currently a small bitfield, so let's assert that the
|
||||
// tag value was not truncated.
|
||||
MOZ_ASSERT(FontSizeAdjust::Tag(sizeAdjustBasis) == aSizeAdjust.tag,
|
||||
"gfxFontStyle.sizeAdjustBasis too small?");
|
||||
|
||||
// If we're created with aSizeAdjust holding a FromFont value, we ignore it
|
||||
// here; this is the style system retrieving font metrics in order to resolve
|
||||
// FromFont to an actual ratio, which it can do using the unmodified metrics.
|
||||
|
||||
#define HANDLE_TAG(TAG) \
|
||||
case FontSizeAdjust::Tag::TAG: \
|
||||
if (aSizeAdjust.As##TAG().IsFromFont()) { \
|
||||
sizeAdjustBasis = uint8_t(FontSizeAdjust::Tag::None); \
|
||||
sizeAdjust = 0.0f; \
|
||||
break; \
|
||||
} \
|
||||
sizeAdjust = aSizeAdjust.As##TAG().AsNumber(); \
|
||||
break;
|
||||
|
||||
switch (aSizeAdjust.tag) {
|
||||
case FontSizeAdjust::Tag::None:
|
||||
sizeAdjust = 0.0f;
|
||||
break;
|
||||
HANDLE_TAG(ExHeight)
|
||||
HANDLE_TAG(CapHeight)
|
||||
HANDLE_TAG(ChWidth)
|
||||
HANDLE_TAG(IcWidth)
|
||||
HANDLE_TAG(IcHeight)
|
||||
}
|
||||
|
||||
#undef HANDLE_TAG
|
||||
|
||||
MOZ_ASSERT(!std::isnan(sizeAdjust));
|
||||
|
||||
if (weight > FontWeight::FromInt(1000)) {
|
||||
weight = FontWeight::FromInt(1000);
|
||||
}
|
||||
|
|
|
@ -187,8 +187,8 @@ void LangGroupFontPrefs::Initialize(nsStaticAtom* aLangGroupAtom) {
|
|||
nsAutoCString cvalue;
|
||||
Preferences::GetCString(pref.get(), cvalue);
|
||||
if (!cvalue.IsEmpty()) {
|
||||
font->sizeAdjust = StyleFontSizeAdjust::ExHeight(
|
||||
StyleFontSizeAdjustFactor::Number((float)atof(cvalue.get())));
|
||||
font->sizeAdjust =
|
||||
StyleFontSizeAdjust::ExHeight((float)atof(cvalue.get()));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_rbs
|
||||
|
|
|
@ -9792,30 +9792,29 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
|
|||
aSystemFont->size = Length::FromPixels(fontStyle.size);
|
||||
|
||||
// aSystemFont->langGroup = fontStyle.langGroup;
|
||||
|
||||
switch (StyleFontSizeAdjust::Tag(fontStyle.sizeAdjustBasis)) {
|
||||
case StyleFontSizeAdjust::Tag::None:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::None();
|
||||
break;
|
||||
case StyleFontSizeAdjust::Tag::ExHeight:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::ExHeight(
|
||||
StyleFontSizeAdjustFactor::Number(fontStyle.sizeAdjust));
|
||||
aSystemFont->sizeAdjust =
|
||||
StyleFontSizeAdjust::ExHeight(fontStyle.sizeAdjust);
|
||||
break;
|
||||
case StyleFontSizeAdjust::Tag::CapHeight:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::CapHeight(
|
||||
StyleFontSizeAdjustFactor::Number(fontStyle.sizeAdjust));
|
||||
aSystemFont->sizeAdjust =
|
||||
StyleFontSizeAdjust::CapHeight(fontStyle.sizeAdjust);
|
||||
break;
|
||||
case StyleFontSizeAdjust::Tag::ChWidth:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::ChWidth(
|
||||
StyleFontSizeAdjustFactor::Number(fontStyle.sizeAdjust));
|
||||
aSystemFont->sizeAdjust =
|
||||
StyleFontSizeAdjust::ChWidth(fontStyle.sizeAdjust);
|
||||
break;
|
||||
case StyleFontSizeAdjust::Tag::IcWidth:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::IcWidth(
|
||||
StyleFontSizeAdjustFactor::Number(fontStyle.sizeAdjust));
|
||||
aSystemFont->sizeAdjust =
|
||||
StyleFontSizeAdjust::IcWidth(fontStyle.sizeAdjust);
|
||||
break;
|
||||
case StyleFontSizeAdjust::Tag::IcHeight:
|
||||
aSystemFont->sizeAdjust = StyleFontSizeAdjust::IcHeight(
|
||||
StyleFontSizeAdjustFactor::Number(fontStyle.sizeAdjust));
|
||||
aSystemFont->sizeAdjust =
|
||||
StyleFontSizeAdjust::IcHeight(fontStyle.sizeAdjust);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -545,8 +545,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleGenericClipRect", servo = "crate::values::generics::GenericClipRect" },
|
||||
{ gecko = "StyleGenericCursorImage", servo = "crate::values::generics::ui::GenericCursorImage" },
|
||||
{ gecko = "StyleFontFamily", servo = "crate::values::computed::font::FontFamily" },
|
||||
{ gecko = "StyleFontSizeAdjust", servo = "crate::values::computed::font::FontSizeAdjust" },
|
||||
{ gecko = "StyleFontSizeAdjustFactor", servo = "crate::values::computed::font::FontSizeAdjustFactor" },
|
||||
{ gecko = "StyleGenericFontSizeAdjust", servo = "crate::values::generics::font::GenericFontSizeAdjust" },
|
||||
{ gecko = "StyleFontFamilyNameSyntax", servo = "crate::values::computed::font::FontFamilyNameSyntax" },
|
||||
{ gecko = "StyleGenericColor", servo = "crate::values::generics::color::Color" },
|
||||
{ gecko = "StyleSystemColor", servo = "crate::values::specified::color::SystemColor" },
|
||||
|
|
|
@ -5783,30 +5783,8 @@ var gCSSProperties = {
|
|||
applies_to_placeholder: true,
|
||||
applies_to_cue: true,
|
||||
initial_values: ["none"],
|
||||
other_values: [
|
||||
"0.7",
|
||||
"0.0",
|
||||
"0",
|
||||
"3",
|
||||
"from-font",
|
||||
"cap-height 0.8",
|
||||
"ch-width 0.4",
|
||||
"ic-width 0.4",
|
||||
"ic-height 0.9",
|
||||
"ch-width from-font",
|
||||
],
|
||||
invalid_values: [
|
||||
"-0.3",
|
||||
"-1",
|
||||
"normal",
|
||||
"none none",
|
||||
"cap-height none",
|
||||
"none from-font",
|
||||
"from-font none",
|
||||
"0.5 from-font",
|
||||
"0.5 cap-height",
|
||||
"cap-height, 0.8",
|
||||
],
|
||||
other_values: ["0.3", "0.5", "0.7", "0.0", "0", "3"],
|
||||
invalid_values: ["-0.3", "-1"],
|
||||
},
|
||||
"font-stretch": {
|
||||
domProp: "fontStretch",
|
||||
|
|
|
@ -8450,6 +8450,13 @@
|
|||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Is the optional adjustment-basis value for font-size-adjust enabled?
|
||||
- name: layout.css.font-size-adjust.basis.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Is support for the tech() function in the @font-face src descriptor enabled?
|
||||
- name: layout.css.font-tech.enabled
|
||||
type: RelaxedAtomicBool
|
||||
|
|
|
@ -1221,61 +1221,6 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
font.mScriptUnconstrainedSize = NonNegative(new_unconstrained_size);
|
||||
}
|
||||
|
||||
/// If font-size-adjust used the from-font value, we need to resolve it to an actual number
|
||||
/// using metrics from the font.
|
||||
fn resolve_font_size_adjust_from_font_if_needed(&mut self) {
|
||||
use crate::values::computed::font::{FontSizeAdjust, FontSizeAdjustFactor as Factor};
|
||||
|
||||
if !self.seen.contains(LonghandId::FontSizeAdjust) {
|
||||
return;
|
||||
}
|
||||
|
||||
let font_metrics = |vertical| {
|
||||
let orient = if vertical {
|
||||
FontMetricsOrientation::MatchContextPreferVertical
|
||||
} else {
|
||||
FontMetricsOrientation::Horizontal
|
||||
};
|
||||
let metrics = self.context.query_font_metrics(FontBaseSize::CurrentStyle, orient, false);
|
||||
let font_size = self.context.style().get_font().clone_font_size().used_size.0;
|
||||
(metrics, font_size)
|
||||
};
|
||||
|
||||
// Macro to resolve a from-font value using the given metric field. If not present,
|
||||
// returns the fallback value, or if that is negative, resolves using ascent instead
|
||||
// of the missing field (this is the fallback for cap-height).
|
||||
macro_rules! resolve {
|
||||
($basis:ident, $value:expr, $vertical:expr, $field:ident, $fallback:expr) => {
|
||||
{
|
||||
if $value != Factor::FromFont {
|
||||
return;
|
||||
}
|
||||
let (metrics, font_size) = font_metrics($vertical);
|
||||
let ratio = if let Some(metric) = metrics.$field {
|
||||
metric / font_size
|
||||
} else if $fallback >= 0.0 {
|
||||
$fallback
|
||||
} else {
|
||||
metrics.ascent / font_size
|
||||
};
|
||||
FontSizeAdjust::$basis(Factor::new(ratio))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If sizeAdjust is currently FromFont, we need to resolve it to a number.
|
||||
let resolved = match self.context.builder.get_font().mFont.sizeAdjust {
|
||||
FontSizeAdjust::None => return,
|
||||
FontSizeAdjust::ExHeight(val) => resolve!(ExHeight, val, false, x_height, 0.5),
|
||||
FontSizeAdjust::CapHeight(val) => resolve!(CapHeight, val, false, cap_height, -1.0 /* fall back to ascent */),
|
||||
FontSizeAdjust::ChWidth(val) => resolve!(ChWidth, val, false, zero_advance_measure, 0.5),
|
||||
FontSizeAdjust::IcWidth(val) => resolve!(IcWidth, val, false, ic_width, 1.0),
|
||||
FontSizeAdjust::IcHeight(val) => resolve!(IcHeight, val, true, ic_width, 1.0),
|
||||
};
|
||||
|
||||
self.context.builder.mutate_font().mFont.sizeAdjust = resolved
|
||||
}
|
||||
|
||||
/// Various properties affect how font-size and font-family are computed.
|
||||
///
|
||||
/// These need to be handled here, since relative lengths and ex / ch units
|
||||
|
@ -1288,8 +1233,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
self.prioritize_user_fonts_if_needed();
|
||||
self.recompute_keyword_font_size_if_needed();
|
||||
self.recompute_math_font_size_if_needed();
|
||||
self.constrain_font_size_if_needed();
|
||||
self.resolve_font_size_adjust_from_font_if_needed()
|
||||
self.constrain_font_size_if_needed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -746,20 +746,8 @@ impl FontFamilyList {
|
|||
}
|
||||
}
|
||||
|
||||
/// A factor for one of the font-size-adjust metrics, which may be either a number
|
||||
/// or the `from-font` keyword.
|
||||
pub type FontSizeAdjustFactor = generics::GenericNumberOrFromFont<NonNegativeNumber>;
|
||||
|
||||
impl FontSizeAdjustFactor {
|
||||
#[inline]
|
||||
/// Create a ratio from a raw number
|
||||
pub fn new(val: f32) -> Self {
|
||||
FontSizeAdjustFactor::Number(NonNegative(val))
|
||||
}
|
||||
}
|
||||
|
||||
/// Preserve the readability of text when font fallback occurs.
|
||||
pub type FontSizeAdjust = generics::GenericFontSizeAdjust<FontSizeAdjustFactor>;
|
||||
/// Preserve the readability of text when font fallback occurs
|
||||
pub type FontSizeAdjust = generics::GenericFontSizeAdjust<NonNegativeNumber>;
|
||||
|
||||
impl FontSizeAdjust {
|
||||
#[inline]
|
||||
|
|
|
@ -67,7 +67,7 @@ pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
|||
pub use self::flex::FlexBasis;
|
||||
pub use self::font::{FontFamily, FontLanguageOverride, FontPalette, FontStyle};
|
||||
pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric};
|
||||
pub use self::font::{FontSize, FontSizeAdjust, FontSizeAdjustFactor, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextScale};
|
||||
|
|
|
@ -213,36 +213,11 @@ pub enum FontStyle<Angle> {
|
|||
Oblique(Angle),
|
||||
}
|
||||
|
||||
/// A generic value that holds either a generic Number or the keyword
|
||||
/// `from-font`; used for values of font-size-adjust.
|
||||
#[repr(u8)]
|
||||
#[derive(
|
||||
Animate,
|
||||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
Copy,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToAnimatedValue,
|
||||
ToAnimatedZero,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToCss,
|
||||
ToShmem,
|
||||
)]
|
||||
pub enum GenericNumberOrFromFont<N> {
|
||||
/// An explicitly-specified number.
|
||||
Number(N),
|
||||
/// The from-font keyword: resolve the number from font metrics.
|
||||
FromFont,
|
||||
}
|
||||
|
||||
/// A generic value for the `font-size-adjust` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts-5/#font-size-adjust-prop
|
||||
/// https://www.w3.org/TR/css-fonts-4/#font-size-adjust-prop
|
||||
/// https://github.com/w3c/csswg-drafts/issues/6160
|
||||
/// https://github.com/w3c/csswg-drafts/issues/6288
|
||||
#[allow(missing_docs)]
|
||||
#[repr(u8)]
|
||||
#[derive(
|
||||
|
@ -261,22 +236,22 @@ pub enum GenericNumberOrFromFont<N> {
|
|||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
pub enum GenericFontSizeAdjust<Factor> {
|
||||
pub enum GenericFontSizeAdjust<Number> {
|
||||
#[animation(error)]
|
||||
None,
|
||||
// 'ex-height' is the implied basis, so the keyword can be omitted
|
||||
ExHeight(Factor),
|
||||
ExHeight(Number),
|
||||
#[value_info(starts_with_keyword)]
|
||||
CapHeight(Factor),
|
||||
CapHeight(Number),
|
||||
#[value_info(starts_with_keyword)]
|
||||
ChWidth(Factor),
|
||||
ChWidth(Number),
|
||||
#[value_info(starts_with_keyword)]
|
||||
IcWidth(Factor),
|
||||
IcWidth(Number),
|
||||
#[value_info(starts_with_keyword)]
|
||||
IcHeight(Factor),
|
||||
IcHeight(Number),
|
||||
}
|
||||
|
||||
impl<Factor: ToCss> ToCss for GenericFontSizeAdjust<Factor> {
|
||||
impl<Number: ToCss> ToCss for GenericFontSizeAdjust<Number> {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
|
|
|
@ -11,8 +11,9 @@ use crate::values::computed::Percentage as ComputedPercentage;
|
|||
use crate::values::computed::{font as computed, Length, NonNegativeLength};
|
||||
use crate::values::computed::{CSSPixelLength, Context, ToComputedValue};
|
||||
use crate::values::generics::font::VariationValue;
|
||||
use crate::values::generics::font::{self as generics, FeatureTagValue, FontSettings, FontTag};
|
||||
use crate::values::generics::font::{GenericFontSizeAdjust, GenericNumberOrFromFont};
|
||||
use crate::values::generics::font::{
|
||||
self as generics, FeatureTagValue, FontSettings, FontTag, GenericFontSizeAdjust,
|
||||
};
|
||||
use crate::values::generics::NonNegative;
|
||||
use crate::values::specified::length::{FontBaseSize, PX_PER_PT};
|
||||
use crate::values::specified::{AllowQuirks, Angle, Integer, LengthPercentage};
|
||||
|
@ -699,15 +700,8 @@ impl Parse for FamilyName {
|
|||
}
|
||||
}
|
||||
|
||||
/// A factor for one of the font-size-adjust metrics, which may be either a number
|
||||
/// or the `from-font` keyword.
|
||||
pub type FontSizeAdjustFactor = GenericNumberOrFromFont<NonNegativeNumber>;
|
||||
|
||||
/// Specified value for font-size-adjust, intended to help
|
||||
/// preserve the readability of text when font fallback occurs.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts-5/#font-size-adjust-prop
|
||||
pub type FontSizeAdjust = GenericFontSizeAdjust<FontSizeAdjustFactor>;
|
||||
/// Preserve the readability of text when font fallback occurs
|
||||
pub type FontSizeAdjust = GenericFontSizeAdjust<NonNegativeNumber>;
|
||||
|
||||
impl Parse for FontSizeAdjust {
|
||||
fn parse<'i, 't>(
|
||||
|
@ -715,27 +709,27 @@ impl Parse for FontSizeAdjust {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let location = input.current_source_location();
|
||||
// First check if we have an adjustment factor without a metrics-basis keyword.
|
||||
if let Ok(factor) = input.try_parse(|i| FontSizeAdjustFactor::parse(context, i)) {
|
||||
return Ok(Self::ExHeight(factor));
|
||||
if let Ok(ident) = input.try_parse(|i| i.expect_ident_cloned()) {
|
||||
let basis_enabled = static_prefs::pref!("layout.css.font-size-adjust.basis.enabled");
|
||||
let basis = match_ignore_ascii_case! { &ident,
|
||||
"none" => return Ok(Self::None),
|
||||
// Check for size adjustment basis keywords if enabled.
|
||||
"ex-height" if basis_enabled => Self::ExHeight,
|
||||
"cap-height" if basis_enabled => Self::CapHeight,
|
||||
"ch-width" if basis_enabled => Self::ChWidth,
|
||||
"ic-width" if basis_enabled => Self::IcWidth,
|
||||
"ic-height" if basis_enabled => Self::IcHeight,
|
||||
// Unknown (or disabled) keyword.
|
||||
_ => return Err(location.new_custom_error(
|
||||
SelectorParseErrorKind::UnexpectedIdent(ident)
|
||||
)),
|
||||
};
|
||||
let value = NonNegativeNumber::parse(context, input)?;
|
||||
return Ok(basis(value));
|
||||
}
|
||||
|
||||
let ident = input.expect_ident()?;
|
||||
let basis = match_ignore_ascii_case! { &ident,
|
||||
"none" => return Ok(Self::None),
|
||||
// Check for size adjustment basis keywords.
|
||||
"ex-height" => Self::ExHeight,
|
||||
"cap-height" => Self::CapHeight,
|
||||
"ch-width" => Self::ChWidth,
|
||||
"ic-width" => Self::IcWidth,
|
||||
"ic-height" => Self::IcHeight,
|
||||
// Unknown keyword.
|
||||
_ => return Err(location.new_custom_error(
|
||||
SelectorParseErrorKind::UnexpectedIdent(ident.clone())
|
||||
)),
|
||||
};
|
||||
|
||||
Ok(basis(FontSizeAdjustFactor::parse(context, input)?))
|
||||
// Without a basis keyword, the number refers to the 'ex-height' metric.
|
||||
let value = NonNegativeNumber::parse(context, input)?;
|
||||
Ok(Self::ExHeight(value))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
|||
pub use self::flex::FlexBasis;
|
||||
pub use self::font::{FontFamily, FontLanguageOverride, FontPalette, FontStyle};
|
||||
pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric};
|
||||
pub use self::font::{FontSize, FontSizeAdjust, FontSizeAdjustFactor, FontSizeKeyword, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontSize, FontSizeAdjust, FontSizeKeyword, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextScale};
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[font-size-adjust-interpolation.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
|
@ -0,0 +1,2 @@
|
|||
[font-size-adjust-009.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
|
@ -1,4 +1,5 @@
|
|||
[font-size-adjust-010.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
||||
fuzzy:
|
||||
if os == "linux": maxDifference=0-255;totalPixels=0-1024
|
||||
if os == "win": maxDifference=0-255;totalPixels=0-256
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
[font-size-adjust-011.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
||||
fuzzy:
|
||||
if os == "win": maxDifference=0-255;totalPixels=0-256
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
[font-size-adjust-computed.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[Property font-size-adjust value 'from-font']
|
||||
expected: FAIL
|
||||
|
||||
[Property font-size-adjust value 'ex-height from-font']
|
||||
expected: FAIL
|
||||
|
||||
[Property font-size-adjust value 'cap-height from-font']
|
||||
expected: FAIL
|
||||
|
||||
[Property font-size-adjust value 'ch-width from-font']
|
||||
expected: FAIL
|
||||
|
||||
[Property font-size-adjust value 'ic-width from-font']
|
||||
expected: FAIL
|
||||
|
||||
[Property font-size-adjust value 'ic-height from-font']
|
||||
expected: FAIL
|
|
@ -0,0 +1,3 @@
|
|||
[font-size-adjust-invalid.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
|
@ -0,0 +1,21 @@
|
|||
[font-size-adjust-valid.html]
|
||||
prefs: [layout.css.font-size-adjust.basis.enabled:true]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[e.style['font-size-adjust'\] = "from-font" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['font-size-adjust'\] = "ex-height from-font" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['font-size-adjust'\] = "cap-height from-font" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['font-size-adjust'\] = "ch-width from-font" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['font-size-adjust'\] = "ic-width from-font" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['font-size-adjust'\] = "ic-height from-font" should set the property value]
|
||||
expected: FAIL
|
|
@ -20,9 +20,8 @@
|
|||
.test {
|
||||
font-family: var(--primary-font), var(--secondary-font);
|
||||
font-size: 100px;
|
||||
line-height: 1;
|
||||
color: peru;
|
||||
height: 100px;
|
||||
height: 200px;
|
||||
}
|
||||
.primary-font {
|
||||
font-family: var(--primary-font);
|
||||
|
|
|
@ -24,9 +24,8 @@
|
|||
.test {
|
||||
font-family: var(--primary-font), var(--secondary-font);
|
||||
font-size: 100px;
|
||||
line-height: 1;
|
||||
color: peru;
|
||||
height: 100px;
|
||||
height: 200px;
|
||||
}
|
||||
.primary-font {
|
||||
font-family: var(--primary-font);
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
font-size: 100px;
|
||||
color: peru;
|
||||
height: 200px;
|
||||
margin-top: -20px;
|
||||
margin-bottom: -80px;
|
||||
line-height: 1;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.tall-inline-block {
|
||||
display: inline-block;
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
font-size: 100px;
|
||||
color: peru;
|
||||
height: 200px;
|
||||
margin-top: -20px;
|
||||
margin-bottom: -80px;
|
||||
line-height: 1;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.tall-inline-block {
|
||||
display: inline-block;
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Reference: font-size-adjust property</title>
|
||||
<style>
|
||||
.outer {
|
||||
font: 50px/1 monospace;
|
||||
height: 100px;
|
||||
}
|
||||
.ref {
|
||||
font-family: serif;
|
||||
font-size-adjust: 0.5;
|
||||
}
|
||||
.tall-inline-block {
|
||||
display: inline-block;
|
||||
height: 100px;
|
||||
}
|
||||
.description {
|
||||
font-family: serif;
|
||||
font-size: 16px;
|
||||
font-size-adjust: from-font;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div class="description">
|
||||
All four instances of "foobar" should be the same size; the font of the outer div
|
||||
should not affect <tt>font-size-adjust:from-font</tt> on the inner.
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="ref">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="ref">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="ref">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="ref">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
|
@ -1,78 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Test: font-size-adjust property</title>
|
||||
<link rel="match" href="font-size-adjust-014-ref.html">
|
||||
<link rel="help" href="https://www.w3.org/TR/css-fonts-5/#font-size-adjust-prop">
|
||||
<meta name="assert" content="Test whether from-font automatically determines a font-size-adjust value
|
||||
based on the primary font of the element (not the font of its parent).">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: ahem-ex-500;
|
||||
src: url('./resources/ahem-ex-500.otf');
|
||||
unicode-range: U+0020;
|
||||
}
|
||||
@font-face {
|
||||
font-family: ahem-ex-250;
|
||||
src: url('./resources/ahem-ex-250.otf');
|
||||
unicode-range: U+0020;
|
||||
}
|
||||
.outer {
|
||||
font: 50px/1 monospace;
|
||||
height: 100px;
|
||||
}
|
||||
.ahem250 {
|
||||
font-family: ahem-ex-250;
|
||||
}
|
||||
.ahem500 {
|
||||
font-family: ahem-ex-500;
|
||||
}
|
||||
.test {
|
||||
font-family: ahem-ex-500, serif;
|
||||
/* font-size-adjust should be computed according to the ex-height of ahem-ex-500 */
|
||||
font-size-adjust: from-font;
|
||||
}
|
||||
.ref {
|
||||
font-family: serif;
|
||||
font-size-adjust: 0.5;
|
||||
}
|
||||
.tall-inline-block {
|
||||
display: inline-block;
|
||||
height: 100px;
|
||||
}
|
||||
.description {
|
||||
font-family: serif;
|
||||
font-size: 16px;
|
||||
font-size-adjust: from-font;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div class="description">
|
||||
All four instances of "foobar" should be the same size; the font of the outer div
|
||||
should not affect <tt>font-size-adjust:from-font</tt> on the inner.
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="ref">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer">
|
||||
<span class="test">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer ahem250">
|
||||
<span class="test">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="outer ahem500">
|
||||
<span class="test">
|
||||
foobar<span class="tall-inline-block"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
Двоичные данные
testing/web-platform/tests/css/css-fonts/parsing/ahem-ex-500.otf
Двоичные данные
testing/web-platform/tests/css/css-fonts/parsing/ahem-ex-500.otf
Двоичный файл не отображается.
|
@ -8,43 +8,25 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
<style>
|
||||
/* Use a font with known metrics so we can verify that from-font
|
||||
computes to the expected value from the font. */
|
||||
@font-face {
|
||||
font-family: ahem-ex-500;
|
||||
src: url(ahem-ex-500.otf);
|
||||
}
|
||||
#target {
|
||||
font-family: ahem-ex-500 !important;
|
||||
font-size: 1000px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
promise_test(async (t) => {
|
||||
await document.fonts.load("1000px ahem-ex-500");
|
||||
test_computed_value('font-size-adjust', 'none');
|
||||
|
||||
test_computed_value('font-size-adjust', 'none');
|
||||
test_computed_value('font-size-adjust', '0.5');
|
||||
test_computed_value('font-size-adjust', 'ex-height 0.5', '0.5'); // default basis 'ex-height' omitted from serialization
|
||||
test_computed_value('font-size-adjust', 'cap-height 0.8');
|
||||
test_computed_value('font-size-adjust', 'ch-width 0.4');
|
||||
test_computed_value('font-size-adjust', 'ic-width 0.9');
|
||||
test_computed_value('font-size-adjust', 'ic-height 1.1');
|
||||
|
||||
test_computed_value('font-size-adjust', '0.5');
|
||||
test_computed_value('font-size-adjust', 'ex-height 0.5', '0.5'); // default basis 'ex-height' omitted from serialization
|
||||
test_computed_value('font-size-adjust', 'cap-height 0.8');
|
||||
test_computed_value('font-size-adjust', 'ch-width 0.4');
|
||||
test_computed_value('font-size-adjust', 'ic-width 0.9');
|
||||
test_computed_value('font-size-adjust', 'ic-height 1.1');
|
||||
|
||||
// The ahem-ex-500 font has both ex-height and cap-height set at 0.5em, and ch-width is 1em.
|
||||
// Ideographic metrics are not available, so fall back to 1em.
|
||||
test_computed_value('font-size-adjust', 'from-font', '0.5');
|
||||
test_computed_value('font-size-adjust', 'ex-height from-font', '0.5'); // default basis 'ex-height' omitted from serialization
|
||||
test_computed_value('font-size-adjust', 'cap-height from-font', 'cap-height 0.5');
|
||||
test_computed_value('font-size-adjust', 'ch-width from-font', 'ch-width 1');
|
||||
test_computed_value('font-size-adjust', 'ic-width from-font', 'ic-width 1');
|
||||
test_computed_value('font-size-adjust', 'ic-height from-font', 'ic-height 1');
|
||||
})
|
||||
test_computed_value('font-size-adjust', 'from-font');
|
||||
test_computed_value('font-size-adjust', 'ex-height from-font', 'from-font'); // default basis 'ex-height' omitted from serialization
|
||||
test_computed_value('font-size-adjust', 'cap-height from-font');
|
||||
test_computed_value('font-size-adjust', 'ch-width from-font');
|
||||
test_computed_value('font-size-adjust', 'ic-width from-font');
|
||||
test_computed_value('font-size-adjust', 'ic-height from-font');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -614,12 +614,9 @@ AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-012.html
|
|||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-012-ref.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-013.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-013-ref.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-014.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-014-ref.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-metrics-override.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/font-size-adjust-metrics-override-ref.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/line-gap-override.html
|
||||
AHEM SYSTEM FONT: css/css-fonts/parsing/font-size-adjust-computed.html
|
||||
AHEM SYSTEM FONT: html/dom/render-blocking/remove-attr-unblocks-rendering.optional.html
|
||||
AHEM SYSTEM FONT: html/dom/render-blocking/remove-element-unblocks-rendering.optional.html
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче