LCOV - code coverage report
Current view: directory - content/svg/content/src - nsSVGStylableElement.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 46 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                 :  * IBM Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2004
      20                 :  * IBM Corporation. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   IBM Corporation
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "nsSVGStylableElement.h"
      40                 : #include "nsGkAtoms.h"
      41                 : #include "nsDOMCSSDeclaration.h"
      42                 : 
      43                 : //----------------------------------------------------------------------
      44                 : // nsISupports methods
      45                 : 
      46               0 : NS_IMPL_ADDREF_INHERITED(nsSVGStylableElement, nsSVGStylableElementBase)
      47               0 : NS_IMPL_RELEASE_INHERITED(nsSVGStylableElement, nsSVGStylableElementBase)
      48                 : 
      49               0 : NS_INTERFACE_MAP_BEGIN(nsSVGStylableElement)
      50               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMSVGStylable)
      51               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGStylableElementBase)
      52                 : 
      53                 : //----------------------------------------------------------------------
      54                 : // Implementation
      55                 : 
      56               0 : nsSVGStylableElement::nsSVGStylableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
      57               0 :   : nsSVGStylableElementBase(aNodeInfo)
      58                 : {
      59               0 : }
      60                 : 
      61                 : //----------------------------------------------------------------------
      62                 : // nsIContent methods
      63                 : 
      64                 : const nsAttrValue*
      65               0 : nsSVGStylableElement::DoGetClasses() const
      66                 : {
      67               0 :   if (mClassAttribute.IsAnimated()) {
      68               0 :     return mClassAnimAttr;
      69                 :   }
      70               0 :   return nsSVGStylableElementBase::DoGetClasses();
      71                 : }
      72                 : 
      73                 : bool
      74               0 : nsSVGStylableElement::ParseAttribute(PRInt32 aNamespaceID,
      75                 :                                      nsIAtom* aAttribute,
      76                 :                                      const nsAString& aValue,
      77                 :                                      nsAttrValue& aResult)
      78                 : {
      79               0 :   if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::_class) {
      80               0 :     mClassAttribute.SetBaseValue(aValue, this, false);
      81               0 :     aResult.ParseAtomArray(aValue);
      82               0 :     return true;
      83                 :   }
      84                 :   return nsSVGStylableElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
      85               0 :                                                   aResult);
      86                 : }
      87                 : 
      88                 : nsresult
      89               0 : nsSVGStylableElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
      90                 :                                 bool aNotify)
      91                 : {
      92               0 :   if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::_class) {
      93               0 :     mClassAttribute.Init();
      94                 :   }
      95               0 :   return nsSVGStylableElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
      96                 : }
      97                 : 
      98                 : //----------------------------------------------------------------------
      99                 : // nsIDOMSVGStylable methods
     100                 : 
     101                 : /* readonly attribute nsIDOMSVGAnimatedString className; */
     102                 : NS_IMETHODIMP
     103               0 : nsSVGStylableElement::GetClassName(nsIDOMSVGAnimatedString** aClassName)
     104                 : {
     105               0 :   return mClassAttribute.ToDOMAnimatedString(aClassName, this);
     106                 : }
     107                 : 
     108                 : /* readonly attribute nsIDOMCSSStyleDeclaration style; */
     109                 : NS_IMETHODIMP
     110               0 : nsSVGStylableElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
     111                 : {
     112                 :   nsresult rv;
     113               0 :   *aStyle = GetStyle(&rv);
     114               0 :   if (NS_FAILED(rv)) {
     115               0 :     return rv;
     116                 :   }
     117               0 :   NS_ADDREF(*aStyle);
     118               0 :   return NS_OK;
     119                 : }
     120                 : 
     121                 : /* nsIDOMCSSValue getPresentationAttribute (in DOMString name); */
     122                 : NS_IMETHODIMP
     123               0 : nsSVGStylableElement::GetPresentationAttribute(const nsAString& aName,
     124                 :                                                nsIDOMCSSValue** aReturn)
     125                 : {
     126                 :   // Let's not implement this just yet. The CSSValue interface has been
     127                 :   // deprecated by the CSS WG.
     128                 :   // http://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html
     129                 : 
     130               0 :   return NS_ERROR_NOT_IMPLEMENTED;
     131                 : }
     132                 : 
     133                 : //----------------------------------------------------------------------
     134                 : // nsSVGElement methods
     135                 : 
     136                 : void
     137               0 : nsSVGStylableElement::DidAnimateClass()
     138                 : {
     139               0 :   nsAutoString src;
     140               0 :   mClassAttribute.GetAnimValue(src, this);
     141               0 :   if (!mClassAnimAttr) {
     142               0 :     mClassAnimAttr = new nsAttrValue();
     143                 :   }
     144               0 :   mClassAnimAttr->ParseAtomArray(src);
     145                 : 
     146               0 :   nsIPresShell* shell = OwnerDoc()->GetShell();
     147               0 :   if (shell) {
     148               0 :     shell->RestyleForAnimation(this, eRestyle_Self);
     149                 :   }
     150               0 : }
     151                 : 
     152                 : nsISMILAttr*
     153               0 : nsSVGStylableElement::GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName)
     154                 : {
     155               0 :   if (aNamespaceID == kNameSpaceID_None && 
     156                 :       aName == nsGkAtoms::_class) {
     157               0 :     return mClassAttribute.ToSMILAttr(this);
     158                 :   }
     159               0 :   return nsSVGStylableElementBase::GetAnimatedAttr(aNamespaceID, aName);
     160                 : }

Generated by: LCOV version 1.7