/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsIMathMLFrame_h_ #define nsIMathMLFrame_h_
struct nsPresentationData; struct nsEmbellishData; class gfxContext; class nsIFrame; namespace mozilla { class ReflowOutput;
} // namespace mozilla
// For MathML, this 'type' will be used to determine the spacing between frames // Subclasses can return a 'type' that will give them a particular spacing enumclass MathMLFrameType : uint8_t {
Ordinary,
OperatorOrdinary,
OperatorInvisible,
OperatorUserDefined,
Inner,
ItalicIdentifier,
UprightIdentifier,
Unknown,
};
constexpr auto MathMLFrameTypeCount = size_t(MathMLFrameType::Unknown);
// Bits used for the presentation flags -- these bits are set // in their relevant situation as they become available enumclass MathMLPresentationFlag : uint8_t { // This bit is set if the frame will fire a vertical stretch // command on all its (non-empty) children. // Tags like <mrow> (or an inferred mrow), mpadded, etc, will fire a // vertical stretch command on all their non-empty children
StretchAllChildrenVertically,
// This bit is set if the frame will fire a horizontal stretch // command on all its (non-empty) children. // Tags like munder, mover, munderover, will fire a // horizontal stretch command on all their non-empty children
StretchAllChildrenHorizontally,
// This bit is set if the frame is "space-like", as defined by the spec.
SpaceLike,
// This bit is set if a token frame should be rendered with the dtls font // feature setting.
Dtls,
// a bit used for debug
StretchDone,
};
using MathMLPresentationFlags = mozilla::EnumSet<MathMLPresentationFlag>;
// Bits used for the embellish flags -- these bits are set // in their relevant situation as they become available enumclass 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 <mo> frame or an embellihsed // operator for which the core <mo> has largeop="true"
LargeOp,
// 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:
NS_DECL_QUERYFRAME_TARGET(nsIMathMLFrame)
// helper to check whether the frame is "space-like", as defined by the spec.
virtual bool IsSpaceLike() = 0;
/* SUPPORT FOR PRECISE POSITIONING */ /*====================================================================*/
/* Metrics that _exactly_ enclose the text of the frame. *Theframe*must*have*already*beingreflowed,beforeyoucancall *theGetBoundingMetrics()method. *Notethatforaframewithnestedchildren,theboundingmetrics *willexactlyencloseitschildren.Forexample,theboundingmetrics *ofmsubisthesmallestrectanglethatexactlyenclosesboththe *baseandthesubscript.
*/
NS_IMETHOD
GetBoundingMetrics(nsBoundingMetrics& aBoundingMetrics) = 0;
// If aFrame is a child frame, returns the script increment which this frame // imposes on the specified frame, ignoring any artificial adjustments to // scriptlevel. // Returns 0 if the specified frame isn't a child frame.
virtual uint8_t ScriptIncrement(nsIFrame* aFrame) = 0;
// Returns true if the frame is considered to be an mrow for layout purposes. // This includes inferred mrows, but excludes <mrow> elements with a single // child. In the latter case, the child is to be treated as if it wasn't // within an mrow, so we pretend the mrow isn't mrow-like.
virtual bool IsMrowLike() = 0;
// struct used by a container frame to keep track of its embellishments. // By convention, the data that we keep here is bubbled from the embellished // hierarchy, and it remains unchanged unless we have to recover from a change // that occurs in the embellished hierarchy. The struct remains in its nil // state in those frames that are not part of the embellished hierarchy. struct nsEmbellishData { // bits used to mark certain properties of our embellishments
MathMLEmbellishFlags flags;
// pointer on the <mo> frame at the core of the embellished hierarchy
nsIFrame* coreFrame = nullptr;
// stretchy direction that the nsMathMLChar owned by the core <mo> supports
StretchDirection direction = StretchDirection::Unsupported;
// spacing that may come from <mo> depending on its 'form'. Since // the 'form' may also depend on the position of the outermost // embellished ancestor, the set up of these values may require // looking up the position of our ancestors.
nscoord leadingSpace = 0;
nscoord trailingSpace = 0;
};
// struct used by a container frame to modulate its presentation. // By convention, the data that we keep in this struct can change depending // on any of our ancestors and/or descendants. If a data can be resolved // solely from the embellished hierarchy, and it remains immutable once // resolved, we put it in |nsEmbellishData|. If it can be affected by other // things, it comes here. This struct is updated as we receive information // transmitted by our ancestors and is kept in sync with changes in our // descendants that affects us. struct nsPresentationData { // bits for: compressed, etc
MathMLPresentationFlags flags;
// handy pointer on our base child (the 'nucleus' in TeX), but it may be // null here (e.g., tags like <mrow>, <mfrac>, <mtable>, etc, won't // pick a particular child in their child list to be the base)
nsIFrame* baseFrame = nullptr;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.