layout/mathml/nsMathMLmrowFrame.cpp

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing 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/. */
     6 #include "nsMathMLmrowFrame.h"
     7 #include "mozilla/gfx/2D.h"
     9 //
    10 // <mrow> -- horizontally group any number of subexpressions - implementation
    11 //
    13 nsIFrame*
    14 NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
    15 {
    16   return new (aPresShell) nsMathMLmrowFrame(aContext);
    17 }
    19 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmrowFrame)
    21 nsMathMLmrowFrame::~nsMathMLmrowFrame()
    22 {
    23 }
    25 NS_IMETHODIMP
    26 nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
    27 {
    28   // let the base class get the default from our parent
    29   nsMathMLContainerFrame::InheritAutomaticData(aParent);
    31   mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
    33   return NS_OK;
    34 }
    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   }
    54   return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
    55 }
    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 }

mercurial