LCOV - code coverage report
Current view: top level - dom/animation - AnimationPerformanceWarning.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "AnimationPerformanceWarning.h"
       8             : 
       9             : #include "nsContentUtils.h"
      10             : 
      11             : namespace mozilla {
      12             : 
      13             : template<uint32_t N> nsresult
      14           0 : AnimationPerformanceWarning::ToLocalizedStringWithIntParams(
      15             :   const char* aKey, nsXPIDLString& aLocalizedString) const
      16             : {
      17           0 :   nsAutoString strings[N];
      18             :   const char16_t* charParams[N];
      19             : 
      20           0 :   for (size_t i = 0, n = mParams->Length(); i < n; i++) {
      21           0 :     strings[i].AppendInt((*mParams)[i]);
      22           0 :     charParams[i] = strings[i].get();
      23             :   }
      24             : 
      25             :   return nsContentUtils::FormatLocalizedString(
      26           0 :       nsContentUtils::eLAYOUT_PROPERTIES, aKey, charParams, aLocalizedString);
      27             : }
      28             : 
      29             : bool
      30           0 : AnimationPerformanceWarning::ToLocalizedString(
      31             :   nsXPIDLString& aLocalizedString) const
      32             : {
      33           0 :   const char* key = nullptr;
      34             : 
      35           0 :   switch (mType) {
      36             :     case Type::ContentTooLarge:
      37           0 :       MOZ_ASSERT(mParams && mParams->Length() == 6,
      38             :                  "Parameter's length should be 6 for ContentTooLarge2");
      39             : 
      40           0 :       return NS_SUCCEEDED(
      41             :         ToLocalizedStringWithIntParams<7>(
      42             :           "CompositorAnimationWarningContentTooLarge2", aLocalizedString));
      43             :     case Type::ContentTooLargeArea:
      44           0 :       MOZ_ASSERT(mParams && mParams->Length() == 2,
      45             :                  "Parameter's length should be 2 for ContentTooLargeArea");
      46             : 
      47           0 :       return NS_SUCCEEDED(
      48             :         ToLocalizedStringWithIntParams<3>(
      49             :           "CompositorAnimationWarningContentTooLargeArea", aLocalizedString));
      50             :     case Type::TransformBackfaceVisibilityHidden:
      51           0 :       key = "CompositorAnimationWarningTransformBackfaceVisibilityHidden";
      52           0 :       break;
      53             :     case Type::TransformPreserve3D:
      54           0 :       key = "CompositorAnimationWarningTransformPreserve3D";
      55           0 :       break;
      56             :     case Type::TransformSVG:
      57           0 :       key = "CompositorAnimationWarningTransformSVG";
      58           0 :       break;
      59             :     case Type::TransformWithGeometricProperties:
      60           0 :       key = "CompositorAnimationWarningTransformWithGeometricProperties";
      61           0 :       break;
      62             :     case Type::TransformWithSyncGeometricAnimations:
      63           0 :       key = "CompositorAnimationWarningTransformWithSyncGeometricAnimations";
      64           0 :       break;
      65             :     case Type::TransformFrameInactive:
      66           0 :       key = "CompositorAnimationWarningTransformFrameInactive";
      67           0 :       break;
      68             :     case Type::OpacityFrameInactive:
      69           0 :       key = "CompositorAnimationWarningOpacityFrameInactive";
      70           0 :       break;
      71             :     case Type::HasRenderingObserver:
      72           0 :       key = "CompositorAnimationWarningHasRenderingObserver";
      73           0 :       break;
      74             :   }
      75             : 
      76             :   nsresult rv =
      77             :     nsContentUtils::GetLocalizedString(nsContentUtils::eLAYOUT_PROPERTIES,
      78           0 :                                        key, aLocalizedString);
      79           0 :   return NS_SUCCEEDED(rv);
      80             : }
      81             : 
      82             : } // namespace mozilla

Generated by: LCOV version 1.13