1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsMathMLmrowFrame.h"
9 #include "mozilla/PresShell.h"
10 #include "mozilla/gfx/2D.h"
12 using namespace mozilla
;
15 // <mrow> -- horizontally group any number of subexpressions - implementation
18 nsIFrame
* NS_NewMathMLmrowFrame(PresShell
* aPresShell
, ComputedStyle
* aStyle
) {
19 return new (aPresShell
)
20 nsMathMLmrowFrame(aStyle
, aPresShell
->GetPresContext());
23 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame
)
25 nsMathMLmrowFrame::~nsMathMLmrowFrame() = default;
28 nsMathMLmrowFrame::InheritAutomaticData(nsIFrame
* aParent
) {
29 // let the base class get the default from our parent
30 nsMathMLContainerFrame::InheritAutomaticData(aParent
);
32 mPresentationData
.flags
|= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY
;
37 nsresult
nsMathMLmrowFrame::AttributeChanged(int32_t aNameSpaceID
,
40 // Special for <mtable>: In the frame construction code, we also use
41 // this frame class as a wrapper for mtable. Hence, we should pass the
42 // notification to the real mtable
43 if (mContent
->IsMathMLElement(nsGkAtoms::mtable_
)) {
44 nsIFrame
* frame
= mFrames
.FirstChild();
45 for (; frame
; frame
= frame
->PrincipalChildList().FirstChild()) {
46 // drill down to the real mtable
47 if (frame
->IsTableWrapperFrame())
48 return frame
->AttributeChanged(aNameSpaceID
, aAttribute
, aModType
);
50 MOZ_ASSERT_UNREACHABLE("mtable wrapper without the real table frame");
53 return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID
, aAttribute
,
58 eMathMLFrameType
nsMathMLmrowFrame::GetMathMLFrameType() {
60 nsIMathMLFrame
* child
= do_QueryFrame(mFrames
.FirstChild());
62 // We only have one child, so we return the frame type of that child as if
64 return child
->GetMathMLFrameType();
67 return nsMathMLFrame::GetMathMLFrameType();