Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 #ifndef nsHTMLButtonControlFrame_h___
7 #define nsHTMLButtonControlFrame_h___
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIFormControlFrame.h"
12 #include "nsButtonFrameRenderer.h"
14 class nsRenderingContext;
15 class nsPresContext;
17 class nsHTMLButtonControlFrame : public nsContainerFrame,
18 public nsIFormControlFrame
19 {
20 public:
21 nsHTMLButtonControlFrame(nsStyleContext* aContext);
22 ~nsHTMLButtonControlFrame();
24 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
26 NS_DECL_QUERYFRAME
27 NS_DECL_FRAMEARENA_HELPERS
29 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
30 const nsRect& aDirtyRect,
31 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
33 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
35 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
37 virtual nsresult Reflow(nsPresContext* aPresContext,
38 nsHTMLReflowMetrics& aDesiredSize,
39 const nsHTMLReflowState& aReflowState,
40 nsReflowStatus& aStatus) MOZ_OVERRIDE;
42 virtual nsresult HandleEvent(nsPresContext* aPresContext,
43 mozilla::WidgetGUIEvent* aEvent,
44 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
46 virtual void Init(nsIContent* aContent,
47 nsIFrame* aParent,
48 nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
50 virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
51 virtual void SetAdditionalStyleContext(int32_t aIndex,
52 nsStyleContext* aStyleContext) MOZ_OVERRIDE;
54 virtual nsresult AppendFrames(ChildListID aListID,
55 nsFrameList& aFrameList) MOZ_OVERRIDE;
57 virtual nsresult InsertFrames(ChildListID aListID,
58 nsIFrame* aPrevFrame,
59 nsFrameList& aFrameList) MOZ_OVERRIDE;
61 virtual nsresult RemoveFrame(ChildListID aListID,
62 nsIFrame* aOldFrame) MOZ_OVERRIDE;
64 #ifdef ACCESSIBILITY
65 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
66 #endif
68 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
70 #ifdef DEBUG_FRAME_DUMP
71 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
72 return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
73 }
74 #endif
76 virtual bool HonorPrintBackgroundSettings() MOZ_OVERRIDE { return false; }
78 // nsIFormControlFrame
79 void SetFocus(bool aOn, bool aRepaint) MOZ_OVERRIDE;
80 virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
82 // Inserted child content gets its frames parented by our child block
83 virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
84 return GetFirstPrincipalChild()->GetContentInsertionFrame();
85 }
87 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
88 {
89 return nsContainerFrame::IsFrameOfType(aFlags &
90 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
91 }
93 protected:
94 virtual bool IsInput() { return false; }
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 nsHTMLReflowMetrics& aButtonDesiredSize,
99 const nsHTMLReflowState& aButtonReflowState,
100 nsIFrame* aFirstKid);
102 nsButtonFrameRenderer mRenderer;
103 };
105 #endif