From 4f44f0d754b9371a73ea9d65576a3a759277816b Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Fri, 11 Sep 2020 19:48:07 +0000 Subject: [PATCH] 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 --- .../en-US/chrome/mathml/mathml.properties | 1 - dom/mathml/MathMLElement.cpp | 32 +++++-------------- layout/mathml/tests/test_bug553917.html | 21 ++++-------- layout/reftests/mathml/355548-3-ref.xml | 4 +-- layout/reftests/mathml/355548-3.xml | 4 +-- .../mathml/mfrac-linethickness-2-ref.xhtml | 2 +- .../reftests/mathml/number-size-1-ref.xhtml | 2 +- layout/reftests/mathml/reftest.list | 6 ++-- modules/libpref/init/StaticPrefList.yaml | 13 -------- testing/web-platform/meta/mathml/__dir__.ini | 2 +- 10 files changed, 24 insertions(+), 63 deletions(-) diff --git a/dom/locales/en-US/chrome/mathml/mathml.properties b/dom/locales/en-US/chrome/mathml/mathml.properties index 9065487d42d6..60a7f1d6054a 100644 --- a/dom/locales/en-US/chrome/mathml/mathml.properties +++ b/dom/locales/en-US/chrome/mathml/mathml.properties @@ -13,4 +13,3 @@ SubSupMismatch=Invalid markup: Incomplete subscript/superscript pair in . 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. diff --git a/dom/mathml/MathMLElement.cpp b/dom/mathml/MathMLElement.cpp index e7c3135c9b83..5c243b64a5aa 100644 --- a/dom/mathml/MathMLElement.cpp +++ b/dom/mathml/MathMLElement.cpp @@ -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; diff --git a/layout/mathml/tests/test_bug553917.html b/layout/mathml/tests/test_bug553917.html index d4bbdd6059b6..e296112255a2 100644 --- a/layout/mathml/tests/test_bug553917.html +++ b/layout/mathml/tests/test_bug553917.html @@ -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 = { /* @@ -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"] - }, - /*+*/ - 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 - + + + xy - - - + diff --git a/layout/reftests/mathml/355548-3-ref.xml b/layout/reftests/mathml/355548-3-ref.xml index 99d8a7b3c9f0..e908b755e082 100644 --- a/layout/reftests/mathml/355548-3-ref.xml +++ b/layout/reftests/mathml/355548-3-ref.xml @@ -49,11 +49,11 @@ Id Id Id + Id + Id

- Id - Id Id Id Id diff --git a/layout/reftests/mathml/355548-3.xml b/layout/reftests/mathml/355548-3.xml index 35b216fcf5fb..0e0f97fd7906 100644 --- a/layout/reftests/mathml/355548-3.xml +++ b/layout/reftests/mathml/355548-3.xml @@ -59,14 +59,14 @@ Id Id Id + Id + Id

Id Id - Id - Id Id Id Id diff --git a/layout/reftests/mathml/mfrac-linethickness-2-ref.xhtml b/layout/reftests/mathml/mfrac-linethickness-2-ref.xhtml index f83f88f995c9..7394f6d0b6c4 100644 --- a/layout/reftests/mathml/mfrac-linethickness-2-ref.xhtml +++ b/layout/reftests/mathml/mfrac-linethickness-2-ref.xhtml @@ -13,7 +13,7 @@ - + 1 2 diff --git a/layout/reftests/mathml/number-size-1-ref.xhtml b/layout/reftests/mathml/number-size-1-ref.xhtml index 6d38b4bb0217..e84a9ac75e88 100644 --- a/layout/reftests/mathml/number-size-1-ref.xhtml +++ b/layout/reftests/mathml/number-size-1-ref.xhtml @@ -1,7 +1,7 @@ - 2 + 2 diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index db9f9e7862f7..1214af24792e 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -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 diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 4e32a076b995..33e43072382b 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -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 diff --git a/testing/web-platform/meta/mathml/__dir__.ini b/testing/web-platform/meta/mathml/__dir__.ini index 80b0271971bd..bd8a0e704393 100644 --- a/testing/web-platform/meta/mathml/__dir__.ini +++ b/testing/web-platform/meta/mathml/__dir__.ini @@ -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] \ No newline at end of file +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] \ No newline at end of file