LCOV - code coverage report
Current view: top level - layout/generic - nsSplittableFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 7 7 100.0 %
Date: 2017-07-14 16:53:18 Functions: 4 5 80.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             : 
       6             : /*
       7             :  * base class for rendering objects that can be split across lines,
       8             :  * columns, or pages
       9             :  */
      10             : 
      11             : #ifndef nsSplittableFrame_h___
      12             : #define nsSplittableFrame_h___
      13             : 
      14             : #include "mozilla/Attributes.h"
      15             : #include "nsFrame.h"
      16             : 
      17             : // Derived class that allows splitting
      18          76 : class nsSplittableFrame : public nsFrame
      19             : {
      20             : public:
      21             :   NS_DECL_ABSTRACT_FRAME(nsSplittableFrame)
      22             : 
      23             :   virtual void Init(nsIContent*       aContent,
      24             :                     nsContainerFrame* aParent,
      25             :                     nsIFrame*         aPrevInFlow) override;
      26             : 
      27             :   virtual nsSplittableType GetSplittableType() const override;
      28             : 
      29             :   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
      30             : 
      31             :   /*
      32             :    * Frame continuations can be either fluid or not:
      33             :    * Fluid continuations ("in-flows") are the result of line breaking,
      34             :    * column breaking, or page breaking.
      35             :    * Other (non-fluid) continuations can be the result of BiDi frame splitting.
      36             :    * A "flow" is a chain of fluid continuations.
      37             :    */
      38             : 
      39             :   // Get the previous/next continuation, regardless of its type (fluid or non-fluid).
      40             :   virtual nsIFrame* GetPrevContinuation() const override;
      41             :   virtual nsIFrame* GetNextContinuation() const override;
      42             : 
      43             :   // Set a previous/next non-fluid continuation.
      44             :   virtual void SetPrevContinuation(nsIFrame*) override;
      45             :   virtual void SetNextContinuation(nsIFrame*) override;
      46             : 
      47             :   // Get the first/last continuation for this frame.
      48             :   virtual nsIFrame* FirstContinuation() const override;
      49             :   virtual nsIFrame* LastContinuation() const override;
      50             : 
      51             : #ifdef DEBUG
      52             :   // Can aFrame2 be reached from aFrame1 by following prev/next continuations?
      53             :   static bool IsInPrevContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
      54             :   static bool IsInNextContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
      55             : #endif
      56             : 
      57             :   // Get the previous/next continuation, only if it is fluid (an "in-flow").
      58             :   nsIFrame* GetPrevInFlow() const;
      59             :   nsIFrame* GetNextInFlow() const;
      60             : 
      61         408 :   virtual nsIFrame* GetPrevInFlowVirtual() const override { return GetPrevInFlow(); }
      62         442 :   virtual nsIFrame* GetNextInFlowVirtual() const override { return GetNextInFlow(); }
      63             : 
      64             :   // Set a previous/next fluid continuation.
      65             :   virtual void SetPrevInFlow(nsIFrame*) override;
      66             :   virtual void SetNextInFlow(nsIFrame*) override;
      67             : 
      68             :   // Get the first/last frame in the current flow.
      69             :   virtual nsIFrame* FirstInFlow() const override;
      70             :   virtual nsIFrame* LastInFlow() const override;
      71             : 
      72             :   // Remove the frame from the flow. Connects the frame's prev-in-flow
      73             :   // and its next-in-flow. This should only be called in frame Destroy() methods.
      74             :   static void RemoveFromFlow(nsIFrame* aFrame);
      75             : 
      76             : protected:
      77         448 :   nsSplittableFrame(nsStyleContext* aContext, ClassID aID)
      78         448 :     : nsFrame(aContext, aID)
      79             :     , mPrevContinuation(nullptr)
      80         448 :     , mNextContinuation(nullptr)
      81         448 :   {}
      82             : 
      83             :   /**
      84             :    * Return the sum of the block-axis content size of our prev-in-flows.
      85             :    * @param aWM a writing-mode to determine the block-axis
      86             :    *
      87             :    * @note (bz) This makes laying out a splittable frame with N in-flows
      88             :    *       O(N^2)! So, use this function with caution and minimize the number
      89             :    *       of calls to this method.
      90             :    */
      91             :   nscoord ConsumedBSize(mozilla::WritingMode aWM) const;
      92             : 
      93             :   /**
      94             :    * Retrieve the effective computed block size of this frame, which is the
      95             :    * computed block size, minus the block size consumed by any previous in-flows.
      96             :    */
      97             :   nscoord GetEffectiveComputedBSize(const ReflowInput& aReflowInput,
      98             :                                     nscoord aConsumed = NS_INTRINSICSIZE) const;
      99             : 
     100             :   /**
     101             :    * @see nsIFrame::GetLogicalSkipSides()
     102             :    */
     103             :   virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
     104             : 
     105             :   /**
     106             :    * A faster version of GetLogicalSkipSides() that is intended to be used
     107             :    * inside Reflow before it's known if |this| frame will be COMPLETE or not.
     108             :    * It returns a result that assumes this fragment is the last and thus
     109             :    * should apply the block-end border/padding etc (except for "true" overflow
     110             :    * containers which always skip block sides).  You're then expected to
     111             :    * recalculate the block-end side (as needed) when you know |this| frame's
     112             :    * reflow status is INCOMPLETE.
     113             :    * This method is intended for frames that breaks in the block axis.
     114             :    */
     115             :   LogicalSides PreReflowBlockLevelLogicalSkipSides() const;
     116             : 
     117             : #ifdef DEBUG
     118             :   virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent) override;
     119             : #endif
     120             : 
     121             :   nsIFrame*   mPrevContinuation;
     122             :   nsIFrame*   mNextContinuation;
     123             : };
     124             : 
     125             : #endif /* nsSplittableFrame_h___ */

Generated by: LCOV version 1.13