gfx/layers/basic/BasicContainerLayer.h

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.

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 #ifndef GFX_BASICCONTAINERLAYER_H
michael@0 7 #define GFX_BASICCONTAINERLAYER_H
michael@0 8
michael@0 9 #include "BasicImplData.h" // for BasicImplData
michael@0 10 #include "BasicLayers.h" // for BasicLayerManager
michael@0 11 #include "Layers.h" // for Layer, ContainerLayer
michael@0 12 #include "nsDebug.h" // for NS_ASSERTION
michael@0 13 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR
michael@0 14 #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
michael@0 15 struct nsIntRect;
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace layers {
michael@0 19
michael@0 20 class BasicContainerLayer : public ContainerLayer, public BasicImplData {
michael@0 21 public:
michael@0 22 BasicContainerLayer(BasicLayerManager* aManager) :
michael@0 23 ContainerLayer(aManager,
michael@0 24 static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST()))
michael@0 25 {
michael@0 26 MOZ_COUNT_CTOR(BasicContainerLayer);
michael@0 27 mSupportsComponentAlphaChildren = true;
michael@0 28 }
michael@0 29 virtual ~BasicContainerLayer();
michael@0 30
michael@0 31 virtual void SetVisibleRegion(const nsIntRegion& aRegion)
michael@0 32 {
michael@0 33 NS_ASSERTION(BasicManager()->InConstruction(),
michael@0 34 "Can only set properties in construction phase");
michael@0 35 ContainerLayer::SetVisibleRegion(aRegion);
michael@0 36 }
michael@0 37 virtual bool InsertAfter(Layer* aChild, Layer* aAfter)
michael@0 38 {
michael@0 39 if (!BasicManager()->InConstruction()) {
michael@0 40 NS_ERROR("Can only set properties in construction phase");
michael@0 41 return false;
michael@0 42 }
michael@0 43 return ContainerLayer::InsertAfter(aChild, aAfter);
michael@0 44 }
michael@0 45
michael@0 46 virtual bool RemoveChild(Layer* aChild)
michael@0 47 {
michael@0 48 if (!BasicManager()->InConstruction()) {
michael@0 49 NS_ERROR("Can only set properties in construction phase");
michael@0 50 return false;
michael@0 51 }
michael@0 52 return ContainerLayer::RemoveChild(aChild);
michael@0 53 }
michael@0 54
michael@0 55 virtual bool RepositionChild(Layer* aChild, Layer* aAfter)
michael@0 56 {
michael@0 57 if (!BasicManager()->InConstruction()) {
michael@0 58 NS_ERROR("Can only set properties in construction phase");
michael@0 59 return false;
michael@0 60 }
michael@0 61 return ContainerLayer::RepositionChild(aChild, aAfter);
michael@0 62 }
michael@0 63
michael@0 64 virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface);
michael@0 65
michael@0 66 /**
michael@0 67 * Returns true when:
michael@0 68 * a) no (non-hidden) childrens' visible areas overlap in
michael@0 69 * (aInRect intersected with this layer's visible region).
michael@0 70 * b) the (non-hidden) childrens' visible areas cover
michael@0 71 * (aInRect intersected with this layer's visible region).
michael@0 72 * c) this layer and all (non-hidden) children have transforms that are translations
michael@0 73 * by integers.
michael@0 74 * aInRect is in the root coordinate system.
michael@0 75 * Child layers with opacity do not contribute to the covered area in check b).
michael@0 76 * This method can be conservative; it's OK to return false under any
michael@0 77 * circumstances.
michael@0 78 */
michael@0 79 bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect);
michael@0 80
michael@0 81 void ForceIntermediateSurface() { mUseIntermediateSurface = true; }
michael@0 82
michael@0 83 void SetSupportsComponentAlphaChildren(bool aSupports) { mSupportsComponentAlphaChildren = aSupports; }
michael@0 84
michael@0 85 virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
michael@0 86 void* aCallbackData) MOZ_OVERRIDE;
michael@0 87
michael@0 88 protected:
michael@0 89 BasicLayerManager* BasicManager()
michael@0 90 {
michael@0 91 return static_cast<BasicLayerManager*>(mManager);
michael@0 92 }
michael@0 93 };
michael@0 94 }
michael@0 95 }
michael@0 96
michael@0 97 #endif

mercurial