LCOV - app.info - content/svg/content/src/nsSVGClass.h

LCOV - code coverage report
| Current view: | directory - content/svg/content/src - nsSVGClass.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 18 | 1 | 5.6 %
| Date: | 2012-04-21 | Functions: | 16 | 1 | 6.2 %

           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 Robert Longson.
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2011
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Contributor(s):
          22                 :  *
          23                 :  * Alternatively, the contents of this file may be used under the terms of
          24                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          25                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          26                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          27                 :  * of those above. If you wish to allow use of your version of this file only
          28                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          29                 :  * use your version of this file under the terms of the MPL, indicate your
          30                 :  * decision by deleting the provisions above and replace them with the notice
          31                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          32                 :  * the provisions above, a recipient may use your version of this file under
          33                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          34                 :  *
          35                 :  * ***** END LICENSE BLOCK ***** */
          36                 :
          37                 : #ifndef __NS_SVGCLASS_H__
          38                 : #define __NS_SVGCLASS_H__
          39                 :
          40                 : #include "nsAutoPtr.h"
          41                 : #include "nsCycleCollectionParticipant.h"
          42                 : #include "nsDOMError.h"
          43                 : #include "nsIDOMSVGAnimatedString.h"
          44                 : #include "nsISMILAttr.h"
          45                 : #include "nsString.h"
          46                 :
          47                 : class nsSVGStylableElement;
          48                 :
          49                 : class nsSVGClass
          50               0 : {
          51                 :
          52                 : public:
          53               0 :   void Init() {
          54               0 :     mAnimVal = nsnull;
          55               0 :   }
          56                 :
          57                 :   void SetBaseValue(const nsAString& aValue,
          58                 :                     nsSVGStylableElement *aSVGElement,
          59                 :                     bool aDoSetAttr);
          60                 :   void GetBaseValue(nsAString& aValue, const nsSVGStylableElement *aSVGElement) const;
          61                 :
          62                 :   void SetAnimValue(const nsAString& aValue, nsSVGStylableElement *aSVGElement);
          63                 :   void GetAnimValue(nsAString& aValue, const nsSVGStylableElement *aSVGElement) const;
          64               0 :   bool IsAnimated() const
          65               0 :     { return !!mAnimVal; }
          66                 :
          67                 :   nsresult ToDOMAnimatedString(nsIDOMSVGAnimatedString **aResult,
          68                 :                                nsSVGStylableElement *aSVGElement);
          69                 :   // Returns a new nsISMILAttr object that the caller must delete
          70                 :   nsISMILAttr* ToSMILAttr(nsSVGStylableElement *aSVGElement);
          71                 :
          72                 : private:
          73                 :
          74                 :   nsAutoPtr<nsString> mAnimVal;
          75                 :
          76                 : public:
          77                 :   struct DOMAnimatedString : public nsIDOMSVGAnimatedString
          78               0 :   {
          79               0 :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
          80            1396 :     NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString)
          81                 :
          82               0 :     DOMAnimatedString(nsSVGClass *aVal, nsSVGStylableElement *aSVGElement)
          83               0 :       : mVal(aVal), mSVGElement(aSVGElement) {}
          84                 :
          85                 :     nsSVGClass* mVal; // kept alive because it belongs to content
          86                 :     nsRefPtr<nsSVGStylableElement> mSVGElement;
          87                 :
          88               0 :     NS_IMETHOD GetBaseVal(nsAString& aResult)
          89               0 :       { mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; }
          90               0 :     NS_IMETHOD SetBaseVal(const nsAString& aValue)
          91               0 :       { mVal->SetBaseValue(aValue, mSVGElement, true); return NS_OK; }
          92                 :
          93                 :     NS_IMETHOD GetAnimVal(nsAString& aResult);
          94                 :   };
          95                 :   struct SMILString : public nsISMILAttr
          96               0 :   {
          97                 :   public:
          98               0 :     SMILString(nsSVGClass *aVal, nsSVGStylableElement *aSVGElement)
          99               0 :       : mVal(aVal), mSVGElement(aSVGElement) {}
         100                 :
         101                 :     // These will stay alive because a nsISMILAttr only lives as long
         102                 :     // as the Compositing step, and DOM elements don't get a chance to
         103                 :     // die during that.
         104                 :     nsSVGClass* mVal;
         105                 :     nsSVGStylableElement* mSVGElement;
         106                 :
         107                 :     // nsISMILAttr methods
         108                 :     virtual nsresult ValueFromString(const nsAString& aStr,
         109                 :                                      const nsISMILAnimationElement *aSrcElement,
         110                 :                                      nsSMILValue& aValue,
         111                 :                                      bool& aPreventCachingOfSandwich) const;
         112                 :     virtual nsSMILValue GetBaseValue() const;
         113                 :     virtual void ClearAnimValue();
         114                 :     virtual nsresult SetAnimValue(const nsSMILValue& aValue);
         115                 :   };
         116                 : };
         117                 : #endif //__NS_SVGCLASS_H__

Generated by: LCOV version 1.7