LCOV - app.info - layout/base/nsQuoteList.h

LCOV - code coverage report
| Current view: | directory - layout/base - nsQuoteList.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 21 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 12 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is mozilla.org code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Esben Mose Hansen.
          19                 :  *
          20                 :  * Contributor(s):
          21                 :  *   Esben Mose Hansen <esben@oek.dk> (original author)
          22                 :  *   L. David Baron <dbaron@dbaron.org>
          23                 :  *
          24                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
          26                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : /* implementation of quotes for the CSS 'content' property */
          39                 :
          40                 : #ifndef nsQuoteList_h___
          41                 : #define nsQuoteList_h___
          42                 :
          43                 : #include "nsGenConList.h"
          44                 :
          45               0 : struct nsQuoteNode : public nsGenConNode {
          46                 :   // open-quote, close-quote, no-open-quote, or no-close-quote
          47                 :   const nsStyleContentType mType;
          48                 :
          49                 :   // Quote depth before this quote, which is always non-negative.
          50                 :   PRInt32 mDepthBefore;
          51                 :
          52               0 :   nsQuoteNode(nsStyleContentType& aType, PRUint32 aContentIndex)
          53                 :     : nsGenConNode(aContentIndex)
          54                 :     , mType(aType)
          55               0 :     , mDepthBefore(0)
          56                 :   {
          57               0 :     NS_ASSERTION(aType == eStyleContentType_OpenQuote ||
          58                 :                  aType == eStyleContentType_CloseQuote ||
          59                 :                  aType == eStyleContentType_NoOpenQuote ||
          60                 :                  aType == eStyleContentType_NoCloseQuote,
          61                 :                  "incorrect type");
          62               0 :     NS_ASSERTION(aContentIndex <= PR_INT32_MAX, "out of range");
          63               0 :   }
          64                 :
          65                 :   virtual bool InitTextFrame(nsGenConList* aList,
          66                 :           nsIFrame* aPseudoFrame, nsIFrame* aTextFrame);
          67                 :
          68                 :   // is this 'open-quote' or 'no-open-quote'?
          69               0 :   bool IsOpenQuote() {
          70                 :     return mType == eStyleContentType_OpenQuote ||
          71               0 :            mType == eStyleContentType_NoOpenQuote;
          72                 :   }
          73                 :
          74                 :   // is this 'close-quote' or 'no-close-quote'?
          75                 :   bool IsCloseQuote() {
          76                 :     return !IsOpenQuote();
          77                 :   }
          78                 :
          79                 :   // is this 'open-quote' or 'close-quote'?
          80               0 :   bool IsRealQuote() {
          81                 :     return mType == eStyleContentType_OpenQuote ||
          82               0 :            mType == eStyleContentType_CloseQuote;
          83                 :   }
          84                 :
          85                 :   // Depth of the quote for *this* node.  Either non-negative or -1.
          86                 :   // -1 means this is a closing quote that tried to decrement the
          87                 :   // counter below zero (which means no quote should be rendered).
          88               0 :   PRInt32 Depth() {
          89               0 :     return IsOpenQuote() ? mDepthBefore : mDepthBefore - 1;
          90                 :   }
          91                 :
          92                 :   // always non-negative
          93               0 :   PRInt32 DepthAfter() {
          94               0 :     return IsOpenQuote() ? mDepthBefore + 1
          95               0 :                          : (mDepthBefore == 0 ? 0 : mDepthBefore - 1);
          96                 :   }
          97                 :
          98                 :   // The text that should be displayed for this quote.
          99                 :   const nsString* Text();
         100                 : };
         101                 :
         102               0 : class nsQuoteList : public nsGenConList {
         103                 : private:
         104               0 :   nsQuoteNode* FirstNode() { return static_cast<nsQuoteNode*>(mFirstNode); }
         105                 : public:
         106                 :   // assign the correct |mDepthBefore| value to a node that has been inserted
         107                 :   // Should be called immediately after calling |Insert|.
         108                 :   void Calc(nsQuoteNode* aNode);
         109                 :
         110               0 :   nsQuoteNode* Next(nsQuoteNode* aNode) {
         111               0 :     return static_cast<nsQuoteNode*>(nsGenConList::Next(aNode));
         112                 :   }
         113               0 :   nsQuoteNode* Prev(nsQuoteNode* aNode) {
         114               0 :     return static_cast<nsQuoteNode*>(nsGenConList::Prev(aNode));
         115                 :   }
         116                 :
         117                 :   void RecalcAll();
         118                 : #ifdef DEBUG
         119                 :   void PrintChain();
         120                 : #endif
         121                 : };
         122                 :
         123                 : #endif /* nsQuoteList_h___ */

Generated by: LCOV version 1.7