/src/mozilla-central/dom/animation/AnimationPerformanceWarning.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | AnimationPerformanceWarning::ToLocalizedStringWithIntParams( |
15 | | const char* aKey, nsAString& aLocalizedString) const |
16 | 0 | { |
17 | 0 | nsAutoString strings[N]; |
18 | 0 | const char16_t* charParams[N]; |
19 | 0 |
|
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 | 0 | } |
24 | 0 |
|
25 | 0 | return nsContentUtils::FormatLocalizedString( |
26 | 0 | nsContentUtils::eLAYOUT_PROPERTIES, aKey, charParams, aLocalizedString); |
27 | 0 | } Unexecuted instantiation: nsresult mozilla::AnimationPerformanceWarning::ToLocalizedStringWithIntParams<7u>(char const*, nsTSubstring<char16_t>&) const Unexecuted instantiation: nsresult mozilla::AnimationPerformanceWarning::ToLocalizedStringWithIntParams<3u>(char const*, nsTSubstring<char16_t>&) const |
28 | | |
29 | | bool |
30 | | AnimationPerformanceWarning::ToLocalizedString( |
31 | | nsAString& aLocalizedString) const |
32 | 0 | { |
33 | 0 | const char* key = nullptr; |
34 | 0 |
|
35 | 0 | switch (mType) { |
36 | 0 | case Type::ContentTooLarge: |
37 | 0 | MOZ_ASSERT(mParams && mParams->Length() == 6, |
38 | 0 | "Parameter's length should be 6 for ContentTooLarge2"); |
39 | 0 |
|
40 | 0 | return NS_SUCCEEDED( |
41 | 0 | ToLocalizedStringWithIntParams<7>( |
42 | 0 | "CompositorAnimationWarningContentTooLarge2", aLocalizedString)); |
43 | 0 | case Type::ContentTooLargeArea: |
44 | 0 | MOZ_ASSERT(mParams && mParams->Length() == 2, |
45 | 0 | "Parameter's length should be 2 for ContentTooLargeArea"); |
46 | 0 |
|
47 | 0 | return NS_SUCCEEDED( |
48 | 0 | ToLocalizedStringWithIntParams<3>( |
49 | 0 | "CompositorAnimationWarningContentTooLargeArea", aLocalizedString)); |
50 | 0 | case Type::TransformBackfaceVisibilityHidden: |
51 | 0 | key = "CompositorAnimationWarningTransformBackfaceVisibilityHidden"; |
52 | 0 | break; |
53 | 0 | case Type::TransformPreserve3D: |
54 | 0 | key = "CompositorAnimationWarningTransformPreserve3D"; |
55 | 0 | break; |
56 | 0 | case Type::TransformSVG: |
57 | 0 | key = "CompositorAnimationWarningTransformSVG"; |
58 | 0 | break; |
59 | 0 | case Type::TransformWithGeometricProperties: |
60 | 0 | key = "CompositorAnimationWarningTransformWithGeometricProperties"; |
61 | 0 | break; |
62 | 0 | case Type::TransformWithSyncGeometricAnimations: |
63 | 0 | key = "CompositorAnimationWarningTransformWithSyncGeometricAnimations"; |
64 | 0 | break; |
65 | 0 | case Type::TransformFrameInactive: |
66 | 0 | key = "CompositorAnimationWarningTransformFrameInactive"; |
67 | 0 | break; |
68 | 0 | case Type::OpacityFrameInactive: |
69 | 0 | key = "CompositorAnimationWarningOpacityFrameInactive"; |
70 | 0 | break; |
71 | 0 | case Type::HasRenderingObserver: |
72 | 0 | key = "CompositorAnimationWarningHasRenderingObserver"; |
73 | 0 | break; |
74 | 0 | } |
75 | 0 | |
76 | 0 | nsresult rv = |
77 | 0 | nsContentUtils::GetLocalizedString(nsContentUtils::eLAYOUT_PROPERTIES, |
78 | 0 | key, aLocalizedString); |
79 | 0 | return NS_SUCCEEDED(rv); |
80 | 0 | } |
81 | | |
82 | | } // namespace mozilla |