Bug 1760604 - fix bogus domain to be example.com which is part of our test PAC rules...
[gecko.git] / gfx / src / nsRect.cpp
blob74ffbf0fb2fffcce3f9a1e7fbfef8a47e82beea1
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 #include "nsRect.h"
8 #include "mozilla/gfx/Types.h" // for eSideBottom, etc
9 #include "mozilla/CheckedInt.h" // for CheckedInt
10 #include "nsDeviceContext.h" // for nsDeviceContext
11 #include "nsString.h" // for nsAutoString, etc
12 #include "nsMargin.h" // for nsMargin
14 static_assert(
15 (int(mozilla::eSideTop) == 0) && (int(mozilla::eSideRight) == 1) &&
16 (int(mozilla::eSideBottom) == 2) && (int(mozilla::eSideLeft) == 3),
17 "The mozilla::Side sequence must match the nsMargin nscoord sequence");
19 const mozilla::gfx::IntRect& GetMaxSizedIntRect() {
20 static const mozilla::gfx::IntRect r(0, 0, INT32_MAX, INT32_MAX);
21 return r;
24 bool nsRect::Overflows() const {
25 #ifdef NS_COORD_IS_FLOAT
26 return false;
27 #else
28 mozilla::CheckedInt<int32_t> xMost = this->x;
29 xMost += this->width;
30 mozilla::CheckedInt<int32_t> yMost = this->y;
31 yMost += this->height;
32 return !xMost.isValid() || !yMost.isValid();
33 #endif