Line data Source code
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 :
6 : #include "nsMathMLmrowFrame.h"
7 : #include "mozilla/gfx/2D.h"
8 :
9 : //
10 : // <mrow> -- horizontally group any number of subexpressions - implementation
11 : //
12 :
13 : nsIFrame*
14 0 : NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
15 : {
16 0 : return new (aPresShell) nsMathMLmrowFrame(aContext);
17 : }
18 :
19 0 : NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame)
20 :
21 0 : nsMathMLmrowFrame::~nsMathMLmrowFrame()
22 : {
23 0 : }
24 :
25 : NS_IMETHODIMP
26 0 : nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
27 : {
28 : // let the base class get the default from our parent
29 0 : nsMathMLContainerFrame::InheritAutomaticData(aParent);
30 :
31 0 : mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
32 :
33 0 : return NS_OK;
34 : }
35 :
36 : nsresult
37 0 : nsMathMLmrowFrame::AttributeChanged(int32_t aNameSpaceID,
38 : nsIAtom* aAttribute,
39 : int32_t aModType)
40 : {
41 : // Special for <mtable>: In the frame construction code, we also use
42 : // this frame class as a wrapper for mtable. Hence, we should pass the
43 : // notification to the real mtable
44 0 : if (mContent->IsMathMLElement(nsGkAtoms::mtable_)) {
45 0 : nsIFrame* frame = mFrames.FirstChild();
46 0 : for ( ; frame; frame = frame->PrincipalChildList().FirstChild()) {
47 : // drill down to the real mtable
48 0 : if (frame->IsTableWrapperFrame())
49 0 : return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType);
50 : }
51 0 : NS_NOTREACHED("mtable wrapper without the real table frame");
52 : }
53 :
54 0 : return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
55 : }
56 :
57 : /* virtual */ eMathMLFrameType
58 0 : nsMathMLmrowFrame::GetMathMLFrameType()
59 : {
60 0 : if (!IsMrowLike()) {
61 0 : nsIMathMLFrame* child = do_QueryFrame(mFrames.FirstChild());
62 0 : if (child) {
63 : // We only have one child, so we return the frame type of that child as if
64 : // we didn't exist.
65 0 : return child->GetMathMLFrameType();
66 : }
67 : }
68 0 : return nsMathMLFrame::GetMathMLFrameType();
69 : }
|