Bug 1664467: Remove runtime preferences for legacy MathML lengths. r=emilio

This commit remove the following preferences, which have been
disabled since Firefox 70:
- mathml.nonzero_unitless_lengths.disabled
- mathml.legacy_number_syntax.disabled

These are edge syntaxes for MathML3 lengths that don't align well
with CSS and we haven't received any bug report about it since they
were disabled. Tests are updated to treat attributes using such
values as invalid.

update tests

Differential Revision: https://phabricator.services.mozilla.com/D89920
This commit is contained in:
Frederic Wang 2020-09-11 19:48:07 +00:00
parent 8ca0706c76
commit 4f44f0d754
10 changed files with 24 additions and 63 deletions

View File

@ -13,4 +13,3 @@ SubSupMismatch=Invalid markup: Incomplete subscript/superscript pair in <mmultis
AttributeParsingError=Error in parsing the value %1$S for %2$S attribute of <%3$S/>. Attribute ignored.
AttributeParsingErrorNoTag=Error in parsing the value %1$S for %2$S attribute. Attribute ignored.
LengthParsingError=Error in parsing MathML attribute value %1$S as length. Attribute ignored.
UnitlessValuesAreDeprecated=Unitless values are deprecated in MathML 3.

View File

@ -306,8 +306,7 @@ bool MathMLElement::ParseNumericValue(const nsString& aString,
}
number.Append(c);
}
if (StaticPrefs::mathml_legacy_number_syntax_disabled() && gotDot &&
str[i - 1] == '.') {
if (gotDot && str[i - 1] == '.') {
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
ReportLengthParseError(aString, aDocument);
}
@ -332,31 +331,16 @@ bool MathMLElement::ParseNumericValue(const nsString& aString,
nsCSSUnit cssUnit;
if (unit.IsEmpty()) {
if (!StaticPrefs::mathml_nonzero_unitless_lengths_disabled() &&
(aFlags & PARSE_ALLOW_UNITLESS)) {
// no explicit unit, this is a number that will act as a multiplier
// We are supposed to have a unit, but there isn't one.
// If the value is 0 we can just call it "pixels" otherwise
// this is illegal.
if (floatValue != 0.0) {
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag, "MathML"_ns, aDocument,
nsContentUtils::eMATHML_PROPERTIES, "UnitlessValuesAreDeprecated");
ReportLengthParseError(aString, aDocument);
}
if (aFlags & CONVERT_UNITLESS_TO_PERCENT) {
aCSSValue.SetPercentValue(floatValue);
return true;
} else
cssUnit = eCSSUnit_Number;
} else {
// We are supposed to have a unit, but there isn't one.
// If the value is 0 we can just call it "pixels" otherwise
// this is illegal.
if (floatValue != 0.0) {
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
ReportLengthParseError(aString, aDocument);
}
return false;
}
cssUnit = eCSSUnit_Pixel;
return false;
}
cssUnit = eCSSUnit_Pixel;
} else if (unit.EqualsLiteral("%")) {
aCSSValue.SetPercentValue(floatValue / 100.0f);
return true;

View File

@ -17,9 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
const allow_linethickness_names = !SpecialPowers.getBoolPref('mathml.mfrac_linethickness_names.disabled');
const allow_mathsize_names = !SpecialPowers.getBoolPref('mathml.mathsize_names.disabled');
const allow_nonzero_unitless_lengths = !SpecialPowers.getBoolPref('mathml.nonzero_unitless_lengths.disabled');
const allow_mathspace_names = !SpecialPowers.getBoolPref('mathml.mathspace_names.disabled');
const allow_legacy_numbers = !SpecialPowers.getBoolPref('mathml.legacy_number_syntax.disabled');
var g_errorInfo = {
/*<math><mroot></mroot></math>
@ -86,8 +84,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
allow_mathspace_names,
allow_mathspace_names,
allow_mathspace_names,
allow_legacy_numbers,
allow_nonzero_unitless_lengths,
false,
false,
],
args: [["2..0px"],
["1.5notaunit"],
@ -118,15 +116,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
MMultiscriptsErrors: {
status: [false, false, false],
args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
},
/*<math><mo minsize="17">+</mo></math>*/
UnitlessValuesAreDeprecated : {
status : [!allow_nonzero_unitless_lengths],
args : [[]] }};
}};
var g_errorTypes = ["ChildCountIncorrect","AttributeParsingError",
"AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors",
"UnitlessValuesAreDeprecated"];
"AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors"];
function getErrorMessage(name,idx)
{
@ -219,13 +212,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
<math><mspace width="verythickmathspace"/></math>
<math><mspace width="veryverythickmathspace"/></math>
<math><mspace width="12345."/></math>
<math><mo minsize="17">+</mo></math>
<!-- MMultiscriptsErrors -->
<math><mmultiscripts></mmultiscripts></math>
<math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
<math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
<!-- UnitlessValuesAreDeprecated -->
<math><mo minsize="17">+</mo></math>
</body>
</html>

View File

@ -49,11 +49,11 @@
<m:mstyle><m:mi style="font-size:48px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:48px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:48px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:48px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:48px;">Id</m:mi></m:mstyle>
</m:math></p>
<p><m:math>
<m:mstyle><m:mi style="font-size:24px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:24px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:24px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:24px;">Id</m:mi></m:mstyle>
<m:mstyle><m:mi style="font-size:24px;">Id</m:mi></m:mstyle>

View File

@ -59,14 +59,14 @@
<m:mstyle mathsize=".px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="..px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="+20px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="0.5"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="24.px"><m:mi>Id</m:mi></m:mstyle>
</m:mstyle></m:math></p>
<p><m:math><m:mstyle scriptlevel="0" scriptsizemultiplier="0.5" scriptminsize="18px" style="font-size:48px;">
<!-- test valid values for MathML length attributes -->
<m:mstyle mathsize=" 24px "><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="24.0px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="24.px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="0.5"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="50%"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize=".0px"><m:mi>Id</m:mi></m:mstyle>
<m:mstyle mathsize="-0px"><m:mi>Id</m:mi></m:mstyle>

View File

@ -13,7 +13,7 @@
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac linethickness="200%">
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>

View File

@ -1,7 +1,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mn mathsize="200%">2</mn>
<mn>2</mn>
</math>
</body>
</html>

View File

@ -4,7 +4,7 @@
== 347496-1.xhtml 347496-1-ref.xhtml
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-1.xml 355548-1-ref.xml # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-2.xml 355548-2-ref.xml # Bug 1392106
pref(mathml.deprecated_style_attributes.disabled,false) pref(mathml.legacy_number_syntax.disabled,false) pref(mathml.nonzero_unitless_lengths.disabled,false) pref(mathml.mathsize_names.disabled,false) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-3.xml 355548-3-ref.xml # Bug 1392106
pref(mathml.deprecated_style_attributes.disabled,false) pref(mathml.mathsize_names.disabled,false) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-3.xml 355548-3-ref.xml # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-4.xml 355548-4-ref.xml # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-5.xml 355548-5-ref.xml # Bug 1392106
== 370692-1.xhtml 370692-1-ref.xhtml
@ -153,7 +153,7 @@ pref(mathml.deprecated_alignment_attributes.disabled,false) random-if(/^Windows\
pref(mathml.deprecated_alignment_attributes.disabled,false) == munder-mover-align-accent-true.html munder-mover-align-accent-true-ref.html
pref(mathml.deprecated_alignment_attributes.disabled,false) == munder-mover-align-accent-false.html munder-mover-align-accent-false-ref.html
pref(mathml.mfrac_linethickness_names.disabled,false) == mfrac-linethickness-1.xhtml mfrac-linethickness-1-ref.xhtml
pref(mathml.nonzero_unitless_lengths.disabled,false) == mfrac-linethickness-2.xhtml mfrac-linethickness-2-ref.xhtml
== mfrac-linethickness-2.xhtml mfrac-linethickness-2-ref.xhtml
== mfrac-linethickness-3.xhtml mfrac-linethickness-3-ref.xhtml
pref(mathml.mathspace_names.disabled,false) == mathml-negativespace.html mathml-negativespace-ref.html
== negative-mspace-1.html negative-mspace-1-ref.html
@ -201,7 +201,7 @@ random-if(winWidget&&!d2d) == opentype-stretchy.html opentype-stretchy-ref.html
== opentype-fraction-dynamic-linethickness.html opentype-fraction-dynamic-linethickness-ref.html
== operator-1.xhtml operator-1-ref.xhtml
== scriptshift-1.xhtml scriptshift-1-ref.xhtml
pref(mathml.nonzero_unitless_lengths.disabled,false) == number-size-1.xhtml number-size-1-ref.xhtml
== number-size-1.xhtml number-size-1-ref.xhtml
fuzzy-if(skiaContent,0-1,0-80) fuzzy-if(Android,0-255,0-105) fuzzy-if(gtkWidget,255-255,96-96) skip-if(winWidget) == multiscripts-1.html multiscripts-1-ref.html # Windows: bug 1314684; Android: bug 1392254; Linux: bug 1599638
== mathml-mmultiscript-base.html mathml-mmultiscript-base-ref.html
== mathml-mmultiscript-mprescript.html mathml-mmultiscript-mprescript-ref.html

View File

@ -6602,13 +6602,6 @@
value: @IS_NIGHTLY_BUILD@
mirror: always
# Whether to disable legacy MathML number values that are not valid CSS numbers
# (e.g. "1234.")
- name: mathml.legacy_number_syntax.disabled
type: bool
value: true
mirror: always
# Whether to disable legacy names "small", "normal" and "big" for the
# mathsize attribute.
- name: mathml.mathsize_names.disabled
@ -6642,12 +6635,6 @@
value: @IS_NIGHTLY_BUILD@
mirror: always
# Whether to disable nonzero unitless values e.g. linethickness="2" for 200%
- name: mathml.nonzero_unitless_lengths.disabled
type: bool
value: true
mirror: always
# Whether to disable deprecated numalign/denomalign/align attributes
- name: mathml.deprecated_alignment_attributes.disabled
type: bool

View File

@ -1 +1 @@
prefs: [mathml.deprecated_style_attributes.disabled: true, mathml.deprecated_menclose_notation_radical.disabled: true, mathml.legacy_number_syntax.disabled: true, mathml.mathsize_names.disabled:true, mathml.mathspace_names.disabled: true, mathml.mfrac_linethickness_names.disabled:true, mathml.nonzero_unitless_lengths.disabled:true, mathml.deprecated_alignment_attributes.disabled: true, mathml.script_shift_attributes.disabled: true, mathml.mfrac_bevelled_attribute.disabled: true, mathml.mfenced_element.disabled: true]
prefs: [mathml.deprecated_style_attributes.disabled: true, mathml.deprecated_menclose_notation_radical.disabled: true, mathml.mathsize_names.disabled:true, mathml.mathspace_names.disabled: true, mathml.mfrac_linethickness_names.disabled:true, mathml.deprecated_alignment_attributes.disabled: true, mathml.script_shift_attributes.disabled: true, mathml.mfrac_bevelled_attribute.disabled: true, mathml.mfenced_element.disabled: true]