Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/mathml/nsMathMLmpaddedFrame.h
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
#ifndef nsMathMLmpaddedFrame_h___
8
#define nsMathMLmpaddedFrame_h___
9
10
#include "mozilla/Attributes.h"
11
#include "nsMathMLContainerFrame.h"
12
13
//
14
// <mpadded> -- adjust space around content
15
//
16
17
class nsMathMLmpaddedFrame final : public nsMathMLContainerFrame
18
{
19
public:
20
  NS_DECL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
21
22
  friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
23
24
  NS_IMETHOD
25
  InheritAutomaticData(nsIFrame* aParent) override;
26
27
  NS_IMETHOD
28
0
  TransmitAutomaticData() override {
29
0
    return TransmitAutomaticDataForMrowLikeElement();
30
0
  }
31
32
  virtual void
33
  Reflow(nsPresContext*          aPresContext,
34
         ReflowOutput&     aDesiredSize,
35
         const ReflowInput& aReflowInput,
36
         nsReflowStatus&          aStatus) override;
37
38
  virtual nsresult
39
  Place(DrawTarget*          aDrawTarget,
40
        bool                 aPlaceOrigin,
41
        ReflowOutput& aDesiredSize) override;
42
43
  bool
44
0
  IsMrowLike() override {
45
0
    return mFrames.FirstChild() != mFrames.LastChild() ||
46
0
           !mFrames.FirstChild();
47
0
  }
48
49
protected:
50
  explicit nsMathMLmpaddedFrame(ComputedStyle* aStyle)
51
    : nsMathMLContainerFrame(aStyle, kClassID)
52
    , mWidthSign(0)
53
    , mHeightSign(0)
54
    , mDepthSign(0)
55
    , mLeadingSpaceSign(0)
56
    , mVerticalOffsetSign(0)
57
    , mWidthPseudoUnit(0)
58
    , mHeightPseudoUnit(0)
59
    , mDepthPseudoUnit(0)
60
    , mLeadingSpacePseudoUnit(0)
61
    , mVerticalOffsetPseudoUnit(0)
62
0
  {}
63
64
  virtual ~nsMathMLmpaddedFrame();
65
66
  virtual nsresult
67
  MeasureForWidth(DrawTarget* aDrawTarget,
68
                  ReflowOutput& aDesiredSize) override;
69
70
private:
71
  nsCSSValue mWidth;
72
  nsCSSValue mHeight;
73
  nsCSSValue mDepth;
74
  nsCSSValue mLeadingSpace;
75
  nsCSSValue mVerticalOffset;
76
77
  int32_t    mWidthSign;
78
  int32_t    mHeightSign;
79
  int32_t    mDepthSign;
80
  int32_t    mLeadingSpaceSign;
81
  int32_t    mVerticalOffsetSign;
82
83
  int32_t    mWidthPseudoUnit;
84
  int32_t    mHeightPseudoUnit;
85
  int32_t    mDepthPseudoUnit;
86
  int32_t    mLeadingSpacePseudoUnit;
87
  int32_t    mVerticalOffsetPseudoUnit;
88
89
  // helpers to process the attributes
90
  void
91
  ProcessAttributes();
92
93
  static bool
94
  ParseAttribute(nsString&   aString,
95
                 int32_t&    aSign,
96
                 nsCSSValue& aCSSValue,
97
                 int32_t&    aPseudoUnit);
98
99
  void
100
  UpdateValue(int32_t                  aSign,
101
              int32_t                  aPseudoUnit,
102
              const nsCSSValue&        aCSSValue,
103
              const ReflowOutput& aDesiredSize,
104
              nscoord&                 aValueToUpdate,
105
              float                    aFontSizeInflation) const;
106
};
107
108
#endif /* nsMathMLmpaddedFrame_h___ */