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

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Communicator client code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : /* rendering object for list-item bullets */
      39                 : 
      40                 : #ifndef nsBulletFrame_h___
      41                 : #define nsBulletFrame_h___
      42                 : 
      43                 : #include "nsFrame.h"
      44                 : #include "nsStyleContext.h"
      45                 : 
      46                 : #include "imgIRequest.h"
      47                 : #include "imgIDecoderObserver.h"
      48                 : #include "nsStubImageDecoderObserver.h"
      49                 : 
      50                 : #define BULLET_FRAME_IMAGE_LOADING NS_FRAME_STATE_BIT(63)
      51                 : #define BULLET_FRAME_HAS_FONT_INFLATION NS_FRAME_STATE_BIT(62)
      52                 : 
      53                 : class nsBulletFrame;
      54                 : 
      55                 : class nsBulletListener : public nsStubImageDecoderObserver
      56                 : {
      57                 : public:
      58                 :   nsBulletListener();
      59                 :   virtual ~nsBulletListener();
      60                 : 
      61                 :   NS_DECL_ISUPPORTS
      62                 :   // imgIDecoderObserver (override nsStubImageDecoderObserver)
      63                 :   NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
      64                 :   NS_IMETHOD OnDataAvailable(imgIRequest *aRequest, bool aCurrentFrame,
      65                 :                              const nsIntRect *aRect);
      66                 :   NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
      67                 :                           const PRUnichar *statusArg);
      68                 :   NS_IMETHOD OnImageIsAnimated(imgIRequest *aRequest);
      69                 : 
      70                 :   // imgIContainerObserver (override nsStubImageDecoderObserver)
      71                 :   NS_IMETHOD FrameChanged(imgIRequest *aRequest,
      72                 :                           imgIContainer *aContainer,
      73                 :                           const nsIntRect *dirtyRect);
      74                 : 
      75               0 :   void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
      76                 : 
      77                 : private:
      78                 :   nsBulletFrame *mFrame;
      79                 : };
      80                 : 
      81                 : /**
      82                 :  * A simple class that manages the layout and rendering of html bullets.
      83                 :  * This class also supports the CSS list-style properties.
      84                 :  */
      85                 : class nsBulletFrame : public nsFrame {
      86                 : public:
      87                 :   NS_DECL_FRAMEARENA_HELPERS
      88                 : 
      89               0 :   nsBulletFrame(nsStyleContext* aContext)
      90               0 :     : nsFrame(aContext)
      91                 :   {
      92               0 :   }
      93                 :   virtual ~nsBulletFrame();
      94                 : 
      95                 :   // nsIFrame
      96                 :   virtual void DestroyFrom(nsIFrame* aDestructRoot);
      97                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      98                 :                               const nsRect&           aDirtyRect,
      99                 :                               const nsDisplayListSet& aLists);
     100                 :   virtual nsIAtom* GetType() const;
     101                 :   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
     102                 : #ifdef NS_DEBUG
     103                 :   NS_IMETHOD GetFrameName(nsAString& aResult) const;
     104                 : #endif
     105                 : 
     106                 :   // nsIHTMLReflow
     107                 :   NS_IMETHOD Reflow(nsPresContext* aPresContext,
     108                 :                     nsHTMLReflowMetrics& aMetrics,
     109                 :                     const nsHTMLReflowState& aReflowState,
     110                 :                     nsReflowStatus& aStatus);
     111                 :   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
     112                 :   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
     113                 : 
     114                 :   // nsBulletFrame
     115                 :   PRInt32 SetListItemOrdinal(PRInt32 aNextOrdinal, bool* aChanged);
     116                 : 
     117                 : 
     118                 :   NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
     119                 :   NS_IMETHOD OnDataAvailable(imgIRequest *aRequest,
     120                 :                              bool aCurrentFrame,
     121                 :                              const nsIntRect *aRect);
     122                 :   NS_IMETHOD OnStopDecode(imgIRequest *aRequest,
     123                 :                           nsresult aStatus,
     124                 :                           const PRUnichar *aStatusArg);
     125                 :   NS_IMETHOD OnImageIsAnimated(imgIRequest *aRequest);
     126                 :   NS_IMETHOD FrameChanged(imgIRequest *aRequest,
     127                 :                           imgIContainer *aContainer,
     128                 :                           const nsIntRect *aDirtyRect);
     129                 : 
     130                 :   /* get list item text, without '.' */
     131                 :   static bool AppendCounterText(PRInt32 aListStyleType,
     132                 :                                   PRInt32 aOrdinal,
     133                 :                                   nsString& aResult);
     134                 : 
     135                 :   /* get list item text, with '.' */
     136                 :   bool GetListItemText(const nsStyleList& aStyleList,
     137                 :                          nsString& aResult);
     138                 :                          
     139                 :   void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
     140                 :                    const nsRect& aDirtyRect);
     141                 :   
     142                 :   virtual bool IsEmpty();
     143                 :   virtual bool IsSelfEmpty();
     144                 :   virtual nscoord GetBaseline() const;
     145                 : 
     146                 :   float GetFontSizeInflation() const;
     147               0 :   bool HasFontSizeInflation() const {
     148               0 :     return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
     149                 :   }
     150                 :   void SetFontSizeInflation(float aInflation);
     151                 : 
     152                 : protected:
     153                 :   void GetDesiredSize(nsPresContext* aPresContext,
     154                 :                       nsRenderingContext *aRenderingContext,
     155                 :                       nsHTMLReflowMetrics& aMetrics,
     156                 :                       float aFontSizeInflation);
     157                 : 
     158                 :   void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
     159                 : 
     160                 :   nsMargin mPadding;
     161                 :   nsCOMPtr<imgIRequest> mImageRequest;
     162                 :   nsRefPtr<nsBulletListener> mListener;
     163                 : 
     164                 :   nsSize mIntrinsicSize;
     165                 :   nsSize mComputedSize;
     166                 :   PRInt32 mOrdinal;
     167                 :   bool mTextIsRTL;
     168                 : 
     169                 : private:
     170                 : 
     171                 :   // This is a boolean flag indicating whether or not the current image request
     172                 :   // has been registered with the refresh driver.
     173                 :   bool mRequestRegistered;
     174                 : };
     175                 : 
     176                 : #endif /* nsBulletFrame_h___ */

Generated by: LCOV version 1.7