AnimValuesStyleRule.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_AnimValuesStyleRule_h
  6. #define mozilla_AnimValuesStyleRule_h
  7. #include "mozilla/StyleAnimationValue.h"
  8. #include "nsCSSPropertyID.h"
  9. #include "nsCSSPropertyIDSet.h"
  10. #include "nsDataHashtable.h"
  11. #include "nsHashKeys.h" // For nsUint32HashKey
  12. #include "nsIStyleRule.h"
  13. #include "nsISupportsImpl.h" // For NS_DECL_ISUPPORTS
  14. #include "nsRuleNode.h" // For nsCachedStyleData
  15. #include "nsTArray.h" // For nsTArray
  16. namespace mozilla {
  17. /**
  18. * A style rule that maps property-StyleAnimationValue pairs.
  19. */
  20. class AnimValuesStyleRule final : public nsIStyleRule
  21. {
  22. public:
  23. AnimValuesStyleRule()
  24. : mStyleBits(0) {}
  25. // nsISupports implementation
  26. NS_DECL_ISUPPORTS
  27. // nsIStyleRule implementation
  28. void MapRuleInfoInto(nsRuleData* aRuleData) override;
  29. bool MightMapInheritedStyleData() override;
  30. bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
  31. nsCSSValue* aValue) override;
  32. #ifdef DEBUG
  33. void List(FILE* out = stdout, int32_t aIndent = 0) const override;
  34. #endif
  35. // For the following functions, it there is already a value for |aProperty| it
  36. // will be replaced with |aValue|.
  37. void AddValue(nsCSSPropertyID aProperty, const StyleAnimationValue &aValue);
  38. void AddValue(nsCSSPropertyID aProperty, StyleAnimationValue&& aValue);
  39. private:
  40. ~AnimValuesStyleRule() {}
  41. nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mAnimationValues;
  42. uint32_t mStyleBits;
  43. };
  44. } // namespace mozilla
  45. #endif // mozilla_AnimValuesStyleRule_h