LCOV - code coverage report
Current view: top level - dom/smil - nsSMILSetAnimationFunction.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 37 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "nsSMILSetAnimationFunction.h"
       8             : 
       9             : inline bool
      10           0 : nsSMILSetAnimationFunction::IsDisallowedAttribute(
      11             :     const nsIAtom* aAttribute) const
      12             : {
      13             :   //
      14             :   // A <set> element is similar to <animate> but lacks:
      15             :   //   AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to,
      16             :   //                         by) -- BUT has 'to'
      17             :   //   AnimationAddition.attrib(additive, accumulate)
      18             :   //
      19           0 :   if (aAttribute == nsGkAtoms::calcMode ||
      20           0 :       aAttribute == nsGkAtoms::values ||
      21           0 :       aAttribute == nsGkAtoms::keyTimes ||
      22           0 :       aAttribute == nsGkAtoms::keySplines ||
      23           0 :       aAttribute == nsGkAtoms::from ||
      24           0 :       aAttribute == nsGkAtoms::by ||
      25           0 :       aAttribute == nsGkAtoms::additive ||
      26           0 :       aAttribute == nsGkAtoms::accumulate) {
      27           0 :     return true;
      28             :   }
      29             : 
      30           0 :   return false;
      31             : }
      32             : 
      33             : bool
      34           0 : nsSMILSetAnimationFunction::SetAttr(nsIAtom* aAttribute,
      35             :                                     const nsAString& aValue,
      36             :                                     nsAttrValue& aResult,
      37             :                                     nsresult* aParseResult)
      38             : {
      39           0 :   if (IsDisallowedAttribute(aAttribute)) {
      40           0 :     aResult.SetTo(aValue);
      41           0 :     if (aParseResult) {
      42             :       // SMILANIM 4.2 says:
      43             :       //
      44             :       //   The additive and accumulate attributes are not allowed, and will be
      45             :       //   ignored if specified.
      46             :       //
      47             :       // So at least for those two attributes we shouldn't report an error even
      48             :       // if they're present. For now we'll also just silently ignore other
      49             :       // attribute types too.
      50           0 :       *aParseResult = NS_OK;
      51             :     }
      52           0 :     return true;
      53             :   }
      54             : 
      55           0 :   return nsSMILAnimationFunction::SetAttr(aAttribute, aValue,
      56           0 :                                           aResult, aParseResult);
      57             : }
      58             : 
      59             : bool
      60           0 : nsSMILSetAnimationFunction::UnsetAttr(nsIAtom* aAttribute)
      61             : {
      62           0 :   if (IsDisallowedAttribute(aAttribute)) {
      63           0 :     return true;
      64             :   }
      65             : 
      66           0 :   return nsSMILAnimationFunction::UnsetAttr(aAttribute);
      67             : }
      68             : 
      69             : bool
      70           0 : nsSMILSetAnimationFunction::HasAttr(nsIAtom* aAttName) const
      71             : {
      72           0 :   if (IsDisallowedAttribute(aAttName))
      73           0 :     return false;
      74             : 
      75           0 :   return nsSMILAnimationFunction::HasAttr(aAttName);
      76             : }
      77             : 
      78             : const nsAttrValue*
      79           0 : nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName) const
      80             : {
      81           0 :   if (IsDisallowedAttribute(aAttName))
      82           0 :     return nullptr;
      83             : 
      84           0 :   return nsSMILAnimationFunction::GetAttr(aAttName);
      85             : }
      86             : 
      87             : bool
      88           0 : nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName,
      89             :                                     nsAString& aResult) const
      90             : {
      91           0 :   if (IsDisallowedAttribute(aAttName))
      92           0 :     return false;
      93             : 
      94           0 :   return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
      95             : }
      96             : 
      97             : bool
      98           0 : nsSMILSetAnimationFunction::WillReplace() const
      99             : {
     100           0 :   return true;
     101             : }

Generated by: LCOV version 1.13