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/. */
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");
21 FILE* operator<<(FILE* out
, const nsRect
& rect
)
25 // Output the coordinates in fractional pixels so they're easier to read
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()));
39 fputs(NS_LossyConvertUTF16toASCII(tmp
).get(), out
);