Sat, 03 Jan 2015 20:18:00 +0100
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 "BasicLayersImpl.h" // for FillRectWithMask, etc |
michael@0 | 7 | #include "Layers.h" // for ColorLayer, etc |
michael@0 | 8 | #include "BasicImplData.h" // for BasicImplData |
michael@0 | 9 | #include "BasicLayers.h" // for BasicLayerManager |
michael@0 | 10 | #include "gfxContext.h" // for gfxContext, etc |
michael@0 | 11 | #include "gfxRect.h" // for gfxRect |
michael@0 | 12 | #include "gfx2DGlue.h" |
michael@0 | 13 | #include "mozilla/mozalloc.h" // for operator new |
michael@0 | 14 | #include "nsAutoPtr.h" // for nsRefPtr |
michael@0 | 15 | #include "nsCOMPtr.h" // for already_AddRefed |
michael@0 | 16 | #include "nsDebug.h" // for NS_ASSERTION |
michael@0 | 17 | #include "nsISupportsImpl.h" // for Layer::AddRef, etc |
michael@0 | 18 | #include "nsRect.h" // for nsIntRect |
michael@0 | 19 | #include "nsRegion.h" // for nsIntRegion |
michael@0 | 20 | #include "mozilla/gfx/PathHelpers.h" |
michael@0 | 21 | |
michael@0 | 22 | using namespace mozilla::gfx; |
michael@0 | 23 | |
michael@0 | 24 | namespace mozilla { |
michael@0 | 25 | namespace layers { |
michael@0 | 26 | |
michael@0 | 27 | class BasicColorLayer : public ColorLayer, public BasicImplData { |
michael@0 | 28 | public: |
michael@0 | 29 | BasicColorLayer(BasicLayerManager* aLayerManager) : |
michael@0 | 30 | ColorLayer(aLayerManager, |
michael@0 | 31 | static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST())) |
michael@0 | 32 | { |
michael@0 | 33 | MOZ_COUNT_CTOR(BasicColorLayer); |
michael@0 | 34 | } |
michael@0 | 35 | virtual ~BasicColorLayer() |
michael@0 | 36 | { |
michael@0 | 37 | MOZ_COUNT_DTOR(BasicColorLayer); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | virtual void SetVisibleRegion(const nsIntRegion& aRegion) |
michael@0 | 41 | { |
michael@0 | 42 | NS_ASSERTION(BasicManager()->InConstruction(), |
michael@0 | 43 | "Can only set properties in construction phase"); |
michael@0 | 44 | ColorLayer::SetVisibleRegion(aRegion); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | virtual void Paint(DrawTarget* aDT, |
michael@0 | 48 | const gfx::Point& aDeviceOffset, |
michael@0 | 49 | Layer* aMaskLayer) MOZ_OVERRIDE |
michael@0 | 50 | { |
michael@0 | 51 | if (IsHidden()) { |
michael@0 | 52 | return; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | Rect snapped(mBounds.x, mBounds.y, mBounds.width, mBounds.height); |
michael@0 | 56 | if (UserToDevicePixelSnapped(snapped, aDT->GetTransform())) { |
michael@0 | 57 | Matrix mat = aDT->GetTransform(); |
michael@0 | 58 | mat.Invert(); |
michael@0 | 59 | snapped = mat.TransformBounds(snapped); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | FillRectWithMask(aDT, aDeviceOffset, snapped, ToColor(mColor), |
michael@0 | 63 | DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)), |
michael@0 | 64 | aMaskLayer); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | protected: |
michael@0 | 68 | BasicLayerManager* BasicManager() |
michael@0 | 69 | { |
michael@0 | 70 | return static_cast<BasicLayerManager*>(mManager); |
michael@0 | 71 | } |
michael@0 | 72 | }; |
michael@0 | 73 | |
michael@0 | 74 | already_AddRefed<ColorLayer> |
michael@0 | 75 | BasicLayerManager::CreateColorLayer() |
michael@0 | 76 | { |
michael@0 | 77 | NS_ASSERTION(InConstruction(), "Only allowed in construction phase"); |
michael@0 | 78 | nsRefPtr<ColorLayer> layer = new BasicColorLayer(this); |
michael@0 | 79 | return layer.forget(); |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | } |
michael@0 | 83 | } |