LCOV - app.info - layout/tables/nsTableOuterFrame.h

LCOV - code coverage report
| Current view: | directory - layout/tables - nsTableOuterFrame.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 9 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 4 | 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                 : #ifndef nsTableOuterFrame_h__
          38                 : #define nsTableOuterFrame_h__
          39                 :
          40                 : #include "nscore.h"
          41                 : #include "nsContainerFrame.h"
          42                 : #include "nsBlockFrame.h"
          43                 : #include "nsITableLayout.h"
          44                 : #include "nsTableFrame.h"
          45                 :
          46                 : class nsTableCaptionFrame : public nsBlockFrame
          47                 : {
          48                 : public:
          49                 :   NS_DECL_FRAMEARENA_HELPERS
          50                 :
          51                 :   // nsISupports
          52                 :   virtual nsIAtom* GetType() const;
          53                 :   friend nsIFrame* NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext*  aContext);
          54                 :
          55                 :   virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
          56                 :                                  nsSize aCBSize, nscoord aAvailableWidth,
          57                 :                                  nsSize aMargin, nsSize aBorder,
          58                 :                                  nsSize aPadding, bool aShrinkWrap);
          59                 :
          60                 :   virtual nsIFrame* GetParentStyleContextFrame() const;
          61                 :
          62                 : #ifdef ACCESSIBILITY
          63                 :   virtual already_AddRefed<nsAccessible> CreateAccessible();
          64                 : #endif
          65                 :
          66                 : #ifdef NS_DEBUG
          67                 :   NS_IMETHOD GetFrameName(nsAString& aResult) const;
          68                 : #endif
          69                 :
          70                 : protected:
          71                 :   nsTableCaptionFrame(nsStyleContext*  aContext);
          72                 :   virtual ~nsTableCaptionFrame();
          73                 : };
          74                 :
          75                 :
          76                 : /* TODO
          77                 : 1. decide if we'll allow subclassing.  If so, decide which methods really need to be virtual.
          78                 : */
          79                 :
          80                 : /**
          81                 :  * main frame for an nsTable content object,
          82                 :  * the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
          83                 :  * pseudo-frame (referred to as the "inner frame').
          84                 :  */
          85                 : class nsTableOuterFrame : public nsContainerFrame, public nsITableLayout
          86                 : {
          87                 : public:
          88                 :   NS_DECL_QUERYFRAME
          89                 :   NS_DECL_FRAMEARENA_HELPERS
          90                 :
          91                 :   /** instantiate a new instance of nsTableRowFrame.
          92                 :     * @param aPresShell the pres shell for this frame
          93                 :     *
          94                 :     * @return           the frame that was created
          95                 :     */
          96                 :   friend nsIFrame* NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
          97                 :
          98                 :   // nsIFrame overrides - see there for a description
          99                 :
         100                 :   virtual void DestroyFrom(nsIFrame* aDestructRoot);
         101                 :
         102                 :   NS_IMETHOD SetInitialChildList(ChildListID     aListID,
         103                 :                                  nsFrameList&    aChildList);
         104                 :
         105                 :   virtual const nsFrameList& GetChildList(ChildListID aListID) const;
         106                 :   virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
         107                 :
         108                 :   NS_IMETHOD AppendFrames(ChildListID     aListID,
         109                 :                           nsFrameList&    aFrameList);
         110                 :
         111                 :   NS_IMETHOD InsertFrames(ChildListID     aListID,
         112                 :                           nsIFrame*       aPrevFrame,
         113                 :                           nsFrameList&    aFrameList);
         114                 :
         115                 :   NS_IMETHOD RemoveFrame(ChildListID     aListID,
         116                 :                          nsIFrame*       aOldFrame);
         117                 :
         118               0 :   virtual nsIFrame* GetContentInsertionFrame() {
         119               0 :     return GetFirstPrincipalChild()->GetContentInsertionFrame();
         120                 :   }
         121                 :
         122                 : #ifdef ACCESSIBILITY
         123                 :   virtual already_AddRefed<nsAccessible> CreateAccessible();
         124                 : #endif
         125                 :
         126                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
         127                 :                               const nsRect&           aDirtyRect,
         128                 :                               const nsDisplayListSet& aLists);
         129                 :
         130                 :   nsresult BuildDisplayListForInnerTable(nsDisplayListBuilder*   aBuilder,
         131                 :                                          const nsRect&           aDirtyRect,
         132                 :                                          const nsDisplayListSet& aLists);
         133                 :
         134                 :   virtual nscoord GetBaseline() const;
         135                 :
         136                 :   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
         137                 :   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
         138                 :   virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
         139                 :                                  nsSize aCBSize, nscoord aAvailableWidth,
         140                 :                                  nsSize aMargin, nsSize aBorder,
         141                 :                                  nsSize aPadding, bool aShrinkWrap);
         142                 :
         143                 :   /** process a reflow command for the table.
         144                 :     * This involves reflowing the caption and the inner table.
         145                 :     * @see nsIFrame::Reflow */
         146                 :   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
         147                 :                     nsHTMLReflowMetrics&     aDesiredSize,
         148                 :                     const nsHTMLReflowState& aReflowState,
         149                 :                     nsReflowStatus&          aStatus);
         150                 :
         151                 :   /**
         152                 :    * Get the "type" of the frame
         153                 :    *
         154                 :    * @see nsGkAtoms::tableOuterFrame
         155                 :    */
         156                 :   virtual nsIAtom* GetType() const;
         157                 :
         158                 : #ifdef DEBUG
         159                 :   NS_IMETHOD GetFrameName(nsAString& aResult) const;
         160                 : #endif
         161                 :
         162                 :   virtual nsIFrame* GetParentStyleContextFrame() const;
         163                 :
         164                 :   /*---------------- nsITableLayout methods ------------------------*/
         165                 :
         166                 :   /** @see nsITableFrame::GetCellDataAt */
         167                 :   NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
         168                 :                            nsIDOMElement* &aCell,   //out params
         169                 :                            PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
         170                 :                            PRInt32& aRowSpan, PRInt32& aColSpan,
         171                 :                            PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
         172                 :                            bool& aIsSelected);
         173                 :
         174                 :   /** @see nsITableFrame::GetTableSize */
         175                 :   NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
         176                 :
         177                 :   NS_IMETHOD GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex);
         178                 :   NS_IMETHOD GetRowAndColumnByIndex(PRInt32 aIndex, PRInt32 *aRow, PRInt32 *aColumn);
         179                 :
         180                 : protected:
         181                 :
         182                 :
         183                 :   nsTableOuterFrame(nsStyleContext* aContext);
         184                 :   virtual ~nsTableOuterFrame();
         185                 :
         186                 :   void InitChildReflowState(nsPresContext&    aPresContext,
         187                 :                             nsHTMLReflowState& aReflowState);
         188                 :
         189                 :   /** Always returns 0, since the outer table frame has no border of its own
         190                 :     * The inner table frame can answer this question in a meaningful way.
         191                 :     * @see nsContainerFrame::GetSkipSides */
         192                 :   virtual PRIntn GetSkipSides() const;
         193                 :
         194                 :   PRUint8 GetCaptionSide(); // NS_STYLE_CAPTION_SIDE_* or NO_SIDE
         195                 :
         196               0 :   bool HasSideCaption() {
         197               0 :     PRUint8 captionSide = GetCaptionSide();
         198                 :     return captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
         199               0 :            captionSide == NS_STYLE_CAPTION_SIDE_RIGHT;
         200                 :   }
         201                 :
         202                 :   PRUint8 GetCaptionVerticalAlign();
         203                 :
         204                 :   void SetDesiredSize(PRUint8         aCaptionSide,
         205                 :                       const nsMargin& aInnerMargin,
         206                 :                       const nsMargin& aCaptionMargin,
         207                 :                       nscoord&        aWidth,
         208                 :                       nscoord&        aHeight);
         209                 :
         210                 :   nsresult   GetCaptionOrigin(PRUint32         aCaptionSide,
         211                 :                               const nsSize&    aContainBlockSize,
         212                 :                               const nsSize&    aInnerSize,
         213                 :                               const nsMargin&  aInnerMargin,
         214                 :                               const nsSize&    aCaptionSize,
         215                 :                               nsMargin&        aCaptionMargin,
         216                 :                               nsPoint&         aOrigin);
         217                 :
         218                 :   nsresult   GetInnerOrigin(PRUint32         aCaptionSide,
         219                 :                             const nsSize&    aContainBlockSize,
         220                 :                             const nsSize&    aCaptionSize,
         221                 :                             const nsMargin&  aCaptionMargin,
         222                 :                             const nsSize&    aInnerSize,
         223                 :                             nsMargin&        aInnerMargin,
         224                 :                             nsPoint&         aOrigin);
         225                 :
         226                 :   // reflow the child (caption or innertable frame)
         227                 :   void OuterBeginReflowChild(nsPresContext*           aPresContext,
         228                 :                              nsIFrame*                aChildFrame,
         229                 :                              const nsHTMLReflowState& aOuterRS,
         230                 :                              void*                    aChildRSSpace,
         231                 :                              nscoord                  aAvailWidth);
         232                 :
         233                 :   nsresult OuterDoReflowChild(nsPresContext*           aPresContext,
         234                 :                               nsIFrame*                aChildFrame,
         235                 :                               const nsHTMLReflowState& aChildRS,
         236                 :                               nsHTMLReflowMetrics&     aMetrics,
         237                 :                               nsReflowStatus&          aStatus);
         238                 :
         239                 :   // Set the reflow metrics
         240                 :   void UpdateReflowMetrics(PRUint8              aCaptionSide,
         241                 :                            nsHTMLReflowMetrics& aMet,
         242                 :                            const nsMargin&      aInnerMargin,
         243                 :                            const nsMargin&      aCaptionMargin);
         244                 :
         245                 :   // Get the margin.  aMarginNoAuto is aMargin, but with auto
         246                 :   // margins set to 0
         247                 :   void GetChildMargin(nsPresContext*           aPresContext,
         248                 :                       const nsHTMLReflowState& aOuterRS,
         249                 :                       nsIFrame*                aChildFrame,
         250                 :                       nscoord                  aAvailableWidth,
         251                 :                       nsMargin&                aMargin);
         252                 :
         253               0 :   nsTableFrame* InnerTableFrame() const {
         254               0 :     return static_cast<nsTableFrame*>(mFrames.FirstChild());
         255                 :   }
         256                 :
         257                 : private:
         258                 :   nsFrameList   mCaptionFrames;
         259                 : };
         260                 :
         261               0 : inline PRIntn nsTableOuterFrame::GetSkipSides() const
         262               0 : { return 0; }
         263                 :
         264                 : #endif

Generated by: LCOV version 1.7