Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/forms/nsHTMLButtonControlFrame.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 nsHTMLButtonControlFrame_h___
8
#define nsHTMLButtonControlFrame_h___
9
10
#include "mozilla/Attributes.h"
11
#include "nsContainerFrame.h"
12
#include "nsIFormControlFrame.h"
13
#include "nsButtonFrameRenderer.h"
14
15
class gfxContext;
16
class nsPresContext;
17
18
class nsHTMLButtonControlFrame : public nsContainerFrame,
19
                                 public nsIFormControlFrame
20
{
21
public:
22
  explicit nsHTMLButtonControlFrame(ComputedStyle* aStyle)
23
    : nsHTMLButtonControlFrame(aStyle, kClassID)
24
0
  {}
25
26
  ~nsHTMLButtonControlFrame();
27
28
  virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
29
30
  NS_DECL_QUERYFRAME
31
  NS_DECL_FRAMEARENA_HELPERS(nsHTMLButtonControlFrame)
32
33
  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
34
                                const nsDisplayListSet& aLists) override;
35
36
  virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
37
38
  virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
39
40
  virtual void Reflow(nsPresContext*           aPresContext,
41
                      ReflowOutput&     aDesiredSize,
42
                      const ReflowInput& aReflowInput,
43
                      nsReflowStatus&          aStatus) override;
44
45
  bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
46
                                nscoord* aBaseline) const override;
47
48
  bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
49
                                 BaselineSharingGroup aBaselineGroup,
50
                                 nscoord* aBaseline) const override;
51
52
  virtual nsresult HandleEvent(nsPresContext* aPresContext,
53
                               mozilla::WidgetGUIEvent* aEvent,
54
                               nsEventStatus* aEventStatus) override;
55
56
  virtual void Init(nsIContent*       aContent,
57
                    nsContainerFrame* aParent,
58
                    nsIFrame*         aPrevInFlow) override;
59
60
  ComputedStyle* GetAdditionalComputedStyle(int32_t aIndex) const override;
61
  void SetAdditionalComputedStyle(int32_t aIndex,
62
                                  ComputedStyle* aComputedStyle) override;
63
64
#ifdef DEBUG
65
  virtual void AppendFrames(ChildListID     aListID,
66
                            nsFrameList&    aFrameList) override;
67
  virtual void InsertFrames(ChildListID     aListID,
68
                            nsIFrame*       aPrevFrame,
69
                            nsFrameList&    aFrameList) override;
70
  virtual void RemoveFrame(ChildListID     aListID,
71
                           nsIFrame*       aOldFrame) override;
72
#endif
73
74
#ifdef ACCESSIBILITY
75
  virtual mozilla::a11y::AccType AccessibleType() override;
76
#endif
77
78
#ifdef DEBUG_FRAME_DUMP
79
  virtual nsresult GetFrameName(nsAString& aResult) const override {
80
    return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
81
  }
82
#endif
83
84
0
  virtual bool HonorPrintBackgroundSettings() override { return false; }
85
86
  // nsIFormControlFrame
87
  void SetFocus(bool aOn, bool aRepaint) override;
88
  virtual nsresult SetFormProperty(nsAtom* aName, const nsAString& aValue) override;
89
90
  // Inserted child content gets its frames parented by our child block
91
0
  virtual nsContainerFrame* GetContentInsertionFrame() override {
92
0
    return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
93
0
  }
94
95
  virtual bool IsFrameOfType(uint32_t aFlags) const override
96
0
  {
97
0
    return nsContainerFrame::IsFrameOfType(aFlags &
98
0
      ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
99
0
  }
100
101
  // Return the ::-moz-button-content anonymous box.
102
  void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
103
104
protected:
105
  nsHTMLButtonControlFrame(ComputedStyle* aStyle, nsIFrame::ClassID aID);
106
107
0
  virtual bool IsInput() { return false; }
108
109
  // Indicates whether we should clip our children's painting to our
110
  // border-box (either because of "overflow" or because of legacy reasons
111
  // about how <input>-flavored buttons work).
112
  bool ShouldClipPaintingToBorderBox();
113
114
  // Reflows the button's sole child frame, and computes the desired size
115
  // of the button itself from the results.
116
  void ReflowButtonContents(nsPresContext* aPresContext,
117
                            ReflowOutput& aButtonDesiredSize,
118
                            const ReflowInput& aButtonReflowInput,
119
                            nsIFrame* aFirstKid);
120
121
  nsButtonFrameRenderer mRenderer;
122
};
123
124
#endif
125
126
127
128