summaryrefslogtreecommitdiffstats
path: root/layout/mathml/nsMathMLmoFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/mathml/nsMathMLmoFrame.cpp')
-rw-r--r--layout/mathml/nsMathMLmoFrame.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp
index e0d68234ae..e27709c0b0 100644
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -8,6 +8,7 @@
#include "gfxContext.h"
#include "mozilla/PresShell.h"
+#include "mozilla/StaticPrefs_mathml.h"
#include "nsCSSValue.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
@@ -145,15 +146,17 @@ void nsMathMLmoFrame::ProcessTextData() {
mFlags |= allFlags & NS_MATHML_OPERATOR_ACCENT;
mFlags |= allFlags & NS_MATHML_OPERATOR_MOVABLELIMITS;
- // see if this is an operator that should be centered to cater for
- // fonts that are not math-aware
- if (1 == length) {
- if ((ch == '+') || (ch == '=') || (ch == '*') ||
- (ch == 0x2212) || // −
- (ch == 0x2264) || // ≤
- (ch == 0x2265) || // ≥
- (ch == 0x00D7)) { // ×
- mFlags |= NS_MATHML_OPERATOR_CENTERED;
+ if (!StaticPrefs::mathml_centered_operators_disabled()) {
+ // see if this is an operator that should be centered to cater for
+ // fonts that are not math-aware
+ if (1 == length) {
+ if ((ch == '+') || (ch == '=') || (ch == '*') ||
+ (ch == 0x2212) || // −
+ (ch == 0x2264) || // ≤
+ (ch == 0x2265) || // ≥
+ (ch == 0x00D7)) { // ×
+ mFlags |= NS_MATHML_OPERATOR_CENTERED;
+ }
}
}
@@ -593,9 +596,15 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
// get the leading to be left at the top and the bottom of the stretched char
// this seems more reliable than using fm->GetLeading() on suspicious fonts
- nscoord em;
- GetEmHeight(fm, em);
- nscoord leading = NSToCoordRound(0.2f * em);
+ const nscoord leading = [&fm] {
+ if (StaticPrefs::
+ mathml_top_bottom_spacing_for_stretchy_operators_disabled()) {
+ return 0;
+ }
+ nscoord em;
+ GetEmHeight(fm, em);
+ return NSToCoordRound(0.2f * (float)em);
+ }();
// Operators that are stretchy, or those that are to be centered
// to cater for fonts that are not math-aware, are handled by the MathMLChar