gfx/layers/basic/BasicImplData.h

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef GFX_BASICIMPLDATA_H
     6 #define GFX_BASICIMPLDATA_H
     8 #include "Layers.h"                     // for Layer (ptr only), etc
     9 #include "gfxContext.h"                 // for gfxContext, etc
    10 #include "nsDebug.h"                    // for NS_ASSERTION
    11 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
    12 #include "mozilla/gfx/Types.h"
    14 namespace mozilla {
    15 namespace layers {
    17 class ReadbackProcessor;
    18 class SurfaceDescriptor;
    20 /**
    21  * This is the ImplData for all Basic layers. It also exposes methods
    22  * private to the Basic implementation that are common to all Basic layer types.
    23  * In particular, there is an internal Paint() method that we can use
    24  * to paint the contents of non-Thebes layers.
    25  *
    26  * The class hierarchy for Basic layers is like this:
    27  *                                 BasicImplData
    28  * Layer                            |   |   |
    29  *  |                               |   |   |
    30  *  +-> ContainerLayer              |   |   |
    31  *  |    |                          |   |   |
    32  *  |    +-> BasicContainerLayer <--+   |   |
    33  *  |                                   |   |
    34  *  +-> ThebesLayer                     |   |
    35  *  |    |                              |   |
    36  *  |    +-> BasicThebesLayer <---------+   |
    37  *  |                                       |
    38  *  +-> ImageLayer                          |
    39  *       |                                  |
    40  *       +-> BasicImageLayer <--------------+
    41  */
    42 class BasicImplData {
    43 public:
    44   BasicImplData() : mHidden(false),
    45     mClipToVisibleRegion(false),
    46     mDrawAtomically(false),
    47     mOperator(gfx::CompositionOp::OP_OVER)
    48   {
    49     MOZ_COUNT_CTOR(BasicImplData);
    50   }
    51   virtual ~BasicImplData()
    52   {
    53     MOZ_COUNT_DTOR(BasicImplData);
    54   }
    56   /**
    57    * Layers that paint themselves, such as ImageLayers, should paint
    58    * in response to this method call. aContext will already have been
    59    * set up to account for all the properties of the layer (transform,
    60    * opacity, etc).
    61    */
    62   virtual void Paint(gfx::DrawTarget* aDT,
    63                      const gfx::Point& aDeviceOffset,
    64                      Layer* aMaskLayer) {}
    66   /**
    67    * Like Paint() but called for ThebesLayers with the additional parameters
    68    * they need.
    69    * If mClipToVisibleRegion is set, then the layer must clip to its
    70    * effective visible region (snapped or unsnapped, it doesn't matter).
    71    */
    72   virtual void PaintThebes(gfxContext* aContext,
    73                            Layer* aMasklayer,
    74                            LayerManager::DrawThebesLayerCallback aCallback,
    75                            void* aCallbackData,
    76                            ReadbackProcessor* aReadback) {}
    78   virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
    79                         void* aCallbackData) {}
    81   /**
    82    * Layers will get this call when their layer manager is destroyed, this
    83    * indicates they should clear resources they don't really need after their
    84    * LayerManager ceases to exist.
    85    */
    86   virtual void ClearCachedResources() {}
    88   /**
    89    * This variable is set by MarkLayersHidden() before painting. It indicates
    90    * that the layer should not be composited during this transaction.
    91    */
    92   void SetHidden(bool aCovered) { mHidden = aCovered; }
    93   bool IsHidden() const { return false; }
    94   /**
    95    * This variable is set by MarkLayersHidden() before painting. This is
    96    * the operator to be used when compositing the layer in this transaction. It must
    97    * be OVER or SOURCE.
    98    */
    99   void SetOperator(gfx::CompositionOp aOperator)
   100   {
   101     NS_ASSERTION(aOperator == gfx::CompositionOp::OP_OVER ||
   102                  aOperator == gfx::CompositionOp::OP_SOURCE,
   103                  "Bad composition operator");
   104     mOperator = aOperator;
   105   }
   107   gfx::CompositionOp GetOperator() const { return mOperator; }
   108   gfxContext::GraphicsOperator DeprecatedGetOperator() const
   109   {
   110     return gfx::ThebesOp(mOperator);
   111   }
   113   /**
   114    * Return a surface for this layer. Will use an existing surface, if
   115    * possible, or may create a temporary surface.  Implement this
   116    * method for any layers that might be used as a mask.  Should only
   117    * return false if a surface cannot be created.  If true is
   118    * returned, only one of |aSurface| or |aDescriptor| is valid.
   119    */
   120   virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() { return nullptr; }
   122   bool GetClipToVisibleRegion() { return mClipToVisibleRegion; }
   123   void SetClipToVisibleRegion(bool aClip) { mClipToVisibleRegion = aClip; }
   125   void SetDrawAtomically(bool aDrawAtomically) { mDrawAtomically = aDrawAtomically; }
   127 protected:
   128   bool mHidden;
   129   bool mClipToVisibleRegion;
   130   bool mDrawAtomically;
   131   gfx::CompositionOp mOperator;
   132 };
   134 } // layers
   135 } // mozilla
   137 #endif

mercurial