blob: 4b5afe57c6ce9478c17ea8c81d78177805a1f5b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/animation/svg_interpolation_types_map.h"
#include <memory>
#include <utility>
#include "third_party/blink/renderer/core/animation/svg_angle_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_integer_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_length_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_number_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_path_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_rect_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/svg_value_interpolation_type.h"
#include "third_party/blink/renderer/core/html_names.h"
namespace blink {
const InterpolationTypes& SVGInterpolationTypesMap::Get(
const PropertyHandle& property) const {
using ApplicableTypesMap =
HashMap<PropertyHandle, std::unique_ptr<const InterpolationTypes>>;
DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicable_types_map, ());
auto entry = applicable_types_map.find(property);
if (entry != applicable_types_map.end())
return *entry->value.get();
std::unique_ptr<InterpolationTypes> applicable_types =
std::make_unique<InterpolationTypes>();
const QualifiedName& attribute = property.SvgAttribute();
if (attribute == svg_names::kOrientAttr) {
applicable_types->push_back(
std::make_unique<SVGAngleInterpolationType>(attribute));
} else if (attribute == svg_names::kNumOctavesAttr ||
attribute == svg_names::kTargetXAttr ||
attribute == svg_names::kTargetYAttr) {
applicable_types->push_back(
std::make_unique<SVGIntegerInterpolationType>(attribute));
} else if (attribute == svg_names::kOrderAttr) {
applicable_types->push_back(
std::make_unique<SVGIntegerOptionalIntegerInterpolationType>(
attribute));
} else if (attribute == svg_names::kCxAttr ||
attribute == svg_names::kCyAttr ||
attribute == svg_names::kFxAttr ||
attribute == svg_names::kFyAttr ||
attribute == svg_names::kHeightAttr ||
attribute == svg_names::kMarkerHeightAttr ||
attribute == svg_names::kMarkerWidthAttr ||
attribute == svg_names::kRAttr ||
attribute == svg_names::kRefXAttr ||
attribute == svg_names::kRefYAttr ||
attribute == svg_names::kRxAttr ||
attribute == svg_names::kRyAttr ||
attribute == svg_names::kStartOffsetAttr ||
attribute == svg_names::kTextLengthAttr ||
attribute == svg_names::kWidthAttr ||
attribute == svg_names::kX1Attr ||
attribute == svg_names::kX2Attr ||
attribute == svg_names::kY1Attr ||
attribute == svg_names::kY2Attr) {
applicable_types->push_back(
std::make_unique<SVGLengthInterpolationType>(attribute));
} else if (attribute == svg_names::kDxAttr ||
attribute == svg_names::kDyAttr) {
applicable_types->push_back(
std::make_unique<SVGNumberInterpolationType>(attribute));
applicable_types->push_back(
std::make_unique<SVGLengthListInterpolationType>(attribute));
} else if (attribute == svg_names::kXAttr || attribute == svg_names::kYAttr) {
applicable_types->push_back(
std::make_unique<SVGLengthInterpolationType>(attribute));
applicable_types->push_back(
std::make_unique<SVGLengthListInterpolationType>(attribute));
} else if (attribute == svg_names::kAmplitudeAttr ||
attribute == svg_names::kAzimuthAttr ||
attribute == svg_names::kBiasAttr ||
attribute == svg_names::kDiffuseConstantAttr ||
attribute == svg_names::kDivisorAttr ||
attribute == svg_names::kElevationAttr ||
attribute == svg_names::kExponentAttr ||
attribute == svg_names::kInterceptAttr ||
attribute == svg_names::kK1Attr ||
attribute == svg_names::kK2Attr ||
attribute == svg_names::kK3Attr ||
attribute == svg_names::kK4Attr ||
attribute == svg_names::kLimitingConeAngleAttr ||
attribute == svg_names::kOffsetAttr ||
attribute == svg_names::kPathLengthAttr ||
attribute == svg_names::kPointsAtXAttr ||
attribute == svg_names::kPointsAtYAttr ||
attribute == svg_names::kPointsAtZAttr ||
attribute == svg_names::kScaleAttr ||
attribute == svg_names::kSeedAttr ||
attribute == svg_names::kSlopeAttr ||
attribute == svg_names::kSpecularConstantAttr ||
attribute == svg_names::kSpecularExponentAttr ||
attribute == svg_names::kSurfaceScaleAttr ||
attribute == svg_names::kZAttr) {
applicable_types->push_back(
std::make_unique<SVGNumberInterpolationType>(attribute));
} else if (attribute == svg_names::kKernelMatrixAttr ||
attribute == svg_names::kRotateAttr ||
attribute == svg_names::kTableValuesAttr ||
attribute == svg_names::kValuesAttr) {
applicable_types->push_back(
std::make_unique<SVGNumberListInterpolationType>(attribute));
} else if (attribute == svg_names::kBaseFrequencyAttr ||
attribute == svg_names::kKernelUnitLengthAttr ||
attribute == svg_names::kRadiusAttr ||
attribute == svg_names::kStdDeviationAttr) {
applicable_types->push_back(
std::make_unique<SVGNumberOptionalNumberInterpolationType>(attribute));
} else if (attribute == svg_names::kDAttr) {
applicable_types->push_back(
std::make_unique<SVGPathInterpolationType>(attribute));
} else if (attribute == svg_names::kPointsAttr) {
applicable_types->push_back(
std::make_unique<SVGPointListInterpolationType>(attribute));
} else if (attribute == svg_names::kViewBoxAttr) {
applicable_types->push_back(
std::make_unique<SVGRectInterpolationType>(attribute));
} else if (attribute == svg_names::kGradientTransformAttr ||
attribute == svg_names::kPatternTransformAttr ||
attribute == svg_names::kTransformAttr) {
applicable_types->push_back(
std::make_unique<SVGTransformListInterpolationType>(attribute));
} else if (attribute == html_names::kClassAttr ||
attribute == svg_names::kClipPathUnitsAttr ||
attribute == svg_names::kEdgeModeAttr ||
attribute == svg_names::kFilterUnitsAttr ||
attribute == svg_names::kGradientUnitsAttr ||
attribute == svg_names::kHrefAttr ||
attribute == svg_names::kInAttr ||
attribute == svg_names::kIn2Attr ||
attribute == svg_names::kLengthAdjustAttr ||
attribute == svg_names::kMarkerUnitsAttr ||
attribute == svg_names::kMaskContentUnitsAttr ||
attribute == svg_names::kMaskUnitsAttr ||
attribute == svg_names::kMethodAttr ||
attribute == svg_names::kModeAttr ||
attribute == svg_names::kOperatorAttr ||
attribute == svg_names::kPatternContentUnitsAttr ||
attribute == svg_names::kPatternUnitsAttr ||
attribute == svg_names::kPreserveAlphaAttr ||
attribute == svg_names::kPreserveAspectRatioAttr ||
attribute == svg_names::kPrimitiveUnitsAttr ||
attribute == svg_names::kResultAttr ||
attribute == svg_names::kSpacingAttr ||
attribute == svg_names::kSpreadMethodAttr ||
attribute == svg_names::kStitchTilesAttr ||
attribute == svg_names::kTargetAttr ||
attribute == svg_names::kTypeAttr ||
attribute == svg_names::kXChannelSelectorAttr ||
attribute == svg_names::kYChannelSelectorAttr) {
// Use default SVGValueInterpolationType.
} else {
NOTREACHED();
}
applicable_types->push_back(
std::make_unique<SVGValueInterpolationType>(attribute));
auto add_result =
applicable_types_map.insert(property, std::move(applicable_types));
return *add_result.stored_value->value.get();
}
} // namespace blink
|