LCOV - code coverage report
Current view: top level - layout/style - LayerAnimationInfo.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 14 14 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
       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             : 
       6             : #include "LayerAnimationInfo.h"
       7             : 
       8             : #include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
       9             : 
      10             : namespace mozilla {
      11             : 
      12             : /* static */ const LayerAnimationInfo::Record LayerAnimationInfo::sRecords[] =
      13             :   { { eCSSProperty_transform,
      14             :       nsDisplayItem::TYPE_TRANSFORM,
      15             :       nsChangeHint_UpdateTransformLayer },
      16             :     { eCSSProperty_opacity,
      17             :       nsDisplayItem::TYPE_OPACITY,
      18             :       nsChangeHint_UpdateOpacityLayer } };
      19             : 
      20             : #ifdef DEBUG
      21             : /* static */ void
      22           3 : LayerAnimationInfo::Initialize()
      23             : {
      24           9 :   for (const Record& record : sRecords) {
      25           6 :     MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
      26             :                                         CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR),
      27             :                "CSS property with entry in LayerAnimation::sRecords does not "
      28             :                "have the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR flag");
      29             :   }
      30             : 
      31             :   // Check that every property with the flag for animating on the
      32             :   // compositor has an entry in LayerAnimationInfo::sRecords.
      33        1113 :   for (nsCSSPropertyID prop = nsCSSPropertyID(0);
      34        1113 :        prop < eCSSProperty_COUNT;
      35        1110 :        prop = nsCSSPropertyID(prop + 1)) {
      36        1110 :     if (nsCSSProps::PropHasFlags(prop,
      37             :                                  CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR)) {
      38           6 :       bool found = false;
      39           9 :       for (const Record& record : sRecords) {
      40           9 :         if (record.mProperty == prop) {
      41           6 :           found = true;
      42           6 :           break;
      43             :         }
      44             :       }
      45           6 :       MOZ_ASSERT(found,
      46             :                  "CSS property with the CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR "
      47             :                  "flag does not have an entry in LayerAnimationInfo::sRecords");
      48             :     }
      49             :   }
      50           3 : }
      51             : #endif
      52             : 
      53             : } // namespace mozilla

Generated by: LCOV version 1.13