зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1904220 - Fix MathML regression with HYPHEN-MINUS not rendered as MINUS SIGN. r=emilio
After bug 1890531, mathml.centered_operator is disabled and U+002D HYPHEN-MINUS in <mo> no longer renders as U+2212 MINUS SIGN. This patches restore this behavior as the change was unintentional, even though this is not specified in MathML Core. Differential Revision: https://phabricator.services.mozilla.com/D219085
This commit is contained in:
Родитель
829c3645f6
Коммит
da354de8ce
|
@ -18,8 +18,9 @@ enum nsStretchDirection {
|
|||
};
|
||||
|
||||
typedef uint32_t nsOperatorFlags;
|
||||
enum {
|
||||
enum nsOperatorFlagEnum : nsOperatorFlags {
|
||||
// define the bits used to handle the operator
|
||||
NS_MATHML_OPERATOR_FORCE_MATHML_CHAR = 1u << 31,
|
||||
NS_MATHML_OPERATOR_MUTABLE = 1 << 30,
|
||||
NS_MATHML_OPERATOR_EMBELLISH_ANCESTOR = 1 << 29,
|
||||
NS_MATHML_OPERATOR_EMBELLISH_ISOLATED = 1 << 28,
|
||||
|
@ -96,6 +97,10 @@ class nsMathMLOperators {
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// Macros that retrieve the bits used to handle operators
|
||||
|
||||
#define NS_MATHML_OPERATOR_FORCES_MATHML_CHAR(_flags) \
|
||||
(NS_MATHML_OPERATOR_FORCE_MATHML_CHAR == \
|
||||
((_flags) & NS_MATHML_OPERATOR_FORCE_MATHML_CHAR))
|
||||
|
||||
#define NS_MATHML_OPERATOR_IS_MUTABLE(_flags) \
|
||||
(NS_MATHML_OPERATOR_MUTABLE == ((_flags) & NS_MATHML_OPERATOR_MUTABLE))
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ bool nsMathMLmoFrame::IsFrameInSelection(nsIFrame* aFrame) {
|
|||
bool nsMathMLmoFrame::UseMathMLChar() {
|
||||
return (NS_MATHML_OPERATOR_GET_FORM(mFlags) &&
|
||||
NS_MATHML_OPERATOR_IS_MUTABLE(mFlags)) ||
|
||||
NS_MATHML_OPERATOR_IS_CENTERED(mFlags);
|
||||
NS_MATHML_OPERATOR_FORCES_MATHML_CHAR(mFlags);
|
||||
}
|
||||
|
||||
void nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -124,6 +124,7 @@ void nsMathMLmoFrame::ProcessTextData() {
|
|||
if (1 == length && ch == '-') {
|
||||
ch = 0x2212;
|
||||
data = ch;
|
||||
mFlags |= NS_MATHML_OPERATOR_FORCE_MATHML_CHAR;
|
||||
}
|
||||
|
||||
// cache the special bits: mutable, accent, movablelimits, centered.
|
||||
|
@ -156,6 +157,7 @@ void nsMathMLmoFrame::ProcessTextData() {
|
|||
(ch == 0x2265) || // ≥
|
||||
(ch == 0x00D7)) { // ×
|
||||
mFlags |= NS_MATHML_OPERATOR_CENTERED;
|
||||
mFlags |= NS_MATHML_OPERATOR_FORCE_MATHML_CHAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +199,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
|
|||
// Also remember the other special bits that we want to carry forward.
|
||||
mFlags &= NS_MATHML_OPERATOR_MUTABLE | NS_MATHML_OPERATOR_ACCENT |
|
||||
NS_MATHML_OPERATOR_MOVABLELIMITS | NS_MATHML_OPERATOR_CENTERED |
|
||||
NS_MATHML_OPERATOR_INVISIBLE;
|
||||
NS_MATHML_OPERATOR_INVISIBLE | NS_MATHML_OPERATOR_FORCE_MATHML_CHAR;
|
||||
|
||||
if (!mEmbellishData.coreFrame) {
|
||||
// i.e., we haven't been here before, the default form is infix
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<title>hyphen operator is rendered as a minus sign</title>
|
||||
<meta charset="utf-8"/>
|
||||
<style>
|
||||
math {
|
||||
font-size: 64pt;
|
||||
}
|
||||
.box {
|
||||
position: absolute;
|
||||
left: 2em;
|
||||
top: 2em;
|
||||
border: 1px solid lightgreen;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<p>This test passes if you see a green rectangle and no red.</p>
|
||||
<math class="box" style="position: absolute; color: red"><mo>−</mo></math>
|
||||
<math class="box" style="position: absolute; color: green; background: green;"><mo>−</mo></math>
|
||||
</body>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<title>hyphen operator is rendered as a minus sign</title>
|
||||
<link rel="match" href="hyphen-as-minus-sign-ref.html"/>
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1904220"/>
|
||||
<meta charset="utf-8"/>
|
||||
<style>
|
||||
math {
|
||||
font-size: 64pt;
|
||||
}
|
||||
.box {
|
||||
position: absolute;
|
||||
left: 2em;
|
||||
top: 2em;
|
||||
border: 1px solid lightgreen;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<p>This test passes if you see a green rectangle and no red.</p>
|
||||
<math class="box" style="position: absolute; color: red"><mo>−</mo></math>
|
||||
<math class="box" style="position: absolute; color: green; background: green;"><mo>-</mo></math>
|
||||
</body>
|
Загрузка…
Ссылка в новой задаче