mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1548527 - Remove values "small", "normal", "big" values of the mathsize attribute. r=emilio
See https://github.com/mathml-refresh/mathml/issues/7 and https://groups.google.com/forum/#!topic/mozilla.dev.platform/kyB34PjYXek This commit introduces a new preference option mathml.mathsize_names.disabled to disable mathsize keyword values. For now, these are only disabled in Nightly builds. * test_bug553917.html is updated to check that these values now cause an error message to be logged into the console when mathsize names are used and the feature disabled. * The old test 355548-3.xml checks support for mathsize names and also uses several features that are going to be deprecated. So it is just run with the proper preference adjustment. * mathml/relations/css-styling/mathsize-attribute-legacy-values.html passes after this change so the test is run with the mathsize names disabled too and the failure expectation is removed. * mathml/relations/css-styling/mathsize-attribute-css-keywords.html is added to check that CSS keywords won't be supported when we switch to using the CSS parser in the future. This test passes now when the "small" keyword is not accepted so it is run with the mathsize names disabled too. Differential Revision: https://phabricator.services.mozilla.com/D42426 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6a74af6652
commit
526e469d17
@ -9,6 +9,7 @@
|
||||
#include "mozilla/dom/BindContext.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/FontPropertyTypes.h"
|
||||
#include "mozilla/StaticPrefs_mathml.h"
|
||||
#include "mozilla/TextUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN
|
||||
@ -506,7 +507,7 @@ void nsMathMLElement::MapMathMLAttributesInto(
|
||||
// In both cases, we don't allow negative values.
|
||||
// Unitless values give a multiple of the default value.
|
||||
//
|
||||
bool parseSizeKeywords = true;
|
||||
bool parseSizeKeywords = !StaticPrefs::mathml_mathsize_names_disabled();
|
||||
value = aAttributes->GetAttr(nsGkAtoms::mathsize_);
|
||||
if (!value) {
|
||||
parseSizeKeywords = false;
|
||||
@ -520,10 +521,12 @@ void nsMathMLElement::MapMathMLAttributesInto(
|
||||
!aDecls.PropertyIsSet(eCSSProperty_font_size)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
nsCSSValue fontSize;
|
||||
if (!ParseNumericValue(str, fontSize,
|
||||
PARSE_SUPPRESS_WARNINGS | PARSE_ALLOW_UNITLESS |
|
||||
CONVERT_UNITLESS_TO_PERCENT,
|
||||
nullptr) &&
|
||||
uint32_t flags = PARSE_ALLOW_UNITLESS | CONVERT_UNITLESS_TO_PERCENT;
|
||||
if (parseSizeKeywords) {
|
||||
// Do not warn for invalid value if mathsize keywords are accepted.
|
||||
flags |= PARSE_SUPPRESS_WARNINGS;
|
||||
}
|
||||
if (!ParseNumericValue(str, fontSize, flags, nullptr) &&
|
||||
parseSizeKeywords) {
|
||||
static const char sizes[3][7] = {"small", "normal", "big"};
|
||||
static const int32_t values[MOZ_ARRAY_LENGTH(sizes)] = {
|
||||
|
@ -16,6 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
||||
stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
|
||||
|
||||
const allow_linethickness_names = !SpecialPowers.getBoolPref('mathml.mfrac_linethickness_names.disabled');
|
||||
const allow_mathsize_names = !SpecialPowers.getBoolPref('mathml.mathsize_names.disabled');
|
||||
|
||||
var g_errorInfo = {
|
||||
/*<math><mroot></mroot></math>
|
||||
@ -58,10 +59,37 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
||||
<math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mstyle mathsize="small"></mstyle></math>
|
||||
<math><mstyle mathsize="normal"></mstyle></math>
|
||||
<math><mstyle mathsize="big"></mstyle></math>
|
||||
*/
|
||||
LengthParsingError : {
|
||||
status: [false, false, false, false, false, false, allow_linethickness_names, allow_linethickness_names, allow_linethickness_names],
|
||||
args: [["2..0"], ["1.5notaunit"], ["2"],["BADlspace"],["BADheight"],["BADdepth"], ["thin"],["medium"],["thick"]]
|
||||
status: [false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
allow_linethickness_names,
|
||||
allow_linethickness_names,
|
||||
allow_linethickness_names,
|
||||
allow_mathsize_names,
|
||||
allow_mathsize_names,
|
||||
allow_mathsize_names,
|
||||
],
|
||||
args: [["2..0"],
|
||||
["1.5notaunit"],
|
||||
["2"],
|
||||
["BADlspace"],
|
||||
["BADheight"],
|
||||
["BADdepth"],
|
||||
["thin"],
|
||||
["medium"],
|
||||
["thick"],
|
||||
["small"],
|
||||
["normal"],
|
||||
["big"],
|
||||
]
|
||||
},
|
||||
/*<math><mmultiscripts></mmultiscripts></math>
|
||||
<math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
|
||||
@ -166,6 +194,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=553917
|
||||
<math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><mstyle mathsize="small"></mstyle></math>
|
||||
<math><mstyle mathsize="normal"></mstyle></math>
|
||||
<math><mstyle mathsize="big"></mstyle></math>
|
||||
|
||||
<!-- MMultiscriptsErrors -->
|
||||
<math><mmultiscripts></mmultiscripts></math>
|
||||
|
@ -533,7 +533,7 @@ random-if(cocoaWidget) == 350506-1.html 350506-1-ref.html
|
||||
== 352980-3f.html 352980-3-ref.html
|
||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-1.xml 355548-1-ref.xml # Bug 1392106
|
||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-2.xml 355548-2-ref.xml # Bug 1392106
|
||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-3.xml 355548-3-ref.xml # Bug 1392106
|
||||
pref(mathml.mathsize_names.disabled,false) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-3.xml 355548-3-ref.xml # Bug 1392106
|
||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-4.xml 355548-4-ref.xml # Bug 1392106
|
||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 355548-5.xml 355548-5-ref.xml # Bug 1392106
|
||||
== 356774-1.html 356774-1-ref.html
|
||||
|
@ -4884,6 +4884,13 @@
|
||||
# Prefs starting with "mathml."
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Whether to disable legacy names "small", "normal" and "big" for the
|
||||
# mathsize attribute.
|
||||
- name: mathml.mathsize_names.disabled
|
||||
type: bool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
|
||||
# Whether to disable legacy names "thin", "thick" and "medium" for the
|
||||
# linethickness attribute of the mfrac element.
|
||||
- name: mathml.mfrac_linethickness_names.disabled
|
||||
|
@ -0,0 +1,2 @@
|
||||
[mathsize-attribute-legacy-values.html]
|
||||
prefs: [mathml.mathsize_names.disabled:true]
|
@ -1,2 +1,2 @@
|
||||
[mathsize-attribute-legacy-values.html]
|
||||
expected: FAIL
|
||||
prefs: [mathml.mathsize_names.disabled:true]
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>mathsize and css keywords</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see ten "A" of equal size:</p>
|
||||
<math>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
<mtext>A</mtext>
|
||||
</math>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>mathsize and css keywords</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#legacy-mathml-style-attributes">
|
||||
<meta name="assert" content="Verify that CSS font-size keywords are invalid for the mathsize attribute.">
|
||||
<link rel="match" href="mathsize-attribute-css-keywords-ref.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see ten "A" of equal size:</p>
|
||||
<math>
|
||||
<mtext>A</mtext>
|
||||
<mtext mathsize="xx-small">A</mtext>
|
||||
<mtext mathsize="x-small">A</mtext>
|
||||
<mtext mathsize="small">A</mtext>
|
||||
<mtext mathsize="medium">A</mtext>
|
||||
<mtext mathsize="large">A</mtext>
|
||||
<mtext mathsize="x-large">A</mtext>
|
||||
<mtext mathsize="xx-large">A</mtext>
|
||||
<mtext mathsize="larger">A</mtext>
|
||||
<mtext mathsize="smaller">A</mtext>
|
||||
</math>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user