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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "BasicCanvasLayer.h"
michael@0 7 #include "basic/BasicLayers.h" // for BasicLayerManager
michael@0 8 #include "basic/BasicLayersImpl.h" // for GetEffectiveOperator
michael@0 9 #include "mozilla/mozalloc.h" // for operator new
michael@0 10 #include "nsAutoPtr.h" // for nsRefPtr
michael@0 11 #include "nsCOMPtr.h" // for already_AddRefed
michael@0 12 #include "nsISupportsImpl.h" // for Layer::AddRef, etc
michael@0 13 #include "gfx2DGlue.h"
michael@0 14
michael@0 15 class gfxContext;
michael@0 16
michael@0 17 using namespace mozilla::gfx;
michael@0 18 using namespace mozilla::gl;
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace layers {
michael@0 22
michael@0 23 void
michael@0 24 BasicCanvasLayer::Paint(DrawTarget* aDT,
michael@0 25 const Point& aDeviceOffset,
michael@0 26 Layer* aMaskLayer)
michael@0 27 {
michael@0 28 if (IsHidden())
michael@0 29 return;
michael@0 30
michael@0 31 FirePreTransactionCallback();
michael@0 32 UpdateTarget();
michael@0 33 FireDidTransactionCallback();
michael@0 34
michael@0 35 if (!mSurface) {
michael@0 36 return;
michael@0 37 }
michael@0 38
michael@0 39 Matrix m;
michael@0 40 if (mNeedsYFlip) {
michael@0 41 m = aDT->GetTransform();
michael@0 42 Matrix newTransform = m;
michael@0 43 newTransform.Translate(0.0f, mBounds.height);
michael@0 44 newTransform.Scale(1.0f, -1.0f);
michael@0 45 aDT->SetTransform(newTransform);
michael@0 46 }
michael@0 47
michael@0 48 FillRectWithMask(aDT, aDeviceOffset,
michael@0 49 Rect(0, 0, mBounds.width, mBounds.height),
michael@0 50 mSurface, ToFilter(mFilter),
michael@0 51 DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
michael@0 52 aMaskLayer);
michael@0 53
michael@0 54 if (mNeedsYFlip) {
michael@0 55 aDT->SetTransform(m);
michael@0 56 }
michael@0 57 }
michael@0 58
michael@0 59 already_AddRefed<CanvasLayer>
michael@0 60 BasicLayerManager::CreateCanvasLayer()
michael@0 61 {
michael@0 62 NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
michael@0 63 nsRefPtr<CanvasLayer> layer = new BasicCanvasLayer(this);
michael@0 64 return layer.forget();
michael@0 65 }
michael@0 66
michael@0 67 }
michael@0 68 }

mercurial