tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SMILSetAnimationFunction.h (2056B)


      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 DOM_SMIL_SMILSETANIMATIONFUNCTION_H_
      8 #define DOM_SMIL_SMILSETANIMATIONFUNCTION_H_
      9 
     10 #include "mozilla/SMILAnimationFunction.h"
     11 
     12 namespace mozilla {
     13 
     14 //----------------------------------------------------------------------
     15 // SMILSetAnimationFunction
     16 //
     17 // Subclass of SMILAnimationFunction that limits the behaviour to that offered
     18 // by a <set> element.
     19 //
     20 class SMILSetAnimationFunction : public SMILAnimationFunction {
     21 protected:
     22  bool IsDisallowedAttribute(const nsAtom* aAttribute) const override {
     23    //
     24    // A <set> element is similar to <animate> but lacks:
     25    //   AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to,
     26    //                         by) -- BUT has 'to'
     27    //   AnimationAddition.attrib(additive, accumulate)
     28    //
     29    return aAttribute == nsGkAtoms::calcMode ||
     30           aAttribute == nsGkAtoms::values ||
     31           aAttribute == nsGkAtoms::keyTimes ||
     32           aAttribute == nsGkAtoms::keySplines ||
     33           aAttribute == nsGkAtoms::from || aAttribute == nsGkAtoms::by ||
     34           aAttribute == nsGkAtoms::additive ||
     35           aAttribute == nsGkAtoms::accumulate;
     36  }
     37 
     38  // Although <set> animation might look like to-animation, unlike to-animation,
     39  // it never interpolates values.
     40  // Returning false here will mean this animation function gets treated as
     41  // a single-valued function and no interpolation will be attempted.
     42  bool IsToAnimation() const override { return false; }
     43 
     44  // <set> applies the exact same value across the simple duration.
     45  bool IsValueFixedForSimpleDuration() const override { return true; }
     46  bool WillReplace() const override { return true; }
     47 };
     48 
     49 }  // namespace mozilla
     50 
     51 #endif  // DOM_SMIL_SMILSETANIMATIONFUNCTION_H_