Line data Source code
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 "DrawResult.h"
11 : #include "nsContainerFrame.h"
12 :
13 0 : class nsFieldSetFrame final : public nsContainerFrame
14 : {
15 : typedef mozilla::image::DrawResult DrawResult;
16 :
17 : public:
18 0 : NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame)
19 :
20 : explicit nsFieldSetFrame(nsStyleContext* aContext);
21 :
22 : nscoord
23 : GetIntrinsicISize(gfxContext* aRenderingContext,
24 : nsLayoutUtils::IntrinsicISizeType);
25 : virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
26 : virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
27 :
28 : /**
29 : * The area to paint box-shadows around. It's the border rect except
30 : * when there's a <legend> we offset the y-position to the center of it.
31 : */
32 : virtual nsRect VisualBorderRectRelativeToSelf() const override;
33 :
34 : virtual void Reflow(nsPresContext* aPresContext,
35 : ReflowOutput& aDesiredSize,
36 : const ReflowInput& aReflowInput,
37 : nsReflowStatus& aStatus) override;
38 :
39 : nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override;
40 : bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
41 : nscoord* aBaseline) const override;
42 : bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
43 : BaselineSharingGroup aBaselineGroup,
44 : nscoord* aBaseline) const override;
45 :
46 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
47 : const nsRect& aDirtyRect,
48 : const nsDisplayListSet& aLists) override;
49 :
50 : DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
51 : gfxContext& aRenderingContext,
52 : nsPoint aPt, const nsRect& aDirtyRect);
53 :
54 : #ifdef DEBUG
55 : virtual void SetInitialChildList(ChildListID aListID,
56 : nsFrameList& aChildList) override;
57 : virtual void AppendFrames(ChildListID aListID,
58 : nsFrameList& aFrameList) override;
59 : virtual void InsertFrames(ChildListID aListID,
60 : nsIFrame* aPrevFrame,
61 : nsFrameList& aFrameList) override;
62 : virtual void RemoveFrame(ChildListID aListID,
63 : nsIFrame* aOldFrame) override;
64 : #endif
65 :
66 0 : virtual bool IsFrameOfType(uint32_t aFlags) const override
67 : {
68 0 : return nsContainerFrame::IsFrameOfType(aFlags &
69 0 : ~nsIFrame::eCanContainOverflowContainers);
70 : }
71 0 : virtual nsIScrollableFrame* GetScrollTargetFrame() override
72 : {
73 0 : return do_QueryFrame(GetInner());
74 : }
75 :
76 : // Return the block wrapper around our kids.
77 : void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
78 :
79 : #ifdef ACCESSIBILITY
80 : virtual mozilla::a11y::AccType AccessibleType() override;
81 : #endif
82 :
83 : #ifdef DEBUG_FRAME_DUMP
84 0 : virtual nsresult GetFrameName(nsAString& aResult) const override {
85 0 : return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
86 : }
87 : #endif
88 :
89 : /**
90 : * Return the anonymous frame that contains all descendants except
91 : * the legend frame. This is currently always a block frame with
92 : * pseudo nsCSSAnonBoxes::fieldsetContent -- this may change in the
93 : * future when we add support for CSS overflow for <fieldset>. This really
94 : * can't return null, though callers seem to feel that it can.
95 : */
96 : nsIFrame* GetInner() const;
97 :
98 : /**
99 : * Return the frame that represents the legend if any. This may be
100 : * a nsLegendFrame or a nsHTMLScrollFrame with the nsLegendFrame as the
101 : * scrolled frame (aka content insertion frame).
102 : */
103 : nsIFrame* GetLegend() const;
104 :
105 : protected:
106 : mozilla::LogicalRect mLegendRect;
107 : nscoord mLegendSpace;
108 : };
109 :
110 : #endif // nsFieldSetFrame_h___
|