|
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 NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
|
15 { |
|
16 return new (aPresShell) nsMathMLmrowFrame(aContext); |
|
17 } |
|
18 |
|
19 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame) |
|
20 |
|
21 nsMathMLmrowFrame::~nsMathMLmrowFrame() |
|
22 { |
|
23 } |
|
24 |
|
25 NS_IMETHODIMP |
|
26 nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent) |
|
27 { |
|
28 // let the base class get the default from our parent |
|
29 nsMathMLContainerFrame::InheritAutomaticData(aParent); |
|
30 |
|
31 mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; |
|
32 |
|
33 return NS_OK; |
|
34 } |
|
35 |
|
36 nsresult |
|
37 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 if (mContent->Tag() == nsGkAtoms::mtable_) { |
|
45 nsIFrame* frame = mFrames.FirstChild(); |
|
46 for ( ; frame; frame = frame->GetFirstPrincipalChild()) { |
|
47 // drill down to the real mtable |
|
48 if (frame->GetType() == nsGkAtoms::tableOuterFrame) |
|
49 return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType); |
|
50 } |
|
51 NS_NOTREACHED("mtable wrapper without the real table frame"); |
|
52 } |
|
53 |
|
54 return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); |
|
55 } |
|
56 |
|
57 /* virtual */ eMathMLFrameType |
|
58 nsMathMLmrowFrame::GetMathMLFrameType() |
|
59 { |
|
60 if (!IsMrowLike()) { |
|
61 nsIMathMLFrame* child = do_QueryFrame(mFrames.FirstChild()); |
|
62 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 return child->GetMathMLFrameType(); |
|
66 } |
|
67 } |
|
68 return nsMathMLFrame::GetMathMLFrameType(); |
|
69 } |