From 62d1893ea444b78a176818c6242f927cce894f83 Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Tue, 20 Sep 2022 03:53:50 +0000 Subject: [PATCH] Bug 1791245 - More cleanup for the element. r=emilio The element [1] is not part of MathML Core [2] or MathML AAM [3] and was removed in bug 1603773. It should be treated as an unknown MathML element, that is like an ``. This commit performs some follow-up code cleanup: * Remove a11y mapping, instead map it like an mrow. * Remove obsolete deprecation message. * Don't include mfenced in the sanitizer's default element allow list. The spec [4] does not mention an explicit list. * Preference mathml.mfenced_element.disabled was removed, so no need to force it when running tests. * Tweak some code comments. [1] https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfenced [2] https://w3c.github.io/mathml-core/#mathml-elements-and-attributes [3] https://w3c.github.io/mathml-aam/ [4] https://wicg.github.io/sanitizer-api Differential Revision: https://phabricator.services.mozilla.com/D157580 --- accessible/base/MathMLMarkupMap.h | 4 +--- accessible/base/Role.h | 5 ----- accessible/base/RoleMap.h | 12 ------------ accessible/interfaces/nsIAccessibleRole.idl | 5 ----- accessible/tests/mochitest/elm/test_MathMLSpec.html | 5 ++--- dom/base/nsTreeSanitizer.cpp | 1 - dom/locales/en-US/chrome/dom/dom.properties | 2 -- layout/mathml/nsMathMLChar.cpp | 4 ++-- testing/web-platform/meta/mathml/__dir__.ini | 2 +- 9 files changed, 6 insertions(+), 34 deletions(-) diff --git a/accessible/base/MathMLMarkupMap.h b/accessible/base/MathMLMarkupMap.h index 97037d4a496c..d233a6661e35 100644 --- a/accessible/base/MathMLMarkupMap.h +++ b/accessible/base/MathMLMarkupMap.h @@ -31,9 +31,7 @@ MARKUPMAP(msqrt_, New_HyperText, roles::MATHML_SQUARE_ROOT) MARKUPMAP(mroot_, New_HyperText, roles::MATHML_ROOT) -MARKUPMAP(mfenced_, New_HyperText, roles::MATHML_FENCED, - AttrFromDOM(close, close), AttrFromDOM(open, open), - AttrFromDOM(separators_, separators_)) +MARKUPMAP(mfenced_, New_HyperText, roles::MATHML_ROW) MARKUPMAP(menclose_, New_HyperText, roles::MATHML_ENCLOSED, AttrFromDOM(notation_, notation_)) diff --git a/accessible/base/Role.h b/accessible/base/Role.h index 5a78feb4340b..5c148c4e3b8a 100644 --- a/accessible/base/Role.h +++ b/accessible/base/Role.h @@ -845,11 +845,6 @@ enum Role { */ MATHML_ROOT = 141, - /** - * A MathML fenced element (mfenced in MathML). - */ - MATHML_FENCED = 142, - /** * A MathML enclosed element (menclose in MathML). */ diff --git a/accessible/base/RoleMap.h b/accessible/base/RoleMap.h index 3b15f0fb7a42..e1d409f2cabe 100644 --- a/accessible/base/RoleMap.h +++ b/accessible/base/RoleMap.h @@ -1368,8 +1368,6 @@ ROLE(MATHML_OPERATOR, // NS_MATHML_OPERATOR_SEPARATOR bits of nsOperatorFlags, but currently they // are only available from the MathML layout code. Hence we just fallback // to subrole AXMathOperator for now. - // XXX bug 1175747 WebKit also creates anonymous operators for - // which have subroles AXMathSeparatorOperator and AXMathFenceOperator. 0, IA2_ROLE_UNKNOWN, java::SessionAccessibility::CLASSNAME_VIEW, @@ -1445,16 +1443,6 @@ ROLE(MATHML_ROOT, java::SessionAccessibility::CLASSNAME_VIEW, eNoNameRule) -ROLE(MATHML_FENCED, - "mathml fenced", - ATK_ROLE_SECTION, - NSAccessibilityGroupRole, - @"AXMathFenced", // XXX bug 1176970 This should be AXMathFence, but doing so without implementing the whole fence interface seems to make VoiceOver crash, so we present it as a row for now. - 0, - IA2_ROLE_UNKNOWN, - java::SessionAccessibility::CLASSNAME_VIEW, - eNoNameRule) - ROLE(MATHML_ENCLOSED, "mathml enclosed", ATK_ROLE_SECTION, diff --git a/accessible/interfaces/nsIAccessibleRole.idl b/accessible/interfaces/nsIAccessibleRole.idl index 9e55cf874fcf..5022f3ddc420 100644 --- a/accessible/interfaces/nsIAccessibleRole.idl +++ b/accessible/interfaces/nsIAccessibleRole.idl @@ -838,11 +838,6 @@ interface nsIAccessibleRole : nsISupports */ const unsigned long ROLE_MATHML_ROOT = 141; - /** - * A MathML fenced element (mfenced in MathML). - */ - const unsigned long ROLE_MATHML_FENCED = 142; - /** * A MathML enclosed element (menclose in MathML). */ diff --git a/accessible/tests/mochitest/elm/test_MathMLSpec.html b/accessible/tests/mochitest/elm/test_MathMLSpec.html index c711acf05f0c..a55c77668a66 100644 --- a/accessible/tests/mochitest/elm/test_MathMLSpec.html +++ b/accessible/tests/mochitest/elm/test_MathMLSpec.html @@ -140,11 +140,10 @@ testElm("mroot", obj); // //////////////////////////////////////////////////////////////////////// - // mfenced + // Deprecated mfenced element (treated as an mrow). obj = { - role: ROLE_MATHML_FENCED, - attributes: { open: "]", close: "[", separators: "." }, + role: ROLE_MATHML_ROW, }; testElm("mfenced", obj); diff --git a/dom/base/nsTreeSanitizer.cpp b/dom/base/nsTreeSanitizer.cpp index 1343e8ae50e2..d6688e440488 100644 --- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -749,7 +749,6 @@ const nsStaticAtom* const kElementsMathML[] = { nsGkAtoms::median_, // median nsGkAtoms::menclose_, // menclose nsGkAtoms::merror_, // merror - nsGkAtoms::mfenced_, // mfenced nsGkAtoms::mfrac_, // mfrac nsGkAtoms::mglyph_, // mglyph nsGkAtoms::mi_, // mi diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index 2970c23589d2..63bb3e2e27d7 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -378,8 +378,6 @@ 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 MathML or mfenced. -MathML_DeprecatedMfencedElement=MathML element mfenced is deprecated 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. # LOCALIZATION NOTE: Do not translate MathML and STIXGeneral. %S is a documentation URL. diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index b85794a61c59..49e98d25aa5a 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -759,8 +759,8 @@ void nsMathMLChar::SetData(nsString& aData) { static bool IsSizeOK(nscoord a, nscoord b, uint32_t aHint) { // Normal: True if 'a' is around +/-10% of the target 'b' (10% is // 1-DelimiterFactor). This often gives a chance to the base size to - // win, especially in the context of without tall elements - // or in sloppy markups without protective + // win, especially in the context of sloppy markups without protective + // bool isNormal = (aHint & NS_STRETCH_NORMAL) && Abs(a - b) < (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b); diff --git a/testing/web-platform/meta/mathml/__dir__.ini b/testing/web-platform/meta/mathml/__dir__.ini index 161276a5bf96..6abcb7a6fcb2 100644 --- a/testing/web-platform/meta/mathml/__dir__.ini +++ b/testing/web-platform/meta/mathml/__dir__.ini @@ -1 +1 @@ -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] \ No newline at end of file +prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, layout.css.math-style.enabled: true] \ No newline at end of file