LCOV - code coverage report
Current view: directory - layout/base - nsImageLoader.h (source / functions) Found Hit Coverage
Test: app.info Lines: 2 0 0.0 %
Date: 2012-06-02 Functions: 2 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  *
       3                 :  * ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is mozilla.org code.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Netscape Communications Corporation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2001
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   Stuart Parmenter <pavlov@netscape.com>
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      28                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : /* class to notify frames of background and border image loads */
      41                 : 
      42                 : #include "nsStubImageDecoderObserver.h"
      43                 : 
      44                 : class nsIFrame;
      45                 : class nsIURI;
      46                 : 
      47                 : #include "imgIRequest.h"
      48                 : #include "nsCOMPtr.h"
      49                 : #include "nsAutoPtr.h"
      50                 : 
      51                 : /**
      52                 :  * Image loaders pass notifications for background and border image
      53                 :  * loading and animation on to the frames.
      54                 :  *
      55                 :  * Each frame's image loaders form a linked list.
      56                 :  */
      57                 : class nsImageLoader : public nsStubImageDecoderObserver
      58                 : {
      59                 : private:
      60                 :   nsImageLoader(nsIFrame *aFrame, PRUint32 aActions,
      61                 :                 nsImageLoader *aNextLoader);
      62                 :   virtual ~nsImageLoader();
      63                 : 
      64                 : public:
      65                 :   /*
      66                 :    * Flags to specify actions that can be taken for the image at various
      67                 :    * times. Reflows always occur before redraws. "Decode" refers to one
      68                 :    * frame being available, whereas "load" refers to all the data being loaded
      69                 :    * from the network.
      70                 :    */
      71                 :   enum {
      72                 :     ACTION_REFLOW_ON_DECODE = 0x01,
      73                 :     ACTION_REDRAW_ON_DECODE = 0x02,
      74                 :     ACTION_REFLOW_ON_LOAD   = 0x04,
      75                 :     ACTION_REDRAW_ON_LOAD   = 0x08
      76                 :   };
      77                 :   static already_AddRefed<nsImageLoader>
      78                 :     Create(nsIFrame *aFrame, imgIRequest *aRequest,
      79                 :            PRUint32 aActions, nsImageLoader *aNextLoader);
      80                 : 
      81                 :   NS_DECL_ISUPPORTS
      82                 : 
      83                 :   // imgIDecoderObserver (override nsStubImageDecoderObserver)
      84                 :   NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
      85                 :   NS_IMETHOD OnStopFrame(imgIRequest *aRequest, PRUint32 aFrame);
      86                 :   NS_IMETHOD OnStopRequest(imgIRequest *aRequest, bool aLastPart);
      87                 :   NS_IMETHOD OnImageIsAnimated(imgIRequest *aRequest);
      88                 :   // Do not override OnDataAvailable since background images are not
      89                 :   // displayed incrementally; they are displayed after the entire image
      90                 :   // has been loaded.
      91                 :   // Note: Images referenced by the <img> element are displayed
      92                 :   // incrementally in nsImageFrame.cpp.
      93                 : 
      94                 :   // imgIContainerObserver (override nsStubImageDecoderObserver)
      95                 :   NS_IMETHOD FrameChanged(imgIRequest *aRequest,
      96                 :                           imgIContainer *aContainer,
      97                 :                           const nsIntRect *aDirtyRect);
      98                 : 
      99                 :   void Destroy();
     100                 : 
     101               0 :   imgIRequest *GetRequest() { return mRequest; }
     102               0 :   nsImageLoader *GetNextLoader() { return mNextLoader; }
     103                 : 
     104                 : private:
     105                 :   nsresult Load(imgIRequest *aImage);
     106                 :   void DoReflow();
     107                 :   /* if aDamageRect is nsnull, the whole frame is redrawn. */
     108                 :   void DoRedraw(const nsRect* aDamageRect);
     109                 : 
     110                 :   nsIFrame *mFrame;
     111                 :   nsCOMPtr<imgIRequest> mRequest;
     112                 :   PRUint32 mActions;
     113                 :   nsRefPtr<nsImageLoader> mNextLoader;
     114                 : 
     115                 :   // This is a boolean flag indicating whether or not the current image request
     116                 :   // has been registered with the refresh driver.
     117                 :   bool mRequestRegistered;
     118                 : };

Generated by: LCOV version 1.7