2 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "SimpleXULLeafFrame.h"
9 #include "mozilla/PresShell.h"
11 nsIFrame
* NS_NewSimpleXULLeafFrame(mozilla::PresShell
* aPresShell
,
12 mozilla::ComputedStyle
* aStyle
) {
13 return new (aPresShell
)
14 mozilla::SimpleXULLeafFrame(aStyle
, aPresShell
->GetPresContext());
19 NS_IMPL_FRAMEARENA_HELPERS(SimpleXULLeafFrame
)
21 void SimpleXULLeafFrame::Reflow(nsPresContext
* aPresContext
,
22 ReflowOutput
& aDesiredSize
,
23 const ReflowInput
& aReflowInput
,
24 nsReflowStatus
& aStatus
) {
26 MOZ_ASSERT(aStatus
.IsEmpty(), "Caller should pass a fresh reflow status!");
27 const auto wm
= GetWritingMode();
28 const auto& bp
= aReflowInput
.ComputedLogicalBorderPadding(wm
);
29 aDesiredSize
.ISize(wm
) = bp
.IStartEnd(wm
) + aReflowInput
.ComputedISize();
30 aDesiredSize
.BSize(wm
) =
31 bp
.BStartEnd(wm
) + (aReflowInput
.ComputedBSize() == NS_UNCONSTRAINEDSIZE
32 ? aReflowInput
.ComputedMinBSize()
33 : aReflowInput
.ComputedBSize());
34 aDesiredSize
.SetOverflowAreasToDesiredBounds();
37 } // namespace mozilla