gfx/src/nsRect.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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)
    22 {
    23   nsAutoString tmp;
    25   // Output the coordinates in fractional pixels so they're easier to read
    26   tmp.AppendLiteral("{");
    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.AppendLiteral("}");
    39   fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
    40   return out;
    41 }
    43 #endif // DEBUG

mercurial