File: KeyframeEffectReadOnly.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (128 lines) | stat: -rw-r--r-- 4,315 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef KeyframeEffectReadOnly_h
#define KeyframeEffectReadOnly_h

#include "core/CoreExport.h"
#include "core/animation/AnimationEffectReadOnly.h"
#include "core/animation/EffectModel.h"

namespace blink {

class DictionarySequenceOrDictionary;
class Element;
class ExceptionState;
class ExecutionContext;
class KeyframeEffectOptions;
class PropertyHandle;
class SampledEffect;

// Represents the effect of an Animation on an Element's properties.
// http://w3c.github.io/web-animations/#the-keyframeeffect-interfaces
class CORE_EXPORT KeyframeEffectReadOnly : public AnimationEffectReadOnly {
  DEFINE_WRAPPERTYPEINFO();

 public:
  enum Priority { DefaultPriority, TransitionPriority };

  static KeyframeEffectReadOnly* create(Element*,
                                        EffectModel*,
                                        const Timing&,
                                        Priority = DefaultPriority,
                                        EventDelegate* = nullptr);
  // Web Animations API Bindings constructors.
  static KeyframeEffectReadOnly* create(
      ExecutionContext*,
      Element*,
      const DictionarySequenceOrDictionary& effectInput,
      double duration,
      ExceptionState&);
  static KeyframeEffectReadOnly* create(
      ExecutionContext*,
      Element*,
      const DictionarySequenceOrDictionary& effectInput,
      const KeyframeEffectOptions& timingInput,
      ExceptionState&);
  static KeyframeEffectReadOnly* create(
      ExecutionContext*,
      Element*,
      const DictionarySequenceOrDictionary& effectInput,
      ExceptionState&);

  ~KeyframeEffectReadOnly() override {}

  bool isKeyframeEffectReadOnly() const override { return true; }

  bool affects(PropertyHandle) const;
  const EffectModel* model() const { return m_model.get(); }
  EffectModel* model() { return m_model.get(); }
  void setModel(EffectModel* model) { m_model = model; }
  Priority getPriority() const { return m_priority; }
  Element* target() const { return m_target; }

  void notifySampledEffectRemovedFromEffectStack();

  bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const;
  // Must only be called once.
  bool maybeStartAnimationOnCompositor(int group,
                                       double startTime,
                                       double timeOffset,
                                       double animationPlaybackRate);
  bool hasActiveAnimationsOnCompositor() const;
  bool hasActiveAnimationsOnCompositor(CSSPropertyID) const;
  bool cancelAnimationOnCompositor();
  void restartAnimationOnCompositor();
  void cancelIncompatibleAnimationsOnCompositor();
  void pauseAnimationForTestingOnCompositor(double pauseTime);

  void attachCompositedLayers();

  void setCompositorAnimationIdsForTesting(
      const Vector<int>& compositorAnimationIds) {
    m_compositorAnimationIds = compositorAnimationIds;
  }

  DECLARE_VIRTUAL_TRACE();

  void downgradeToNormal() { m_priority = DefaultPriority; }

 protected:
  KeyframeEffectReadOnly(Element*,
                         EffectModel*,
                         const Timing&,
                         Priority,
                         EventDelegate*);

  void applyEffects();
  void clearEffects();
  void updateChildrenAndEffects() const override;
  void attach(Animation*) override;
  void detach() override;
  void specifiedTimingChanged() override;
  double calculateTimeToEffectChange(bool forwards,
                                     double inheritedTime,
                                     double timeToNextIteration) const override;
  virtual bool hasIncompatibleStyle();
  bool hasMultipleTransformProperties() const;

 private:
  Member<Element> m_target;
  Member<EffectModel> m_model;
  Member<SampledEffect> m_sampledEffect;

  Priority m_priority;

  Vector<int> m_compositorAnimationIds;
};

DEFINE_TYPE_CASTS(KeyframeEffectReadOnly,
                  AnimationEffectReadOnly,
                  animationNode,
                  animationNode->isKeyframeEffectReadOnly(),
                  animationNode.isKeyframeEffectReadOnly());

}  // namespace blink

#endif  // KeyframeEffectReadOnly_h