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 NSRECTABSOLUTE_H
8 #define NSRECTABSOLUTE_H
10 #include "mozilla/gfx/RectAbsolute.h"
16 : public mozilla::gfx::BaseRectAbsolute
<nscoord
, nsRectAbsolute
, nsPoint
,
18 typedef mozilla::gfx::BaseRectAbsolute
<nscoord
, nsRectAbsolute
, nsPoint
,
23 nsRectAbsolute(nscoord aX1
, nscoord aY1
, nscoord aX2
, nscoord aY2
)
24 : Super(aX1
, aY1
, aX2
, aY2
) {}
26 MOZ_ALWAYS_INLINE nscoord
SafeWidth() const {
27 int64_t width
= right
;
30 std::min
<int64_t>(std::numeric_limits
<nscoord
>::max(), width
));
32 MOZ_ALWAYS_INLINE nscoord
SafeHeight() const {
33 int64_t height
= bottom
;
36 std::min
<int64_t>(std::numeric_limits
<nscoord
>::max(), height
));
39 nsRect
ToNSRect() const {
40 return nsRect(left
, top
, nscoord(SafeWidth()), nscoord(SafeHeight()));
43 [[nodiscard
]] nsRectAbsolute
UnsafeUnion(const nsRectAbsolute
& aRect
) const {
44 return Super::Union(aRect
);
47 void Inflate(const nsMargin
& aMargin
) {
50 right
+= aMargin
.right
;
51 bottom
+= aMargin
.bottom
;
55 #endif /* NSRECTABSOLUTE_H */