commit 291e676b1d581375adbe91ccac5a4ff05d62aa73
parent eb94b292ae755ba93c9d065771931379bf792aed
Author: Frédéric Wang <fwang@igalia.com>
Date: Thu, 8 Jan 2026 15:24:07 +0000
Bug 2008902 - Convert MathML embellish flags to mozilla::EnumSet. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D278100
Diffstat:
7 files changed, 95 insertions(+), 112 deletions(-)
diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp
@@ -309,7 +309,7 @@ void HyperTextAccessible::SetMathMLXMLRoles(AccAttributes* aAttributes) {
if (mathMLFrame) {
nsEmbellishData embellishData;
mathMLFrame->GetEmbellishData(embellishData);
- if (NS_MATHML_EMBELLISH_IS_FENCE(embellishData.flags)) {
+ if (embellishData.flags.contains(MathMLEmbellishFlag::Fence)) {
if (!LocalPrevSibling()) {
aAttributes->SetAttribute(nsGkAtoms::xmlroles,
nsGkAtoms::open_fence);
@@ -318,7 +318,7 @@ void HyperTextAccessible::SetMathMLXMLRoles(AccAttributes* aAttributes) {
nsGkAtoms::close_fence);
}
}
- if (NS_MATHML_EMBELLISH_IS_SEPARATOR(embellishData.flags)) {
+ if (embellishData.flags.contains(MathMLEmbellishFlag::Separator)) {
aAttributes->SetAttribute(nsGkAtoms::xmlroles,
nsGkAtoms::separator);
}
diff --git a/layout/mathml/nsIMathMLFrame.h b/layout/mathml/nsIMathMLFrame.h
@@ -62,6 +62,36 @@ enum class MathMLPresentationFlag : uint8_t {
};
using MathMLPresentationFlags = mozilla::EnumSet<MathMLPresentationFlag>;
+// Bits used for the embellish flags -- these bits are set
+// in their relevant situation as they become available
+enum class MathMLEmbellishFlag : uint8_t {
+ // This bit is set if the frame is an embellished operator.
+ EmbellishedOperator,
+
+ // This bit is set if the frame is an <mo> frame or an embellihsed
+ // operator for which the core <mo> has movablelimits="true"
+ MovableLimits,
+
+ // This bit is set if the frame is an <mo> frame or an embellihsed
+ // operator for which the core <mo> has accent="true"
+ Accent,
+
+ // This bit is set if the frame is an <mover> or <munderover> with
+ // an accent frame
+ AccentOver,
+
+ // This bit is set if the frame is an <munder> or <munderover> with
+ // an accentunder frame
+ AccentUnder,
+
+ // This bit is set on the core if it is a fence operator.
+ Fence,
+
+ // This bit is set on the core if it is a separator operator.
+ Separator,
+};
+using MathMLEmbellishFlags = mozilla::EnumSet<MathMLEmbellishFlag>;
+
// Abstract base class that provides additional methods for MathML frames
class nsIMathMLFrame {
public:
@@ -248,7 +278,7 @@ class nsIMathMLFrame {
// state in those frames that are not part of the embellished hierarchy.
struct nsEmbellishData {
// bits used to mark certain properties of our embellishments
- uint32_t flags = 0;
+ MathMLEmbellishFlags flags;
// pointer on the <mo> frame at the core of the embellished hierarchy
nsIFrame* coreFrame = nullptr;
@@ -282,59 +312,4 @@ struct nsPresentationData {
nsIFrame* baseFrame = nullptr;
};
-// ==========================================================================
-// Bits used for the embellish flags -- these bits are set
-// in their relevant situation as they become available
-
-// This bit is set if the frame is an embellished operator.
-#define NS_MATHML_EMBELLISH_OPERATOR 0x00000001
-
-// This bit is set if the frame is an <mo> frame or an embellihsed
-// operator for which the core <mo> has movablelimits="true"
-#define NS_MATHML_EMBELLISH_MOVABLELIMITS 0x00000002
-
-// This bit is set if the frame is an <mo> frame or an embellihsed
-// operator for which the core <mo> has accent="true"
-#define NS_MATHML_EMBELLISH_ACCENT 0x00000004
-
-// This bit is set if the frame is an <mover> or <munderover> with
-// an accent frame
-#define NS_MATHML_EMBELLISH_ACCENTOVER 0x00000008
-
-// This bit is set if the frame is an <munder> or <munderover> with
-// an accentunder frame
-#define NS_MATHML_EMBELLISH_ACCENTUNDER 0x00000010
-
-// This bit is set on the core if it is a fence operator.
-#define NS_MATHML_EMBELLISH_FENCE 0x00000020
-
-// This bit is set on the core if it is a separator operator.
-#define NS_MATHML_EMBELLISH_SEPARATOR 0x00000040
-
-// Macros that retrieve those bits
-
-#define NS_MATHML_IS_EMBELLISH_OPERATOR(_flags) \
- (NS_MATHML_EMBELLISH_OPERATOR == ((_flags) & NS_MATHML_EMBELLISH_OPERATOR))
-
-#define NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(_flags) \
- (NS_MATHML_EMBELLISH_MOVABLELIMITS == \
- ((_flags) & NS_MATHML_EMBELLISH_MOVABLELIMITS))
-
-#define NS_MATHML_EMBELLISH_IS_ACCENT(_flags) \
- (NS_MATHML_EMBELLISH_ACCENT == ((_flags) & NS_MATHML_EMBELLISH_ACCENT))
-
-#define NS_MATHML_EMBELLISH_IS_ACCENTOVER(_flags) \
- (NS_MATHML_EMBELLISH_ACCENTOVER == \
- ((_flags) & NS_MATHML_EMBELLISH_ACCENTOVER))
-
-#define NS_MATHML_EMBELLISH_IS_ACCENTUNDER(_flags) \
- (NS_MATHML_EMBELLISH_ACCENTUNDER == \
- ((_flags) & NS_MATHML_EMBELLISH_ACCENTUNDER))
-
-#define NS_MATHML_EMBELLISH_IS_FENCE(_flags) \
- (NS_MATHML_EMBELLISH_FENCE == ((_flags) & NS_MATHML_EMBELLISH_FENCE))
-
-#define NS_MATHML_EMBELLISH_IS_SEPARATOR(_flags) \
- (NS_MATHML_EMBELLISH_SEPARATOR == ((_flags) & NS_MATHML_EMBELLISH_SEPARATOR))
-
#endif /* nsIMathMLFrame_h___ */
diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -210,9 +210,10 @@ void nsMathMLContainerFrame::GetPreferredStretchSize(
NS_ASSERTION(aStretchDirection == NS_STRETCH_DIRECTION_HORIZONTAL ||
aStretchDirection == NS_STRETCH_DIRECTION_VERTICAL,
"You must specify a direction in which to stretch");
- NS_ASSERTION(
- NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) || stretchAll,
- "invalid call to GetPreferredStretchSize");
+ NS_ASSERTION(mEmbellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator) ||
+ stretchAll,
+ "invalid call to GetPreferredStretchSize");
bool firstTime = true;
nsBoundingMetrics bm, bmChild;
nsIFrame* childFrame = stretchAll ? PrincipalChildList().FirstChild()
@@ -225,7 +226,8 @@ void nsMathMLContainerFrame::GetPreferredStretchSize(
nsPresentationData presentationData;
mathMLFrame->GetEmbellishData(embellishData);
mathMLFrame->GetPresentationData(presentationData);
- if (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) &&
+ if (embellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator) &&
embellishData.direction == aStretchDirection &&
presentationData.baseFrame) {
// embellishements are not included, only consider the inner first
@@ -292,7 +294,7 @@ nsMathMLContainerFrame::Stretch(DrawTarget* aDrawTarget,
nsStretchDirection aStretchDirection,
nsBoundingMetrics& aContainerSize,
ReflowOutput& aDesiredStretchSize) {
- if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) {
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::EmbellishedOperator)) {
if (mPresentationData.flags.contains(MathMLPresentationFlag::StretchDone)) {
NS_WARNING("it is wrong to fire stretch more than once on a frame");
return NS_OK;
@@ -466,7 +468,8 @@ nsresult nsMathMLContainerFrame::FinalizeReflow(DrawTarget* aDrawTarget,
// <mo>...</mo> itself.
// (<mo> needs to fire stretch on its MathMLChar in any case to initialize it)
bool placeOrigin =
- !NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) ||
+ !mEmbellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator) ||
(mEmbellishData.coreFrame != this && !mPresentationData.baseFrame &&
mEmbellishData.direction == NS_STRETCH_DIRECTION_UNSUPPORTED);
PlaceFlags flags;
@@ -491,7 +494,8 @@ nsresult nsMathMLContainerFrame::FinalizeReflow(DrawTarget* aDrawTarget,
MathMLPresentationFlag::StretchAllChildrenVertically) ||
presentationData.flags.contains(
MathMLPresentationFlag::StretchAllChildrenHorizontally) ||
- (NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags) &&
+ (embellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator) &&
presentationData.baseFrame == this)) {
parentWillFireStretch = true;
}
@@ -862,7 +866,8 @@ void nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
DrawTarget* drawTarget = aReflowInput.mRenderingContext->GetDrawTarget();
- if (!NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) &&
+ if (!mEmbellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator) &&
(mPresentationData.flags.contains(
MathMLPresentationFlag::StretchAllChildrenVertically) ||
mPresentationData.flags.contains(
@@ -1389,7 +1394,8 @@ nsresult nsMathMLContainerFrame::TransmitAutomaticDataForMrowLikeElement() {
}
baseFrame = childFrame;
GetEmbellishDataFrom(baseFrame, embellishData);
- if (!NS_MATHML_IS_EMBELLISH_OPERATOR(embellishData.flags)) {
+ if (!embellishData.flags.contains(
+ MathMLEmbellishFlag::EmbellishedOperator)) {
break;
}
embellishedOpFound = true;
@@ -1413,7 +1419,7 @@ nsresult nsMathMLContainerFrame::TransmitAutomaticDataForMrowLikeElement() {
if (childFrame || !embellishedOpFound) {
// The element is not embellished operator
mPresentationData.baseFrame = nullptr;
- mEmbellishData.flags = 0;
+ mEmbellishData.flags.clear();
mEmbellishData.coreFrame = nullptr;
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
mEmbellishData.leadingSpace = 0;
diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp
@@ -47,7 +47,7 @@ eMathMLFrameType nsMathMLFrame::GetMathMLFrameType() {
NS_IMETHODIMP
nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent) {
- mEmbellishData.flags = 0;
+ mEmbellishData.flags.clear();
mEmbellishData.coreFrame = nullptr;
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
mEmbellishData.leadingSpace = 0;
@@ -95,7 +95,7 @@ nsMathMLFrame::UpdatePresentationData(MathMLPresentationFlags aFlagsValues,
void nsMathMLFrame::GetEmbellishDataFrom(nsIFrame* aFrame,
nsEmbellishData& aEmbellishData) {
// initialize OUT params
- aEmbellishData.flags = 0;
+ aEmbellishData.flags.clear();
aEmbellishData.coreFrame = nullptr;
aEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
aEmbellishData.leadingSpace = 0;
diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -71,7 +71,7 @@ nsMathMLmfracFrame::TransmitAutomaticData() {
// if our numerator is an embellished operator, let its state bubble to us
GetEmbellishDataFrom(mFrames.FirstChild(), mEmbellishData);
- if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) {
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::EmbellishedOperator)) {
// even when embellished, we need to record that <mfrac> won't fire
// Stretch() on its embellished child
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp
@@ -196,7 +196,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
// reset everything so that we don't keep outdated values around
// in case of dynamic changes
- mEmbellishData.flags = 0;
+ mEmbellishData.flags.clear();
mEmbellishData.coreFrame = nullptr;
mEmbellishData.leadingSpace = 0;
mEmbellishData.trailingSpace = 0;
@@ -209,7 +209,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
return;
}
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_OPERATOR;
+ mEmbellishData.flags += MathMLEmbellishFlag::EmbellishedOperator;
mEmbellishData.coreFrame = this;
// there are two particular things that we also need to record so that if
@@ -223,10 +223,10 @@ void nsMathMLmoFrame::ProcessOperatorData() {
// default values from the Operator Dictionary were obtained in
// ProcessTextData() and these special bits are always kept in mFlags
if (NS_MATHML_OPERATOR_IS_ACCENT(mFlags)) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENT;
+ mEmbellishData.flags += MathMLEmbellishFlag::Accent;
}
if (NS_MATHML_OPERATOR_IS_MOVABLELIMITS(mFlags)) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_MOVABLELIMITS;
+ mEmbellishData.flags += MathMLEmbellishFlag::MovableLimits;
}
// see if the accent attribute is there
@@ -251,18 +251,18 @@ void nsMathMLmoFrame::ProcessOperatorData() {
false, params);
}();
if (value.LowerCaseEqualsLiteral("true")) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENT;
+ mEmbellishData.flags += MathMLEmbellishFlag::Accent;
} else if (value.LowerCaseEqualsLiteral("false")) {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENT;
+ mEmbellishData.flags -= MathMLEmbellishFlag::Accent;
}
}
// see if the movablelimits attribute is there
mContent->AsElement()->GetAttr(nsGkAtoms::movablelimits, value);
if (value.LowerCaseEqualsLiteral("true")) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_MOVABLELIMITS;
+ mEmbellishData.flags += MathMLEmbellishFlag::MovableLimits;
} else if (value.LowerCaseEqualsLiteral("false")) {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_MOVABLELIMITS;
+ mEmbellishData.flags -= MathMLEmbellishFlag::MovableLimits;
}
// ---------------------------------------------------------------------
@@ -477,7 +477,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
if (value.LowerCaseEqualsLiteral("false")) {
mFlags &= ~NS_MATHML_OPERATOR_FENCE;
} else {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_FENCE;
+ mEmbellishData.flags += MathMLEmbellishFlag::Fence;
}
}
mContent->AsElement()->GetAttr(nsGkAtoms::largeop, value);
@@ -491,7 +491,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
if (value.LowerCaseEqualsLiteral("false")) {
mFlags &= ~NS_MATHML_OPERATOR_SEPARATOR;
} else {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_SEPARATOR;
+ mEmbellishData.flags += MathMLEmbellishFlag::Separator;
}
}
mContent->AsElement()->GetAttr(nsGkAtoms::symmetric, value);
@@ -801,12 +801,12 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
// special case for accents... keep them short to improve mouse operations...
// an accent can only be the non-first child of <mover>, <munder>,
// <munderover>
- bool isAccent = NS_MATHML_EMBELLISH_IS_ACCENT(mEmbellishData.flags);
+ bool isAccent = mEmbellishData.flags.contains(MathMLEmbellishFlag::Accent);
if (isAccent) {
nsEmbellishData parentData;
GetEmbellishDataFrom(GetParent(), parentData);
- isAccent = (NS_MATHML_EMBELLISH_IS_ACCENTOVER(parentData.flags) ||
- NS_MATHML_EMBELLISH_IS_ACCENTUNDER(parentData.flags)) &&
+ isAccent = (parentData.flags.contains(MathMLEmbellishFlag::AccentOver) ||
+ parentData.flags.contains(MathMLEmbellishFlag::AccentUnder)) &&
parentData.coreFrame != this;
}
if (isAccent && firstChild) {
diff --git a/layout/mathml/nsMathMLmunderoverFrame.cpp b/layout/mathml/nsMathMLmunderoverFrame.cpp
@@ -61,7 +61,7 @@ nsMathMLmunderoverFrame::UpdatePresentationData(
nsMathMLContainerFrame::UpdatePresentationData(aFlagsValues, aFlagsToUpdate);
// disable the stretch-all flag if we are going to act like a
// subscript-superscript pair
- if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::MovableLimits) &&
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
mPresentationData.flags -=
MathMLPresentationFlag::StretchAllChildrenHorizontally;
@@ -210,7 +210,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
// if our base is an embellished operator, let its state bubble to us (in
// particular, this is where we get the flag for
- // NS_MATHML_EMBELLISH_MOVABLELIMITS). Our flags are reset to the default
+ // MovableLimits). Our flags are reset to the default
// values of false if the base frame isn't embellished.
mPresentationData.baseFrame = baseFrame;
GetEmbellishDataFrom(baseFrame, mEmbellishData);
@@ -222,21 +222,22 @@ XXX The winner is the outermost setting in conflicting settings like these:
if (mContent->IsAnyOfMathMLElements(nsGkAtoms::munder,
nsGkAtoms::munderover)) {
GetEmbellishDataFrom(underscriptFrame, embellishData);
- if (NS_MATHML_EMBELLISH_IS_ACCENT(embellishData.flags)) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENTUNDER;
+ if (embellishData.flags.contains(MathMLEmbellishFlag::Accent)) {
+ mEmbellishData.flags += MathMLEmbellishFlag::AccentUnder;
} else {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTUNDER;
+ mEmbellishData.flags -= MathMLEmbellishFlag::AccentUnder;
}
// if we have an accentunder attribute, it overrides what the underscript
// said
if (mContent->AsElement()->GetAttr(nsGkAtoms::accentunder, value)) {
if (value.LowerCaseEqualsLiteral("true")) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENTUNDER;
+ mEmbellishData.flags += MathMLEmbellishFlag::AccentUnder;
} else if (value.LowerCaseEqualsLiteral("false")) {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTUNDER;
+ mEmbellishData.flags -= MathMLEmbellishFlag::AccentUnder;
}
- } else if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
+ } else if (mEmbellishData.flags.contains(
+ MathMLEmbellishFlag::AccentUnder)) {
AutoTArray<nsString, 1> params;
params.AppendElement(mContent->NodeInfo()->NodeName());
PresContext()->Document()->WarnOnceAbout(
@@ -251,20 +252,20 @@ XXX The winner is the outermost setting in conflicting settings like these:
if (mContent->IsAnyOfMathMLElements(nsGkAtoms::mover,
nsGkAtoms::munderover)) {
GetEmbellishDataFrom(overscriptFrame, embellishData);
- if (NS_MATHML_EMBELLISH_IS_ACCENT(embellishData.flags)) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENTOVER;
+ if (embellishData.flags.contains(MathMLEmbellishFlag::Accent)) {
+ mEmbellishData.flags += MathMLEmbellishFlag::AccentOver;
} else {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTOVER;
+ mEmbellishData.flags -= MathMLEmbellishFlag::AccentOver;
}
// if we have an accent attribute, it overrides what the overscript said
if (mContent->AsElement()->GetAttr(nsGkAtoms::accent, value)) {
if (value.LowerCaseEqualsLiteral("true")) {
- mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENTOVER;
+ mEmbellishData.flags += MathMLEmbellishFlag::AccentOver;
} else if (value.LowerCaseEqualsLiteral("false")) {
- mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTOVER;
+ mEmbellishData.flags -= MathMLEmbellishFlag::AccentOver;
}
- } else if (NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) {
+ } else if (mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver)) {
AutoTArray<nsString, 1> params;
params.AppendElement(mContent->NodeInfo()->NodeName());
PresContext()->Document()->WarnOnceAbout(
@@ -274,7 +275,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
}
bool subsupDisplay =
- NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
+ mEmbellishData.flags.contains(MathMLEmbellishFlag::MovableLimits) &&
StyleFont()->mMathStyle == StyleMathStyle::Compact;
// disable the stretch-all flag if we are going to act like a superscript
@@ -305,8 +306,9 @@ XXX The winner is the outermost setting in conflicting settings like these:
*/
if (mContent->IsAnyOfMathMLElements(nsGkAtoms::mover,
nsGkAtoms::munderover)) {
- mIncrementOver = !NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags) ||
- subsupDisplay;
+ mIncrementOver =
+ !mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver) ||
+ subsupDisplay;
SetIncrementScriptLevel(mContent->IsMathMLElement(nsGkAtoms::mover) ? 1 : 2,
mIncrementOver);
if (mIncrementOver) {
@@ -314,7 +316,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
}
if (!StaticPrefs::mathml_math_shift_enabled()) {
MathMLPresentationFlags flags;
- if (NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) {
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver)) {
flags += MathMLPresentationFlag::Compressed;
}
PropagatePresentationDataFor(overscriptFrame, flags, flags);
@@ -327,7 +329,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
if (mContent->IsAnyOfMathMLElements(nsGkAtoms::munder,
nsGkAtoms::munderover)) {
mIncrementUnder =
- !NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags) ||
+ !mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentUnder) ||
subsupDisplay;
SetIncrementScriptLevel(1, mIncrementUnder);
if (mIncrementUnder) {
@@ -357,8 +359,8 @@ XXX The winner is the outermost setting in conflicting settings like these:
"font-feature-settings: 'dtls' 0"
*/
if (overscriptFrame &&
- NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags) &&
- !NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags)) {
+ mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver) &&
+ !mEmbellishData.flags.contains(MathMLEmbellishFlag::MovableLimits)) {
PropagatePresentationDataFor(baseFrame, MathMLPresentationFlag::Dtls,
MathMLPresentationFlag::Dtls);
}
@@ -376,7 +378,7 @@ The REC says:
used for limits on symbols such as ∑.
i.e.,:
- if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishDataflags) &&
+ if (mEmbellishDataflags.contains(MathMLEmbellishFlag::MovableLimits) &&
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
// place like subscript-superscript pair
}
@@ -390,7 +392,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
const PlaceFlags& aFlags,
ReflowOutput& aDesiredSize) {
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
- if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::MovableLimits) &&
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
// place like sub sup or subsup
if (mContent->IsMathMLElement(nsGkAtoms::munderover)) {
@@ -496,7 +498,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
nscoord underDelta1 = 0; // gap between base and underscript
nscoord underDelta2 = 0; // extra space beneath underscript
- if (!NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
+ if (!mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentUnder)) {
// Rule 13a, App. G, TeXbook
nscoord bigOpSpacing2, bigOpSpacing4, bigOpSpacing5, dummy;
GetBigOpSpacings(fm, dummy, bigOpSpacing2, dummy, bigOpSpacing4,
@@ -532,7 +534,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
nscoord overDelta1 = 0; // gap between base and overscript
nscoord overDelta2 = 0; // extra space above overscript
- if (!NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) {
+ if (!mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver)) {
// Rule 13a, App. G, TeXbook
// XXXfredw The Open Type MATH table has some StretchStack* parameters
// that we may use when the base is a stretchy horizontal operator. See
@@ -626,7 +628,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
dxOver = -bmOver.leftBearing;
}
- if (NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) {
+ if (mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentOver)) {
mBoundingMetrics.width = bmBase.width + baseMargin.LeftRight();
dxOver += correction;
} else {
@@ -672,7 +674,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
}
nscoord maxWidth = std::max(bmAnonymousBase.width, underWidth);
- if (!NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
+ if (!mEmbellishData.flags.contains(MathMLEmbellishFlag::AccentUnder)) {
GetItalicCorrection(bmAnonymousBase, correction);
dxUnder += -correction / 2;
}
@@ -757,7 +759,7 @@ void nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
bool nsMathMLmunderoverFrame::IsMathContentBoxHorizontallyCentered() const {
bool subsupDisplay =
- NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
+ mEmbellishData.flags.contains(MathMLEmbellishFlag::MovableLimits) &&
StyleFont()->mMathStyle == StyleMathStyle::Compact;
return !subsupDisplay;
}