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

          Line data    Source code
       1             : /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
       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             : /* Per-block-formatting-context manager of font size inflation for pan and zoom UI. */
       7             : 
       8             : #ifndef nsFontInflationData_h_
       9             : #define nsFontInflationData_h_
      10             : 
      11             : #include "nsContainerFrame.h"
      12             : 
      13             : class nsFontInflationData
      14             : {
      15             :   using ReflowInput = mozilla::ReflowInput;
      16             : 
      17             : public:
      18             : 
      19             :   static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
      20             : 
      21             :   // Returns whether the effective width changed (which requires the
      22             :   // caller to mark its descendants dirty
      23             :   static bool
      24             :     UpdateFontInflationDataISizeFor(const ReflowInput& aReflowInput);
      25             : 
      26             :   static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);
      27             : 
      28           0 :   bool InflationEnabled() {
      29           0 :     if (mTextDirty) {
      30           0 :       ScanText();
      31             :     }
      32           0 :     return mInflationEnabled;
      33             :   }
      34             : 
      35           0 :   nscoord EffectiveISize() const {
      36           0 :     return mNCAISize;
      37             :   }
      38             : 
      39             : private:
      40             : 
      41             :   explicit nsFontInflationData(nsIFrame* aBFCFrame);
      42             : 
      43             :   nsFontInflationData(const nsFontInflationData&) = delete;
      44             :   void operator=(const nsFontInflationData&) = delete;
      45             : 
      46             :   void UpdateISize(const ReflowInput &aReflowInput);
      47             :   enum SearchDirection { eFromStart, eFromEnd };
      48             :   static nsIFrame* FindEdgeInflatableFrameIn(nsIFrame *aFrame,
      49             :                                              SearchDirection aDirection);
      50             : 
      51           0 :   void MarkTextDirty() { mTextDirty = true; }
      52             :   void ScanText();
      53             :   // Scan text in the subtree rooted at aFrame.  Increment mTextAmount
      54             :   // by multiplying the number of characters found by the font size
      55             :   // (yielding the inline-size that would be occupied by the characters if
      56             :   // they were all em squares).  But stop scanning if mTextAmount
      57             :   // crosses mTextThreshold.
      58             :   void ScanTextIn(nsIFrame *aFrame);
      59             : 
      60           0 :   static const nsIFrame* FlowRootFor(const nsIFrame *aFrame)
      61             :   {
      62           0 :     while (!(aFrame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT)) {
      63           0 :       aFrame = aFrame->GetParent();
      64             :     }
      65           0 :     return aFrame;
      66             :   }
      67             : 
      68             :   nsIFrame *mBFCFrame;
      69             :   nscoord mNCAISize;
      70             :   nscoord mTextAmount, mTextThreshold;
      71             :   bool mInflationEnabled; // for this BFC
      72             :   bool mTextDirty;
      73             : };
      74             : 
      75             : #endif /* !defined(nsFontInflationData_h_) */

Generated by: LCOV version 1.13