LCOV - code coverage report
Current view: directory - content/svg/content/src - DOMSVGTests.h (source / functions) Found Hit Coverage
Test: app.info Lines: 1 0 0.0 %
Date: 2012-06-02 Functions: 1 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 the Mozilla SVG project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Robert Longson <longsonr@gmail.com>
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2011
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or 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                 : #ifndef MOZILLA_DOMSVGTESTS_H__
      39                 : #define MOZILLA_DOMSVGTESTS_H__
      40                 : 
      41                 : #include "nsIDOMSVGTests.h"
      42                 : #include "nsStringFwd.h"
      43                 : #include "SVGStringList.h"
      44                 : 
      45                 : class nsAttrValue;
      46                 : class nsIAtom;
      47                 : class nsString;
      48                 : 
      49                 : namespace mozilla {
      50                 : class DOMSVGStringList;
      51                 : }
      52                 : 
      53                 : class DOMSVGTests : public nsIDOMSVGTests
      54               0 : {
      55                 : public:
      56                 :   NS_DECL_ISUPPORTS
      57                 :   NS_DECL_NSIDOMSVGTESTS
      58                 : 
      59                 :   friend class mozilla::DOMSVGStringList;
      60                 :   typedef mozilla::SVGStringList SVGStringList;
      61                 : 
      62                 :   DOMSVGTests();
      63                 : 
      64                 :   /**
      65                 :    * Compare the language name(s) in a systemLanguage attribute to the
      66                 :    * user's language preferences, as defined in
      67                 :    * http://www.w3.org/TR/SVG11/struct.html#SystemLanguageAttribute
      68                 :    * We have a match if a language name in the users language preferences
      69                 :    * exactly equals one of the language names or exactly equals a prefix of
      70                 :    * one of the language names in the systemLanguage attribute.
      71                 :    * @returns 2 * the lowest index in the aAcceptLangs that matches + 1
      72                 :    * if only the prefix matches, or -1 if no indices match.
      73                 :    * XXX This algorithm is O(M*N).
      74                 :    */
      75                 :   PRInt32 GetBestLanguagePreferenceRank(const nsSubstring& aAcceptLangs) const;
      76                 : 
      77                 :   /**
      78                 :    * Special value to pass to PassesConditionalProcessingTests to ignore systemLanguage
      79                 :    * attributes
      80                 :    */
      81                 :   static const nsString * const kIgnoreSystemLanguage;
      82                 : 
      83                 :   /**
      84                 :    * Check whether the conditional processing attributes requiredFeatures,
      85                 :    * requiredExtensions and systemLanguage all "return true" if they apply to
      86                 :    * and are specified on the given element. Returns true if this element
      87                 :    * should be rendered, false if it should not.
      88                 :    *
      89                 :    * @param aAcceptLangs Optional parameter to pass in the value of the
      90                 :    *   intl.accept_languages preference if the caller has it cached.
      91                 :    *   Alternatively, pass in kIgnoreSystemLanguage to skip the systemLanguage
      92                 :    *   check if the caller is giving that special treatment.
      93                 :    */
      94                 :   bool PassesConditionalProcessingTests(
      95                 :          const nsString *aAcceptLangs = nsnull) const;
      96                 : 
      97                 :   /**
      98                 :    * Returns true if the attribute is one of the conditional processing
      99                 :    * attributes.
     100                 :    */
     101                 :   bool IsConditionalProcessingAttribute(const nsIAtom* aAttribute) const;
     102                 : 
     103                 :   bool ParseConditionalProcessingAttribute(
     104                 :          nsIAtom* aAttribute,
     105                 :          const nsAString& aValue,
     106                 :          nsAttrValue& aResult);
     107                 : 
     108                 :   /**
     109                 :    * Unsets a conditional processing attribute.
     110                 :    */
     111                 :   void UnsetAttr(const nsIAtom* aAttribute);
     112                 : 
     113                 :   nsIAtom* GetAttrName(PRUint8 aAttrEnum) const;
     114                 :   void GetAttrValue(PRUint8 aAttrEnum, nsAttrValue &aValue) const;
     115                 : 
     116                 :   void MaybeInvalidate();
     117                 : 
     118                 : private:
     119                 :   enum { FEATURES, EXTENSIONS, LANGUAGE };
     120                 :   SVGStringList mStringListAttributes[3];
     121                 :   static nsIAtom** sStringListNames[3];
     122                 : };
     123                 : 
     124                 : #endif // MOZILLA_DOMSVGTESTS_H__

Generated by: LCOV version 1.7