LCOV - code coverage report
Current view: directory - layout/generic - nsFrameSetFrame.h (source / functions) Found Hit Coverage
Test: app.info Lines: 6 0 0.0 %
Date: 2012-06-02 Functions: 6 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                 : /* rendering object for HTML <frameset> elements */
      39                 : 
      40                 : #ifndef nsHTMLFrameset_h___
      41                 : #define nsHTMLFrameset_h___
      42                 : 
      43                 : #include "nsGkAtoms.h"
      44                 : #include "nsContainerFrame.h"
      45                 : #include "nsColor.h"
      46                 : #include "nsIObserver.h"
      47                 : #include "nsWeakPtr.h"
      48                 : 
      49                 : class  nsIContent;
      50                 : class  nsIFrame;
      51                 : class  nsPresContext;
      52                 : class  nsRenderingContext;
      53                 : struct nsRect;
      54                 : struct nsHTMLReflowState;
      55                 : struct nsSize;
      56                 : class  nsIAtom;
      57                 : class  nsHTMLFramesetBorderFrame;
      58                 : class  nsGUIEvent;
      59                 : class  nsHTMLFramesetFrame;
      60                 : 
      61                 : #define NO_COLOR 0xFFFFFFFA
      62                 : 
      63                 : // defined at nsHTMLFrameSetElement.h
      64                 : struct nsFramesetSpec;
      65                 : 
      66                 : struct nsBorderColor 
      67                 : {
      68                 :   nscolor mLeft;
      69                 :   nscolor mRight;
      70                 :   nscolor mTop;
      71                 :   nscolor mBottom;
      72                 : 
      73               0 :   nsBorderColor() { Set(NO_COLOR); }
      74               0 :   ~nsBorderColor() {}
      75               0 :   void Set(nscolor aColor) { mLeft = mRight = mTop = mBottom = aColor; }
      76                 : };
      77                 : 
      78                 : enum nsFrameborder {
      79                 :   eFrameborder_Yes = 0,
      80                 :   eFrameborder_No,
      81                 :   eFrameborder_Notset
      82                 : };
      83                 : 
      84                 : struct nsFramesetDrag {
      85                 :   nsHTMLFramesetFrame* mSource;    // frameset whose border was dragged to cause the resize
      86                 :   PRInt32              mIndex;     // index of left col or top row of effected area
      87                 :   PRInt32              mChange;    // pos for left to right or top to bottom, neg otherwise
      88                 :   bool                 mVertical;  // vertical if true, otherwise horizontal
      89                 : 
      90                 :   nsFramesetDrag();
      91                 :   void Reset(bool                 aVertical, 
      92                 :              PRInt32              aIndex, 
      93                 :              PRInt32              aChange, 
      94                 :              nsHTMLFramesetFrame* aSource); 
      95                 :   void UnSet();
      96                 : };
      97                 : 
      98                 : /*******************************************************************************
      99                 :  * nsHTMLFramesetFrame
     100                 :  ******************************************************************************/
     101                 : class nsHTMLFramesetFrame : public nsContainerFrame
     102                 : {
     103                 : public:
     104                 :   NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
     105                 :   NS_DECL_QUERYFRAME
     106                 :   NS_DECL_FRAMEARENA_HELPERS
     107                 : 
     108                 :   nsHTMLFramesetFrame(nsStyleContext* aContext);
     109                 : 
     110                 :   virtual ~nsHTMLFramesetFrame();
     111                 : 
     112                 :   NS_IMETHOD Init(nsIContent*      aContent,
     113                 :                   nsIFrame*        aParent,
     114                 :                   nsIFrame*        aPrevInFlow);
     115                 : 
     116                 :   NS_IMETHOD SetInitialChildList(ChildListID  aListID,
     117                 :                                  nsFrameList& aChildList);
     118                 : 
     119                 :   static bool    gDragInProgress;
     120                 : 
     121                 :   void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
     122                 : 
     123                 :   void GetSizeOfChildAt(PRInt32  aIndexInParent, 
     124                 :                         nsSize&  aSize, 
     125                 :                         nsIntPoint& aCellIndex);
     126                 : 
     127                 :   static nsHTMLFramesetFrame* GetFramesetParent(nsIFrame* aChild);
     128                 : 
     129                 :   NS_IMETHOD HandleEvent(nsPresContext* aPresContext, 
     130                 :                          nsGUIEvent*     aEvent,
     131                 :                          nsEventStatus*  aEventStatus);
     132                 : 
     133                 :   NS_IMETHOD GetCursor(const nsPoint&    aPoint,
     134                 :                        nsIFrame::Cursor& aCursor);
     135                 : 
     136                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
     137                 :                               const nsRect&           aDirtyRect,
     138                 :                               const nsDisplayListSet& aLists);
     139                 : 
     140                 :   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
     141                 :                     nsHTMLReflowMetrics&     aDesiredSize,
     142                 :                     const nsHTMLReflowState& aReflowState,
     143                 :                     nsReflowStatus&          aStatus);
     144                 : 
     145                 :   virtual nsIAtom* GetType() const;
     146                 : #ifdef DEBUG
     147                 :   NS_IMETHOD GetFrameName(nsAString& aResult) const;
     148                 : #endif
     149                 : 
     150                 :   virtual bool IsLeaf() const;
     151                 :   
     152                 :   void StartMouseDrag(nsPresContext*            aPresContext, 
     153                 :                       nsHTMLFramesetBorderFrame* aBorder, 
     154                 :                       nsGUIEvent*                aEvent);
     155                 : 
     156                 :   void MouseDrag(nsPresContext* aPresContext, 
     157                 :                  nsGUIEvent*     aEvent);
     158                 : 
     159                 :   void EndMouseDrag(nsPresContext* aPresContext);
     160                 : 
     161                 :   nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
     162                 : 
     163               0 :   void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
     164                 : 
     165                 :   nsFramesetDrag& GetDrag() { return mDrag; }
     166                 : 
     167                 :   void RecalculateBorderResize();
     168                 : 
     169                 : protected:
     170                 :   void Scale(nscoord  aDesired, 
     171                 :              PRInt32  aNumIndicies, 
     172                 :              PRInt32* aIndicies, 
     173                 :              PRInt32  aNumItems,
     174                 :              PRInt32* aItems);
     175                 : 
     176                 :   void CalculateRowCol(nsPresContext*       aPresContext, 
     177                 :                        nscoord               aSize, 
     178                 :                        PRInt32               aNumSpecs, 
     179                 :                        const nsFramesetSpec* aSpecs, 
     180                 :                        nscoord*              aValues);
     181                 : 
     182                 :   void GenerateRowCol(nsPresContext*       aPresContext,
     183                 :                       nscoord               aSize,
     184                 :                       PRInt32               aNumSpecs,
     185                 :                       const nsFramesetSpec* aSpecs,
     186                 :                       nscoord*              aValues,
     187                 :                       nsString&             aNewAttr);
     188                 : 
     189                 :   virtual void GetDesiredSize(nsPresContext*          aPresContext,
     190                 :                               const nsHTMLReflowState& aReflowState,
     191                 :                               nsHTMLReflowMetrics&     aDesiredSize);
     192                 : 
     193                 :   PRInt32 GetBorderWidth(nsPresContext* aPresContext,
     194                 :                          bool aTakeForcingIntoAccount);
     195                 : 
     196                 :   PRInt32 GetParentBorderWidth() { return mParentBorderWidth; }
     197                 : 
     198               0 :   void SetParentBorderWidth(PRInt32 aWidth) { mParentBorderWidth = aWidth; }
     199                 : 
     200                 :   nscolor GetParentBorderColor() { return mParentBorderColor; }
     201                 : 
     202               0 :   void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
     203                 : 
     204                 :   nsFrameborder GetFrameBorder();
     205                 : 
     206                 :   nsFrameborder GetFrameBorder(nsIContent* aContent);
     207                 : 
     208                 :   nscolor GetBorderColor();
     209                 : 
     210                 :   nscolor GetBorderColor(nsIContent* aFrameContent);
     211                 : 
     212                 :   bool GetNoResize(nsIFrame* aChildFrame); 
     213                 :   
     214                 :   virtual PRIntn GetSkipSides() const;
     215                 : 
     216                 :   void ReflowPlaceChild(nsIFrame*                aChild,
     217                 :                         nsPresContext*          aPresContext,
     218                 :                         const nsHTMLReflowState& aReflowState,
     219                 :                         nsPoint&                 aOffset,
     220                 :                         nsSize&                  aSize,
     221                 :                         nsIntPoint*              aCellIndex = 0);
     222                 :   
     223                 :   bool CanResize(bool aVertical, 
     224                 :                    bool aLeft); 
     225                 : 
     226                 :   bool CanChildResize(bool    aVertical, 
     227                 :                         bool    aLeft, 
     228                 :                         PRInt32 aChildX,
     229                 :                         bool    aFrameset);
     230                 :   
     231                 :   void SetBorderResize(PRInt32*                   aChildTypes, 
     232                 :                        nsHTMLFramesetBorderFrame* aBorderFrame);
     233                 : 
     234                 :   bool ChildIsFrameset(nsIFrame* aChild); 
     235                 : 
     236                 :   static int FrameResizePrefCallback(const char* aPref, void* aClosure);
     237                 : 
     238                 :   nsFramesetDrag   mDrag;
     239                 :   nsBorderColor    mEdgeColors;
     240                 :   nsHTMLFramesetBorderFrame* mDragger;
     241                 :   nsHTMLFramesetFrame* mTopLevelFrameset;
     242                 :   nsHTMLFramesetBorderFrame** mVerBorders;  // vertical borders
     243                 :   nsHTMLFramesetBorderFrame** mHorBorders;  // horizontal borders
     244                 :   PRInt32*         mChildTypes; // frameset/frame distinction of children
     245                 :   nsFrameborder*   mChildFrameborder; // the frameborder attr of children
     246                 :   nsBorderColor*   mChildBorderColors;
     247                 :   nscoord*         mRowSizes;  // currently computed row sizes
     248                 :   nscoord*         mColSizes;  // currently computed col sizes
     249                 :   nsIntPoint       mFirstDragPoint;
     250                 :   PRInt32          mNumRows;
     251                 :   PRInt32          mNumCols;
     252                 :   PRInt32          mNonBorderChildCount; 
     253                 :   PRInt32          mNonBlankChildCount; 
     254                 :   PRInt32          mEdgeVisibility;
     255                 :   nsFrameborder    mParentFrameborder;
     256                 :   nscolor          mParentBorderColor;
     257                 :   PRInt32          mParentBorderWidth;
     258                 :   PRInt32          mPrevNeighborOrigSize; // used during resize
     259                 :   PRInt32          mNextNeighborOrigSize;
     260                 :   PRInt32          mMinDrag;
     261                 :   PRInt32          mChildCount;
     262                 :   bool             mForceFrameResizability;
     263                 : };
     264                 : 
     265                 : #endif

Generated by: LCOV version 1.7