LCOV - code coverage report
Current view: directory - objdir/dist/include/mozilla/layout - RenderFrameParent.h (source / functions) Found Hit Coverage
Test: app.info Lines: 1 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  * vim: sw=2 ts=8 et :
       3                 :  */
       4                 : /* ***** BEGIN LICENSE BLOCK *****
       5                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       6                 :  *
       7                 :  * The contents of this file are subject to the Mozilla Public License Version
       8                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       9                 :  * the License. You may obtain a copy of the License at:
      10                 :  * http://www.mozilla.org/MPL/
      11                 :  *
      12                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      13                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      14                 :  * for the specific language governing rights and limitations under the
      15                 :  * License.
      16                 :  *
      17                 :  * The Original Code is Mozilla Code.
      18                 :  *
      19                 :  * The Initial Developer of the Original Code is
      20                 :  *   The Mozilla Foundation
      21                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      22                 :  * the Initial Developer. All Rights Reserved.
      23                 :  *
      24                 :  * Contributor(s):
      25                 :  *   Chris Jones <jones.chris.g@gmail.com>
      26                 :  *
      27                 :  * Alternatively, the contents of this file may be used under the terms of
      28                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      29                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      30                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      31                 :  * of those above. If you wish to allow use of your version of this file only
      32                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      33                 :  * use your version of this file under the terms of the MPL, indicate your
      34                 :  * decision by deleting the provisions above and replace them with the notice
      35                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      36                 :  * the provisions above, a recipient may use your version of this file under
      37                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      38                 :  *
      39                 :  * ***** END LICENSE BLOCK ***** */
      40                 : 
      41                 : #ifndef mozilla_layout_RenderFrameParent_h
      42                 : #define mozilla_layout_RenderFrameParent_h
      43                 : 
      44                 : #include "mozilla/layout/PRenderFrameParent.h"
      45                 : #include "mozilla/layers/ShadowLayersManager.h"
      46                 : 
      47                 : #include <map>
      48                 : #include "nsDisplayList.h"
      49                 : #include "Layers.h"
      50                 : 
      51                 : class nsContentView;
      52                 : class nsFrameLoader;
      53                 : class nsSubDocumentFrame;
      54                 : 
      55                 : namespace mozilla {
      56                 : 
      57                 : namespace layers {
      58                 : class ShadowLayersParent;
      59                 : }
      60                 : 
      61                 : namespace layout {
      62                 : 
      63                 : class RenderFrameParent : public PRenderFrameParent,
      64                 :                           public mozilla::layers::ShadowLayersManager
      65                 : {
      66                 :   typedef mozilla::layers::FrameMetrics FrameMetrics;
      67                 :   typedef mozilla::layers::ContainerLayer ContainerLayer;
      68                 :   typedef mozilla::layers::Layer Layer;
      69                 :   typedef mozilla::layers::LayerManager LayerManager;
      70                 :   typedef mozilla::layers::ShadowLayersParent ShadowLayersParent;
      71                 :   typedef FrameMetrics::ViewID ViewID;
      72                 : 
      73                 : public:
      74                 :   typedef std::map<ViewID, nsRefPtr<nsContentView> > ViewMap;
      75                 : 
      76                 :   RenderFrameParent(nsFrameLoader* aFrameLoader);
      77                 :   virtual ~RenderFrameParent();
      78                 : 
      79                 :   void Destroy();
      80                 : 
      81                 :   /**
      82                 :    * Helper function for getting a non-owning reference to a scrollable.
      83                 :    * @param aId The ID of the frame.
      84                 :    */
      85                 :   nsContentView* GetContentView(ViewID aId = FrameMetrics::ROOT_SCROLL_ID);
      86                 : 
      87                 :   void ContentViewScaleChanged(nsContentView* aView);
      88                 : 
      89                 :   virtual void ShadowLayersUpdated() MOZ_OVERRIDE;
      90                 : 
      91                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
      92                 :                               nsSubDocumentFrame* aFrame,
      93                 :                               const nsRect& aDirtyRect,
      94                 :                               const nsDisplayListSet& aLists);
      95                 : 
      96                 :   already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
      97                 :                                      nsIFrame* aFrame,
      98                 :                                      LayerManager* aManager,
      99                 :                                      const nsIntRect& aVisibleRect);
     100                 : 
     101                 :   void OwnerContentChanged(nsIContent* aContent);
     102                 : 
     103               0 :   void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
     104                 : 
     105                 : protected:
     106                 :   NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
     107                 : 
     108                 :   NS_OVERRIDE virtual PLayersParent* AllocPLayers(LayerManager::LayersBackend* aBackendType);
     109                 :   NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
     110                 : 
     111                 : private:
     112                 :   void BuildViewMap();
     113                 : 
     114                 :   LayerManager* GetLayerManager() const;
     115                 :   ShadowLayersParent* GetShadowLayers() const;
     116                 :   ContainerLayer* GetRootLayer() const;
     117                 : 
     118                 :   nsRefPtr<nsFrameLoader> mFrameLoader;
     119                 :   nsRefPtr<ContainerLayer> mContainer;
     120                 : 
     121                 :   // This contains the views for all the scrollable frames currently in the
     122                 :   // painted region of our remote content.
     123                 :   ViewMap mContentViews;
     124                 : 
     125                 :   // True after Destroy() has been called, which is triggered
     126                 :   // originally by nsFrameLoader::Destroy().  After this point, we can
     127                 :   // no longer safely ask the frame loader to find its nearest layer
     128                 :   // manager, because it may have been disconnected from the DOM.
     129                 :   // It's still OK to *tell* the frame loader that we've painted after
     130                 :   // it's destroyed; it'll just ignore us, and we won't be able to
     131                 :   // find an nsIFrame to invalidate.  See ShadowLayersUpdated().
     132                 :   //
     133                 :   // Prefer the extra bit of state to null'ing out mFrameLoader in
     134                 :   // Destroy() so that less code needs to be special-cased for after
     135                 :   // Destroy().
     136                 :   // 
     137                 :   // It's possible for mFrameLoader==null and
     138                 :   // mFrameLoaderDestroyed==false.
     139                 :   bool mFrameLoaderDestroyed;
     140                 :   // this is gfxRGBA because that's what ColorLayer wants.
     141                 :   gfxRGBA mBackgroundColor;
     142                 : };
     143                 : 
     144                 : } // namespace layout
     145                 : } // namespace mozilla
     146                 : 
     147                 : /**
     148                 :  * A DisplayRemote exists solely to graft a child process's shadow
     149                 :  * layer tree (for a given RenderFrameParent) into its parent
     150                 :  * process's layer tree.
     151                 :  */
     152                 : class nsDisplayRemote : public nsDisplayItem
     153                 : {
     154                 :   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
     155                 : 
     156                 : public:
     157                 :   nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
     158                 :                   RenderFrameParent* aRemoteFrame)
     159                 :     : nsDisplayItem(aBuilder, aFrame)
     160                 :     , mRemoteFrame(aRemoteFrame)
     161                 :   {}
     162                 : 
     163                 :   NS_OVERRIDE
     164                 :   virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
     165                 :                                    LayerManager* aManager)
     166                 :   { return mozilla::LAYER_ACTIVE; }  
     167                 : 
     168                 :   NS_OVERRIDE
     169                 :   virtual already_AddRefed<Layer>
     170                 :   BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
     171                 :              const ContainerParameters& aContainerParameters);
     172                 : 
     173                 :   NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
     174                 : 
     175                 : private:
     176                 :   RenderFrameParent* mRemoteFrame;
     177                 : };
     178                 : 
     179                 : /**
     180                 :  * nsDisplayRemoteShadow is a way of adding display items for frames in a
     181                 :  * separate process, for hit testing only. After being processed, the hit
     182                 :  * test state will contain IDs for any remote frames that were hit.
     183                 :  *
     184                 :  * The frame should be its respective render frame parent.
     185                 :  */
     186                 : class nsDisplayRemoteShadow : public nsDisplayItem
     187                 : {
     188                 :   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
     189                 :   typedef mozilla::layers::FrameMetrics::ViewID ViewID;
     190                 : 
     191                 : public:
     192                 :   nsDisplayRemoteShadow(nsDisplayListBuilder* aBuilder,
     193                 :                         nsIFrame* aFrame,
     194                 :                         nsRect aRect,
     195                 :                         ViewID aId)
     196                 :     : nsDisplayItem(aBuilder, aFrame)
     197                 :     , mRect(aRect)
     198                 :     , mId(aId)
     199                 :   {}
     200                 : 
     201                 :   NS_OVERRIDE nsRect GetBounds(nsDisplayListBuilder* aBuilder)
     202                 :   {
     203                 :     return mRect;
     204                 :   }
     205                 : 
     206                 :   virtual PRUint32 GetPerFrameKey()
     207                 :   {
     208                 :     NS_ABORT();
     209                 :     return 0;
     210                 :   }
     211                 : 
     212                 :   NS_OVERRIDE void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
     213                 :                            HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
     214                 : 
     215                 :   NS_DISPLAY_DECL_NAME("Remote-Shadow", TYPE_REMOTE_SHADOW)
     216                 : 
     217                 : private:
     218                 :   nsRect mRect;
     219                 :   ViewID mId;
     220                 : };
     221                 : 
     222                 : #endif  // mozilla_layout_RenderFrameParent_h

Generated by: LCOV version 1.7