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 #include "nsLeafFrame.h"
11 #include "mozilla/PresShell.h"
12 #include "nsPresContext.h"
14 using namespace mozilla
;
16 nsLeafFrame::~nsLeafFrame() = default;
19 void nsLeafFrame::BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
20 const nsDisplayListSet
& aLists
) {
21 DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
22 DisplayBorderBackgroundOutline(aBuilder
, aLists
);
26 nscoord
nsLeafFrame::GetMinISize(gfxContext
* aRenderingContext
) {
28 DISPLAY_MIN_INLINE_SIZE(this, result
);
29 result
= GetIntrinsicISize();
34 nscoord
nsLeafFrame::GetPrefISize(gfxContext
* aRenderingContext
) {
36 DISPLAY_PREF_INLINE_SIZE(this, result
);
37 result
= GetIntrinsicISize();
42 LogicalSize
nsLeafFrame::ComputeAutoSize(
43 gfxContext
* aRenderingContext
, WritingMode aWM
, const LogicalSize
& aCBSize
,
44 nscoord aAvailableISize
, const LogicalSize
& aMargin
,
45 const LogicalSize
& aBorderPadding
, const StyleSizeOverrides
& aSizeOverrides
,
46 ComputeSizeFlags aFlags
) {
47 const WritingMode wm
= GetWritingMode();
48 LogicalSize
result(wm
, GetIntrinsicISize(), GetIntrinsicBSize());
49 return result
.ConvertTo(aWM
, wm
);
52 nscoord
nsLeafFrame::GetIntrinsicBSize() {
53 MOZ_ASSERT_UNREACHABLE("Someone didn't override Reflow or ComputeAutoSize");
57 void nsLeafFrame::SizeToAvailSize(const ReflowInput
& aReflowInput
,
58 ReflowOutput
& aDesiredSize
) {
59 aDesiredSize
.SetSize(aReflowInput
.GetWritingMode(),
60 aReflowInput
.AvailableSize());
61 aDesiredSize
.SetOverflowAreasToDesiredBounds();
62 FinishAndStoreOverflow(&aDesiredSize
, aReflowInput
.mStyleDisplay
);