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.

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

mercurial