|
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/. */ |
|
5 |
|
6 #ifndef nsFieldSetFrame_h___ |
|
7 #define nsFieldSetFrame_h___ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsContainerFrame.h" |
|
11 |
|
12 class nsFieldSetFrame MOZ_FINAL : public nsContainerFrame |
|
13 { |
|
14 public: |
|
15 NS_DECL_FRAMEARENA_HELPERS |
|
16 |
|
17 nsFieldSetFrame(nsStyleContext* aContext); |
|
18 |
|
19 NS_HIDDEN_(nscoord) |
|
20 GetIntrinsicWidth(nsRenderingContext* aRenderingContext, |
|
21 nsLayoutUtils::IntrinsicWidthType); |
|
22 virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE; |
|
23 virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE; |
|
24 virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, |
|
25 nsSize aCBSize, nscoord aAvailableWidth, |
|
26 nsSize aMargin, nsSize aBorder, nsSize aPadding, |
|
27 uint32_t aFlags) MOZ_OVERRIDE; |
|
28 virtual nscoord GetBaseline() const MOZ_OVERRIDE; |
|
29 |
|
30 /** |
|
31 * The area to paint box-shadows around. It's the border rect except |
|
32 * when there's a <legend> we offset the y-position to the center of it. |
|
33 */ |
|
34 virtual nsRect VisualBorderRectRelativeToSelf() const MOZ_OVERRIDE; |
|
35 |
|
36 virtual nsresult Reflow(nsPresContext* aPresContext, |
|
37 nsHTMLReflowMetrics& aDesiredSize, |
|
38 const nsHTMLReflowState& aReflowState, |
|
39 nsReflowStatus& aStatus) MOZ_OVERRIDE; |
|
40 |
|
41 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
|
42 const nsRect& aDirtyRect, |
|
43 const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
|
44 |
|
45 void PaintBorderBackground(nsRenderingContext& aRenderingContext, |
|
46 nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags); |
|
47 |
|
48 virtual nsresult AppendFrames(ChildListID aListID, |
|
49 nsFrameList& aFrameList) MOZ_OVERRIDE; |
|
50 virtual nsresult InsertFrames(ChildListID aListID, |
|
51 nsIFrame* aPrevFrame, |
|
52 nsFrameList& aFrameList) MOZ_OVERRIDE; |
|
53 virtual nsresult RemoveFrame(ChildListID aListID, |
|
54 nsIFrame* aOldFrame) MOZ_OVERRIDE; |
|
55 |
|
56 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
57 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
|
58 { |
|
59 return nsContainerFrame::IsFrameOfType(aFlags & |
|
60 ~nsIFrame::eCanContainOverflowContainers); |
|
61 } |
|
62 virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE |
|
63 { |
|
64 return do_QueryFrame(GetInner()); |
|
65 } |
|
66 |
|
67 #ifdef ACCESSIBILITY |
|
68 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE; |
|
69 #endif |
|
70 |
|
71 #ifdef DEBUG |
|
72 virtual nsresult SetInitialChildList(ChildListID aListID, |
|
73 nsFrameList& aChildList) MOZ_OVERRIDE; |
|
74 #endif |
|
75 |
|
76 #ifdef DEBUG_FRAME_DUMP |
|
77 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { |
|
78 return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult); |
|
79 } |
|
80 #endif |
|
81 |
|
82 /** |
|
83 * Return the anonymous frame that contains all descendants except |
|
84 * the legend frame. This is currently always a block frame with |
|
85 * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the |
|
86 * future when we add support for CSS overflow for <fieldset>. |
|
87 */ |
|
88 nsIFrame* GetInner() const; |
|
89 |
|
90 /** |
|
91 * Return the frame that represents the legend if any. This may be |
|
92 * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the |
|
93 * scrolled frame (aka content insertion frame). |
|
94 */ |
|
95 nsIFrame* GetLegend() const; |
|
96 |
|
97 protected: |
|
98 nsRect mLegendRect; |
|
99 nscoord mLegendSpace; |
|
100 }; |
|
101 |
|
102 #endif // nsFieldSetFrame_h___ |