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"
15 class ScrollContainerFrame
;
16 } // namespace mozilla
18 class nsFieldSetFrame final
: public nsContainerFrame
{
19 typedef mozilla::image::ImgDrawResult ImgDrawResult
;
22 NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame
)
25 explicit nsFieldSetFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
);
27 nscoord
IntrinsicISize(const mozilla::IntrinsicSizeInput
& aInput
,
28 mozilla::IntrinsicISizeType aType
) override
;
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.
34 nsRect
VisualBorderRectRelativeToSelf() const override
;
36 void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
37 const ReflowInput
& aReflowInput
,
38 nsReflowStatus
& aStatus
) override
;
40 nscoord
SynthesizeFallbackBaseline(
41 mozilla::WritingMode aWM
,
42 BaselineSharingGroup aBaselineGroup
) const override
;
43 BaselineSharingGroup
GetDefaultBaselineSharingGroup() const override
;
44 Maybe
<nscoord
> GetNaturalBaselineBOffset(
45 mozilla::WritingMode aWM
, BaselineSharingGroup aBaselineGroup
,
46 BaselineExportContext aExportContext
) const override
;
48 void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
49 const nsDisplayListSet
& aLists
) override
;
51 ImgDrawResult
PaintBorder(nsDisplayListBuilder
* aBuilder
,
52 gfxContext
& aRenderingContext
, nsPoint aPt
,
53 const nsRect
& aDirtyRect
);
55 void SetInitialChildList(ChildListID aListID
,
56 nsFrameList
&& aChildList
) override
;
57 void AppendFrames(ChildListID aListID
, nsFrameList
&& aFrameList
) override
;
58 void InsertFrames(ChildListID aListID
, nsIFrame
* aPrevFrame
,
59 const nsLineList::iterator
* aPrevFrameLine
,
60 nsFrameList
&& aFrameList
) override
;
62 void RemoveFrame(DestroyContext
&, ChildListID aListID
,
63 nsIFrame
* aOldFrame
) override
;
66 mozilla::ScrollContainerFrame
* GetScrollTargetFrame() const override
;
68 // Return the block wrapper around our kids.
69 void AppendDirectlyOwnedAnonBoxes(nsTArray
<OwnedAnonBox
>& aResult
) override
;
72 virtual mozilla::a11y::AccType
AccessibleType() override
;
75 #ifdef DEBUG_FRAME_DUMP
76 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
{
77 return MakeFrameName(u
"FieldSet"_ns
, aResult
);
82 * Return the anonymous frame that contains all descendants except the legend
83 * frame. This can be a block/grid/flex/scroll frame. It always has
84 * the pseudo type nsCSSAnonBoxes::fieldsetContent. If it's a scroll frame,
85 * the scrolled frame can be a block/grid/flex frame.
86 * This may return null, for example for a fieldset that is a true overflow
89 nsContainerFrame
* GetInner() const;
92 * Return the frame that represents the rendered legend if any.
93 * https://html.spec.whatwg.org/multipage/rendering.html#rendered-legend
95 nsIFrame
* GetLegend() const;
97 /** @see mLegendSpace below */
98 nscoord
LegendSpace() const { return mLegendSpace
; }
102 * Convenience method to create a continuation for aChild after we've
103 * reflowed it and got the reflow status aStatus.
105 void EnsureChildContinuation(nsIFrame
* aChild
, const nsReflowStatus
& aStatus
);
107 mozilla::LogicalRect mLegendRect
;
109 // This is how much to subtract from our inner frame's content-box block-size
110 // to account for a protruding legend. It's zero if there's no legend or
111 // the legend fits entirely inside our start border.
112 nscoord mLegendSpace
;
115 #endif // nsFieldSetFrame_h___