gfx/src/nsRect.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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