1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/mathml/nsMathMLmrowFrame.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsMathMLmrowFrame.h" 1.10 +#include "mozilla/gfx/2D.h" 1.11 + 1.12 +// 1.13 +// <mrow> -- horizontally group any number of subexpressions - implementation 1.14 +// 1.15 + 1.16 +nsIFrame* 1.17 +NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) 1.18 +{ 1.19 + return new (aPresShell) nsMathMLmrowFrame(aContext); 1.20 +} 1.21 + 1.22 +NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame) 1.23 + 1.24 +nsMathMLmrowFrame::~nsMathMLmrowFrame() 1.25 +{ 1.26 +} 1.27 + 1.28 +NS_IMETHODIMP 1.29 +nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent) 1.30 +{ 1.31 + // let the base class get the default from our parent 1.32 + nsMathMLContainerFrame::InheritAutomaticData(aParent); 1.33 + 1.34 + mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; 1.35 + 1.36 + return NS_OK; 1.37 +} 1.38 + 1.39 +nsresult 1.40 +nsMathMLmrowFrame::AttributeChanged(int32_t aNameSpaceID, 1.41 + nsIAtom* aAttribute, 1.42 + int32_t aModType) 1.43 +{ 1.44 + // Special for <mtable>: In the frame construction code, we also use 1.45 + // this frame class as a wrapper for mtable. Hence, we should pass the 1.46 + // notification to the real mtable 1.47 + if (mContent->Tag() == nsGkAtoms::mtable_) { 1.48 + nsIFrame* frame = mFrames.FirstChild(); 1.49 + for ( ; frame; frame = frame->GetFirstPrincipalChild()) { 1.50 + // drill down to the real mtable 1.51 + if (frame->GetType() == nsGkAtoms::tableOuterFrame) 1.52 + return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType); 1.53 + } 1.54 + NS_NOTREACHED("mtable wrapper without the real table frame"); 1.55 + } 1.56 + 1.57 + return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); 1.58 +} 1.59 + 1.60 +/* virtual */ eMathMLFrameType 1.61 +nsMathMLmrowFrame::GetMathMLFrameType() 1.62 +{ 1.63 + if (!IsMrowLike()) { 1.64 + nsIMathMLFrame* child = do_QueryFrame(mFrames.FirstChild()); 1.65 + if (child) { 1.66 + // We only have one child, so we return the frame type of that child as if 1.67 + // we didn't exist. 1.68 + return child->GetMathMLFrameType(); 1.69 + } 1.70 + } 1.71 + return nsMathMLFrame::GetMathMLFrameType(); 1.72 +}