LCOV - code coverage report
Current view: top level - layout/base - nsQuoteList.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 24 4.2 %
Date: 2017-07-14 16:53:18 Functions: 2 12 16.7 %
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             : /* implementation of quotes for the CSS 'content' property */
       7             : 
       8             : #ifndef nsQuoteList_h___
       9             : #define nsQuoteList_h___
      10             : 
      11             : #include "mozilla/Attributes.h"
      12             : #include "nsGenConList.h"
      13             : 
      14           0 : struct nsQuoteNode : public nsGenConNode {
      15             :   // open-quote, close-quote, no-open-quote, or no-close-quote
      16             :   const nsStyleContentType mType;
      17             : 
      18             :   // Quote depth before this quote, which is always non-negative.
      19             :   int32_t mDepthBefore;
      20             : 
      21           0 :   nsQuoteNode(nsStyleContentType& aType, uint32_t aContentIndex)
      22           0 :     : nsGenConNode(aContentIndex)
      23             :     , mType(aType)
      24           0 :     , mDepthBefore(0)
      25             :   {
      26           0 :     NS_ASSERTION(aType == eStyleContentType_OpenQuote ||
      27             :                  aType == eStyleContentType_CloseQuote ||
      28             :                  aType == eStyleContentType_NoOpenQuote ||
      29             :                  aType == eStyleContentType_NoCloseQuote,
      30             :                  "incorrect type");
      31           0 :     NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range");
      32           0 :   }
      33             : 
      34             :   virtual bool InitTextFrame(nsGenConList* aList,
      35             :           nsIFrame* aPseudoFrame, nsIFrame* aTextFrame) override;
      36             : 
      37             :   // is this 'open-quote' or 'no-open-quote'?
      38           0 :   bool IsOpenQuote() {
      39           0 :     return mType == eStyleContentType_OpenQuote ||
      40           0 :            mType == eStyleContentType_NoOpenQuote;
      41             :   }
      42             : 
      43             :   // is this 'close-quote' or 'no-close-quote'?
      44             :   bool IsCloseQuote() {
      45             :     return !IsOpenQuote();
      46             :   }
      47             : 
      48             :   // is this 'open-quote' or 'close-quote'?
      49           0 :   bool IsRealQuote() {
      50           0 :     return mType == eStyleContentType_OpenQuote ||
      51           0 :            mType == eStyleContentType_CloseQuote;
      52             :   }
      53             : 
      54             :   // Depth of the quote for *this* node.  Either non-negative or -1.
      55             :   // -1 means this is a closing quote that tried to decrement the
      56             :   // counter below zero (which means no quote should be rendered).
      57           0 :   int32_t Depth() {
      58           0 :     return IsOpenQuote() ? mDepthBefore : mDepthBefore - 1;
      59             :   }
      60             : 
      61             :   // always non-negative
      62           0 :   int32_t DepthAfter() {
      63           0 :     return IsOpenQuote() ? mDepthBefore + 1
      64           0 :                          : (mDepthBefore == 0 ? 0 : mDepthBefore - 1);
      65             :   }
      66             : 
      67             :   // The text that should be displayed for this quote.
      68             :   const nsString* Text();
      69             : };
      70             : 
      71          32 : class nsQuoteList : public nsGenConList {
      72             : private:
      73           0 :   nsQuoteNode* FirstNode() { return static_cast<nsQuoteNode*>(mList.getFirst()); }
      74             : public:
      75             :   // assign the correct |mDepthBefore| value to a node that has been inserted
      76             :   // Should be called immediately after calling |Insert|.
      77             :   void Calc(nsQuoteNode* aNode);
      78             : 
      79           0 :   nsQuoteNode* Next(nsQuoteNode* aNode) {
      80           0 :     return static_cast<nsQuoteNode*>(nsGenConList::Next(aNode));
      81             :   }
      82           0 :   nsQuoteNode* Prev(nsQuoteNode* aNode) {
      83           0 :     return static_cast<nsQuoteNode*>(nsGenConList::Prev(aNode));
      84             :   }
      85             : 
      86             :   void RecalcAll();
      87             : #ifdef DEBUG
      88             :   void PrintChain();
      89             : #endif
      90             : };
      91             : 
      92             : #endif /* nsQuoteList_h___ */

Generated by: LCOV version 1.13