Coverage Report

Created: 2018-09-25 14:53

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