LCOV - code coverage report
Current view: directory - layout/generic - nsLeafFrame.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.org 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                 : /* base class for rendering objects that do not have child lists */
      39                 : 
      40                 : #ifndef nsLeafFrame_h___
      41                 : #define nsLeafFrame_h___
      42                 : 
      43                 : #include "nsFrame.h"
      44                 : #include "nsDisplayList.h"
      45                 : 
      46                 : /**
      47                 :  * Abstract class that provides simple fixed-size layout for leaf objects
      48                 :  * (e.g. images, form elements, etc.). Deriviations provide the implementation
      49                 :  * of the GetDesiredSize method. The rendering method knows how to render
      50                 :  * borders and backgrounds.
      51                 :  */
      52                 : class nsLeafFrame : public nsFrame {
      53                 : public:
      54                 :   NS_DECL_FRAMEARENA_HELPERS
      55                 : 
      56                 :   // nsIFrame replacements
      57               0 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      58                 :                               const nsRect&           aDirtyRect,
      59                 :                               const nsDisplayListSet& aLists) {
      60               0 :     DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
      61               0 :     return DisplayBorderBackgroundOutline(aBuilder, aLists);
      62                 :   }
      63                 : 
      64                 :   /**
      65                 :    * Both GetMinWidth and GetPrefWidth will return whatever GetIntrinsicWidth
      66                 :    * returns.
      67                 :    */
      68                 :   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
      69                 :   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
      70                 : 
      71                 :   /**
      72                 :    * Our auto size is just intrinsic width and intrinsic height.
      73                 :    */
      74                 :   virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
      75                 :                                  nsSize aCBSize, nscoord aAvailableWidth,
      76                 :                                  nsSize aMargin, nsSize aBorder,
      77                 :                                  nsSize aPadding, bool aShrinkWrap);
      78                 : 
      79                 :   /**
      80                 :    * Reflow our frame.  This will use the computed width plus borderpadding for
      81                 :    * the desired width, and use the return value of GetIntrinsicHeight plus
      82                 :    * borderpadding for the desired height.  Ascent will be set to the height,
      83                 :    * and descent will be set to 0.
      84                 :    */
      85                 :   NS_IMETHOD Reflow(nsPresContext*      aPresContext,
      86                 :                     nsHTMLReflowMetrics& aDesiredSize,
      87                 :                     const nsHTMLReflowState& aReflowState,
      88                 :                     nsReflowStatus&      aStatus);
      89                 :   
      90                 :   /**
      91                 :    * This method does most of the work that Reflow() above need done.
      92                 :    */
      93                 :   NS_IMETHOD DoReflow(nsPresContext*      aPresContext,
      94                 :                       nsHTMLReflowMetrics& aDesiredSize,
      95                 :                       const nsHTMLReflowState& aReflowState,
      96                 :                       nsReflowStatus&      aStatus);
      97                 : 
      98               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
      99                 :   {
     100                 :     // We don't actually contain a block, but we do always want a
     101                 :     // computed width, so tell a little white lie here.
     102               0 :     return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplacedContainsBlock));
     103                 :   }
     104                 : 
     105                 : protected:
     106               0 :   nsLeafFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
     107                 :   virtual ~nsLeafFrame();
     108                 : 
     109                 :   /**
     110                 :    * Return the intrinsic width of the frame's content area. Note that this
     111                 :    * should not include borders or padding and should not depend on the applied
     112                 :    * styles.
     113                 :    */
     114                 :   virtual nscoord GetIntrinsicWidth() = 0;
     115                 : 
     116                 :   /**
     117                 :    * Return the intrinsic height of the frame's content area.  This should not
     118                 :    * include border or padding.  This will only matter if the specified height
     119                 :    * is auto.  Note that subclasses must either implement this or override
     120                 :    * Reflow and ComputeAutoSize; the default Reflow and ComputeAutoSize impls
     121                 :    * call this method.
     122                 :    */
     123                 :   virtual nscoord GetIntrinsicHeight();
     124                 : 
     125                 :   /**
     126                 :    * Subroutine to add in borders and padding
     127                 :    */
     128                 :   void AddBordersAndPadding(const nsHTMLReflowState& aReflowState,
     129                 :                             nsHTMLReflowMetrics& aDesiredSize);
     130                 : 
     131                 :   /**
     132                 :    * Set aDesiredSize to be the available size
     133                 :    */
     134                 :   void SizeToAvailSize(const nsHTMLReflowState& aReflowState,
     135                 :                        nsHTMLReflowMetrics& aDesiredSize);
     136                 : };
     137                 : 
     138                 : #endif /* nsLeafFrame_h___ */

Generated by: LCOV version 1.7