Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/smil/nsSMILSetAnimationFunction.h
Line
Count
Source (jump to first uncovered line)
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_SMILSETANIMATIONFUNCTION_H_
8
#define NS_SMILSETANIMATIONFUNCTION_H_
9
10
#include "mozilla/Attributes.h"
11
#include "nsSMILAnimationFunction.h"
12
13
//----------------------------------------------------------------------
14
// nsSMILSetAnimationFunction
15
//
16
// Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
17
// by a <set> element.
18
//
19
class nsSMILSetAnimationFunction : public nsSMILAnimationFunction
20
{
21
public:
22
  /*
23
   * Sets animation-specific attributes (or marks them dirty, in the case
24
   * of from/to/by/values).
25
   *
26
   * @param aAttribute The attribute being set
27
   * @param aValue     The updated value of the attribute.
28
   * @param aResult    The nsAttrValue object that may be used for storing the
29
   *                   parsed result.
30
   * @param aParseResult  Outparam used for reporting parse errors. Will be set
31
   *                      to NS_OK if everything succeeds.
32
   * @returns true if aAttribute is a recognized animation-related
33
   *          attribute; false otherwise.
34
   */
35
  virtual bool SetAttr(nsAtom* aAttribute, const nsAString& aValue,
36
                         nsAttrValue& aResult, nsresult* aParseResult = nullptr) override;
37
38
  /*
39
   * Unsets the given attribute.
40
   *
41
   * @returns true if aAttribute is a recognized animation-related
42
   *          attribute; false otherwise.
43
   */
44
  virtual bool UnsetAttr(nsAtom* aAttribute) override;
45
46
protected:
47
  // Although <set> animation might look like to-animation, unlike to-animation,
48
  // it never interpolates values.
49
  // Returning false here will mean this animation function gets treated as
50
  // a single-valued function and no interpolation will be attempted.
51
0
  virtual bool IsToAnimation() const override {
52
0
    return false;
53
0
  }
54
55
  // <set> applies the exact same value across the simple duration.
56
0
  virtual bool IsValueFixedForSimpleDuration() const override {
57
0
    return true;
58
0
  }
59
  virtual bool               HasAttr(nsAtom* aAttName) const override;
60
  virtual const nsAttrValue* GetAttr(nsAtom* aAttName) const override;
61
  virtual bool               GetAttr(nsAtom* aAttName,
62
                                     nsAString& aResult) const override;
63
  virtual bool WillReplace() const override;
64
65
  bool IsDisallowedAttribute(const nsAtom* aAttribute) const;
66
};
67
68
#endif // NS_SMILSETANIMATIONFUNCTION_H_