Bug 1587570 - Remove support for the subscriptshift and superscriptshift attributes. r=emilio
authorFrederic Wang <fred.wang@free.fr>
Wed, 16 Oct 2019 11:57:13 +0000
changeset 559190 fe2312ad6c4fd03510106cfdbe51480ffcff031d
parent 559189 b649a4a3bb7e1f7ed173fd1f0237c0d896e84432
child 559191 0e06e454c8c8a9286e1416c664dd250704ac81c2
push id12175
push userccoroiu@mozilla.com
push dateThu, 17 Oct 2019 19:29:09 +0000
treeherdermozilla-beta@d333b6ef1fd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1587570
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1587570 - Remove support for the subscriptshift and superscriptshift attributes. r=emilio See https://groups.google.com/forum/#!topic/mozilla.dev.platform/CAqw0Nxw6Pg Differential Revision: https://phabricator.services.mozilla.com/D48766
dom/base/nsDeprecatedOperationList.h
dom/locales/en-US/chrome/dom/dom.properties
layout/mathml/nsMathMLmmultiscriptsFrame.cpp
layout/mathml/tests/test_bug827713.html
modules/libpref/init/StaticPrefList.yaml
testing/web-platform/meta/mathml/__dir__.ini
testing/web-platform/meta/mathml/presentation-markup/scripts/subsup-legacy-scriptshift-attributes-001.tentative.html.ini
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -46,10 +46,11 @@ DEPRECATED_OPERATION(Mozfullscreenchange
 DEPRECATED_OPERATION(MozfullscreenerrorDeprecatedPrefix)
 DEPRECATED_OPERATION(External_AddSearchProvider)
 DEPRECATED_OPERATION(MouseEvent_MozPressure)
 DEPRECATED_OPERATION(MathML_DeprecatedAlignmentAttributes)
 DEPRECATED_OPERATION(MathML_DeprecatedLineThicknessValue)
 DEPRECATED_OPERATION(MathML_DeprecatedMathSizeValue)
 DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue)
 DEPRECATED_OPERATION(MathML_DeprecatedMencloseNotationRadical)
+DEPRECATED_OPERATION(MathML_DeprecatedScriptShiftAttributes)
 DEPRECATED_OPERATION(MathML_DeprecatedStyleAttribute)
 DEPRECATED_OPERATION(MathML_DeprecatedXLinkAttribute)
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -370,14 +370,16 @@ MathML_DeprecatedAlignmentAttributesWarning=MathML attributes “align”, “numalign” and “denomalign” are deprecated values and will be removed at a future date.
 MathML_DeprecatedLineThicknessValueWarning=“thin”, “medium” and “thick” are deprecated values for the linethickness attribute and will be removed at a future date.
 # LOCALIZATION NOTE: Do not translate small, normal, big and mathsize.
 MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” are deprecated values for the mathsize attribute and will be removed at a future date.
 # 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, subscriptshift and superscriptshift.
+MathML_DeprecatedScriptShiftAttributes=MathML attributes “subscriptshift” and “superscriptshift” are deprecated and may 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 XLink.
 MathML_DeprecatedXLinkAttributeWarning=XLink attributes “href”, “type”, “show” and “actuate” are deprecated on MathML elements and will be removed at a future date.
 # LOCALIZATION NOTE: Do not translate title, text, url as they are the names of JS properties.
 WebShareAPI_NeedOneMember=title or text or url member of the ShareData dictionary. At least one of the members is required.
--- a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp
+++ b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMathMLmmultiscriptsFrame.h"
 
 #include "mozilla/PresShell.h"
+#include "mozilla/StaticPrefs_mathml.h"
 #include "nsPresContext.h"
 #include <algorithm>
 #include "gfxContext.h"
 #include "gfxMathTable.h"
 
 using namespace mozilla;
 
 //
