gfx/layers/basic/BasicCanvasLayer.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 "BasicCanvasLayer.h"
     7 #include "basic/BasicLayers.h"          // for BasicLayerManager
     8 #include "basic/BasicLayersImpl.h"      // for GetEffectiveOperator
     9 #include "mozilla/mozalloc.h"           // for operator new
    10 #include "nsAutoPtr.h"                  // for nsRefPtr
    11 #include "nsCOMPtr.h"                   // for already_AddRefed
    12 #include "nsISupportsImpl.h"            // for Layer::AddRef, etc
    13 #include "gfx2DGlue.h"
    15 class gfxContext;
    17 using namespace mozilla::gfx;
    18 using namespace mozilla::gl;
    20 namespace mozilla {
    21 namespace layers {
    23 void
    24 BasicCanvasLayer::Paint(DrawTarget* aDT,
    25                         const Point& aDeviceOffset,
    26                         Layer* aMaskLayer)
    27 {
    28   if (IsHidden())
    29     return;
    31   FirePreTransactionCallback();
    32   UpdateTarget();
    33   FireDidTransactionCallback();
    35   if (!mSurface) {
    36     return;
    37   }
    39   Matrix m;
    40   if (mNeedsYFlip) {
    41     m = aDT->GetTransform();
    42     Matrix newTransform = m;
    43     newTransform.Translate(0.0f, mBounds.height);
    44     newTransform.Scale(1.0f, -1.0f);
    45     aDT->SetTransform(newTransform);
    46   }
    48   FillRectWithMask(aDT, aDeviceOffset,
    49                    Rect(0, 0, mBounds.width, mBounds.height),
    50                    mSurface, ToFilter(mFilter),
    51                    DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
    52                    aMaskLayer);
    54   if (mNeedsYFlip) {
    55     aDT->SetTransform(m);
    56   }
    57 }
    59 already_AddRefed<CanvasLayer>
    60 BasicLayerManager::CreateCanvasLayer()
    61 {
    62   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
    63   nsRefPtr<CanvasLayer> layer = new BasicCanvasLayer(this);
    64   return layer.forget();
    65 }
    67 }
    68 }

mercurial