From 0c2987e39254aa5b1dd30c73fa82d2ca2811b5b8 Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Thu, 3 Oct 2019 21:37:03 +0000 Subject: [PATCH] Bug 1548522 - Remove support for the menclose's "radical" notation. r=emilio See https://groups.google.com/forum/#!topic/mozilla.dev.platform/vwAkuZIEhnY * Introduce a new preference option to disable menclose's "radical" notation. * Disable the notation in Nightly and when running WPT tests. * Enable the notation in other channels together with a counter and deprecation warning. * Update WPT test legacy-menclose-radical-notation.html - Fix test: "radical" should be equivalent to "", which is not the same as the default value "longdiv". See https://github.com/mathml-refresh/mathml/issues/144 - Add a test "box radical" which should be equivalent to "box". - Remove failure expectation. * Enable the radical notation for MathML reftests testing it. Differential Revision: https://phabricator.services.mozilla.com/D46721 --- dom/base/nsDeprecatedOperationList.h | 1 + dom/locales/en-US/chrome/dom/dom.properties | 2 ++ layout/mathml/nsMathMLmencloseFrame.cpp | 10 +++++++--- layout/mathml/nsMathMLmsqrtFrame.h | 3 +++ layout/reftests/mathml/reftest.list | 10 +++++----- modules/libpref/init/StaticPrefList.yaml | 6 ++++++ testing/web-platform/meta/mathml/__dir__.ini | 2 +- .../menclose/legacy-menclose-radical-notation.html.ini | 2 -- .../menclose/legacy-menclose-radical-notation-ref.html | 5 ++++- .../menclose/legacy-menclose-radical-notation.html | 5 ++++- 10 files changed, 33 insertions(+), 13 deletions(-) delete mode 100644 testing/web-platform/meta/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html.ini diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index 88535aa96d6e8..1c2f75396ba59 100644 --- a/dom/base/nsDeprecatedOperationList.h +++ b/dom/base/nsDeprecatedOperationList.h @@ -53,4 +53,5 @@ DEPRECATED_OPERATION(MathML_DeprecatedAlignmentAttributes) DEPRECATED_OPERATION(MathML_DeprecatedLineThicknessValue) DEPRECATED_OPERATION(MathML_DeprecatedMathSizeValue) DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue) +DEPRECATED_OPERATION(MathML_DeprecatedMencloseNotationRadical) DEPRECATED_OPERATION(MathML_DeprecatedStyleAttribute) diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index dfc213064c85b..667121095f52a 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -378,5 +378,7 @@ MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” ar # LOCALIZATION NOTE: Do not translate veryverythinmathspace, verythinmathspace, # thinmathspace, mediummathspace, thickmathspace, verythickmathspace, veryverythickmathspace and MathML. MathML_DeprecatedMathSpaceValueWarning=“veryverythinmathspace”, “verythinmathspace”, “thinmathspace”, “mediummathspace”, “thickmathspace”, “verythickmathspace” and “veryverythickmathspace” are deprecated values for MathML lengths and will be removed at a future date. +# LOCALIZATION NOTE: Do not translate radical, notation and menclose. +MathML_DeprecatedMencloseNotationRadical=The “radical” value is deprecated for the “notation” attribute of the element and will be removed at a future date. # LOCALIZATION NOTE: Do not translate MathML, background, color, fontfamily, fontsize, fontstyle and fontweight. MathML_DeprecatedStyleAttributeWarning=MathML attributes “background”, “color”, “fontfamily”, “fontsize”, “fontstyle” and “fontweight” are deprecated and will be removed at a future date. diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index b0efebc042458..09511a3c58bb9 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -9,6 +9,7 @@ #include "gfx2DGlue.h" #include "gfxUtils.h" #include "mozilla/PresShell.h" +#include "mozilla/StaticPrefs_mathml.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" #include "nsPresContext.h" @@ -105,9 +106,12 @@ nsresult nsMathMLmencloseFrame::AddNotation(const nsAString& aNotation) { mNotationsToDraw += NOTATION_RIGHT; mNotationsToDraw += NOTATION_TOP; } else if (aNotation.EqualsLiteral("radical")) { - rv = AllocateMathMLChar(NOTATION_RADICAL); - NS_ENSURE_SUCCESS(rv, rv); - mNotationsToDraw += NOTATION_RADICAL; + if (!StaticPrefs::mathml_deprecated_menclose_notation_radical_disabled()) { + mContent->OwnerDoc()->WarnOnceAbout(dom::Document::eMathML_DeprecatedMencloseNotationRadical); + rv = AllocateMathMLChar(NOTATION_RADICAL); + NS_ENSURE_SUCCESS(rv, rv); + mNotationsToDraw += NOTATION_RADICAL; + } } else if (aNotation.EqualsLiteral("box")) { mNotationsToDraw += NOTATION_LEFT; mNotationsToDraw += NOTATION_RIGHT; diff --git a/layout/mathml/nsMathMLmsqrtFrame.h b/layout/mathml/nsMathMLmsqrtFrame.h index fccb82ff89ddd..43c2702c6c701 100644 --- a/layout/mathml/nsMathMLmsqrtFrame.h +++ b/layout/mathml/nsMathMLmsqrtFrame.h @@ -37,6 +37,9 @@ These attributes are inherited by every element from its rendering environment, but can be set explicitly only on . (See Section 3.3.4.) */ +// XXXfredw: This class should share its layout logic with nsMathMLmrootFrame +// when the menclose "radical" notation is removed. +// See https://bugzilla.mozilla.org/show_bug.cgi?id=1548522 class nsMathMLmsqrtFrame final : public nsMathMLmencloseFrame { public: NS_DECL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame) diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index 6659b6f75b248..721a1f876461e 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -17,7 +17,7 @@ fuzzy-if(skiaContent,0-2,0-529) == 393760-2.xml 393760-2-ref.xml == dir-1.html dir-1-ref.html pref(mathml.deprecated_alignment_attributes.disabled,false) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == dir-2.html dir-2-ref.html # Bug 1392106 random-if(gtkWidget) == dir-3.html dir-3-ref.html # bug 1309426 -== dir-4.html dir-4-ref.html +pref(mathml.deprecated_menclose_notation_radical.disabled,false) == dir-4.html dir-4-ref.html == dir-5.html dir-5-ref.html fuzzy-if(cocoaWidget,0-135,0-56) == dir-6a.html dir-6a-ref.html == css-spacing-1.html css-spacing-1-ref.html @@ -207,7 +207,7 @@ fuzzy-if(skiaContent,0-1,0-80) fuzzy-if(Android,0-255,0-105) skip-if(winWidget) == mathml-mmultiscript-mprescript.html mathml-mmultiscript-mprescript-ref.html != menclose-1a.html menclose-1-ref.html != menclose-1b.html menclose-1-ref.html -!= menclose-1c.html menclose-1-ref.html +pref(mathml.deprecated_menclose_notation_radical.disabled,false) != menclose-1c.html menclose-1-ref.html != menclose-1d.html menclose-1-ref.html != menclose-1e.html menclose-1-ref.html != menclose-1f.html menclose-1-ref.html @@ -240,7 +240,7 @@ random-if(gtkWidget) == menclose-2-roundedbox.html menclose-2-roundedbox-ref.htm == menclose-2-phasorangle.html menclose-2-phasorangle-ref.html == menclose-3-box.html menclose-3-box-ref.html == menclose-3-madruwb.html menclose-3-madruwb-ref.html -fails-if(Android) == menclose-3-radical.html menclose-3-radical-ref.html # Bug 973917 +pref(mathml.deprecated_menclose_notation_radical.disabled,false) fails-if(Android) == menclose-3-radical.html menclose-3-radical-ref.html # Bug 973917 == menclose-3-default.html menclose-3-default-ref.html == menclose-3-invalid.html menclose-3-invalid-ref.html == menclose-3-multiple.html menclose-3-multiple-ref.html @@ -255,7 +255,7 @@ fuzzy-if(d2d,0-7,0-1) == menclose-5-downdiagonalstrike.html menclose-5-downdiago == menclose-5-left.html menclose-5-left-ref.html == menclose-5-longdiv.html menclose-5-longdiv-ref.html == menclose-5-madruwb.html menclose-5-madruwb-ref.html -== menclose-5-radical.html menclose-5-radical-ref.html +pref(mathml.deprecated_menclose_notation_radical.disabled,false) == menclose-5-radical.html menclose-5-radical-ref.html == menclose-5-right.html menclose-5-right-ref.html fuzzy-if(skiaContent,0-5,0-5) == menclose-5-roundedbox.html menclose-5-roundedbox-ref.html == menclose-5-top.html menclose-5-top-ref.html @@ -272,7 +272,7 @@ fuzzy-if(d2d,0-7,0-1) == menclose-6-downdiagonalstrike.html menclose-6-ref.html == menclose-6-left.html menclose-6-ref.html == menclose-6-longdiv.html menclose-6-ref.html == menclose-6-madruwb.html menclose-6-ref.html -== menclose-6-radical.html menclose-6-ref.html +pref(mathml.deprecated_menclose_notation_radical.disabled,false) == menclose-6-radical.html menclose-6-ref.html == menclose-6-right.html menclose-6-ref.html fuzzy-if(skiaContent,0-2,0-3) == menclose-6-roundedbox.html menclose-6-ref.html == menclose-6-top.html menclose-6-ref.html diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 6c046978e0188..36287a209d2e7 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -5301,6 +5301,12 @@ value: @IS_NIGHTLY_BUILD@ mirror: always +# Whether to disable deprecated "radical" notation for the menclose element. +- name: mathml.deprecated_menclose_notation_radical.disabled + type: bool + 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 diff --git a/testing/web-platform/meta/mathml/__dir__.ini b/testing/web-platform/meta/mathml/__dir__.ini index 045a97ebf216a..ac615b787b0ee 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.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] +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] \ No newline at end of file diff --git a/testing/web-platform/meta/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html.ini b/testing/web-platform/meta/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html.ini deleted file mode 100644 index 2a204149a1e3d..0000000000000 --- a/testing/web-platform/meta/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[legacy-menclose-radical-notation.html] - expected: FAIL diff --git a/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation-ref.html b/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation-ref.html index f0b5bdd9f04e7..c67ac03f5dcc9 100644 --- a/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation-ref.html +++ b/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation-ref.html @@ -12,7 +12,10 @@ - + + 123 + + 123 diff --git a/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html b/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html index d7f0627059ad9..9b71389e74dd1 100644 --- a/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html +++ b/testing/web-platform/tests/mathml/presentation-markup/menclose/legacy-menclose-radical-notation.html @@ -5,7 +5,7 @@ Legacy menclose radical notation - +