Bug 1869043 allow a device to be specified with MediaTrackGraph::NotifyWhenDeviceStar...
[gecko.git] / layout / generic / nsLeafFrame.cpp
blob2688da3d4bfc33fcc01e14a3ee32d25d71da3042
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;
18 /* virtual */
19 void nsLeafFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
20 const nsDisplayListSet& aLists) {
21 DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
22 DisplayBorderBackgroundOutline(aBuilder, aLists);
25 /* virtual */
26 nscoord nsLeafFrame::GetMinISize(gfxContext* aRenderingContext) {
27 nscoord result;
28 DISPLAY_MIN_INLINE_SIZE(this, result);
29 result = GetIntrinsicISize();
30 return result;
33 /* virtual */
34 nscoord nsLeafFrame::GetPrefISize(gfxContext* aRenderingContext) {
35 nscoord result;
36 DISPLAY_PREF_INLINE_SIZE(this, result);
37 result = GetIntrinsicISize();
38 return result;
41 /* virtual */
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");
54 return 0;
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);