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 nsFieldSetFrame_h___
8 #define nsFieldSetFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "ImgDrawResult.h"
12 #include "nsContainerFrame.h"
13 #include "nsIScrollableFrame.h"
15 class nsFieldSetFrame final
: public nsContainerFrame
{
16 typedef mozilla::image::ImgDrawResult ImgDrawResult
;
19 NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame
)
22 explicit nsFieldSetFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
);
24 nscoord
GetIntrinsicISize(gfxContext
* aRenderingContext
,
25 mozilla::IntrinsicISizeType
);
26 nscoord
GetMinISize(gfxContext
* aRenderingContext
) override
;
27 nscoord
GetPrefISize(gfxContext
* aRenderingContext
) override
;
30 * The area to paint box-shadows around. It's the border rect except
31 * when there's a <legend> we offset the y-position to the center of it.
33 nsRect
VisualBorderRectRelativeToSelf() const override
;
35 void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
36 const ReflowInput
& aReflowInput
,
37 nsReflowStatus
& aStatus
) override
;
39 nscoord
SynthesizeFallbackBaseline(
40 mozilla::WritingMode aWM
,
41 BaselineSharingGroup aBaselineGroup
) const override
;
42 BaselineSharingGroup
GetDefaultBaselineSharingGroup() const override
;
43 Maybe
<nscoord
> GetNaturalBaselineBOffset(
44 mozilla::WritingMode aWM
, BaselineSharingGroup aBaselineGroup
,
45 BaselineExportContext aExportContext
) const override
;
47 void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
48 const nsDisplayListSet
& aLists
) override
;
50 ImgDrawResult
PaintBorder(nsDisplayListBuilder
* aBuilder
,
51 gfxContext
& aRenderingContext
, nsPoint aPt
,
52 const nsRect
& aDirtyRect
);
54 void SetInitialChildList(ChildListID aListID
,
55 nsFrameList
&& aChildList
) override
;
56 void AppendFrames(ChildListID aListID
, nsFrameList
&& aFrameList
) override
;
57 void InsertFrames(ChildListID aListID
, nsIFrame
* aPrevFrame
,
58 const nsLineList::iterator
* aPrevFrameLine
,
59 nsFrameList
&& aFrameList
) override
;
61 void RemoveFrame(DestroyContext
&, ChildListID aListID
,
62 nsIFrame
* aOldFrame
) override
;
65 nsIScrollableFrame
* GetScrollTargetFrame() const override
;
67 // Return the block wrapper around our kids.
68 void AppendDirectlyOwnedAnonBoxes(nsTArray
<OwnedAnonBox
>& aResult
) override
;
71 virtual mozilla::a11y::AccType
AccessibleType() override
;
74 #ifdef DEBUG_FRAME_DUMP
75 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
{
76 return MakeFrameName(u
"FieldSet"_ns
, aResult
);
81 * Return the anonymous frame that contains all descendants except the legend
82 * frame. This can be a block/grid/flex/scroll frame. It always has
83 * the pseudo type nsCSSAnonBoxes::fieldsetContent. If it's a scroll frame,
84 * the scrolled frame can be a block/grid/flex frame.
85 * This may return null, for example for a fieldset that is a true overflow
88 nsContainerFrame
* GetInner() const;
91 * Return the frame that represents the rendered legend if any.
92 * https://html.spec.whatwg.org/multipage/rendering.html#rendered-legend
94 nsIFrame
* GetLegend() const;
96 /** @see mLegendSpace below */
97 nscoord
LegendSpace() const { return mLegendSpace
; }
101 * Convenience method to create a continuation for aChild after we've
102 * reflowed it and got the reflow status aStatus.
104 void EnsureChildContinuation(nsIFrame
* aChild
, const nsReflowStatus
& aStatus
);
106 mozilla::LogicalRect mLegendRect
;
108 // This is how much to subtract from our inner frame's content-box block-size
109 // to account for a protruding legend. It's zero if there's no legend or
110 // the legend fits entirely inside our start border.
111 nscoord mLegendSpace
;
114 #endif // nsFieldSetFrame_h___