nsMathMLContainerFrame.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsMathMLContainerFrame_h___
  6. #define nsMathMLContainerFrame_h___
  7. #include "mozilla/Attributes.h"
  8. #include "nsContainerFrame.h"
  9. #include "nsBlockFrame.h"
  10. #include "nsInlineFrame.h"
  11. #include "nsMathMLOperators.h"
  12. #include "nsMathMLFrame.h"
  13. #include "mozilla/Likely.h"
  14. /*
  15. * Base class for MathML container frames. It acts like an inferred
  16. * mrow. By default, this frame uses its Reflow() method to lay its
  17. * children horizontally and ensure that their baselines are aligned.
  18. * The Reflow() method relies upon Place() to position children.
  19. * By overloading Place() in derived classes, it is therefore possible
  20. * to position children in various customized ways.
  21. */
  22. // Options for the preferred size at which to stretch our stretchy children
  23. #define STRETCH_CONSIDER_ACTUAL_SIZE 0x00000001 // just use our current size
  24. #define STRETCH_CONSIDER_EMBELLISHMENTS 0x00000002 // size calculations include embellishments
  25. class nsMathMLContainerFrame : public nsContainerFrame,
  26. public nsMathMLFrame {
  27. friend class nsMathMLmfencedFrame;
  28. public:
  29. explicit nsMathMLContainerFrame(nsStyleContext* aContext)
  30. : nsContainerFrame(aContext)
  31. , mIntrinsicWidth(NS_INTRINSIC_WIDTH_UNKNOWN)
  32. , mBlockStartAscent(0)
  33. {}
  34. NS_DECL_QUERYFRAME_TARGET(nsMathMLContainerFrame)
  35. NS_DECL_QUERYFRAME
  36. NS_DECL_ABSTRACT_FRAME(nsMathMLContainerFrame)
  37. // --------------------------------------------------------------------------
  38. // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h
  39. NS_IMETHOD
  40. Stretch(DrawTarget* aDrawTarget,
  41. nsStretchDirection aStretchDirection,
  42. nsBoundingMetrics& aContainerSize,
  43. ReflowOutput& aDesiredStretchSize) override;
  44. NS_IMETHOD
  45. UpdatePresentationDataFromChildAt(int32_t aFirstIndex,
  46. int32_t aLastIndex,
  47. uint32_t aFlagsValues,
  48. uint32_t aFlagsToUpdate) override
  49. {
  50. PropagatePresentationDataFromChildAt(this, aFirstIndex, aLastIndex,
  51. aFlagsValues, aFlagsToUpdate);
  52. return NS_OK;
  53. }
  54. // helper to set the "increment script level" flag on the element belonging
  55. // to a child frame given by aChildIndex.
  56. // When this flag is set, the style system will increment the scriptlevel
  57. // for the child element. This is needed for situations where the style system
  58. // cannot itself determine the scriptlevel (mfrac, munder, mover, munderover).
  59. // This should be called during reflow. We set the flag and if it changed,
  60. // we request appropriate restyling and also queue a post-reflow callback
  61. // to ensure that restyle and reflow happens immediately after the current
  62. // reflow.
  63. void
  64. SetIncrementScriptLevel(int32_t aChildIndex, bool aIncrement);
  65. // --------------------------------------------------------------------------
  66. // Overloaded nsContainerFrame methods -- see documentation in nsIFrame.h
  67. virtual bool IsFrameOfType(uint32_t aFlags) const override
  68. {
  69. return !(aFlags & nsIFrame::eLineParticipant) &&
  70. nsContainerFrame::IsFrameOfType(aFlags &
  71. ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
  72. }
  73. virtual void
  74. AppendFrames(ChildListID aListID,
  75. nsFrameList& aFrameList) override;
  76. virtual void
  77. InsertFrames(ChildListID aListID,
  78. nsIFrame* aPrevFrame,
  79. nsFrameList& aFrameList) override;
  80. virtual void
  81. RemoveFrame(ChildListID aListID,
  82. nsIFrame* aOldFrame) override;
  83. /**
  84. * Both GetMinISize and GetPrefISize use the intrinsic width metrics
  85. * returned by GetIntrinsicMetrics, including ink overflow.
  86. */
  87. virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
  88. virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
  89. /**
  90. * Return the intrinsic horizontal metrics of the frame's content area.
  91. */
  92. virtual void
  93. GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingContext,
  94. ReflowOutput& aDesiredSize);
  95. virtual void
  96. Reflow(nsPresContext* aPresContext,
  97. ReflowOutput& aDesiredSize,
  98. const ReflowInput& aReflowInput,
  99. nsReflowStatus& aStatus) override;
  100. virtual void DidReflow(nsPresContext* aPresContext,
  101. const ReflowInput* aReflowInput,
  102. nsDidReflowStatus aStatus) override
  103. {
  104. mPresentationData.flags &= ~NS_MATHML_STRETCH_DONE;
  105. return nsContainerFrame::DidReflow(aPresContext, aReflowInput, aStatus);
  106. }
  107. virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
  108. const nsDisplayListSet& aLists) override;
  109. virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
  110. virtual void MarkIntrinsicISizesDirty() override;
  111. // Notification when an attribute is changed. The MathML module uses the
  112. // following paradigm:
  113. //
  114. // 1. If the MathML frame class doesn't have any cached automatic data that
  115. // depends on the attribute: we just reflow (e.g., this happens with <msub>,
  116. // <msup>, <mmultiscripts>, etc). This is the default behavior implemented
  117. // by this base class.
  118. //
  119. // 2. If the MathML frame class has cached automatic data that depends on
  120. // the attribute:
  121. // 2a. If the automatic data to update resides only within the descendants,
  122. // we just re-layout them using ReLayoutChildren(this);
  123. // (e.g., this happens with <ms>).
  124. // 2b. If the automatic data to update affects us in some way, we ask our parent
  125. // to re-layout its children using ReLayoutChildren(mParent);
  126. // Therefore, there is an overhead here in that our siblings are re-laid
  127. // too (e.g., this happens with <munder>, <mover>, <munderover>).
  128. virtual nsresult
  129. AttributeChanged(int32_t aNameSpaceID,
  130. nsIAtom* aAttribute,
  131. int32_t aModType) override;
  132. // helper function to apply mirroring to a horizontal coordinate, if needed.
  133. nscoord
  134. MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth, nscoord aChildLeading)
  135. {
  136. return (StyleVisibility()->mDirection ?
  137. aParentWidth - aChildWidth - aChildLeading : aChildLeading);
  138. }
  139. // --------------------------------------------------------------------------
  140. // Additional methods
  141. protected:
  142. /* Place :
  143. * This method is used to measure or position child frames and other
  144. * elements. It may be called any number of times with aPlaceOrigin
  145. * false to measure, and the final call of the Reflow process before
  146. * returning from Reflow() or Stretch() will have aPlaceOrigin true
  147. * to position the elements.
  148. *
  149. * IMPORTANT: This method uses GetReflowAndBoundingMetricsFor() which must
  150. * have been set up with SaveReflowAndBoundingMetricsFor().
  151. *
  152. * The Place() method will use this information to compute the desired size
  153. * of the frame.
  154. *
  155. * @param aPlaceOrigin [in]
  156. * If aPlaceOrigin is false, compute your desired size using the
  157. * information from GetReflowAndBoundingMetricsFor. However, child
  158. * frames or other elements should not be repositioned.
  159. *
  160. * If aPlaceOrigin is true, reflow is finished. You should position
  161. * all your children, and return your desired size. You should now
  162. * use FinishReflowChild() on your children to complete post-reflow
  163. * operations.
  164. *
  165. * @param aDesiredSize [out] parameter where you should return your desired
  166. * size and your ascent/descent info. Compute your desired size using
  167. * the information from GetReflowAndBoundingMetricsFor, and include
  168. * any space you want for border/padding in the desired size you
  169. * return.
  170. */
  171. virtual nsresult
  172. Place(DrawTarget* aDrawTarget,
  173. bool aPlaceOrigin,
  174. ReflowOutput& aDesiredSize);
  175. // MeasureForWidth:
  176. //
  177. // A method used by nsMathMLContainerFrame::GetIntrinsicISize to get the
  178. // width that a particular Place method desires. For most frames, this will
  179. // just call the object's Place method. However <msqrt> and <menclose> use
  180. // nsMathMLContainerFrame::GetIntrinsicISize to measure the child frames as
  181. // if in an <mrow>, and so their frames implement MeasureForWidth to use
  182. // nsMathMLContainerFrame::Place.
  183. virtual nsresult
  184. MeasureForWidth(DrawTarget* aDrawTarget,
  185. ReflowOutput& aDesiredSize);
  186. // helper to re-sync the automatic data in our children and notify our parent to
  187. // reflow us when changes (e.g., append/insert/remove) happen in our child list
  188. virtual nsresult
  189. ChildListChanged(int32_t aModType);
  190. // helper to get the preferred size that a container frame should use to fire
  191. // the stretch on its stretchy child frames.
  192. void
  193. GetPreferredStretchSize(DrawTarget* aDrawTarget,
  194. uint32_t aOptions,
  195. nsStretchDirection aStretchDirection,
  196. nsBoundingMetrics& aPreferredStretchSize);
  197. // helper used by mstyle, mphantom, mpadded and mrow in their implementation
  198. // of TransmitAutomaticData() to determine whether they are space-like.
  199. nsresult
  200. TransmitAutomaticDataForMrowLikeElement();
  201. public:
  202. // error handlers to provide a visual feedback to the user when an error
  203. // (typically invalid markup) was encountered during reflow.
  204. nsresult
  205. ReflowError(DrawTarget* aDrawTarget, ReflowOutput& aDesiredSize);
  206. /*
  207. * Helper to call ReportErrorToConsole for parse errors involving
  208. * attribute/value pairs.
  209. * @param aAttribute The attribute for which the parse error occured.
  210. * @param aValue The value for which the parse error occured.
  211. */
  212. nsresult
  213. ReportParseError(const char16_t* aAttribute,
  214. const char16_t* aValue);
  215. /*
  216. * Helper to call ReportErrorToConsole when certain tags
  217. * have more than the expected amount of children.
  218. */
  219. nsresult
  220. ReportChildCountError();
  221. /*
  222. * Helper to call ReportErrorToConsole when certain tags have
  223. * invalid child tags
  224. * @param aChildTag The tag which is forbidden in this context
  225. */
  226. nsresult
  227. ReportInvalidChildError(nsIAtom* aChildTag);
  228. /*
  229. * Helper to call ReportToConsole when an error occurs.
  230. * @param aParams see nsContentUtils::ReportToConsole
  231. */
  232. nsresult
  233. ReportErrorToConsole(const char* aErrorMsgId,
  234. const char16_t** aParams = nullptr,
  235. uint32_t aParamCount = 0);
  236. // helper method to reflow a child frame. We are inline frames, and we don't
  237. // know our positions until reflow is finished. That's why we ask the
  238. // base method not to worry about our position.
  239. void
  240. ReflowChild(nsIFrame* aKidFrame,
  241. nsPresContext* aPresContext,
  242. ReflowOutput& aDesiredSize,
  243. const ReflowInput& aReflowInput,
  244. nsReflowStatus& aStatus);
  245. protected:
  246. // helper to add the inter-spacing when <math> is the immediate parent.
  247. // Since we don't (yet) handle the root <math> element ourselves, we need to
  248. // take special care of the inter-frame spacing on elements for which <math>
  249. // is the direct xml parent. This function will be repeatedly called from
  250. // left to right on the childframes of <math>, and by so doing it will
  251. // emulate the spacing that would have been done by a <mrow> container.
  252. // e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
  253. virtual nscoord
  254. FixInterFrameSpacing(ReflowOutput& aDesiredSize);
  255. // helper method to complete the post-reflow hook and ensure that embellished
  256. // operators don't terminate their Reflow without receiving a Stretch command.
  257. virtual nsresult
  258. FinalizeReflow(DrawTarget* aDrawTarget, ReflowOutput& aDesiredSize);
  259. // Record metrics of a child frame for recovery through the following method
  260. static void
  261. SaveReflowAndBoundingMetricsFor(nsIFrame* aFrame,
  262. const ReflowOutput& aReflowOutput,
  263. const nsBoundingMetrics& aBoundingMetrics);
  264. // helper method to facilitate getting the reflow and bounding metrics of a
  265. // child frame. The argument aMathMLFrameType, when non null, will return
  266. // the 'type' of the frame, which is used to determine the inter-frame
  267. // spacing.
  268. // IMPORTANT: This function is only meant to be called in Place() methods as
  269. // the information is available only when set up with the above method
  270. // during Reflow/Stretch() and GetPrefISize().
  271. static void
  272. GetReflowAndBoundingMetricsFor(nsIFrame* aFrame,
  273. ReflowOutput& aReflowOutput,
  274. nsBoundingMetrics& aBoundingMetrics,
  275. eMathMLFrameType* aMathMLFrameType = nullptr);
  276. // helper method to clear metrics saved with
  277. // SaveReflowAndBoundingMetricsFor() from all child frames.
  278. void ClearSavedChildMetrics();
  279. // helper to let the update of presentation data pass through
  280. // a subtree that may contain non-MathML container frames
  281. static void
  282. PropagatePresentationDataFor(nsIFrame* aFrame,
  283. uint32_t aFlagsValues,
  284. uint32_t aFlagsToUpdate);
  285. public:
  286. static void
  287. PropagatePresentationDataFromChildAt(nsIFrame* aParentFrame,
  288. int32_t aFirstChildIndex,
  289. int32_t aLastChildIndex,
  290. uint32_t aFlagsValues,
  291. uint32_t aFlagsToUpdate);
  292. // Sets flags on aFrame and all descendant frames
  293. static void
  294. PropagateFrameFlagFor(nsIFrame* aFrame,
  295. nsFrameState aFlags);
  296. // helper to let the rebuild of automatic data (presentation data
  297. // and embellishement data) walk through a subtree that may contain
  298. // non-MathML container frames. Note that this method re-builds the
  299. // automatic data in the children -- not in aParentFrame itself (except
  300. // for those particular operations that the parent frame may do in its
  301. // TransmitAutomaticData()). The reason it works this way is because
  302. // a container frame knows what it wants for its children, whereas children
  303. // have no clue who their parent is. For example, it is <mfrac> who knows
  304. // that its children have to be in scriptsizes, and has to transmit this
  305. // information to them. Hence, when changes occur in a child frame, the child
  306. // has to request the re-build from its parent. Unfortunately, the extra cost
  307. // for this is that it will re-sync in the siblings of the child as well.
  308. static void
  309. RebuildAutomaticDataForChildren(nsIFrame* aParentFrame);
  310. // helper to blow away the automatic data cached in a frame's subtree and
  311. // re-layout its subtree to reflect changes that may have happen. In the
  312. // event where aParentFrame isn't a MathML frame, it will first walk up to
  313. // the ancestor that is a MathML frame, and re-layout from there -- this is
  314. // to guarantee that automatic data will be rebuilt properly. Note that this
  315. // method re-builds the automatic data in the children -- not in the parent
  316. // frame itself (except for those particular operations that the parent frame
  317. // may do do its TransmitAutomaticData()). @see RebuildAutomaticDataForChildren
  318. //
  319. // aBits are the bits to pass to FrameNeedsReflow() when we call it.
  320. static nsresult
  321. ReLayoutChildren(nsIFrame* aParentFrame);
  322. protected:
  323. // Helper method which positions child frames as an <mrow> on given baseline
  324. // y = aBaseline starting from x = aOffsetX, calling FinishReflowChild()
  325. // on the frames.
  326. void
  327. PositionRowChildFrames(nscoord aOffsetX, nscoord aBaseline);
  328. // A variant on FinishAndStoreOverflow() that uses the union of child
  329. // overflows, the frame bounds, and mBoundingMetrics to set and store the
  330. // overflow.
  331. void GatherAndStoreOverflow(ReflowOutput* aMetrics);
  332. /**
  333. * Call DidReflow() if the NS_FRAME_IN_REFLOW frame bit is set on aFirst and
  334. * all its next siblings up to, but not including, aStop.
  335. * aStop == nullptr meaning all next siblings with the bit set.
  336. * The method does nothing if aFirst == nullptr.
  337. */
  338. static void DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop = nullptr);
  339. /**
  340. * Recompute mIntrinsicWidth if it's not already up to date.
  341. */
  342. void UpdateIntrinsicWidth(nsRenderingContext* aRenderingContext);
  343. nscoord mIntrinsicWidth;
  344. nscoord mBlockStartAscent;
  345. private:
  346. class RowChildFrameIterator;
  347. friend class RowChildFrameIterator;
  348. };
  349. // --------------------------------------------------------------------------
  350. // Currently, to benefit from line-breaking inside the <math> element, <math> is
  351. // simply mapping to nsBlockFrame or nsInlineFrame.
  352. // A separate implemention needs to provide:
  353. // 1) line-breaking
  354. // 2) proper inter-frame spacing
  355. // 3) firing of Stretch() (in which case FinalizeReflow() would have to be cleaned)
  356. // Issues: If/when mathml becomes a pluggable component, the separation will be needed.
  357. class nsMathMLmathBlockFrame : public nsBlockFrame {
  358. public:
  359. NS_DECL_QUERYFRAME_TARGET(nsMathMLmathBlockFrame)
  360. NS_DECL_QUERYFRAME
  361. NS_DECL_FRAMEARENA_HELPERS
  362. friend nsContainerFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
  363. nsStyleContext* aContext);
  364. // beware, mFrames is not set by nsBlockFrame
  365. // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames
  366. virtual void
  367. SetInitialChildList(ChildListID aListID,
  368. nsFrameList& aChildList) override
  369. {
  370. MOZ_ASSERT(aListID == kPrincipalList || aListID == kBackdropList,
  371. "unexpected frame list");
  372. nsBlockFrame::SetInitialChildList(aListID, aChildList);
  373. if (aListID == kPrincipalList) {
  374. // re-resolve our subtree to set any mathml-expected data
  375. nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
  376. }
  377. }
  378. virtual void
  379. AppendFrames(ChildListID aListID,
  380. nsFrameList& aFrameList) override
  381. {
  382. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  383. "unexpected frame list");
  384. nsBlockFrame::AppendFrames(aListID, aFrameList);
  385. if (MOZ_LIKELY(aListID == kPrincipalList))
  386. nsMathMLContainerFrame::ReLayoutChildren(this);
  387. }
  388. virtual void
  389. InsertFrames(ChildListID aListID,
  390. nsIFrame* aPrevFrame,
  391. nsFrameList& aFrameList) override
  392. {
  393. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  394. "unexpected frame list");
  395. nsBlockFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
  396. if (MOZ_LIKELY(aListID == kPrincipalList))
  397. nsMathMLContainerFrame::ReLayoutChildren(this);
  398. }
  399. virtual void
  400. RemoveFrame(ChildListID aListID,
  401. nsIFrame* aOldFrame) override
  402. {
  403. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  404. "unexpected frame list");
  405. nsBlockFrame::RemoveFrame(aListID, aOldFrame);
  406. if (MOZ_LIKELY(aListID == kPrincipalList))
  407. nsMathMLContainerFrame::ReLayoutChildren(this);
  408. }
  409. virtual bool IsFrameOfType(uint32_t aFlags) const override {
  410. return nsBlockFrame::IsFrameOfType(aFlags &
  411. ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
  412. }
  413. // See nsIMathMLFrame.h
  414. bool IsMrowLike() {
  415. return mFrames.FirstChild() != mFrames.LastChild() ||
  416. !mFrames.FirstChild();
  417. }
  418. protected:
  419. explicit nsMathMLmathBlockFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {
  420. // We should always have a float manager. Not that things can really try
  421. // to float out of us anyway, but we need one for line layout.
  422. // Bug 1301881: Do we still need to set NS_BLOCK_FLOAT_MGR?
  423. // AddStateBits(NS_BLOCK_FLOAT_MGR);
  424. }
  425. virtual ~nsMathMLmathBlockFrame() {}
  426. };
  427. // --------------
  428. class nsMathMLmathInlineFrame : public nsInlineFrame,
  429. public nsMathMLFrame {
  430. public:
  431. NS_DECL_QUERYFRAME_TARGET(nsMathMLmathInlineFrame)
  432. NS_DECL_QUERYFRAME
  433. NS_DECL_FRAMEARENA_HELPERS
  434. friend nsContainerFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell,
  435. nsStyleContext* aContext);
  436. virtual void
  437. SetInitialChildList(ChildListID aListID,
  438. nsFrameList& aChildList) override
  439. {
  440. NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
  441. nsInlineFrame::SetInitialChildList(aListID, aChildList);
  442. // re-resolve our subtree to set any mathml-expected data
  443. nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
  444. }
  445. virtual void
  446. AppendFrames(ChildListID aListID,
  447. nsFrameList& aFrameList) override
  448. {
  449. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  450. "unexpected frame list");
  451. nsInlineFrame::AppendFrames(aListID, aFrameList);
  452. if (MOZ_LIKELY(aListID == kPrincipalList))
  453. nsMathMLContainerFrame::ReLayoutChildren(this);
  454. }
  455. virtual void
  456. InsertFrames(ChildListID aListID,
  457. nsIFrame* aPrevFrame,
  458. nsFrameList& aFrameList) override
  459. {
  460. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  461. "unexpected frame list");
  462. nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
  463. if (MOZ_LIKELY(aListID == kPrincipalList))
  464. nsMathMLContainerFrame::ReLayoutChildren(this);
  465. }
  466. virtual void
  467. RemoveFrame(ChildListID aListID,
  468. nsIFrame* aOldFrame) override
  469. {
  470. NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
  471. "unexpected frame list");
  472. nsInlineFrame::RemoveFrame(aListID, aOldFrame);
  473. if (MOZ_LIKELY(aListID == kPrincipalList))
  474. nsMathMLContainerFrame::ReLayoutChildren(this);
  475. }
  476. virtual bool IsFrameOfType(uint32_t aFlags) const override {
  477. return nsInlineFrame::IsFrameOfType(aFlags &
  478. ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
  479. }
  480. bool
  481. IsMrowLike() override {
  482. return mFrames.FirstChild() != mFrames.LastChild() ||
  483. !mFrames.FirstChild();
  484. }
  485. protected:
  486. explicit nsMathMLmathInlineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {}
  487. virtual ~nsMathMLmathInlineFrame() {}
  488. };
  489. #endif /* nsMathMLContainerFrame_h___ */