Bug 1853801 [wpt PR 42001] - Fix extra rel=match in test reference., a=testonly
[gecko.git] / layout / forms / nsFieldSetFrame.h
blobc3b9f67e0aa034b4061a1e8769cfbdf5cf53d003
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;
18 public:
19 NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame)
20 NS_DECL_QUERYFRAME
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;
29 /**
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;
60 #ifdef DEBUG
61 void RemoveFrame(DestroyContext&, ChildListID aListID,
62 nsIFrame* aOldFrame) override;
63 #endif
65 bool IsFrameOfType(uint32_t aFlags) const override {
66 return nsContainerFrame::IsFrameOfType(
67 aFlags & ~nsIFrame::eCanContainOverflowContainers);
69 nsIScrollableFrame* GetScrollTargetFrame() const override;
71 // Return the block wrapper around our kids.
72 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
74 #ifdef ACCESSIBILITY
75 virtual mozilla::a11y::AccType AccessibleType() override;
76 #endif
78 #ifdef DEBUG_FRAME_DUMP
79 virtual nsresult GetFrameName(nsAString& aResult) const override {
80 return MakeFrameName(u"FieldSet"_ns, aResult);
82 #endif
84 /**
85 * Return the anonymous frame that contains all descendants except the legend
86 * frame. This can be a block/grid/flex/scroll frame. It always has
87 * the pseudo type nsCSSAnonBoxes::fieldsetContent. If it's a scroll frame,
88 * the scrolled frame can be a block/grid/flex frame.
89 * This may return null, for example for a fieldset that is a true overflow
90 * container.
92 nsContainerFrame* GetInner() const;
94 /**
95 * Return the frame that represents the rendered legend if any.
96 * https://html.spec.whatwg.org/multipage/rendering.html#rendered-legend
98 nsIFrame* GetLegend() const;
100 /** @see mLegendSpace below */
101 nscoord LegendSpace() const { return mLegendSpace; }
103 protected:
105 * Convenience method to create a continuation for aChild after we've
106 * reflowed it and got the reflow status aStatus.
108 void EnsureChildContinuation(nsIFrame* aChild, const nsReflowStatus& aStatus);
110 mozilla::LogicalRect mLegendRect;
112 // This is how much to subtract from our inner frame's content-box block-size
113 // to account for a protruding legend. It's zero if there's no legend or
114 // the legend fits entirely inside our start border.
115 nscoord mLegendSpace;
118 #endif // nsFieldSetFrame_h___