forked from mirrors/gecko-dev
Backed out 2 changesets (bug 1667090, bug 1788605) for causing Xpcshell failures on test_css-properties-db.js. CLOSED TREE
Backed out changeset cee98ae67ea4 (bug 1788605) Backed out changeset 404e0b4bcd0f (bug 1667090)
This commit is contained in:
parent
bba5141ddc
commit
49eaaa607e
18 changed files with 258 additions and 280 deletions
|
|
@ -6630,7 +6630,6 @@ exports.CSS_PROPERTIES = {
|
|||
"large",
|
||||
"larger",
|
||||
"lighter",
|
||||
"math",
|
||||
"medium",
|
||||
"menu",
|
||||
"message-box",
|
||||
|
|
@ -8618,21 +8617,6 @@ exports.CSS_PROPERTIES = {
|
|||
"unset"
|
||||
]
|
||||
},
|
||||
"math-depth": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
"math-depth"
|
||||
],
|
||||
"supports": [],
|
||||
"values": [
|
||||
"add",
|
||||
"auto-add",
|
||||
"inherit",
|
||||
"initial",
|
||||
"revert",
|
||||
"unset"
|
||||
]
|
||||
},
|
||||
"math-style": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
|
|
|
|||
|
|
@ -421,35 +421,29 @@ void MathMLElement::MapMathMLAttributesInto(
|
|||
}
|
||||
|
||||
// scriptlevel
|
||||
// https://w3c.github.io/mathml-core/#dfn-scriptlevel
|
||||
//
|
||||
// "Changes the scriptlevel in effect for the children. When the value is
|
||||
// given without a sign, it sets scriptlevel to the specified value; when a
|
||||
// sign is given, it increments ("+") or decrements ("-") the current
|
||||
// value. (Note that large decrements can result in negative values of
|
||||
// scriptlevel, but these values are considered legal.)"
|
||||
//
|
||||
// values: ( "+" | "-" )? unsigned-integer
|
||||
// default: inherited
|
||||
//
|
||||
value = aAttributes->GetAttr(nsGkAtoms::scriptlevel_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aDecls.PropertyIsSet(eCSSProperty_math_depth)) {
|
||||
auto str = value->GetStringValue();
|
||||
// FIXME: Should we remove whitespace trimming?
|
||||
// See https://github.com/w3c/mathml/issues/122
|
||||
str.CompressWhitespace();
|
||||
if (str.Length() > 0) {
|
||||
nsresult errorCode;
|
||||
int32_t intValue = str.ToInteger(&errorCode);
|
||||
bool reportParseError = true;
|
||||
if (NS_SUCCEEDED(errorCode)) {
|
||||
char16_t ch = str.CharAt(0);
|
||||
bool isRelativeScriptLevel = (ch == '+' || ch == '-');
|
||||
// ToInteger is not very strict, check this is really <unsigned>.
|
||||
reportParseError = false;
|
||||
for (uint32_t i = isRelativeScriptLevel ? 1 : 0; i < str.Length();
|
||||
i++) {
|
||||
if (!IsAsciiDigit(str.CharAt(i))) {
|
||||
reportParseError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!reportParseError) {
|
||||
aDecls.SetMathDepthValue(intValue, isRelativeScriptLevel);
|
||||
}
|
||||
}
|
||||
if (reportParseError) {
|
||||
aDecls.SetMathDepthValue(intValue, isRelativeScriptLevel);
|
||||
} else {
|
||||
ReportParseErrorNoTag(str, nsGkAtoms::scriptlevel_, aDecls.Document());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
@namespace url(http://www.w3.org/1998/Math/MathML);
|
||||
|
||||
* {
|
||||
font-size: math;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* <math> - outermost math element */
|
||||
/**************************************************************************/
|
||||
|
|
@ -31,7 +27,6 @@ math {
|
|||
text-rendering: optimizeLegibility;
|
||||
-moz-float-edge: margin-box;
|
||||
math-style: compact;
|
||||
math-depth: 0;
|
||||
}
|
||||
math[display="block" i] {
|
||||
display: block;
|
||||
|
|
|
|||
|
|
@ -13510,14 +13510,13 @@ if (IsCSSPropertyPrefEnabled("layout.css.math-depth.enabled")) {
|
|||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: ["0"],
|
||||
other_values: [
|
||||
// auto-add cannot be tested here because it has no effect when the
|
||||
// inherited math-style is equal to the default (normal).
|
||||
"auto-add",
|
||||
"123",
|
||||
"-123",
|
||||
"add(123)",
|
||||
"add(-123)",
|
||||
"calc(1 + 2*3)",
|
||||
"add(calc(4 - 2/3))",
|
||||
"add(calc(1 - 2/3))",
|
||||
],
|
||||
invalid_values: ["auto", "1,23", "1.23", "add(1,23)", "add(1.23)"],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8112,9 +8112,10 @@
|
|||
rust: true
|
||||
|
||||
# Is support for math-depth enabled?
|
||||
# This must not be enabled until implementation is complete (see bug 1667090).
|
||||
- name: layout.css.math-depth.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
value: false
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
|
|
|
|||
|
|
@ -1040,21 +1040,25 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
builder.mutate_font().unzoom_fonts(device);
|
||||
}
|
||||
|
||||
/// Special handling of font-size: math (used for MathML).
|
||||
/// https://w3c.github.io/mathml-core/#the-math-script-level-property
|
||||
/// TODO: Bug: 1788637: Get rid of mScriptSizeMultiplier/mScriptMinSize when
|
||||
/// the corresponding preference for these attributes is removed.
|
||||
/// TODO: Bug: 1548471: MathML Core also does not specify a script min size
|
||||
/// should we unship that feature or standardize it?
|
||||
/// MathML script* attributes do some very weird shit with font-size.
|
||||
///
|
||||
/// Handle them specially here, separate from other font-size stuff.
|
||||
///
|
||||
/// How this should interact with lang="" and font-family-dependent sizes is
|
||||
/// not clear to me. For now just pretend those don't exist here.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn recompute_math_font_size_if_needed(&mut self) {
|
||||
fn handle_mathml_scriptlevel_if_needed(&mut self) {
|
||||
use crate::values::generics::NonNegative;
|
||||
|
||||
// Do not do anything if font-size: math or math-depth is not set.
|
||||
if !self.seen.contains(LonghandId::MathDepth) ||
|
||||
!self.seen.contains(LonghandId::FontSize) ||
|
||||
self.context.builder.get_font().clone_font_size().keyword_info.kw !=
|
||||
specified::FontSizeKeyword::Math {
|
||||
if !self.seen.contains(LonghandId::MathDepth) &&
|
||||
!self.seen.contains(LonghandId::MozScriptMinSize) &&
|
||||
!self.seen.contains(LonghandId::MozScriptSizeMultiplier)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If the user specifies a font-size, just let it be.
|
||||
if self.seen.contains(LonghandId::FontSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1190,7 +1194,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
self.recompute_initial_font_family_if_needed();
|
||||
self.prioritize_user_fonts_if_needed();
|
||||
self.recompute_keyword_font_size_if_needed();
|
||||
self.recompute_math_font_size_if_needed();
|
||||
self.handle_mathml_scriptlevel_if_needed();
|
||||
self.constrain_font_size_if_needed()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,16 +444,6 @@ impl ToComputedValue for FontStretch {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn math_depth_enabled(_context: &ParserContext) -> bool {
|
||||
static_prefs::pref!("layout.css.math-depth.enabled")
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
fn math_depth_enabled(_context: &ParserContext) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// CSS font keywords
|
||||
#[derive(
|
||||
Animate,
|
||||
|
|
@ -488,10 +478,6 @@ pub enum FontSizeKeyword {
|
|||
XXLarge,
|
||||
#[css(keyword = "xxx-large")]
|
||||
XXXLarge,
|
||||
/// Indicate whether to apply font-size: math is specified so that extra
|
||||
/// scaling due to math-depth changes is applied during the cascade.
|
||||
#[parse(condition = "math_depth_enabled")]
|
||||
Math,
|
||||
#[css(skip)]
|
||||
None,
|
||||
}
|
||||
|
|
@ -562,7 +548,6 @@ impl KeywordInfo {
|
|||
/// text-zoom.
|
||||
fn to_computed_value(&self, context: &Context) -> CSSPixelLength {
|
||||
debug_assert_ne!(self.kw, FontSizeKeyword::None);
|
||||
debug_assert_ne!(self.kw, FontSizeKeyword::Math);
|
||||
let base = context.maybe_zoom_text(self.kw.to_length(context).0);
|
||||
base * self.factor + context.maybe_zoom_text(self.offset)
|
||||
}
|
||||
|
|
@ -784,7 +769,7 @@ impl FontSizeKeyword {
|
|||
FontSizeKeyword::XLarge => medium * 3.0 / 2.0,
|
||||
FontSizeKeyword::XXLarge => medium * 2.0,
|
||||
FontSizeKeyword::XXXLarge => medium * 3.0,
|
||||
FontSizeKeyword::Math | FontSizeKeyword::None => unreachable!(),
|
||||
FontSizeKeyword::None => unreachable!(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -815,7 +800,6 @@ impl FontSizeKeyword {
|
|||
language: &Atom,
|
||||
family: &FontFamilyList,
|
||||
) -> NonNegativeLength {
|
||||
debug_assert_ne!(*self, FontSizeKeyword::Math);
|
||||
// The tables in this function are originally from
|
||||
// nsRuleNode::CalcFontPointSize in Gecko:
|
||||
//
|
||||
|
|
@ -939,16 +923,9 @@ impl FontSize {
|
|||
calc.resolve(base_size.resolve(context))
|
||||
},
|
||||
FontSize::Keyword(i) => {
|
||||
if i.kw == FontSizeKeyword::Math {
|
||||
// Scaling is done in recompute_math_font_size_if_needed().
|
||||
info = compose_keyword(1.);
|
||||
info.kw = FontSizeKeyword::Math;
|
||||
FontRelativeLength::Em(1.).to_computed_value(context, base_size)
|
||||
} else {
|
||||
// As a specified keyword, this is keyword derived
|
||||
info = i;
|
||||
i.to_computed_value(context).clamp_to_non_negative()
|
||||
}
|
||||
// As a specified keyword, this is keyword derived
|
||||
info = i;
|
||||
i.to_computed_value(context).clamp_to_non_negative()
|
||||
},
|
||||
FontSize::Smaller => {
|
||||
info = compose_keyword(1. / LARGER_FONT_SIZE_RATIO);
|
||||
|
|
@ -959,6 +936,7 @@ impl FontSize {
|
|||
info = compose_keyword(LARGER_FONT_SIZE_RATIO);
|
||||
FontRelativeLength::Em(LARGER_FONT_SIZE_RATIO).to_computed_value(context, base_size)
|
||||
},
|
||||
|
||||
FontSize::System(_) => {
|
||||
#[cfg(feature = "servo")]
|
||||
{
|
||||
|
|
@ -1020,7 +998,7 @@ impl FontSize {
|
|||
return Ok(FontSize::Length(lp));
|
||||
}
|
||||
|
||||
if let Ok(kw) = input.try_parse(|i| FontSizeKeyword::parse(context, i)) {
|
||||
if let Ok(kw) = input.try_parse(FontSizeKeyword::parse) {
|
||||
return Ok(FontSize::Keyword(KeywordInfo::new(kw)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7158,19 +7158,14 @@ pub unsafe extern "C" fn Servo_ParseFontShorthandForMatching(
|
|||
Err(..) => return false,
|
||||
}
|
||||
},
|
||||
// Map absolute-size keywords to sizes.
|
||||
specified::FontSize::Keyword(info) => {
|
||||
let keyword = if info.kw != specified::FontSizeKeyword::Math {
|
||||
info.kw
|
||||
} else {
|
||||
specified::FontSizeKeyword::Medium
|
||||
};
|
||||
// Map absolute-size keywords to sizes.
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
// TODO: Maybe get a meaningful language / quirks-mode from the
|
||||
// caller?
|
||||
let language = atom!("x-western");
|
||||
let quirks_mode = QuirksMode::NoQuirks;
|
||||
keyword.to_length_without_context(quirks_mode, &metrics, &language, family).0.px()
|
||||
info.kw.to_length_without_context(quirks_mode, &metrics, &language, family).0.px()
|
||||
}
|
||||
// smaller, larger not currently supported
|
||||
specified::FontSize::Smaller | specified::FontSize::Larger | specified::FontSize::System(_) => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
[math-script-level-003.tentative.html]
|
||||
expected: FAIL
|
||||
|
|
@ -1 +1 @@
|
|||
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, layout.css.math-depth.enabled: true, layout.css.math-style.enabled: true]
|
||||
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, mathml.mfenced_element.disabled: true, layout.css.math-style.enabled: true]
|
||||
|
|
@ -94,3 +94,196 @@
|
|||
|
||||
[mathvariant on the semantics element is mapped to CSS text-transform]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the msqrt element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the maction element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the semantics element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mrow element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the none element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mtd element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the msub element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the math element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mroot element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mpadded element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mo element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mi element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the munderover element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the msup element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mtext element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mfrac element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the annotation element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mmultiscripts element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mprescripts element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mtable element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the annotation-xml element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the msubsup element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the merror element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the ms element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mspace element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mtr element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the munder element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mstyle element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mover element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mphantom element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the mn element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[scriptlevel on the menclose element is mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the annotation element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the munderover element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mn element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mtr element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mmultiscripts element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the ms element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the semantics element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the math element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mfrac element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the annotation-xml element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mphantom element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mpadded element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mo element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mtd element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the munder element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mover element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mrow element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the merror element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the msup element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the maction element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mtable element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mi element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the msqrt element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the menclose element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mroot element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mtext element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mstyle element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the msubsup element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the msub element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the none element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mprescripts element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[invalid scriptlevel values on the mspace element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>font-size: math (reference)</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
.container {
|
||||
/* Ahem font does not have a MATH table so the font-size scale factor
|
||||
is always 0.71^{computed - inherited math script level} */
|
||||
font: 100px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div style="font-size: medium;">
|
||||
<div style="font-size: 1em;">X</div>
|
||||
</div>
|
||||
<div style="font-size: x-large;">
|
||||
<div style="font-size: 200%">
|
||||
<div style="font-size: 3em">
|
||||
<div style="font-size: smaller">
|
||||
<div style="font-size: 1em;">
|
||||
<div style="font-size: larger">
|
||||
<div style="font-size: 4em">
|
||||
<div style="font-size: 500%">X</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>font-size: math</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3746">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-math-script-level-property">
|
||||
<meta name="assert" content="Test that a specified font-size: math behaves like 1em when mixed with other keyword and relative sizes.">
|
||||
<link rel="match" href="font-size-math-001.tentative-ref.html">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
.container {
|
||||
/* Ahem font does not have a MATH table so the font-size scale factor
|
||||
is always 0.71^{computed - inherited math script level} */
|
||||
font: 100px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div style="font-size: medium;">
|
||||
<div style="font-size: math;">X</div>
|
||||
</div>
|
||||
<div style="font-size: x-large;">
|
||||
<div style="font-size: 200%">
|
||||
<div style="font-size: 3em">
|
||||
<div style="font-size: smaller">
|
||||
<div style="font-size: math;">
|
||||
<div style="font-size: larger">
|
||||
<div style="font-size: 4em">
|
||||
<div style="font-size: 500%">X</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>font-size: math inheritance (reference)</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
.container {
|
||||
/* Ahem font does not have a MATH table so the font-size scale factor
|
||||
is always 0.71^{computed - inherited math script level} */
|
||||
font: 100px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a square of side 100px.</p>
|
||||
<div class="container">
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<div>X</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>font-size: math inheritance</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3746">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-math-script-level-property">
|
||||
<meta name="assert" content="Test inheritance for a specified font-size: math.">
|
||||
<link rel="match" href="font-size-math-002.tentative-ref.html">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
.container {
|
||||
/* Ahem font does not have a MATH table so the font-size scale factor
|
||||
is always 0.71^{computed - inherited math script level} */
|
||||
font: 100px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a square of side 100px.</p>
|
||||
<div class="container">
|
||||
<div style="font-size: math">
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="math-depth: 1">X</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>font-size: math treated as medium in disconnected canvas (reference)</title>
|
||||
<body>
|
||||
</body>
|
||||
<script>
|
||||
var d = new Document();
|
||||
var c = d.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.font = `medium serif`;
|
||||
ctx.fillText("Hello World!", 5, c.height / 2);
|
||||
c.toBlob((blob) => {
|
||||
var img = document.createElement("img");
|
||||
const url = URL.createObjectURL(blob);
|
||||
img.src = url;
|
||||
img.style.border = "3px solid cyan";
|
||||
document.body.appendChild(img);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>font-size: math treated as medium in disconnected canvas</title>
|
||||
<link rel="match" href="canvas.2d.disconnected-font-size-math-ref.html">
|
||||
<body>
|
||||
</body>
|
||||
<script>
|
||||
var d = new Document();
|
||||
var c = d.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.font = `math serif`;
|
||||
ctx.fillText("Hello World!", 5, c.height / 2);
|
||||
c.toBlob((blob) => {
|
||||
var img = document.createElement("img");
|
||||
const url = URL.createObjectURL(blob);
|
||||
img.src = url;
|
||||
img.style.border = "3px solid cyan";
|
||||
document.body.appendChild(img);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -65,17 +65,29 @@
|
|||
}, `scriptlevel on the ${tag} element is mapped to math-depth(...)`);
|
||||
|
||||
test(function() {
|
||||
element.removeAttribute("scriptlevel");
|
||||
// none and mprescripts appear as scripts
|
||||
let expected = `${tag === "none" || tag === "mprescripts" ? "1" : "0"}`;
|
||||
assert_equals(style.getPropertyValue("math-depth"), expected, "no attribute");
|
||||
let expected = 0;
|
||||
element.setAttribute("scriptlevel", "" + expected);
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "no attribute");
|
||||
|
||||
element.setAttribute("scriptlevel", " +1");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
element.setAttribute("scriptlevel", " + 1");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
element.setAttribute("scriptlevel", "2.0");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
element.setAttribute("scriptlevel", "-3\"");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
element.setAttribute("scriptlevel", "200px");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
element.setAttribute("scriptlevel", "add(2)");
|
||||
assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value");
|
||||
|
||||
// FIXME: Should we test values " +1" and "+1 " here?
|
||||
// See https://github.com/w3c/mathml/issues/122
|
||||
["+-1", "--1", "+z1", "+ 1", "2.0", "-3\"", "200px", "add(2)"].forEach(invalid_value => {
|
||||
element.setAttribute("scriptlevel", invalid_value);
|
||||
assert_equals(style.getPropertyValue("math-depth"), expected, `invalid scriptlevel value '${invalid_value}'`);
|
||||
});
|
||||
}, `invalid scriptlevel values on the ${tag} element are not mapped to math-depth(...)`);
|
||||
|
||||
test(function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue