no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / layout / forms / nsHTMLButtonControlFrame.h
blobb4409d66a7d883dfcc986dc5882c736f672e67a3
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/. */
7 #ifndef nsHTMLButtonControlFrame_h___
8 #define nsHTMLButtonControlFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "nsContainerFrame.h"
12 #include "nsIFormControlFrame.h"
13 #include "nsButtonFrameRenderer.h"
15 class gfxContext;
16 class nsPresContext;
18 class nsHTMLButtonControlFrame : public nsContainerFrame,
19 public nsIFormControlFrame {
20 public:
21 explicit nsHTMLButtonControlFrame(ComputedStyle* aStyle,
22 nsPresContext* aPresContext)
23 : nsHTMLButtonControlFrame(aStyle, aPresContext, kClassID) {}
25 ~nsHTMLButtonControlFrame();
27 NS_DECL_QUERYFRAME
28 NS_DECL_FRAMEARENA_HELPERS(nsHTMLButtonControlFrame)
30 void BuildDisplayList(nsDisplayListBuilder* aBuilder,
31 const nsDisplayListSet& aLists) override;
33 nscoord GetMinISize(gfxContext* aRenderingContext) override;
35 nscoord GetPrefISize(gfxContext* aRenderingContext) override;
37 void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
38 const ReflowInput& aReflowInput,
39 nsReflowStatus& aStatus) override;
41 Maybe<nscoord> GetNaturalBaselineBOffset(
42 mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
43 BaselineExportContext aExportContext) const override;
45 nsresult HandleEvent(nsPresContext* aPresContext,
46 mozilla::WidgetGUIEvent* aEvent,
47 nsEventStatus* aEventStatus) override;
49 void Init(nsIContent* aContent, nsContainerFrame* aParent,
50 nsIFrame* aPrevInFlow) override;
52 ComputedStyle* GetAdditionalComputedStyle(int32_t aIndex) const override;
53 void SetAdditionalComputedStyle(int32_t aIndex,
54 ComputedStyle* aComputedStyle) override;
56 #ifdef DEBUG
57 void AppendFrames(ChildListID aListID, nsFrameList&& aFrameList) override;
58 void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
59 const nsLineList::iterator* aPrevFrameLine,
60 nsFrameList&& aFrameList) override;
61 void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
62 #endif
64 #ifdef ACCESSIBILITY
65 mozilla::a11y::AccType AccessibleType() override;
66 #endif
68 #ifdef DEBUG_FRAME_DUMP
69 nsresult GetFrameName(nsAString& aResult) const override {
70 return MakeFrameName(u"HTMLButtonControl"_ns, aResult);
72 #endif
74 // nsIFormControlFrame
75 void SetFocus(bool aOn, bool aRepaint) override;
76 nsresult SetFormProperty(nsAtom* aName, const nsAString& aValue) override;
78 // Inserted child content gets its frames parented by our child block
79 nsContainerFrame* GetContentInsertionFrame() override {
80 return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
83 // Return the ::-moz-button-content anonymous box.
84 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
86 protected:
87 nsHTMLButtonControlFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
88 nsIFrame::ClassID aID);
90 // Indicates whether we should clip our children's painting to our
91 // border-box (either because of "overflow" or because of legacy reasons
92 // about how <input>-flavored buttons work).
93 bool ShouldClipPaintingToBorderBox();
95 // Reflows the button's sole child frame, and computes the desired size
96 // of the button itself from the results.
97 void ReflowButtonContents(nsPresContext* aPresContext,
98 ReflowOutput& aButtonDesiredSize,
99 const ReflowInput& aButtonReflowInput,
100 nsIFrame* aFirstKid);
102 BaselineSharingGroup GetDefaultBaselineSharingGroup() const override;
103 nscoord SynthesizeFallbackBaseline(
104 mozilla::WritingMode aWM,
105 BaselineSharingGroup aBaselineGroup) const override;
107 nsButtonFrameRenderer mRenderer;
110 #endif