@react-native-ohos/react-native-svg 15.12.1-rc.11 → 15.12.1-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/harmony/svg/BuildProfile.ets +1 -1
- package/harmony/svg/oh-package.json5 +1 -1
- package/harmony/svg/src/main/cpp/SvgNode.h +198 -67
- package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.cpp +4 -3
- package/harmony/svg/src/main/ets/SvgPackage.ts +0 -19
- package/harmony/svg.har +0 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
3
|
*/
|
|
4
|
-
export const HAR_VERSION = '15.12.1-rc.
|
|
4
|
+
export const HAR_VERSION = '15.12.1-rc.12';
|
|
5
5
|
export const BUILD_MODE_NAME = 'debug';
|
|
6
6
|
export const DEBUG = true;
|
|
7
7
|
export const TARGET_NAME = 'default';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
name: '@react-native-ohos/react-native-svg',
|
|
7
7
|
type: 'module',
|
|
8
8
|
main: 'index.ets',
|
|
9
|
-
version: '15.12.1-rc.
|
|
9
|
+
version: '15.12.1-rc.13',
|
|
10
10
|
dependencies: {
|
|
11
11
|
"@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
|
|
12
12
|
},
|
|
@@ -78,11 +78,12 @@ public:
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
template <typename ConcreteProps>
|
|
81
|
+
template <typename ConcreteProps>
|
|
82
|
+
void UpdateHrefRenderProps(const std::shared_ptr<ConcreteProps> &props, bool inherit = false) {
|
|
82
83
|
if (!props) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
|
|
86
87
|
if (inherit) {
|
|
87
88
|
attributes_.hasInheritedFilter = true;
|
|
88
89
|
}
|
|
@@ -91,7 +92,7 @@ public:
|
|
|
91
92
|
if constexpr (requires { props->propList; }) {
|
|
92
93
|
propSet.insert(props->propList.begin(), props->propList.end());
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
+
|
|
95
96
|
// Always set name and display if available
|
|
96
97
|
if constexpr (requires { props->name; }) {
|
|
97
98
|
attributes_.id = props->name;
|
|
@@ -109,9 +110,9 @@ public:
|
|
|
109
110
|
attributes_.maskId = props->mask;
|
|
110
111
|
}
|
|
111
112
|
if constexpr (requires { props->filter; } &&
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
std::is_same_v<std::decay_t<decltype(props->filter)>, std::string>) {
|
|
114
|
+
attributes_.filterId = props->filter;
|
|
115
|
+
attributes_.hasInheritedFilter = inherit;
|
|
115
116
|
}
|
|
116
117
|
if constexpr (requires { props->opacity; }) {
|
|
117
118
|
attributes_.selfOpacity = props->opacity;
|
|
@@ -134,7 +135,8 @@ public:
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
template <typename ConcreteProps>
|
|
138
|
+
template <typename ConcreteProps>
|
|
139
|
+
void UpdateCommonProps(const std::shared_ptr<ConcreteProps> &props, bool inherit = false) {
|
|
138
140
|
UpdateHrefRenderProps(props, inherit);
|
|
139
141
|
std::unordered_set<std::string> set;
|
|
140
142
|
if constexpr (requires { props->propList; }) {
|
|
@@ -143,79 +145,204 @@ public:
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
// Handle fill properties - support both
|
|
148
|
+
// Handle fill properties - support both object and string forms
|
|
147
149
|
if constexpr (requires { props->fill; }) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
bool hasFillProp = set.count("fill");
|
|
151
|
+
if (props->fill.isString()) {
|
|
152
|
+
auto fillValue = props->fill.asString();
|
|
153
|
+
if (fillValue == "none") {
|
|
154
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
155
|
+
} else if (fillValue == "currentColor") {
|
|
156
|
+
Color color = Color::TRANSPARENT;
|
|
152
157
|
color.SetUseCurrentColor(true);
|
|
153
158
|
attributes_.fillState.SetColor(color, true);
|
|
154
159
|
} else {
|
|
155
|
-
|
|
156
|
-
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
157
|
-
attributes_.fillState.SetColor(Color(colorValue), set.count("fill"));
|
|
158
|
-
} else {
|
|
159
|
-
attributes_.fillState.SetColor(Color::TRANSPARENT, set.count("fill"));
|
|
160
|
-
}
|
|
160
|
+
attributes_.fillState.SetColor(SvgAttributesParser::GetColor(fillValue), hasFillProp);
|
|
161
161
|
}
|
|
162
|
-
} else if (
|
|
163
|
-
uint32_t colorValue = static_cast<uint32_t>(props->fill
|
|
162
|
+
} else if (props->fill.isInt() || props->fill.isDouble()) {
|
|
163
|
+
uint32_t colorValue = props->fill.isInt() ? static_cast<uint32_t>(props->fill.asInt())
|
|
164
|
+
: static_cast<uint32_t>(props->fill.asDouble());
|
|
164
165
|
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
165
|
-
attributes_.fillState.SetColor(Color(colorValue),
|
|
166
|
+
attributes_.fillState.SetColor(Color(colorValue), hasFillProp);
|
|
166
167
|
} else {
|
|
167
|
-
attributes_.fillState.SetColor(Color::TRANSPARENT,
|
|
168
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
169
|
+
}
|
|
170
|
+
} else if (!props->fill.isNull() && props->fill.isObject()) {
|
|
171
|
+
if (props->fill.count("type") > 0) {
|
|
172
|
+
int fillType = props->fill["type"].asInt();
|
|
173
|
+
if (fillType == INHERIT_TYPE) {
|
|
174
|
+
Color color = Color::TRANSPARENT;
|
|
175
|
+
if (props->fill.count("payload") > 0 &&
|
|
176
|
+
(props->fill["payload"].isInt() || props->fill["payload"].isDouble())) {
|
|
177
|
+
uint32_t colorValue = props->fill["payload"].isInt()
|
|
178
|
+
? static_cast<uint32_t>(props->fill["payload"].asInt())
|
|
179
|
+
: static_cast<uint32_t>(props->fill["payload"].asDouble());
|
|
180
|
+
color = Color(colorValue);
|
|
181
|
+
} else if (props->color) {
|
|
182
|
+
color = Color(*props->color);
|
|
183
|
+
}
|
|
184
|
+
color.SetUseCurrentColor(true);
|
|
185
|
+
attributes_.fillState.SetColor(color, true);
|
|
186
|
+
} else if (props->fill.count("payload") > 0) {
|
|
187
|
+
const auto &payload = props->fill["payload"];
|
|
188
|
+
if (payload.isString()) {
|
|
189
|
+
auto payloadValue = payload.asString();
|
|
190
|
+
if (payloadValue == "none") {
|
|
191
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
192
|
+
} else if (payloadValue == "currentColor") {
|
|
193
|
+
Color color = Color::TRANSPARENT;
|
|
194
|
+
color.SetUseCurrentColor(true);
|
|
195
|
+
attributes_.fillState.SetColor(color, true);
|
|
196
|
+
} else {
|
|
197
|
+
attributes_.fillState.SetColor(SvgAttributesParser::GetColor(payloadValue),
|
|
198
|
+
hasFillProp);
|
|
199
|
+
}
|
|
200
|
+
} else if (payload.isInt() || payload.isDouble()) {
|
|
201
|
+
uint32_t colorValue = payload.isInt() ? static_cast<uint32_t>(payload.asInt())
|
|
202
|
+
: static_cast<uint32_t>(payload.asDouble());
|
|
203
|
+
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
204
|
+
attributes_.fillState.SetColor(Color(colorValue), hasFillProp);
|
|
205
|
+
} else {
|
|
206
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
213
|
+
}
|
|
214
|
+
} else if (props->fill.count("payload") > 0) {
|
|
215
|
+
const auto &payload = props->fill["payload"];
|
|
216
|
+
if (payload.isString()) {
|
|
217
|
+
auto payloadValue = payload.asString();
|
|
218
|
+
if (payloadValue == "none") {
|
|
219
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
220
|
+
} else if (payloadValue == "currentColor") {
|
|
221
|
+
Color color = Color::TRANSPARENT;
|
|
222
|
+
color.SetUseCurrentColor(true);
|
|
223
|
+
attributes_.fillState.SetColor(color, true);
|
|
224
|
+
} else {
|
|
225
|
+
attributes_.fillState.SetColor(SvgAttributesParser::GetColor(payloadValue), hasFillProp);
|
|
226
|
+
}
|
|
227
|
+
} else if (payload.isInt() || payload.isDouble()) {
|
|
228
|
+
uint32_t colorValue = payload.isInt() ? static_cast<uint32_t>(payload.asInt())
|
|
229
|
+
: static_cast<uint32_t>(payload.asDouble());
|
|
230
|
+
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
231
|
+
attributes_.fillState.SetColor(Color(colorValue), hasFillProp);
|
|
232
|
+
} else {
|
|
233
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
240
|
+
}
|
|
241
|
+
if (props->fill.count("brushRef") > 0) {
|
|
242
|
+
attributes_.fillState.SetHref(props->fill["brushRef"].asString());
|
|
168
243
|
}
|
|
169
244
|
} else {
|
|
170
|
-
attributes_.fillState.SetColor(Color::TRANSPARENT,
|
|
171
|
-
}
|
|
172
|
-
if (!props->fill.isNull() && props->fill.count("brushRef") > 0) {
|
|
173
|
-
attributes_.fillState.SetHref(props->fill["brushRef"].asString());
|
|
245
|
+
attributes_.fillState.SetColor(Color::TRANSPARENT, hasFillProp);
|
|
174
246
|
}
|
|
175
247
|
}
|
|
176
248
|
|
|
177
|
-
// Handle stroke properties - support both
|
|
249
|
+
// Handle stroke properties - support both object and string forms
|
|
178
250
|
if constexpr (requires { props->stroke; }) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
251
|
+
bool hasStrokeProp = set.count("stroke");
|
|
252
|
+
if (props->stroke.isString()) {
|
|
253
|
+
auto strokeValue = props->stroke.asString();
|
|
254
|
+
if (strokeValue == "none") {
|
|
255
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
256
|
+
} else if (strokeValue == "currentColor") {
|
|
257
|
+
Color color = Color::TRANSPARENT;
|
|
258
|
+
color.SetUseCurrentColor(true);
|
|
259
|
+
attributes_.strokeState.SetColor(color, true);
|
|
260
|
+
} else {
|
|
261
|
+
attributes_.strokeState.SetColor(SvgAttributesParser::GetColor(strokeValue), hasStrokeProp);
|
|
262
|
+
}
|
|
263
|
+
} else if (props->stroke.isInt() || props->stroke.isDouble()) {
|
|
264
|
+
uint32_t colorValue = props->stroke.isInt() ? static_cast<uint32_t>(props->stroke.asInt())
|
|
265
|
+
: static_cast<uint32_t>(props->stroke.asDouble());
|
|
266
|
+
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
267
|
+
attributes_.strokeState.SetColor(Color(colorValue), hasStrokeProp);
|
|
268
|
+
} else {
|
|
269
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
270
|
+
}
|
|
271
|
+
} else if (!props->stroke.isNull() && props->stroke.isObject()) {
|
|
272
|
+
if (props->stroke.count("type") > 0) {
|
|
273
|
+
int strokeType = props->stroke["type"].asInt();
|
|
274
|
+
if (strokeType == INHERIT_TYPE) {
|
|
275
|
+
Color color = Color::TRANSPARENT;
|
|
276
|
+
if (props->stroke.count("payload") > 0 &&
|
|
277
|
+
(props->stroke["payload"].isInt() || props->stroke["payload"].isDouble())) {
|
|
278
|
+
uint32_t colorValue = props->stroke["payload"].isInt()
|
|
279
|
+
? static_cast<uint32_t>(props->stroke["payload"].asInt())
|
|
280
|
+
: static_cast<uint32_t>(props->stroke["payload"].asDouble());
|
|
281
|
+
color = Color(colorValue);
|
|
282
|
+
} else if (props->color) {
|
|
283
|
+
color = Color(*props->color);
|
|
284
|
+
}
|
|
184
285
|
color.SetUseCurrentColor(true);
|
|
185
286
|
attributes_.strokeState.SetColor(color, true);
|
|
186
|
-
} else {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
287
|
+
} else if (props->stroke.count("payload") > 0) {
|
|
288
|
+
const auto &payload = props->stroke["payload"];
|
|
289
|
+
if (payload.isString()) {
|
|
290
|
+
auto payloadValue = payload.asString();
|
|
291
|
+
if (payloadValue == "none") {
|
|
292
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
293
|
+
} else if (payloadValue == "currentColor") {
|
|
294
|
+
Color color = Color::TRANSPARENT;
|
|
295
|
+
color.SetUseCurrentColor(true);
|
|
296
|
+
attributes_.strokeState.SetColor(color, true);
|
|
297
|
+
} else {
|
|
298
|
+
attributes_.strokeState.SetColor(SvgAttributesParser::GetColor(payloadValue),
|
|
299
|
+
hasStrokeProp);
|
|
300
|
+
}
|
|
301
|
+
} else if (payload.isInt() || payload.isDouble()) {
|
|
302
|
+
uint32_t colorValue = payload.isInt() ? static_cast<uint32_t>(payload.asInt())
|
|
303
|
+
: static_cast<uint32_t>(payload.asDouble());
|
|
304
|
+
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
305
|
+
attributes_.strokeState.SetColor(Color(colorValue), hasStrokeProp);
|
|
306
|
+
} else {
|
|
307
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
308
|
+
}
|
|
191
309
|
} else {
|
|
310
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
} else if (props->stroke.count("payload") > 0) {
|
|
314
|
+
const auto &payload = props->stroke["payload"];
|
|
315
|
+
if (payload.isString()) {
|
|
316
|
+
auto payloadValue = payload.asString();
|
|
317
|
+
if (payloadValue == "none") {
|
|
318
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
319
|
+
} else if (payloadValue == "currentColor") {
|
|
192
320
|
Color color = Color::TRANSPARENT;
|
|
193
321
|
color.SetUseCurrentColor(true);
|
|
194
322
|
attributes_.strokeState.SetColor(color, true);
|
|
323
|
+
} else {
|
|
324
|
+
attributes_.strokeState.SetColor(SvgAttributesParser::GetColor(payloadValue),
|
|
325
|
+
hasStrokeProp);
|
|
195
326
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
uint32_t colorValue = static_cast<uint32_t>(props->stroke["payload"].asInt());
|
|
327
|
+
} else if (payload.isInt() || payload.isDouble()) {
|
|
328
|
+
uint32_t colorValue = payload.isInt() ? static_cast<uint32_t>(payload.asInt())
|
|
329
|
+
: static_cast<uint32_t>(payload.asDouble());
|
|
200
330
|
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
201
|
-
attributes_.strokeState.SetColor(Color(colorValue),
|
|
331
|
+
attributes_.strokeState.SetColor(Color(colorValue), hasStrokeProp);
|
|
202
332
|
} else {
|
|
203
|
-
attributes_.strokeState.SetColor(Color::TRANSPARENT,
|
|
333
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
204
334
|
}
|
|
335
|
+
} else {
|
|
336
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
205
337
|
}
|
|
206
|
-
}
|
|
207
|
-
} else if (!props->stroke.isNull() && props->stroke.count("payload") > 0) {
|
|
208
|
-
uint32_t colorValue = static_cast<uint32_t>(props->stroke["payload"].asInt());
|
|
209
|
-
if (facebook::react::isColorMeaningful(facebook::react::SharedColor(colorValue))) {
|
|
210
|
-
attributes_.strokeState.SetColor(Color(colorValue), set.count("stroke"));
|
|
211
338
|
} else {
|
|
212
|
-
attributes_.strokeState.SetColor(Color::TRANSPARENT,
|
|
339
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
340
|
+
}
|
|
341
|
+
if (props->stroke.count("brushRef") > 0) {
|
|
342
|
+
attributes_.strokeState.SetHref(props->stroke["brushRef"].asString());
|
|
213
343
|
}
|
|
214
344
|
} else {
|
|
215
|
-
attributes_.strokeState.SetColor(Color::TRANSPARENT,
|
|
216
|
-
}
|
|
217
|
-
if (!props->stroke.isNull() && props->stroke.count("brushRef") > 0) {
|
|
218
|
-
attributes_.strokeState.SetHref(props->stroke["brushRef"].asString());
|
|
345
|
+
attributes_.strokeState.SetColor(Color::TRANSPARENT, hasStrokeProp);
|
|
219
346
|
}
|
|
220
347
|
}
|
|
221
348
|
|
|
@@ -228,22 +355,28 @@ public:
|
|
|
228
355
|
if constexpr (requires { props->strokeWidth; }) {
|
|
229
356
|
bool hasStrokeWidthInPropList = set.count("strokeWidth") > 0;
|
|
230
357
|
if (hasStrokeWidthInPropList) {
|
|
231
|
-
attributes_.strokeState.SetLineWidth(
|
|
358
|
+
attributes_.strokeState.SetLineWidth(
|
|
359
|
+
StringUtils::StringToDouble(DynamicUtils::DynamicToString(props->strokeWidth)) * scale_, true);
|
|
232
360
|
}
|
|
233
361
|
}
|
|
234
362
|
if constexpr (requires { props->strokeDasharray; }) {
|
|
235
363
|
attributes_.strokeState.SetStrokeDashArray(
|
|
236
|
-
StringUtils::stringVectorToDoubleVector(DynamicUtils::DynamicToStringVector(props->strokeDasharray),
|
|
364
|
+
StringUtils::stringVectorToDoubleVector(DynamicUtils::DynamicToStringVector(props->strokeDasharray),
|
|
365
|
+
scale_),
|
|
366
|
+
set.count("strokeDasharray"));
|
|
237
367
|
}
|
|
238
368
|
if constexpr (requires { props->strokeDashoffset; }) {
|
|
239
|
-
attributes_.strokeState.SetStrokeDashOffset(props->strokeDashoffset * scale_,
|
|
369
|
+
attributes_.strokeState.SetStrokeDashOffset(props->strokeDashoffset * scale_,
|
|
370
|
+
set.count("strokeDashoffset"));
|
|
240
371
|
}
|
|
241
372
|
if constexpr (requires { props->strokeLinecap; }) {
|
|
242
|
-
attributes_.strokeState.SetLineCap(
|
|
373
|
+
attributes_.strokeState.SetLineCap(
|
|
374
|
+
SvgAttributesParser::GetLineCapStyle(std::to_string(props->strokeLinecap)), set.count("strokeLinecap"));
|
|
243
375
|
}
|
|
244
376
|
if constexpr (requires { props->strokeLinejoin; }) {
|
|
245
377
|
attributes_.strokeState.SetLineJoin(
|
|
246
|
-
SvgAttributesParser::GetLineJoinStyle(std::to_string(props->strokeLinejoin)),
|
|
378
|
+
SvgAttributesParser::GetLineJoinStyle(std::to_string(props->strokeLinejoin)),
|
|
379
|
+
set.count("strokeLinejoin"));
|
|
247
380
|
}
|
|
248
381
|
if constexpr (requires { props->vectorEffect; }) {
|
|
249
382
|
attributes_.strokeState.SetVectorEffect(props->vectorEffect);
|
|
@@ -272,12 +405,12 @@ public:
|
|
|
272
405
|
attributes_.Inherit(parent);
|
|
273
406
|
// svg color -> current color
|
|
274
407
|
if (attributes_.strokeState.GetColor().IsUseCurrentColor()) {
|
|
275
|
-
if(context_) {
|
|
408
|
+
if (context_) {
|
|
276
409
|
attributes_.strokeState.SetColor(context_->GetSvgColor(), true);
|
|
277
410
|
}
|
|
278
411
|
}
|
|
279
412
|
if (attributes_.fillState.GetColor().IsUseCurrentColor()) {
|
|
280
|
-
if(context_) {
|
|
413
|
+
if (context_) {
|
|
281
414
|
attributes_.fillState.SetColor(context_->GetSvgColor(), true);
|
|
282
415
|
}
|
|
283
416
|
}
|
|
@@ -295,10 +428,8 @@ public:
|
|
|
295
428
|
double getCanvasHeight();
|
|
296
429
|
double getCanvasDiagonal();
|
|
297
430
|
|
|
298
|
-
void SetForeignObject(ForeignProps foreignProps) {
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
431
|
+
void SetForeignObject(ForeignProps foreignProps) { _foreignPropsArray.emplace_back(foreignProps); }
|
|
432
|
+
|
|
302
433
|
|
|
303
434
|
protected:
|
|
304
435
|
// override as need by derived class
|
|
@@ -321,10 +452,10 @@ protected:
|
|
|
321
452
|
std::optional<Gradient> GetGradient(const std::string &href);
|
|
322
453
|
|
|
323
454
|
std::shared_ptr<PatternAttr> GetPatternAttr(const std::string &href);
|
|
324
|
-
void DrawForeignPixelMap(OH_Drawing_Canvas *canvas,ForeignProps _foreignProps);
|
|
455
|
+
void DrawForeignPixelMap(OH_Drawing_Canvas *canvas, ForeignProps _foreignProps);
|
|
325
456
|
void DrawForeignMask(OH_Drawing_Canvas *canvas, const std::string &id);
|
|
326
457
|
void DrawForeignClip(OH_Drawing_Canvas *canvas, const std::string &id, int clipRule);
|
|
327
|
-
|
|
458
|
+
|
|
328
459
|
void InitNoneFlag() {
|
|
329
460
|
hrefFill_ = false;
|
|
330
461
|
hrefRender_ = false;
|
|
@@ -351,7 +482,7 @@ protected:
|
|
|
351
482
|
bool hrefFill_ = true; // get fill attributes from reference
|
|
352
483
|
bool hrefRender_ = true; // get render attr (mask, filter, transform, opacity,
|
|
353
484
|
// clip path) from reference
|
|
354
|
-
bool passStyle_ = false;
|
|
485
|
+
bool passStyle_ = false; // pass style attributes to child node, TAGS
|
|
355
486
|
// circle/path/line/... = false
|
|
356
487
|
bool inheritStyle_ = true; // inherit style attributes from parent node, TAGS
|
|
357
488
|
// mask/defs/pattern/filter = false
|
|
@@ -122,10 +122,11 @@ void ImageSourceResolver::imageDownloadFail(std::string uri) {
|
|
|
122
122
|
auto &listeners = it->second;
|
|
123
123
|
for (auto listener : listeners) {
|
|
124
124
|
auto weaklistener = listener.lock();
|
|
125
|
-
if (weaklistener) {
|
|
126
|
-
|
|
127
|
-
removeListenerForURI(uri, weaklistener);
|
|
125
|
+
if (!weaklistener) {
|
|
126
|
+
continue;
|
|
128
127
|
}
|
|
128
|
+
weaklistener->onImageSourceCacheDownloadFileFail();
|
|
129
|
+
removeListenerForURI(uri, weaklistener);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -9,24 +9,6 @@ import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openhar
|
|
|
9
9
|
import { RNSVGSvgViewModule } from './RNSVGSvgViewModule';
|
|
10
10
|
import { RNSVGRenderableModule } from './RNSVGRenderableModule';
|
|
11
11
|
import { RNSVGImageModule } from './RNSVGImageModule';
|
|
12
|
-
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
13
|
-
|
|
14
|
-
class MyLog {
|
|
15
|
-
static e(logTag: string, content: string) {
|
|
16
|
-
const maxSize = 1024;
|
|
17
|
-
if (content.length <= maxSize) {
|
|
18
|
-
// 长度小于等于限制直接打印
|
|
19
|
-
hilog.error(0xFF00, logTag, '%{public}s', content);
|
|
20
|
-
} else {
|
|
21
|
-
while (content.length > maxSize) {
|
|
22
|
-
// 循环分段打印
|
|
23
|
-
let logContent = content.substring(0, maxSize);
|
|
24
|
-
content = content.replace(logContent, '');
|
|
25
|
-
hilog.error(0xFF00, logTag, '%{public}s', logContent); // 打印剩余日志
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
12
|
|
|
31
13
|
class SvgTurboModulesFactory extends TurboModulesFactory {
|
|
32
14
|
|
|
@@ -52,7 +34,6 @@ class SvgTurboModulesFactory extends TurboModulesFactory {
|
|
|
52
34
|
|
|
53
35
|
export class SvgPackage extends RNPackage {
|
|
54
36
|
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
55
|
-
MyLog.e('[kuang] SvgPackage createTurboModulesFactory = ', JSON.stringify(ctx));
|
|
56
37
|
return new SvgTurboModulesFactory(ctx);
|
|
57
38
|
}
|
|
58
39
|
}
|
package/harmony/svg.har
CHANGED
|
Binary file
|