Skip to content

Commit

Permalink
Bug 1548522 - Remove support for the menclose's "radical" notation. r…
Browse files Browse the repository at this point in the history
…=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 w3c/mathml#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
  • Loading branch information
fred-wang committed Oct 3, 2019
1 parent 47d876a commit 0c2987e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions dom/base/nsDeprecatedOperationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions dom/locales/en-US/chrome/dom/dom.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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 <menclose> 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.
10 changes: 7 additions & 3 deletions layout/mathml/nsMathMLmencloseFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions layout/mathml/nsMathMLmsqrtFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ These attributes are inherited by every element from its rendering environment,
but can be set explicitly only on <mstyle>. (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)
Expand Down
10 changes: 5 additions & 5 deletions layout/reftests/mathml/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testing/web-platform/meta/mathml/__dir__.ini
Original file line number Diff line number Diff line change
@@ -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]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
</head>
<body>
<math>
<menclose>
<menclose notation="">
<mn>123</mn>
</menclose>
<menclose notation="box">
<mn>123</mn>
</menclose>
</math>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Legacy menclose radical notation</title>
<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#enclose-expression-inside-notation-menclose">
<meta name="assert" content="Verify that the legacy menclose radical notation is not supported.">
<meta name="assert" content="Verify that the legacy menclose radical notation is ignored.">
<link rel="match" href="legacy-menclose-radical-notation-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
Expand All @@ -19,6 +19,9 @@
<menclose notation="radical">
<mn>123</mn>
</menclose>
<menclose notation="box radical">
<mn>123</mn>
</menclose>
</math>

<script src="/mathml/support/feature-detection.js"></script>
Expand Down

0 comments on commit 0c2987e

Please sign in to comment.