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
This commit is contained in:
Frederic Wang 2019-10-16 07:57:38 +00:00
Родитель 41280710d0
Коммит 32ca7cf404
5 изменённых файлов: 59 добавлений и 45 удалений

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

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

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

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

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

@ -7,6 +7,7 @@
#include "nsMathMLmmultiscriptsFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_mathml.h"
#include "nsPresContext.h"
#include <algorithm>
#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);
}

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

@ -34,24 +34,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=706406
</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");
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");
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");
}
SimpleTest.finish();

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

@ -5364,6 +5364,12 @@
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