Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsMathMLmrowFrame.h" |
michael@0 | 7 | #include "mozilla/gfx/2D.h" |
michael@0 | 8 | |
michael@0 | 9 | // |
michael@0 | 10 | // <mrow> -- horizontally group any number of subexpressions - implementation |
michael@0 | 11 | // |
michael@0 | 12 | |
michael@0 | 13 | nsIFrame* |
michael@0 | 14 | NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
michael@0 | 15 | { |
michael@0 | 16 | return new (aPresShell) nsMathMLmrowFrame(aContext); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame) |
michael@0 | 20 | |
michael@0 | 21 | nsMathMLmrowFrame::~nsMathMLmrowFrame() |
michael@0 | 22 | { |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | NS_IMETHODIMP |
michael@0 | 26 | nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent) |
michael@0 | 27 | { |
michael@0 | 28 | // let the base class get the default from our parent |
michael@0 | 29 | nsMathMLContainerFrame::InheritAutomaticData(aParent); |
michael@0 | 30 | |
michael@0 | 31 | mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; |
michael@0 | 32 | |
michael@0 | 33 | return NS_OK; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | nsresult |
michael@0 | 37 | nsMathMLmrowFrame::AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 38 | nsIAtom* aAttribute, |
michael@0 | 39 | int32_t aModType) |
michael@0 | 40 | { |
michael@0 | 41 | // Special for <mtable>: In the frame construction code, we also use |
michael@0 | 42 | // this frame class as a wrapper for mtable. Hence, we should pass the |
michael@0 | 43 | // notification to the real mtable |
michael@0 | 44 | if (mContent->Tag() == nsGkAtoms::mtable_) { |
michael@0 | 45 | nsIFrame* frame = mFrames.FirstChild(); |
michael@0 | 46 | for ( ; frame; frame = frame->GetFirstPrincipalChild()) { |
michael@0 | 47 | // drill down to the real mtable |
michael@0 | 48 | if (frame->GetType() == nsGkAtoms::tableOuterFrame) |
michael@0 | 49 | return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType); |
michael@0 | 50 | } |
michael@0 | 51 | NS_NOTREACHED("mtable wrapper without the real table frame"); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | /* virtual */ eMathMLFrameType |
michael@0 | 58 | nsMathMLmrowFrame::GetMathMLFrameType() |
michael@0 | 59 | { |
michael@0 | 60 | if (!IsMrowLike()) { |
michael@0 | 61 | nsIMathMLFrame* child = do_QueryFrame(mFrames.FirstChild()); |
michael@0 | 62 | if (child) { |
michael@0 | 63 | // We only have one child, so we return the frame type of that child as if |
michael@0 | 64 | // we didn't exist. |
michael@0 | 65 | return child->GetMathMLFrameType(); |
michael@0 | 66 | } |
michael@0 | 67 | } |
michael@0 | 68 | return nsMathMLFrame::GetMathMLFrameType(); |
michael@0 | 69 | } |