Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / generic / nsLeafFrame.h
blobcc2780c4f0463e1b1635d325eddb645e415337c8
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 /* base class for rendering objects that do not have child lists */
9 #ifndef nsLeafFrame_h___
10 #define nsLeafFrame_h___
12 #include "mozilla/Attributes.h"
13 #include "nsIFrame.h"
14 #include "nsDisplayList.h"
16 /**
17 * Abstract class that provides simple fixed-size layout for leaf objects
18 * (e.g. images, form elements, etc.). Deriviations provide the implementation
19 * of the GetDesiredSize method. The rendering method knows how to render
20 * borders and backgrounds.
22 class nsLeafFrame : public nsIFrame {
23 public:
24 NS_DECL_ABSTRACT_FRAME(nsLeafFrame)
26 // nsIFrame replacements
27 void BuildDisplayList(nsDisplayListBuilder* aBuilder,
28 const nsDisplayListSet& aLists) override;
30 /**
31 * Both GetMinISize and GetPrefISize will return whatever GetIntrinsicISize
32 * returns.
34 virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
35 virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
37 /**
38 * Our auto size is just intrinsic width and intrinsic height.
40 mozilla::LogicalSize ComputeAutoSize(
41 gfxContext* aRenderingContext, mozilla::WritingMode aWM,
42 const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
43 const mozilla::LogicalSize& aMargin,
44 const mozilla::LogicalSize& aBorderPadding,
45 const mozilla::StyleSizeOverrides& aSizeOverrides,
46 mozilla::ComputeSizeFlags aFlags) override;
48 /**
49 * Each of our subclasses should provide its own Reflow impl:
51 virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
52 const ReflowInput& aReflowInput,
53 nsReflowStatus& aStatus) override = 0;
55 virtual bool IsFrameOfType(uint32_t aFlags) const override {
56 // We don't actually contain a block, but we do always want a
57 // computed width, so tell a little white lie here.
58 return nsIFrame::IsFrameOfType(aFlags &
59 ~(nsIFrame::eReplacedContainsBlock));
62 protected:
63 nsLeafFrame(ComputedStyle* aStyle, nsPresContext* aPresContext, ClassID aID)
64 : nsIFrame(aStyle, aPresContext, aID) {}
66 virtual ~nsLeafFrame();
68 /**
69 * Return the intrinsic isize of the frame's content area. Note that this
70 * should not include borders or padding and should not depend on the applied
71 * styles.
73 virtual nscoord GetIntrinsicISize() = 0;
75 /**
76 * Return the intrinsic bsize of the frame's content area. This should not
77 * include border or padding. This will only matter if the specified bsize
78 * is auto. Note that subclasses must either implement this or override
79 * Reflow and ComputeAutoSize; the default Reflow and ComputeAutoSize impls
80 * call this method.
82 virtual nscoord GetIntrinsicBSize();
84 /**
85 * Set aDesiredSize to be the available size
87 void SizeToAvailSize(const ReflowInput& aReflowInput,
88 ReflowOutput& aDesiredSize);
91 #endif /* nsLeafFrame_h___ */