LCOV - code coverage report
Current view: top level - layout/tables - nsTableColGroupFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : #ifndef nsTableColGroupFrame_h__
       6             : #define nsTableColGroupFrame_h__
       7             : 
       8             : #include "mozilla/Attributes.h"
       9             : #include "nscore.h"
      10             : #include "nsContainerFrame.h"
      11             : #include "nsTableFrame.h"
      12             : #include "mozilla/WritingModes.h"
      13             : 
      14             : class nsTableColFrame;
      15             : 
      16             : /**
      17             :  * nsTableColGroupFrame
      18             :  * data structure to maintain information about a single table cell's frame
      19             :  */
      20           0 : class nsTableColGroupFrame final : public nsContainerFrame
      21             : {
      22             : public:
      23           0 :   NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
      24             : 
      25             :   /** instantiate a new instance of nsTableRowFrame.
      26             :     * @param aPresShell the pres shell for this frame
      27             :     *
      28             :     * @return           the frame that was created
      29             :     */
      30             :   friend nsTableColGroupFrame* NS_NewTableColGroupFrame(nsIPresShell* aPresShell,
      31             :                                                         nsStyleContext* aContext);
      32             : 
      33             :   // nsIFrame overrides
      34           0 :   virtual void Init(nsIContent*       aContent,
      35             :                     nsContainerFrame* aParent,
      36             :                     nsIFrame*         aPrevInFlow) override
      37             :   {
      38           0 :     nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
      39           0 :     if (!aPrevInFlow) {
      40           0 :       mWritingMode = GetTableFrame()->GetWritingMode();
      41             :     }
      42           0 :   }
      43             : 
      44           0 :   nsTableFrame* GetTableFrame() const
      45             :   {
      46           0 :     nsIFrame* parent = GetParent();
      47           0 :     MOZ_ASSERT(parent && parent->IsTableFrame());
      48           0 :     MOZ_ASSERT(!parent->GetPrevInFlow(),
      49             :                "Col group should always be in a first-in-flow table frame");
      50           0 :     return static_cast<nsTableFrame*>(parent);
      51             :   }
      52             : 
      53             :   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      54             :                                 const nsRect&           aDirtyRect,
      55             :                                 const nsDisplayListSet& aLists) override;
      56             : 
      57             :   /** A colgroup can be caused by three things:
      58             :     * 1)        An element with table-column-group display
      59             :     * 2)        An element with a table-column display without a
      60             :            *    table-column-group parent
      61             :     * 3)        Cells that are not in a column (and hence get an anonymous
      62             :            *    column and colgroup).
      63             :     * @return colgroup type
      64             :     */
      65             :   nsTableColGroupType GetColType() const;
      66             : 
      67             :   /** Set the colgroup type based on the creation cause
      68             :     * @param aType - the reason why this colgroup is needed
      69             :     */
      70             :   void SetColType(nsTableColGroupType aType);
      71             : 
      72             :   /** Real in this context are colgroups that come from an element
      73             :     * with table-column-group display or wrap around columns that
      74             :     * come from an element with table-column display. Colgroups
      75             :     * that are the result of wrapping cells in an anonymous
      76             :     * column and colgroup are not considered real here.
      77             :     * @param aTableFrame - the table parent of the colgroups
      78             :     * @return the last real colgroup
      79             :     */
      80             :   static nsTableColGroupFrame* GetLastRealColGroup(nsTableFrame* aTableFrame);
      81             : 
      82             :   /** @see nsIFrame::DidSetStyleContext */
      83             :   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
      84             : 
      85             :   virtual void SetInitialChildList(ChildListID     aListID,
      86             :                                    nsFrameList&    aChildList) override;
      87             :   virtual void AppendFrames(ChildListID     aListID,
      88             :                             nsFrameList&    aFrameList) override;
      89             :   virtual void InsertFrames(ChildListID     aListID,
      90             :                             nsIFrame*       aPrevFrame,
      91             :                             nsFrameList&    aFrameList) override;
      92             :   virtual void RemoveFrame(ChildListID     aListID,
      93             :                            nsIFrame*       aOldFrame) override;
      94             : 
      95             :   /** remove the column aChild from the column group, if requested renumber
      96             :     * the subsequent columns in this column group and all following column
      97             :     * groups. see also ResetColIndices for this
      98             :     * @param aChild       - the column frame that needs to be removed
      99             :     * @param aResetSubsequentColIndices - if true the columns that follow
     100             :     *                                     after aChild will be reenumerated
     101             :     */
     102             :   void RemoveChild(nsTableColFrame& aChild,
     103             :                    bool             aResetSubsequentColIndices);
     104             : 
     105             :   /** reflow of a column group is a trivial matter of reflowing
     106             :     * the col group's children (columns), and setting this frame
     107             :     * to 0-size.  Since tables are row-centric, column group frames
     108             :     * don't play directly in the rendering game.  They do however
     109             :     * maintain important state that effects table and cell layout.
     110             :     */
     111             :   virtual void Reflow(nsPresContext* aPresContext,
     112             :                       ReflowOutput& aDesiredSize,
     113             :                       const ReflowInput& aReflowInput,
     114             :                       nsReflowStatus& aStatus) override;
     115             : 
     116             :   /** Add column frames to the table storages: colframe cache and cellmap
     117             :     * this doesn't change the mFrames of the colgroup frame.
     118             :     * @param aFirstColIndex - the index at which aFirstFrame should be inserted
     119             :     *                         into the colframe cache.
     120             :     * @param aResetSubsequentColIndices - the indices of the col frames
     121             :     *                                     after the insertion might need
     122             :     *                                     an update
     123             :     * @param aCols - an iterator that can be used to iterate over the col
     124             :     *                frames to be added.  Once this is done, the frames on the
     125             :     *                sbling chain of its .get() at that point will still need
     126             :     *                their col indices updated.
     127             :     * @result            - if there is no table frame or the table frame is not
     128             :     *                      the first in flow it will return an error
     129             :     */
     130             :   nsresult AddColsToTable(int32_t                   aFirstColIndex,
     131             :                           bool                      aResetSubsequentColIndices,
     132             :                           const nsFrameList::Slice& aCols);
     133             : 
     134             : #ifdef DEBUG_FRAME_DUMP
     135             :   virtual nsresult GetFrameName(nsAString& aResult) const override;
     136             :   void Dump(int32_t aIndent);
     137             : #endif
     138             : 
     139             :   /** returns the number of columns represented by this group.
     140             :     * if there are col children, count them (taking into account the span of each)
     141             :     * else, check my own span attribute.
     142             :     */
     143             :   virtual int32_t GetColCount() const;
     144             : 
     145             :   /** first column on the child list */
     146             :   nsTableColFrame * GetFirstColumn();
     147             :   /** next sibling to aChildFrame that is a column frame, first column frame
     148             :     * in the column group if aChildFrame is null
     149             :     */
     150             :   nsTableColFrame * GetNextColumn(nsIFrame *aChildFrame);
     151             : 
     152             :   /** @return - the position of the first column in this colgroup in the table
     153             :     * colframe cache.
     154             :     */
     155             :   int32_t GetStartColumnIndex();
     156             : 
     157             :   /** set the position of the first column in this colgroup in the table
     158             :     * colframe cache.
     159             :     */
     160             :   void SetStartColumnIndex(int32_t aIndex);
     161             : 
     162             :   /** helper method to get the span attribute for this colgroup */
     163             :   int32_t GetSpan();
     164             : 
     165             :   /** provide access to the mFrames list
     166             :     */
     167             :   nsFrameList& GetWritableChildList();
     168             : 
     169             :   /** set the column index for all frames starting at aStartColFrame, it
     170             :     * will also reset the column indices in all subsequent colgroups
     171             :     * @param aFirstColGroup - start the reset operation inside this colgroup
     172             :     * @param aFirstColIndex - first column that is reset should get this index
     173             :     * @param aStartColFrame - if specified the reset starts with this column
     174             :     *                         inside the colgroup; if not specified, the reset
     175             :     *                         starts with the first column
     176             :     */
     177             :   static void ResetColIndices(nsIFrame*       aFirstColGroup,
     178             :                               int32_t         aFirstColIndex,
     179             :                               nsIFrame*       aStartColFrame = nullptr);
     180             : 
     181             :   /**
     182             :    * Gets inner border widths before collapsing with cell borders
     183             :    * Caller must get istart border from previous column
     184             :    * GetContinuousBCBorderWidth will not overwrite aBorder.IStart
     185             :    * see nsTablePainter about continuous borders
     186             :    */
     187             :   void GetContinuousBCBorderWidth(mozilla::WritingMode aWM,
     188             :                                   mozilla::LogicalMargin& aBorder);
     189             :   /**
     190             :    * Set full border widths before collapsing with cell borders
     191             :    * @param aForSide - side to set; only accepts bstart and bend
     192             :    */
     193             :   void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
     194             :                                   BCPixelSize aPixelValue);
     195             : 
     196           0 :   virtual bool IsFrameOfType(uint32_t aFlags) const override
     197             :   {
     198           0 :     return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
     199             :   }
     200             : 
     201             :   virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
     202             :   virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
     203           0 :   virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
     204             : 
     205             : protected:
     206             :   explicit nsTableColGroupFrame(nsStyleContext* aContext);
     207             : 
     208             :   void InsertColsReflow(int32_t                   aColIndex,
     209             :                         const nsFrameList::Slice& aCols);
     210             : 
     211             :   virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
     212             : 
     213             :   // data members
     214             :   int32_t mColCount;
     215             :   // the starting column index this col group represents. Must be >= 0.
     216             :   int32_t mStartColIndex;
     217             : 
     218             :   // border width in pixels
     219             :   BCPixelSize mBStartContBorderWidth;
     220             :   BCPixelSize mBEndContBorderWidth;
     221             : };
     222             : 
     223           0 : inline nsTableColGroupFrame::nsTableColGroupFrame(nsStyleContext* aContext)
     224             :   : nsContainerFrame(aContext, kClassID)
     225             :   , mColCount(0)
     226           0 :   , mStartColIndex(0)
     227             : {
     228           0 :   SetColType(eColGroupContent);
     229           0 : }
     230             : 
     231           0 : inline int32_t nsTableColGroupFrame::GetStartColumnIndex()
     232             : {
     233           0 :   return mStartColIndex;
     234             : }
     235             : 
     236           0 : inline void nsTableColGroupFrame::SetStartColumnIndex (int32_t aIndex)
     237             : {
     238           0 :   mStartColIndex = aIndex;
     239           0 : }
     240             : 
     241           0 : inline int32_t nsTableColGroupFrame::GetColCount() const
     242             : {
     243           0 :   return mColCount;
     244             : }
     245             : 
     246           0 : inline nsFrameList& nsTableColGroupFrame::GetWritableChildList()
     247             : {
     248           0 :   return mFrames;
     249             : }
     250             : 
     251             : #endif
     252             : 

Generated by: LCOV version 1.13