@@ -89,51 +90,53 @@ nsMathMLmmultiscriptsFrame::TransmitAuto
 /* virtual */
 nsresult nsMathMLmmultiscriptsFrame::Place(DrawTarget* aDrawTarget,
                                            bool aPlaceOrigin,
                                            ReflowOutput& aDesiredSize) {
   nscoord subScriptShift = 0;
   nscoord supScriptShift = 0;
   float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
 
-  // subscriptshift
-  //
-  // "Specifies the minimum amount to shift the baseline of subscript down; the
-  // default is for the rendering agent to use its own positioning rules."
-  //
-  // values: length
-  // default: automatic
-  //
-  // We use 0 as the default value so unitless values can be ignored.
-  // As a minimum, negative values can be ignored.
-  //
-  nsAutoString value;
-  if (!mContent->IsMathMLElement(nsGkAtoms::msup_)) {
-    mContent->AsElement()->GetAttr(kNameSpaceID_None,
-                                   nsGkAtoms::subscriptshift_, value);
-    if (!value.IsEmpty()) {
+  if (!StaticPrefs::mathml_script_shift_attributes_disabled()) {
+    // subscriptshift
+    //
+    // "Specifies the minimum amount to shift the baseline of subscript down;
+    // the default is for the rendering agent to use its own positioning rules."
+    //
+    // values: length
+    // default: automatic
+    //
+    // We use 0 as the default value so unitless values can be ignored.
+    // As a minimum, negative values can be ignored.
+    //
+    nsAutoString value;
+    if (!mContent->IsMathMLElement(nsGkAtoms::msup_) &&
+        mContent->AsElement()->GetAttr(kNameSpaceID_None,
+                                       nsGkAtoms::subscriptshift_, value)) {
+      mContent->OwnerDoc()->WarnOnceAbout(
+          dom::Document::eMathML_DeprecatedScriptShiftAttributes);
       ParseNumericValue(value, &subScriptShift, 0, PresContext(),
                         mComputedStyle, fontSizeInflation);
     }
-  }
-  // superscriptshift
-  //
-  // "Specifies the minimum amount to shift the baseline of superscript up; the
-  // default is for the rendering agent to use its own positioning rules."
-  //
-  // values: length
-  // default: automatic
-  //
-  // We use 0 as the default value so unitless values can be ignored.
-  // As a minimum, negative values can be ignored.
-  //
-  if (!mContent->IsMathMLElement(nsGkAtoms::msub_)) {
-    mContent->AsElement()->GetAttr(kNameSpaceID_None,
-                                   nsGkAtoms::superscriptshift_, value);
-    if (!value.IsEmpty()) {
+    // superscriptshift
+    //
+    // "Specifies the minimum amount to shift the baseline of superscript up;
+    // the default is for the rendering agent to use its own positioning rules."
+    //
+    // values: length
+    // default: automatic
+    //
+    // We use 0 as the default value so unitless values can be ignored.
+    // As a minimum, negative values can be ignored.
+    //
+    if (!mContent->IsMathMLElement(nsGkAtoms::msub_) &&
+        mContent->AsElement()->GetAttr(kNameSpaceID_None,
+                                       nsGkAtoms::superscriptshift_, value)) {
+      mContent->OwnerDoc()->WarnOnceAbout(
+          dom::Document::eMathML_DeprecatedScriptShiftAttributes);
       ParseNumericValue(value, &supScriptShift, 0, PresContext(),
                         mComputedStyle, fontSizeInflation);
     }
   }
   return PlaceMultiScript(PresContext(), aDrawTarget, aPlaceOrigin,
                           aDesiredSize, this, subScriptShift, supScriptShift,
                           fontSizeInflation);
 }
--- a/layout/mathml/tests/test_bug827713.html
+++ b/layout/mathml/tests/test_bug827713.html
@@ -29,33 +29,35 @@ https://bugzilla.mozilla.org/show_bug.cg
     <msubsup subscriptshift="50px" superscriptshift="50px">
       <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="ssbase"></mspace>
       <mspace width="50px" height="25px" depth="25px" mathbackground="red" id="sssub"></mspace>
       <mspace width="50px" height="25px" depth="25px" mathbackground="green" id="sssup"></mspace>
     </msubsup>
   </math></p>
 <pre id="test">
 <script type="application/javascript">
-
     /** Test for the scriptshift aspect of bug 827713 **/
     SimpleTest.waitForExplicitFinish();
 
-    subBaseRect = $("subbase").getBoundingClientRect();
-    subSubRect = $("subsub").getBoundingClientRect();
-    is(subBaseRect.bottom, subSubRect.top, "Bad subscript shift for msub");
+    if (SpecialPowers.getBoolPref('mathml.script_shift_attributes.disabled')) {
+      ok(true, "Script shifts disabled");
+    } else {
+      subBaseRect = $("subbase").getBoundingClientRect();
+      subSubRect = $("subsub").getBoundingClientRect();
+      is(subBaseRect.bottom, subSubRect.top, "Bad subscript shift for msub");
 
-    supBaseRect = $("supbase").getBoundingClientRect();
-    supSupRect = $("supsup").getBoundingClientRect();
-    is(supBaseRect.top, supSupRect.bottom, "Bad superscript shift for msup");
+      supBaseRect = $("supbase").getBoundingClientRect();
+      supSupRect = $("supsup").getBoundingClientRect();
+      is(supBaseRect.top, supSupRect.bottom, "Bad superscript shift for msup");
 
-    ssBaseRect = $("ssbase").getBoundingClientRect();
-    ssSubRect = $("sssub").getBoundingClientRect();
-    ssSupRect = $("sssup").getBoundingClientRect();
-    is(ssBaseRect.bottom, ssSubRect.top, "Bad subscript shift for msubusp");
-    is(ssBaseRect.top, ssSupRect.bottom, "Bad superscript shift for msubusp");
-
+      ssBaseRect = $("ssbase").getBoundingClientRect();
+      ssSubRect = $("sssub").getBoundingClientRect();
+      ssSupRect = $("sssup").getBoundingClientRect();
+      is(ssBaseRect.bottom, ssSubRect.top, "Bad subscript shift for msubusp");
+      is(ssBaseRect.top, ssSupRect.bottom, "Bad superscript shift for msubusp");
+    }
 
     SimpleTest.finish();
 
 </script>
 </pre>
 </body>
 </html>
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -5359,16 +5359,22 @@
   mirror: always
 
 # Whether to disable deprecated numalign/denomalign/align attributes
 - name: mathml.deprecated_alignment_attributes.disabled
   type: bool
   value: @IS_NIGHTLY_BUILD@
   mirror: always
 
+# Whether to disable subscriptshift and superscriptshift attributes.
+- name: mathml.script_shift_attributes.disabled
+  type: bool
+  value: @IS_NIGHTLY_BUILD@
+  mirror: always
+
 # Whether to disable support for XLink on MathML elements.
 - name: mathml.xlink.disabled
   type: bool
   value: @IS_NIGHTLY_BUILD@
   mirror: always
 
 #---------------------------------------------------------------------------
 # Prefs starting with "media."
--- a/testing/web-platform/meta/mathml/__dir__.ini
+++ b/testing/web-platform/meta/mathml/__dir__.ini
@@ -1,1 +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]
\ No newline at end of file
+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]
\ No newline at end of file
deleted file mode 100644
--- a/testing/web-platform/meta/mathml/presentation-markup/scripts/subsup-legacy-scriptshift-attributes-001.tentative.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[subsup-legacy-scriptshift-attributes-001.tentative.html]
-  expected: FAIL