summaryrefslogtreecommitdiffstats
path: root/layout/mathml
diff options
context:
space:
mode:
Diffstat (limited to 'layout/mathml')
-rw-r--r--layout/mathml/nsMathMLContainerFrame.cpp22
-rw-r--r--layout/mathml/nsMathMLContainerFrame.h15
-rw-r--r--layout/mathml/nsMathMLmoFrame.cpp33
-rw-r--r--layout/mathml/nsMathMLmtableFrame.h3
4 files changed, 37 insertions, 36 deletions
diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp
index b63792c288..fc334d1cae 100644
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -829,39 +829,33 @@ static nscoord AddInterFrameSpacingToSize(ReflowOutput& aDesiredSize,
/* virtual */
void nsMathMLContainerFrame::MarkIntrinsicISizesDirty() {
- mIntrinsicWidth = NS_INTRINSIC_ISIZE_UNKNOWN;
+ mIntrinsicISize = NS_INTRINSIC_ISIZE_UNKNOWN;
nsContainerFrame::MarkIntrinsicISizesDirty();
}
-void nsMathMLContainerFrame::UpdateIntrinsicWidth(
+void nsMathMLContainerFrame::UpdateIntrinsicISize(
gfxContext* aRenderingContext) {
- if (mIntrinsicWidth == NS_INTRINSIC_ISIZE_UNKNOWN) {
+ if (mIntrinsicISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
ReflowOutput desiredSize(GetWritingMode());
GetIntrinsicISizeMetrics(aRenderingContext, desiredSize);
// Include the additional width added by FixInterFrameSpacing to ensure
// consistent width calculations.
AddInterFrameSpacingToSize(desiredSize, this);
- mIntrinsicWidth = desiredSize.ISize(GetWritingMode());
+ mIntrinsicISize = desiredSize.ISize(GetWritingMode());
}
}
/* virtual */
nscoord nsMathMLContainerFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
- UpdateIntrinsicWidth(aRenderingContext);
- result = mIntrinsicWidth;
- return result;
+ UpdateIntrinsicISize(aRenderingContext);
+ return mIntrinsicISize;
}
/* virtual */
nscoord nsMathMLContainerFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_PREF_INLINE_SIZE(this, result);
- UpdateIntrinsicWidth(aRenderingContext);
- result = mIntrinsicWidth;
- return result;
+ UpdateIntrinsicISize(aRenderingContext);
+ return mIntrinsicISize;
}
/* virtual */
diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h
index 805d7e03ca..24bc86c338 100644
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -37,9 +37,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
public:
nsMathMLContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID)
- : nsContainerFrame(aStyle, aPresContext, aID),
- mIntrinsicWidth(NS_INTRINSIC_ISIZE_UNKNOWN),
- mBlockStartAscent(0) {}
+ : nsContainerFrame(aStyle, aPresContext, aID) {}
NS_DECL_QUERYFRAME_TARGET(nsMathMLContainerFrame)
NS_DECL_QUERYFRAME
@@ -341,13 +339,13 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
static void DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop = nullptr);
/**
- * Recompute mIntrinsicWidth if it's not already up to date.
+ * Recompute mIntrinsicISize if it's not already up to date.
*/
- void UpdateIntrinsicWidth(gfxContext* aRenderingContext);
+ void UpdateIntrinsicISize(gfxContext* aRenderingContext);
- nscoord mIntrinsicWidth;
+ nscoord mIntrinsicISize = NS_INTRINSIC_ISIZE_UNKNOWN;
- nscoord mBlockStartAscent;
+ nscoord mBlockStartAscent = 0;
private:
class RowChildFrameIterator;
@@ -429,8 +427,7 @@ class nsMathMLmathBlockFrame final : public nsBlockFrame {
protected:
explicit nsMathMLmathBlockFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
- : nsBlockFrame(aStyle, aPresContext, kClassID) {
- }
+ : nsBlockFrame(aStyle, aPresContext, kClassID) {}
virtual ~nsMathMLmathBlockFrame() = default;
};
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
diff --git a/layout/mathml/nsMathMLmtableFrame.h b/layout/mathml/nsMathMLmtableFrame.h
index 1a801de8fc..dee6c5ba7a 100644
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -222,7 +222,8 @@ class nsMathMLmtdFrame final : public nsTableCellFrame {
mozilla::nsDisplayListBuilder* aBuilder,
const mozilla::nsDisplayListSet& aLists) override;
- LogicalMargin GetBorderWidth(WritingMode aWM) const override;
+ mozilla::LogicalMargin GetBorderWidth(
+ mozilla::WritingMode aWM) const override;
nsMargin GetBorderOverflow() override;