Bug 1791245 - More cleanup for the <mfenced> element. r=emilio

The <mfenced> 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 `<mrow>`.

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
This commit is contained in:
Frederic Wang 2022-09-20 03:53:50 +00:00
Родитель e1357847e5
Коммит 62d1893ea4
9 изменённых файлов: 6 добавлений и 34 удалений

Просмотреть файл

@ -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_))

Просмотреть файл

@ -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).
*/

Просмотреть файл

@ -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 <mfenced>
// 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,

Просмотреть файл

@ -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).
*/

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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 <mfenced> without tall elements
// or in sloppy markups without protective <mrow></mrow>
// win, especially in the context of sloppy markups without protective
// <mrow></mrow>
bool isNormal =
(aHint & NS_STRETCH_NORMAL) &&
Abs<float>(a - b) < (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b);

Просмотреть файл

@ -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]
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, layout.css.math-style.enabled: true]