зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1821980: Align mathvariant implementation on MathML Core. r=emilio,jfkthame
In MathML Core, the recommendation is to directly use the proper character from the Mathematical Alphanumeric Symbols instead of the mathvariant attribute. The exception is for automatic italicization on single-char `<mi>` element. This is implemented via a new text-transform value "math-auto" [1] which is the default on the `<mi>` element. The mathvariant attribute is now restricted to that element and to value "normal" in order to force upright text instead [2]. This CL implements this restriction together with that new text-transform value under the mathml.legacy_mathvariant_attribute.disabled flag. Some legacy MathML cases where math-auto alone does not work are still handled via MathMLTextRunFactory. [1] https://w3c.github.io/mathml-core/#new-text-transform-values [2] https://w3c.github.io/mathml-core/#the-mathvariant-attribute Differential Revision: https://phabricator.services.mozilla.com/D172395
This commit is contained in:
Родитель
25913044e8
Коммит
0a3179c31f
|
@ -21,11 +21,20 @@
|
|||
testTextAttrs(id, 0, {}, defAttrs, 0, 1);
|
||||
}
|
||||
|
||||
// These elements contain a surrogate pair, so the end offset is 2.
|
||||
for (const id of ["mn_double_struck", "mi_italic"]) {
|
||||
testTextAttrs(id, 0, {}, defAttrs, 0, 2);
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["mathml.legacy_mathvariant_attribute.disabled", true]],
|
||||
}).then(() => {
|
||||
addA11yLoadEvent(doTest);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="font-size: 12pt">
|
||||
|
@ -37,7 +46,9 @@
|
|||
|
||||
<math id="math" style="font-size: smaller">
|
||||
<mn id="mn">1</mn>
|
||||
<mi id="mi">x</mi>
|
||||
<mi id="mi" mathvariant="normal">x</mi>
|
||||
<mn id="mn_double_struck">𝟙</mn>
|
||||
<mi id="mi_italic">x</mi>
|
||||
<!-- tabindex forces creation of an Accessible -->
|
||||
<annotation id="annotation" tabindex="0">a</annotation>
|
||||
<annotation-xml id="annotationXml" tabindex="0">a</annotation-xml>
|
||||
|
|
|
@ -11783,6 +11783,7 @@ exports.CSS_PROPERTIES = {
|
|||
"inherit",
|
||||
"initial",
|
||||
"lowercase",
|
||||
"math-auto",
|
||||
"none",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
|
|
|
@ -126,10 +126,13 @@ bool MathMLElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|||
|
||||
// https://mathml-refresh.github.io/mathml-core/#global-attributes
|
||||
static Element::MappedAttributeEntry sGlobalAttributes[] = {
|
||||
{nsGkAtoms::dir}, {nsGkAtoms::mathbackground_},
|
||||
{nsGkAtoms::mathcolor_}, {nsGkAtoms::mathsize_},
|
||||
{nsGkAtoms::mathvariant_}, {nsGkAtoms::scriptlevel_},
|
||||
{nsGkAtoms::displaystyle_}, {nullptr}};
|
||||
{nsGkAtoms::dir},
|
||||
{nsGkAtoms::mathbackground_},
|
||||
{nsGkAtoms::mathcolor_},
|
||||
{nsGkAtoms::mathsize_},
|
||||
{nsGkAtoms::scriptlevel_},
|
||||
{nsGkAtoms::displaystyle_},
|
||||
{nullptr}};
|
||||
|
||||
bool MathMLElement::IsAttributeMapped(const nsAtom* aAttribute) const {
|
||||
MOZ_ASSERT(IsMathMLElement());
|
||||
|
@ -141,6 +144,9 @@ bool MathMLElement::IsAttributeMapped(const nsAtom* aAttribute) const {
|
|||
aAttribute == nsGkAtoms::scriptminsize_) ||
|
||||
(!StaticPrefs::mathml_scriptsizemultiplier_attribute_disabled() &&
|
||||
aAttribute == nsGkAtoms::scriptsizemultiplier_) ||
|
||||
((!StaticPrefs::mathml_legacy_mathvariant_attribute_disabled() ||
|
||||
mNodeInfo->Equals(nsGkAtoms::mi_)) &&
|
||||
aAttribute == nsGkAtoms::mathvariant_) ||
|
||||
(mNodeInfo->Equals(nsGkAtoms::mtable_) &&
|
||||
aAttribute == nsGkAtoms::width);
|
||||
}
|
||||
|
@ -149,6 +155,10 @@ nsMapRuleToAttributesFunc MathMLElement::GetAttributeMappingFunction() const {
|
|||
if (mNodeInfo->Equals(nsGkAtoms::mtable_)) {
|
||||
return &MapMTableAttributesInto;
|
||||
}
|
||||
if (StaticPrefs::mathml_legacy_mathvariant_attribute_disabled() &&
|
||||
mNodeInfo->Equals(nsGkAtoms::mi_)) {
|
||||
return &MapMiAttributesInto;
|
||||
}
|
||||
return &MapGlobalMathMLAttributesInto;
|
||||
}
|
||||
|
||||
|
@ -386,6 +396,24 @@ void MathMLElement::MapMTableAttributesInto(
|
|||
MapGlobalMathMLAttributesInto(aBuilder);
|
||||
}
|
||||
|
||||
void MathMLElement::MapMiAttributesInto(MappedDeclarationsBuilder& aBuilder) {
|
||||
MOZ_ASSERT(StaticPrefs::mathml_scriptminsize_attribute_disabled());
|
||||
// mathvariant
|
||||
// https://w3c.github.io/mathml-core/#dfn-mathvariant
|
||||
if (!aBuilder.PropertyIsSet(eCSSProperty_text_transform)) {
|
||||
const nsAttrValue* value = aBuilder.GetAttr(nsGkAtoms::mathvariant_);
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
auto str = value->GetStringValue();
|
||||
str.CompressWhitespace();
|
||||
if (value->GetStringValue().LowerCaseEqualsASCII("normal")) {
|
||||
aBuilder.SetKeywordValue(eCSSProperty_text_transform,
|
||||
StyleTextTransformCase::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
MapGlobalMathMLAttributesInto(aBuilder);
|
||||
}
|
||||
|
||||
void MathMLElement::MapGlobalMathMLAttributesInto(
|
||||
MappedDeclarationsBuilder& aBuilder) {
|
||||
// scriptsizemultiplier
|
||||
|
@ -500,63 +528,65 @@ void MathMLElement::MapGlobalMathMLAttributesInto(
|
|||
}
|
||||
}
|
||||
|
||||
// mathvariant
|
||||
//
|
||||
// "Specifies the logical class of the token. Note that this class is more
|
||||
// than styling, it typically conveys semantic intent;"
|
||||
//
|
||||
// values: "normal" | "bold" | "italic" | "bold-italic" | "double-struck" |
|
||||
// "bold-fraktur" | "script" | "bold-script" | "fraktur" | "sans-serif" |
|
||||
// "bold-sans-serif" | "sans-serif-italic" | "sans-serif-bold-italic" |
|
||||
// "monospace" | "initial" | "tailed" | "looped" | "stretched"
|
||||
// default: normal (except on <mi>)
|
||||
//
|
||||
value = aBuilder.GetAttr(nsGkAtoms::mathvariant_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aBuilder.PropertyIsSet(eCSSProperty__moz_math_variant)) {
|
||||
auto str = value->GetStringValue();
|
||||
str.CompressWhitespace();
|
||||
static const char sizes[19][23] = {"normal",
|
||||
"bold",
|
||||
"italic",
|
||||
"bold-italic",
|
||||
"script",
|
||||
"bold-script",
|
||||
"fraktur",
|
||||
"double-struck",
|
||||
"bold-fraktur",
|
||||
"sans-serif",
|
||||
"bold-sans-serif",
|
||||
"sans-serif-italic",
|
||||
"sans-serif-bold-italic",
|
||||
"monospace",
|
||||
"initial",
|
||||
"tailed",
|
||||
"looped",
|
||||
"stretched"};
|
||||
static const StyleMathVariant values[MOZ_ARRAY_LENGTH(sizes)] = {
|
||||
StyleMathVariant::Normal,
|
||||
StyleMathVariant::Bold,
|
||||
StyleMathVariant::Italic,
|
||||
StyleMathVariant::BoldItalic,
|
||||
StyleMathVariant::Script,
|
||||
StyleMathVariant::BoldScript,
|
||||
StyleMathVariant::Fraktur,
|
||||
StyleMathVariant::DoubleStruck,
|
||||
StyleMathVariant::BoldFraktur,
|
||||
StyleMathVariant::SansSerif,
|
||||
StyleMathVariant::BoldSansSerif,
|
||||
StyleMathVariant::SansSerifItalic,
|
||||
StyleMathVariant::SansSerifBoldItalic,
|
||||
StyleMathVariant::Monospace,
|
||||
StyleMathVariant::Initial,
|
||||
StyleMathVariant::Tailed,
|
||||
StyleMathVariant::Looped,
|
||||
StyleMathVariant::Stretched};
|
||||
for (uint32_t i = 0; i < ArrayLength(sizes); ++i) {
|
||||
if (str.LowerCaseEqualsASCII(sizes[i])) {
|
||||
aBuilder.SetKeywordValue(eCSSProperty__moz_math_variant, values[i]);
|
||||
break;
|
||||
if (!StaticPrefs::mathml_legacy_mathvariant_attribute_disabled()) {
|
||||
// mathvariant
|
||||
//
|
||||
// "Specifies the logical class of the token. Note that this class is more
|
||||
// than styling, it typically conveys semantic intent;"
|
||||
//
|
||||
// values: "normal" | "bold" | "italic" | "bold-italic" | "double-struck" |
|
||||
// "bold-fraktur" | "script" | "bold-script" | "fraktur" | "sans-serif" |
|
||||
// "bold-sans-serif" | "sans-serif-italic" | "sans-serif-bold-italic" |
|
||||
// "monospace" | "initial" | "tailed" | "looped" | "stretched"
|
||||
// default: normal (except on <mi>)
|
||||
//
|
||||
value = aBuilder.GetAttr(nsGkAtoms::mathvariant_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aBuilder.PropertyIsSet(eCSSProperty__moz_math_variant)) {
|
||||
auto str = value->GetStringValue();
|
||||
str.CompressWhitespace();
|
||||
static const char sizes[19][23] = {"normal",
|
||||
"bold",
|
||||
"italic",
|
||||
"bold-italic",
|
||||
"script",
|
||||
"bold-script",
|
||||
"fraktur",
|
||||
"double-struck",
|
||||
"bold-fraktur",
|
||||
"sans-serif",
|
||||
"bold-sans-serif",
|
||||
"sans-serif-italic",
|
||||
"sans-serif-bold-italic",
|
||||
"monospace",
|
||||
"initial",
|
||||
"tailed",
|
||||
"looped",
|
||||
"stretched"};
|
||||
static const StyleMathVariant values[MOZ_ARRAY_LENGTH(sizes)] = {
|
||||
StyleMathVariant::Normal,
|
||||
StyleMathVariant::Bold,
|
||||
StyleMathVariant::Italic,
|
||||
StyleMathVariant::BoldItalic,
|
||||
StyleMathVariant::Script,
|
||||
StyleMathVariant::BoldScript,
|
||||
StyleMathVariant::Fraktur,
|
||||
StyleMathVariant::DoubleStruck,
|
||||
StyleMathVariant::BoldFraktur,
|
||||
StyleMathVariant::SansSerif,
|
||||
StyleMathVariant::BoldSansSerif,
|
||||
StyleMathVariant::SansSerifItalic,
|
||||
StyleMathVariant::SansSerifBoldItalic,
|
||||
StyleMathVariant::Monospace,
|
||||
StyleMathVariant::Initial,
|
||||
StyleMathVariant::Tailed,
|
||||
StyleMathVariant::Looped,
|
||||
StyleMathVariant::Stretched};
|
||||
for (uint32_t i = 0; i < ArrayLength(sizes); ++i) {
|
||||
if (str.LowerCaseEqualsASCII(sizes[i])) {
|
||||
aBuilder.SetKeywordValue(eCSSProperty__moz_math_variant, values[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ class MathMLElement final : public MathMLElementBase, public Link {
|
|||
|
||||
static void MapGlobalMathMLAttributesInto(
|
||||
mozilla::MappedDeclarationsBuilder&);
|
||||
static void MapMiAttributesInto(mozilla::MappedDeclarationsBuilder&);
|
||||
static void MapMTableAttributesInto(mozilla::MappedDeclarationsBuilder&);
|
||||
|
||||
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
|
|
|
@ -171,7 +171,8 @@ static uint32_t MathvarMappingSearch(uint32_t aKey,
|
|||
http://lists.w3.org/Archives/Public/www-math/2013Sep/0012.html and
|
||||
https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
|
||||
*/
|
||||
static uint32_t MathVariant(uint32_t aCh, StyleMathVariant aMathVar) {
|
||||
/*static */ uint32_t MathMLTextRunFactory::MathVariant(
|
||||
uint32_t aCh, StyleMathVariant aMathVar) {
|
||||
uint32_t baseChar;
|
||||
enum CharacterType {
|
||||
kIsLatin,
|
||||
|
@ -524,7 +525,9 @@ void MathMLTextRunFactory::RebuildTextRun(
|
|||
int extraChars = 0;
|
||||
mathVar = styles[i]->mMathVariant;
|
||||
|
||||
if (singleCharMI && mathVar == StyleMathVariant::None) {
|
||||
if (singleCharMI && mathVar == StyleMathVariant::None &&
|
||||
(!StaticPrefs::mathml_legacy_mathvariant_attribute_disabled() ||
|
||||
styles[i]->mTextTransform.case_ == StyleTextTransformCase::MathAuto)) {
|
||||
mathVar = StyleMathVariant::Italic;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class MathMLTextRunFactory : public nsTransformingTextRunFactory {
|
|||
mFontInflation(aFontInflation),
|
||||
mSSTYScriptLevel(aSSTYScriptLevel) {}
|
||||
|
||||
static uint32_t MathVariant(uint32_t aCh, mozilla::StyleMathVariant aMathVar);
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun,
|
||||
mozilla::gfx::DrawTarget* aRefDrawTarget,
|
||||
gfxMissingFontRecorder* aMFR) override;
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
#include "GreekCasing.h"
|
||||
#include "IrishCasing.h"
|
||||
#include "MathMLTextRunFactory.h"
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_mathml.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -350,6 +352,7 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
if (i < length - 1 && NS_IS_SURROGATE_PAIR(ch, str[i + 1])) {
|
||||
ch = SURROGATE_TO_UCS4(ch, str[i + 1]);
|
||||
}
|
||||
const uint32_t originalCh = ch;
|
||||
|
||||
// Skip case transform if we're masking current character.
|
||||
if (!maskPassword) {
|
||||
|
@ -720,6 +723,31 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
}
|
||||
break;
|
||||
|
||||
case StyleTextTransformCase::MathAuto:
|
||||
// text-transform: math-auto is used for automatic italicization of
|
||||
// single-char <mi> elements. However, some legacy cases (italic style
|
||||
// fallback and <mi> with leading/trailing whitespace) are still
|
||||
// handled in MathMLTextRunFactory.
|
||||
if (length == 1) {
|
||||
uint32_t ch2 =
|
||||
MathMLTextRunFactory::MathVariant(ch, StyleMathVariant::Italic);
|
||||
if (StaticPrefs::mathml_mathvariant_styling_fallback_disabled()) {
|
||||
ch = ch2;
|
||||
} else if (ch2 != ch) {
|
||||
// Bug 930504. Some platforms do not have fonts for Mathematical
|
||||
// Alphanumeric Symbols. Hence we only perform the transform if a
|
||||
// character is actually available.
|
||||
FontMatchType matchType;
|
||||
RefPtr<gfxFont> mathFont =
|
||||
aTextRun->GetFontGroup()->FindFontForChar(
|
||||
ch2, 0, 0, intl::Script::COMMON, nullptr, &matchType);
|
||||
if (mathFont) {
|
||||
ch = ch2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("all cases should be handled");
|
||||
break;
|
||||
|
@ -793,6 +821,7 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
}
|
||||
|
||||
if (IS_IN_BMP(ch)) {
|
||||
MOZ_ASSERT(IS_IN_BMP(originalCh));
|
||||
aConvertedString.Append(maskPassword ? mask : ch);
|
||||
} else {
|
||||
if (maskPassword) {
|
||||
|
@ -804,10 +833,12 @@ bool nsCaseTransformTextRunFactory::TransformString(
|
|||
aConvertedString.Append(L_SURROGATE(ch));
|
||||
}
|
||||
++extraChars;
|
||||
++i;
|
||||
++aOffsetInTextRun;
|
||||
// Skip the trailing surrogate.
|
||||
aDeletedCharsArray.AppendElement(true);
|
||||
if (!IS_IN_BMP(originalCh)) {
|
||||
// Skip the trailing surrogate.
|
||||
++aOffsetInTextRun;
|
||||
++i;
|
||||
aDeletedCharsArray.AppendElement(true);
|
||||
}
|
||||
}
|
||||
|
||||
while (extraChars-- > 0) {
|
||||
|
|
|
@ -328,3 +328,11 @@ mphantom {
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (-moz-mathml-core-mi) {
|
||||
/* Implement MathML Core's automatic italic on mi.
|
||||
https://w3c.github.io/mathml-core/#the-mathvariant-attribute */
|
||||
mi {
|
||||
text-transform: math-auto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ pref(mathml.scriptminsize_attribute.disabled,false) pref(mathml.scriptsizemultip
|
|||
== 373533-3.xhtml about:blank
|
||||
== 393760-1.xml 393760-1-ref.xml
|
||||
fuzzy(0-2,0-529) == 393760-2.xml 393760-2-ref.xml
|
||||
== 414123.xhtml 414123-ref.xhtml
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == 414123.xhtml 414123-ref.xhtml
|
||||
== dir-1.html dir-1-ref.html
|
||||
== dir-2.html dir-2-ref.html
|
||||
random-if(gtkWidget) == dir-3.html dir-3-ref.html # bug 1309426
|
||||
|
@ -29,8 +29,8 @@ random-if(smallScreen&&Android) fuzzy(0-255,0-200) fuzzy-if(geckoview,201-216,20
|
|||
== dynamic-mi.xhtml dynamic-mi-ref.xhtml
|
||||
== mphantom-1.html mphantom-1-ref.html
|
||||
== mphantom-2.html mphantom-2-ref.html
|
||||
== mi-mathvariant-1.xhtml mi-mathvariant-1-ref.xhtml
|
||||
== mi-mathvariant-2.xhtml mi-mathvariant-2-ref.xhtml
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == mi-mathvariant-1.xhtml mi-mathvariant-1-ref.xhtml
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == mi-mathvariant-2.xhtml mi-mathvariant-2-ref.xhtml
|
||||
!= mi-mathvariant-3.html mi-mathvariant-3-ref.html
|
||||
!= non-spacing-accent-1.xhtml non-spacing-accent-1-ref.xhtml
|
||||
== overbar-width-1.xhtml overbar-width-1-ref.xhtml
|
||||
|
@ -114,9 +114,9 @@ fails-if(OSX>=1010) == scale-stretchy-3.xhtml scale-stretchy-3-ref.xhtml
|
|||
== mpadded-5.html mpadded-5-ref.html
|
||||
== mpadded-1-2.html mpadded-1-2-ref.html
|
||||
== mpadded-6.html mpadded-6-ref.html
|
||||
random-if(gtkWidget) fails-if(geckoview&&device) == mpadded-7.html mpadded-7-ref.html # bug 1309430
|
||||
random-if(gtkWidget) == mpadded-8.html mpadded-8-ref.html # bug 1309430
|
||||
random-if(gtkWidget) == mpadded-9.html mpadded-9-ref.html # bug 1309430
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) random-if(gtkWidget) fails-if(geckoview&&device) == mpadded-7.html mpadded-7-ref.html # bug 1309430
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) random-if(gtkWidget) == mpadded-8.html mpadded-8-ref.html # bug 1309430
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) random-if(gtkWidget) == mpadded-9.html mpadded-9-ref.html # bug 1309430
|
||||
pref(mathml.scriptsizemultiplier_attribute.disabled,false) == scriptlevel-1.html scriptlevel-1-ref.html
|
||||
== scriptlevel-movablelimits-1.html scriptlevel-movablelimits-1-ref.html
|
||||
== munderover-align-accent-false.html munderover-align-accent-false-ref.html
|
||||
|
@ -245,16 +245,16 @@ fuzzy-if(d2d,0-7,0-1) == menclose-6-updiagonalstrike.html menclose-6-ref.html
|
|||
== menclose-6-phasorangle.html menclose-6-ref.html
|
||||
== mmultiscript-align.html mmultiscript-align-ref.html
|
||||
fails-if(winWidget) fuzzy-if(gtkWidget,255-255,776226-776226) == subscript-italic-correction.html subscript-italic-correction-ref.html # bug 961482 (Windows), bug 1599640 (Linux)
|
||||
fails-if(Android&&emulator) == mathvariant-1a.html mathvariant-1a-ref.html # Bug 1010679, Bug 1392106
|
||||
fails-if(Android&&emulator) == mathvariant-1b.html mathvariant-1b-ref.html # Bug 1010679, Bug 1392106
|
||||
fails-if(Android&&emulator) == mathvariant-1c.html mathvariant-1c-ref.html # Bug 1010679, Bug 1392106
|
||||
== mathvariant-1d.html mathvariant-1d-ref.html
|
||||
fails-if(Android&&emulator) == mathvariant-2.html mathvariant-2-ref.html # Bug 1010679
|
||||
== mathvariant-4.html mathvariant-4-ref.html
|
||||
== mathvariant-5.html mathvariant-5-ref.html
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) fails-if(Android&&emulator) == mathvariant-1a.html mathvariant-1a-ref.html # Bug 1010679, Bug 1392106
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) fails-if(Android&&emulator) == mathvariant-1b.html mathvariant-1b-ref.html # Bug 1010679, Bug 1392106
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) fails-if(Android&&emulator) == mathvariant-1c.html mathvariant-1c-ref.html # Bug 1010679, Bug 1392106
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == mathvariant-1d.html mathvariant-1d-ref.html
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) fails-if(Android&&emulator) == mathvariant-2.html mathvariant-2-ref.html # Bug 1010679
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == mathvariant-4.html mathvariant-4-ref.html
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) == mathvariant-5.html mathvariant-5-ref.html
|
||||
== dtls-1.html dtls-1-ref.html
|
||||
pref(mathml.error_message_layout_for_invalid_markup.disabled,false) == dtls-2.html dtls-2-ref.html
|
||||
pref(mathml.error_message_layout_for_invalid_markup.disabled,false) == dtls-3.html dtls-3-ref.html
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) pref(mathml.error_message_layout_for_invalid_markup.disabled,false) == dtls-3.html dtls-3-ref.html
|
||||
== ssty-1.html ssty-1-ref.html
|
||||
== ssty-2.html ssty-2-ref.html
|
||||
pref(mathml.scriptsizemultiplier_attribute.disabled,false) == ssty-3.html ssty-3-ref.html
|
||||
|
@ -300,7 +300,7 @@ random-if(gtkWidget) == rowlines-3-2.html rowlines-3-2-ref.html # bug 1309426
|
|||
== mfrac-D-2.html mfrac-D-2-ref.html
|
||||
== mfrac-E-1.html mfrac-E-1-ref.html
|
||||
== shadow-dom-1.html shadow-dom-1-ref.html
|
||||
pref(ui.useOverlayScrollbars,1) pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,25) fuzzy-if(!gtkWidget,0-255,0-324) fuzzy-if(gtkWidget,0-255,0-66) == font-inflation-1.html font-inflation-1-ref.html # gtkWidget due to Bug 1607294
|
||||
pref(mathml.legacy_mathvariant_attribute.disabled,false) pref(ui.useOverlayScrollbars,1) pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,25) fuzzy-if(!gtkWidget,0-255,0-324) fuzzy-if(gtkWidget,0-255,0-66) == font-inflation-1.html font-inflation-1-ref.html # gtkWidget due to Bug 1607294
|
||||
test-pref(font.minimum-size.x-math,40) == default-font.html default-font-ref.html
|
||||
!= radicalbar-1.html about:blank
|
||||
!= radicalbar-1a.html about:blank
|
||||
|
|
|
@ -9546,6 +9546,16 @@
|
|||
#endif
|
||||
mirror: always
|
||||
|
||||
# Whether to disable the MathML3 support for the mathvariant attribute. For
|
||||
# MathML Core, support is restricted to the <mi> element and to value "normal".
|
||||
# Corresponding automatic italicization on single-char <mi> element is also
|
||||
# implemented via text-transform: auto when that flag is enabled.
|
||||
- name: mathml.legacy_mathvariant_attribute.disabled
|
||||
type: bool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "media."
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -694,7 +694,7 @@ macro_rules! bool_pref_feature {
|
|||
/// to support new types in these entries and (2) ensuring that either
|
||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||
/// would be returned by the evaluator function could change.
|
||||
pub static MEDIA_FEATURES: [QueryFeatureDescription; 67] = [
|
||||
pub static MEDIA_FEATURES: [QueryFeatureDescription; 68] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
|
@ -1025,4 +1025,9 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 67] = [
|
|||
),
|
||||
// media query for popover attribute
|
||||
bool_pref_feature!(atom!("-moz-popover-enabled"), "dom.element.popover.enabled"),
|
||||
// media query for MathML Core's implementation of mi
|
||||
bool_pref_feature!(
|
||||
atom!("-moz-mathml-core-mi"),
|
||||
"mathml.legacy_mathvariant_attribute.disabled"
|
||||
),
|
||||
];
|
||||
|
|
|
@ -341,6 +341,11 @@ impl Parse for TextTransform {
|
|||
"capitalize" if result.case_ == TextTransformCase::None => {
|
||||
result.case_ = TextTransformCase::Capitalize
|
||||
},
|
||||
"math-auto" if result.case_ == TextTransformCase::None &&
|
||||
result.other_.is_empty() => {
|
||||
result.case_ = TextTransformCase::MathAuto;
|
||||
return Ok(result);
|
||||
},
|
||||
"full-width" if !result.other_.intersects(TextTransformOther::FULL_WIDTH) => {
|
||||
result.other_.insert(TextTransformOther::FULL_WIDTH)
|
||||
},
|
||||
|
@ -405,6 +410,8 @@ pub enum TextTransformCase {
|
|||
Lowercase,
|
||||
/// Capitalize each word.
|
||||
Capitalize,
|
||||
/// Automatic italicization of math variables.
|
||||
MathAuto,
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -5204,7 +5204,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
|||
use style::values::generics::box_::{VerticalAlign, VerticalAlignKeyword};
|
||||
use style::values::generics::font::FontStyle;
|
||||
use style::values::specified::{
|
||||
table::CaptionSide, BorderStyle, Clear, Display, Float, TextAlign, TextEmphasisPosition,
|
||||
table::CaptionSide, BorderStyle, Clear, Display, Float, TextAlign, TextEmphasisPosition, TextTransform
|
||||
};
|
||||
|
||||
fn get_from_computed<T>(value: u32) -> T
|
||||
|
@ -5249,6 +5249,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
|||
BorderRightStyle => get_from_computed::<BorderStyle>(value),
|
||||
BorderBottomStyle => get_from_computed::<BorderStyle>(value),
|
||||
BorderLeftStyle => get_from_computed::<BorderStyle>(value),
|
||||
TextTransform => {
|
||||
debug_assert_eq!(value, structs::StyleTextTransformCase_None as u32);
|
||||
TextTransform::none()
|
||||
},
|
||||
};
|
||||
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
||||
decls.push(prop, Importance::Normal);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
prefs: [mathml.legacy_mathvariant_attribute.disabled: true]
|
|
@ -1,2 +0,0 @@
|
|||
[text-transform-math-auto-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[text-transform-math-auto-002.html]
|
||||
expected: FAIL
|
|
@ -1 +1 @@
|
|||
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, layout.css.math-style.enabled: true]
|
||||
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, layout.css.math-style.enabled: true, mathml.legacy_mathvariant_attribute.disabled: true]
|
|
@ -190,6 +190,3 @@
|
|||
|
||||
[invalid scriptlevel values on the mspace element are not mapped to math-depth(...)]
|
||||
expected: FAIL
|
||||
|
||||
[mathvariant on the mi element is mapped to CSS text-transform]
|
||||
expected: FAIL
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
prefs: [mathml.legacy_mathvariant_attribute.disabled: false]
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<title>CSS Text: getComputedStyle().textTransform</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-transform">
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#new-text-transform-values">
|
||||
<meta name="assert" content="text-transform computed value is specified keywords.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
@ -19,6 +20,7 @@ test_computed_value("text-transform", "uppercase");
|
|||
test_computed_value("text-transform", "lowercase");
|
||||
test_computed_value("text-transform", "full-width");
|
||||
test_computed_value("text-transform", "full-size-kana");
|
||||
test_computed_value("text-transform", "math-auto");
|
||||
|
||||
test_computed_value("text-transform", "capitalize full-width");
|
||||
test_computed_value("text-transform", "full-width full-size-kana");
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<meta charset="utf-8">
|
||||
<title>CSS Text Module Test: parsing text-transform with invalid values</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-transform">
|
||||
<meta name="assert" content="text-transform supports only the grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana'.">
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#new-text-transform-values">
|
||||
<meta name="assert" content="text-transform supports only the grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana | math-auto'.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
|
@ -18,6 +19,22 @@ test_invalid_value("text-transform", "capitalize full-width lowercase");
|
|||
test_invalid_value("text-transform", "uppercase full-size-kana uppercase");
|
||||
test_invalid_value("text-transform", "full-width full-size-kana full-width");
|
||||
test_invalid_value("text-transform", "full-size-kana capitalize full-size-kana");
|
||||
|
||||
|
||||
// math-auto keyword cannot be combined with other values.
|
||||
test_invalid_value("text-transform", "none math-auto");
|
||||
test_invalid_value("text-transform", "math-auto none");
|
||||
test_invalid_value("text-transform", "uppercase math-auto");
|
||||
test_invalid_value("text-transform", "math-auto uppercase");
|
||||
test_invalid_value("text-transform", "lowercase math-auto");
|
||||
test_invalid_value("text-transform", "math-auto lowercase");
|
||||
test_invalid_value("text-transform", "capitalize math-auto");
|
||||
test_invalid_value("text-transform", "math-auto capitalize");
|
||||
test_invalid_value("text-transform", "full-width math-auto");
|
||||
test_invalid_value("text-transform", "math-auto full-width");
|
||||
test_invalid_value("text-transform", "full-size-kana math-auto");
|
||||
test_invalid_value("text-transform", "math-auto full-size-kana");
|
||||
test_invalid_value("text-transform", "math-auto math-auto");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<meta charset="utf-8">
|
||||
<title>CSS Text Module Test: parsing text-transform with valid values</title>
|
||||
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-transform">
|
||||
<meta name="assert" content="text-transform supports the full grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana'.">
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#new-text-transform-values">
|
||||
<meta name="assert" content="text-transform supports the full grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana | math-auto'.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
|
@ -18,6 +19,7 @@ test_valid_value("text-transform", "uppercase");
|
|||
test_valid_value("text-transform", "lowercase");
|
||||
test_valid_value("text-transform", "full-width");
|
||||
test_valid_value("text-transform", "full-size-kana");
|
||||
test_valid_value("text-transform", "math-auto");
|
||||
|
||||
test_valid_value("text-transform", "capitalize full-width");
|
||||
test_valid_value("text-transform", "uppercase full-size-kana");
|
||||
|
|
|
@ -533,6 +533,7 @@ static constexpr struct {
|
|||
{"mathml.legacy_maction_and_semantics_implementations.disabled"_ns},
|
||||
{"mathml.ms_lquote_rquote_attributes.disabled"_ns},
|
||||
{"dom.element.popover.enabled"_ns},
|
||||
{"mathml.legacy_mathvariant_attribute.disabled"_ns},
|
||||
};
|
||||
|
||||
// Read values from the user's preferences.
|
||||
|
|
|
@ -2406,6 +2406,8 @@ STATIC_ATOMS = [
|
|||
# media query for MathML Core's implementation of ms
|
||||
Atom("_moz_mathml_core_ms", "-moz-mathml-core-ms"),
|
||||
Atom("_moz_popover_enabled", "-moz-popover-enabled"),
|
||||
# media query for MathML Core's implementation of mi
|
||||
Atom("_moz_mathml_core_mi", "-moz-mathml-core-mi"),
|
||||
# Contextual Identity / Containers
|
||||
Atom("usercontextid", "usercontextid"),
|
||||
Atom("geckoViewSessionContextId", "geckoViewSessionContextId"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче