From 32ca7cf4045ba547d9c6bb2c2126a3c69a57e39d Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Wed, 16 Oct 2019 07:57:38 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- dom/base/nsDeprecatedOperationList.h | 1 + dom/locales/en-US/chrome/dom/dom.properties | 2 + layout/mathml/nsMathMLmmultiscriptsFrame.cpp | 67 ++++++++++---------- layout/mathml/tests/test_bug827713.html | 28 ++++---- modules/libpref/init/StaticPrefList.yaml | 6 ++ 5 files changed, 59 insertions(+), 45 deletions(-) diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index 40e9d8f2de82..eb79e335e9fc 100644 --- a/dom/base/nsDeprecatedOperationList.h +++ b/dom/base/nsDeprecatedOperationList.h @@ -51,5 +51,6 @@ 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) diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index d5c1718ebcdf..93719930733f 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -375,6 +375,8 @@ MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” ar 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, 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. diff --git a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp index fcfe804b427e..f4aae9059a38 100644 --- a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp +++ b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp @@ -7,6 +7,7 @@ #include "nsMathMLmmultiscriptsFrame.h" #include "mozilla/PresShell.h" +#include "mozilla/StaticPrefs_mathml.h" #include "nsPresContext.h" #include #include "gfxContext.h" @@ -94,41 +95,43 @@ nsresult nsMathMLmmultiscriptsFrame::Place(DrawTarget* aDrawTarget, 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); } diff --git a/layout/mathml/tests/test_bug827713.html b/layout/mathml/tests/test_bug827713.html index 93deb30f60f6..e7bf6b5d2e81 100644 --- a/layout/mathml/tests/test_bug827713.html +++ b/layout/mathml/tests/test_bug827713.html @@ -34,24 +34,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=706406