LCOV - code coverage report
Current view: top level - dom/smil - nsSMILParserUtils.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 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             : #ifndef NS_SMILPARSERUTILS_H_
       8             : #define NS_SMILPARSERUTILS_H_
       9             : 
      10             : #include "nsTArray.h"
      11             : #include "nsStringFwd.h"
      12             : 
      13             : class nsISMILAttr;
      14             : class nsSMILKeySpline;
      15             : class nsSMILTimeValue;
      16             : class nsSMILValue;
      17             : class nsSMILRepeatCount;
      18             : class nsSMILTimeValueSpecParams;
      19             : 
      20             : namespace mozilla {
      21             : namespace dom {
      22             : class SVGAnimationElement;
      23             : } // namespace dom
      24             : } // namespace mozilla
      25             : 
      26             : /**
      27             :  * Common parsing utilities for the SMIL module. There is little re-use here; it
      28             :  * simply serves to simplify other classes by moving parsing outside and to aid
      29             :  * unit testing.
      30             :  */
      31             : class nsSMILParserUtils
      32             : {
      33             : public:
      34             :   // Abstract helper-class for assisting in parsing |values| attribute
      35           0 :   class MOZ_STACK_CLASS GenericValueParser {
      36             :   public:
      37             :     virtual bool Parse(const nsAString& aValueStr) = 0;
      38             :   };
      39             : 
      40             :   static const nsDependentSubstring TrimWhitespace(const nsAString& aString);
      41             : 
      42             :   static bool ParseKeySplines(const nsAString& aSpec,
      43             :                               FallibleTArray<nsSMILKeySpline>& aKeySplines);
      44             : 
      45             :   // Used for parsing the |keyTimes| and |keyPoints| attributes.
      46             :   static bool ParseSemicolonDelimitedProgressList(const nsAString& aSpec,
      47             :                                                   bool aNonDecreasing,
      48             :                                                   FallibleTArray<double>& aArray);
      49             : 
      50             :   static bool ParseValues(const nsAString& aSpec,
      51             :                           const mozilla::dom::SVGAnimationElement* aSrcElement,
      52             :                           const nsISMILAttr& aAttribute,
      53             :                           FallibleTArray<nsSMILValue>& aValuesArray,
      54             :                           bool& aPreventCachingOfSandwich);
      55             : 
      56             :   // Generic method that will run some code on each sub-section of an animation
      57             :   // element's "values" list.
      58             :   static bool ParseValuesGeneric(const nsAString& aSpec,
      59             :                                  GenericValueParser& aParser);
      60             : 
      61             :   static bool ParseRepeatCount(const nsAString& aSpec,
      62             :                                nsSMILRepeatCount& aResult);
      63             : 
      64             :   static bool ParseTimeValueSpecParams(const nsAString& aSpec,
      65             :                                        nsSMILTimeValueSpecParams& aResult);
      66             : 
      67             :   /*
      68             :    * Parses a clock value as defined in the SMIL Animation specification.
      69             :    * If parsing succeeds the returned value will be a non-negative, definite
      70             :    * time value i.e. IsDefinite will return true.
      71             :    *
      72             :    * @param aSpec    The string containing a clock value, e.g. "10s"
      73             :    * @param aResult  The parsed result. [OUT]
      74             :    * @return true if parsing succeeded, otherwise false.
      75             :    */
      76             :   static bool ParseClockValue(const nsAString& aSpec,
      77             :                               nsSMILTimeValue* aResult);
      78             : 
      79             :   /*
      80             :    * This method checks whether the given string looks like a negative number.
      81             :    * Specifically, it checks whether the string looks matches the pattern
      82             :    * "[whitespace]*-[numeral].*" If the string matches this pattern, this
      83             :    * method returns the index of the first character after the '-' sign
      84             :    * (i.e. the index of the absolute value).  If not, this method returns -1.
      85             :    */
      86             :   static int32_t CheckForNegativeNumber(const nsAString& aStr);
      87             : };
      88             : 
      89             : #endif // NS_SMILPARSERUTILS_H_

Generated by: LCOV version 1.13