LCOV - code coverage report
Current view: directory - content/smil - nsSMILSetAnimationFunction.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 29 0 0.0 %
Date: 2012-06-02 Functions: 7 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 SMIL module.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Brian Birtles.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Brian Birtles <birtles@gmail.com>
      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                 : #include "nsSMILSetAnimationFunction.h"
      39                 : 
      40                 : inline bool
      41               0 : nsSMILSetAnimationFunction::IsDisallowedAttribute(
      42                 :     const nsIAtom* aAttribute) const
      43                 : {
      44                 :   //
      45                 :   // A <set> element is similar to <animate> but lacks:
      46                 :   //   AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to,
      47                 :   //                         by) -- BUT has 'to'
      48                 :   //   AnimationAddition.attrib(additive, accumulate)
      49                 :   //
      50               0 :   if (aAttribute == nsGkAtoms::calcMode ||
      51                 :       aAttribute == nsGkAtoms::values ||
      52                 :       aAttribute == nsGkAtoms::keyTimes ||
      53                 :       aAttribute == nsGkAtoms::keySplines ||
      54                 :       aAttribute == nsGkAtoms::from ||
      55                 :       aAttribute == nsGkAtoms::by ||
      56                 :       aAttribute == nsGkAtoms::additive ||
      57                 :       aAttribute == nsGkAtoms::accumulate) {
      58               0 :     return true;
      59                 :   }
      60                 : 
      61               0 :   return false;
      62                 : }
      63                 : 
      64                 : bool
      65               0 : nsSMILSetAnimationFunction::SetAttr(nsIAtom* aAttribute,
      66                 :                                     const nsAString& aValue,
      67                 :                                     nsAttrValue& aResult,
      68                 :                                     nsresult* aParseResult)
      69                 : {
      70               0 :   if (IsDisallowedAttribute(aAttribute)) {
      71               0 :     aResult.SetTo(aValue);
      72               0 :     if (aParseResult) {
      73                 :       // SMILANIM 4.2 says:
      74                 :       //
      75                 :       //   The additive and accumulate attributes are not allowed, and will be
      76                 :       //   ignored if specified.
      77                 :       //
      78                 :       // So at least for those two attributes we shouldn't report an error even
      79                 :       // if they're present. For now we'll also just silently ignore other
      80                 :       // attribute types too.
      81               0 :       *aParseResult = NS_OK;
      82                 :     }
      83               0 :     return true;
      84                 :   }
      85                 : 
      86                 :   return nsSMILAnimationFunction::SetAttr(aAttribute, aValue,
      87               0 :                                           aResult, aParseResult);
      88                 : }
      89                 : 
      90                 : bool
      91               0 : nsSMILSetAnimationFunction::UnsetAttr(nsIAtom* aAttribute)
      92                 : {
      93               0 :   if (IsDisallowedAttribute(aAttribute)) {
      94               0 :     return true;
      95                 :   }
      96                 : 
      97               0 :   return nsSMILAnimationFunction::UnsetAttr(aAttribute);
      98                 : }
      99                 : 
     100                 : bool
     101               0 : nsSMILSetAnimationFunction::HasAttr(nsIAtom* aAttName) const
     102                 : {
     103               0 :   if (IsDisallowedAttribute(aAttName))
     104               0 :     return false;
     105                 : 
     106               0 :   return nsSMILAnimationFunction::HasAttr(aAttName);
     107                 : }
     108                 : 
     109                 : const nsAttrValue*
     110               0 : nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName) const
     111                 : {
     112               0 :   if (IsDisallowedAttribute(aAttName))
     113               0 :     return nsnull;
     114                 : 
     115               0 :   return nsSMILAnimationFunction::GetAttr(aAttName);
     116                 : }
     117                 : 
     118                 : bool
     119               0 : nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName,
     120                 :                                     nsAString& aResult) const
     121                 : {
     122               0 :   if (IsDisallowedAttribute(aAttName))
     123               0 :     return nsnull;
     124                 : 
     125               0 :   return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
     126                 : }
     127                 : 
     128                 : bool
     129               0 : nsSMILSetAnimationFunction::WillReplace() const
     130                 : {
     131               0 :   return true;
     132                 : }

Generated by: LCOV version 1.7