Bumping manifests a=b2g-bump
[gecko.git] / gfx / src / nsRect.cpp
blob41a031503942f23f80ba26cc52a375591574a44e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsRect.h"
7 #include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
8 #include "nsDeviceContext.h" // for nsDeviceContext
9 #include "nsString.h" // for nsAutoString, etc
10 #include "nsMargin.h" // for nsMargin
12 static_assert((int(NS_SIDE_TOP) == 0) &&
13 (int(NS_SIDE_RIGHT) == 1) &&
14 (int(NS_SIDE_BOTTOM) == 2) &&
15 (int(NS_SIDE_LEFT) == 3),
16 "The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
18 #ifdef DEBUG
19 // Diagnostics
21 FILE* operator<<(FILE* out, const nsRect& rect)
23 nsAutoString tmp;
25 // Output the coordinates in fractional pixels so they're easier to read
26 tmp.Append('{');
27 tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.x,
28 nsDeviceContext::AppUnitsPerCSSPixel()));
29 tmp.AppendLiteral(", ");
30 tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.y,
31 nsDeviceContext::AppUnitsPerCSSPixel()));
32 tmp.AppendLiteral(", ");
33 tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.width,
34 nsDeviceContext::AppUnitsPerCSSPixel()));
35 tmp.AppendLiteral(", ");
36 tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.height,
37 nsDeviceContext::AppUnitsPerCSSPixel()));
38 tmp.Append('}');
39 fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
40 return out;
43 #endif // DEBUG