layout/generic/nsFrameSetFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/nsFrameSetFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,216 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/* rendering object for HTML <frameset> elements */
    1.10 +
    1.11 +#ifndef nsHTMLFrameset_h___
    1.12 +#define nsHTMLFrameset_h___
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "nsContainerFrame.h"
    1.16 +#include "nsColor.h"
    1.17 +
    1.18 +class  nsIContent;
    1.19 +class  nsPresContext;
    1.20 +struct nsRect;
    1.21 +struct nsHTMLReflowState;
    1.22 +struct nsSize;
    1.23 +class  nsIAtom;
    1.24 +class  nsHTMLFramesetBorderFrame;
    1.25 +class  nsHTMLFramesetFrame;
    1.26 +
    1.27 +#define NO_COLOR 0xFFFFFFFA
    1.28 +
    1.29 +// defined at HTMLFrameSetElement.h
    1.30 +struct nsFramesetSpec;
    1.31 +
    1.32 +struct nsBorderColor 
    1.33 +{
    1.34 +  nscolor mLeft;
    1.35 +  nscolor mRight;
    1.36 +  nscolor mTop;
    1.37 +  nscolor mBottom;
    1.38 +
    1.39 +  nsBorderColor() { Set(NO_COLOR); }
    1.40 +  ~nsBorderColor() {}
    1.41 +  void Set(nscolor aColor) { mLeft = mRight = mTop = mBottom = aColor; }
    1.42 +};
    1.43 +
    1.44 +enum nsFrameborder {
    1.45 +  eFrameborder_Yes = 0,
    1.46 +  eFrameborder_No,
    1.47 +  eFrameborder_Notset
    1.48 +};
    1.49 +
    1.50 +struct nsFramesetDrag {
    1.51 +  nsHTMLFramesetFrame* mSource;    // frameset whose border was dragged to cause the resize
    1.52 +  int32_t              mIndex;     // index of left col or top row of effected area
    1.53 +  int32_t              mChange;    // pos for left to right or top to bottom, neg otherwise
    1.54 +  bool                 mVertical;  // vertical if true, otherwise horizontal
    1.55 +
    1.56 +  nsFramesetDrag();
    1.57 +  void Reset(bool                 aVertical, 
    1.58 +             int32_t              aIndex, 
    1.59 +             int32_t              aChange, 
    1.60 +             nsHTMLFramesetFrame* aSource); 
    1.61 +  void UnSet();
    1.62 +};
    1.63 +
    1.64 +/*******************************************************************************
    1.65 + * nsHTMLFramesetFrame
    1.66 + ******************************************************************************/
    1.67 +class nsHTMLFramesetFrame : public nsContainerFrame
    1.68 +{
    1.69 +public:
    1.70 +  NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
    1.71 +  NS_DECL_QUERYFRAME
    1.72 +  NS_DECL_FRAMEARENA_HELPERS
    1.73 +
    1.74 +  nsHTMLFramesetFrame(nsStyleContext* aContext);
    1.75 +
    1.76 +  virtual ~nsHTMLFramesetFrame();
    1.77 +
    1.78 +  virtual void Init(nsIContent*      aContent,
    1.79 +                    nsIFrame*        aParent,
    1.80 +                    nsIFrame*        aPrevInFlow) MOZ_OVERRIDE;
    1.81 +
    1.82 +  virtual nsresult SetInitialChildList(ChildListID  aListID,
    1.83 +                                       nsFrameList& aChildList) MOZ_OVERRIDE;
    1.84 +
    1.85 +  static bool    gDragInProgress;
    1.86 +
    1.87 +  void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
    1.88 +
    1.89 +  void GetSizeOfChildAt(int32_t  aIndexInParent, 
    1.90 +                        nsSize&  aSize, 
    1.91 +                        nsIntPoint& aCellIndex);
    1.92 +
    1.93 +  virtual nsresult HandleEvent(nsPresContext* aPresContext, 
    1.94 +                               mozilla::WidgetGUIEvent* aEvent,
    1.95 +                               nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    1.96 +
    1.97 +  virtual nsresult GetCursor(const nsPoint&    aPoint,
    1.98 +                             nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
    1.99 +
   1.100 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
   1.101 +                                const nsRect&           aDirtyRect,
   1.102 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
   1.103 +
   1.104 +  virtual nsresult Reflow(nsPresContext*           aPresContext,
   1.105 +                          nsHTMLReflowMetrics&     aDesiredSize,
   1.106 +                          const nsHTMLReflowState& aReflowState,
   1.107 +                          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
   1.108 +
   1.109 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
   1.110 +#ifdef DEBUG_FRAME_DUMP
   1.111 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
   1.112 +#endif
   1.113 +
   1.114 +  virtual bool IsLeaf() const MOZ_OVERRIDE;
   1.115 +  
   1.116 +  void StartMouseDrag(nsPresContext* aPresContext,
   1.117 +                      nsHTMLFramesetBorderFrame* aBorder,
   1.118 +                      mozilla::WidgetGUIEvent* aEvent);
   1.119 +
   1.120 +  void MouseDrag(nsPresContext* aPresContext, 
   1.121 +                 mozilla::WidgetGUIEvent* aEvent);
   1.122 +
   1.123 +  void EndMouseDrag(nsPresContext* aPresContext);
   1.124 +
   1.125 +  nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
   1.126 +
   1.127 +  void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
   1.128 +
   1.129 +  nsFramesetDrag& GetDrag() { return mDrag; }
   1.130 +
   1.131 +  void RecalculateBorderResize();
   1.132 +
   1.133 +protected:
   1.134 +  void Scale(nscoord  aDesired, 
   1.135 +             int32_t  aNumIndicies, 
   1.136 +             int32_t* aIndicies, 
   1.137 +             int32_t  aNumItems,
   1.138 +             int32_t* aItems);
   1.139 +
   1.140 +  void CalculateRowCol(nsPresContext*       aPresContext, 
   1.141 +                       nscoord               aSize, 
   1.142 +                       int32_t               aNumSpecs, 
   1.143 +                       const nsFramesetSpec* aSpecs, 
   1.144 +                       nscoord*              aValues);
   1.145 +
   1.146 +  void GenerateRowCol(nsPresContext*       aPresContext,
   1.147 +                      nscoord               aSize,
   1.148 +                      int32_t               aNumSpecs,
   1.149 +                      const nsFramesetSpec* aSpecs,
   1.150 +                      nscoord*              aValues,
   1.151 +                      nsString&             aNewAttr);
   1.152 +
   1.153 +  virtual void GetDesiredSize(nsPresContext*          aPresContext,
   1.154 +                              const nsHTMLReflowState& aReflowState,
   1.155 +                              nsHTMLReflowMetrics&     aDesiredSize);
   1.156 +
   1.157 +  int32_t GetBorderWidth(nsPresContext* aPresContext,
   1.158 +                         bool aTakeForcingIntoAccount);
   1.159 +
   1.160 +  int32_t GetParentBorderWidth() { return mParentBorderWidth; }
   1.161 +
   1.162 +  void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
   1.163 +
   1.164 +  nscolor GetParentBorderColor() { return mParentBorderColor; }
   1.165 +
   1.166 +  void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
   1.167 +
   1.168 +  nsFrameborder GetFrameBorder();
   1.169 +
   1.170 +  nsFrameborder GetFrameBorder(nsIContent* aContent);
   1.171 +
   1.172 +  nscolor GetBorderColor();
   1.173 +
   1.174 +  nscolor GetBorderColor(nsIContent* aFrameContent);
   1.175 +
   1.176 +  bool GetNoResize(nsIFrame* aChildFrame); 
   1.177 +  
   1.178 +  void ReflowPlaceChild(nsIFrame*                aChild,
   1.179 +                        nsPresContext*          aPresContext,
   1.180 +                        const nsHTMLReflowState& aReflowState,
   1.181 +                        nsPoint&                 aOffset,
   1.182 +                        nsSize&                  aSize,
   1.183 +                        nsIntPoint*              aCellIndex = 0);
   1.184 +  
   1.185 +  bool CanResize(bool aVertical, bool aLeft); 
   1.186 +
   1.187 +  bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
   1.188 +  
   1.189 +  void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
   1.190 +
   1.191 +  static void FrameResizePrefCallback(const char* aPref, void* aClosure);
   1.192 +
   1.193 +  nsFramesetDrag   mDrag;
   1.194 +  nsBorderColor    mEdgeColors;
   1.195 +  nsHTMLFramesetBorderFrame* mDragger;
   1.196 +  nsHTMLFramesetFrame* mTopLevelFrameset;
   1.197 +  nsHTMLFramesetBorderFrame** mVerBorders;  // vertical borders
   1.198 +  nsHTMLFramesetBorderFrame** mHorBorders;  // horizontal borders
   1.199 +  nsFrameborder*   mChildFrameborder; // the frameborder attr of children
   1.200 +  nsBorderColor*   mChildBorderColors;
   1.201 +  nscoord*         mRowSizes;  // currently computed row sizes
   1.202 +  nscoord*         mColSizes;  // currently computed col sizes
   1.203 +  nsIntPoint       mFirstDragPoint;
   1.204 +  int32_t          mNumRows;
   1.205 +  int32_t          mNumCols;
   1.206 +  int32_t          mNonBorderChildCount; 
   1.207 +  int32_t          mNonBlankChildCount; 
   1.208 +  int32_t          mEdgeVisibility;
   1.209 +  nsFrameborder    mParentFrameborder;
   1.210 +  nscolor          mParentBorderColor;
   1.211 +  int32_t          mParentBorderWidth;
   1.212 +  int32_t          mPrevNeighborOrigSize; // used during resize
   1.213 +  int32_t          mNextNeighborOrigSize;
   1.214 +  int32_t          mMinDrag;
   1.215 +  int32_t          mChildCount;
   1.216 +  bool             mForceFrameResizability;
   1.217 +};
   1.218 +
   1.219 +#endif

mercurial