LayerAnimationInfo.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "LayerAnimationInfo.h"
  5. #include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
  6. namespace mozilla {
  7. /* static */ const LayerAnimationInfo::Record LayerAnimationInfo::sRecords[] =
  8. { { eCSSProperty_transform,
  9. nsDisplayItem::TYPE_TRANSFORM,
  10. nsChangeHint_UpdateTransformLayer },
  11. { eCSSProperty_opacity,
  12. nsDisplayItem::TYPE_OPACITY,
  13. nsChangeHint_UpdateOpacityLayer } };
  14. #ifdef DEBUG
  15. /* static */ void
  16. LayerAnimationInfo::Initialize()
  17. {
  18. for (const Record& record : sRecords) {
  19. MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
  20. CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
  21. "CSS property with entry in LayerAnimation::sRecords does not "
  22. "have the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag");
  23. }
  24. // Check that every property with the flag for animating on the
  25. // compositor has an entry in LayerAnimationInfo::sRecords.
  26. for (nsCSSPropertyID prop = nsCSSPropertyID(0);
  27. prop < eCSSProperty_COUNT;
  28. prop = nsCSSPropertyID(prop + 1)) {
  29. if (nsCSSProps::PropHasFlags(prop,
  30. CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
  31. bool found = false;
  32. for (const Record& record : sRecords) {
  33. if (record.mProperty == prop) {
  34. found = true;
  35. break;
  36. }
  37. }
  38. MOZ_ASSERT(found,
  39. "CSS property with the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR "
  40. "flag does not have an entry in LayerAnimationInfo::sRecords");
  41. }
  42. }
  43. }
  44. #endif
  45. } // namespace mozilla