| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 library animations_mojom; | |
| 6 | |
| 7 import 'dart:async'; | |
| 8 | |
| 9 import 'package:mojo/bindings.dart' as bindings; | |
| 10 import 'package:mojo/core.dart' as core; | |
| 11 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom; | |
| 12 | |
| 13 class AnimationTweenType extends bindings.MojoEnum { | |
| 14 static const AnimationTweenType linear = const AnimationTweenType._(0); | |
| 15 static const AnimationTweenType easeIn = const AnimationTweenType._(1); | |
| 16 static const AnimationTweenType easeOut = const AnimationTweenType._(2); | |
| 17 static const AnimationTweenType easeInOut = const AnimationTweenType._(3); | |
| 18 | |
| 19 const AnimationTweenType._(int v) : super(v); | |
| 20 | |
| 21 static const Map<String, AnimationTweenType> valuesMap = const { | |
| 22 "linear": linear, | |
| 23 "easeIn": easeIn, | |
| 24 "easeOut": easeOut, | |
| 25 "easeInOut": easeInOut, | |
| 26 }; | |
| 27 static const List<AnimationTweenType> values = const [ | |
| 28 linear, | |
| 29 easeIn, | |
| 30 easeOut, | |
| 31 easeInOut, | |
| 32 ]; | |
| 33 | |
| 34 static AnimationTweenType valueOf(String name) => valuesMap[name]; | |
| 35 | |
| 36 factory AnimationTweenType(int v) { | |
| 37 switch (v) { | |
| 38 case 0: | |
| 39 return linear; | |
| 40 case 1: | |
| 41 return easeIn; | |
| 42 case 2: | |
| 43 return easeOut; | |
| 44 case 3: | |
| 45 return easeInOut; | |
| 46 default: | |
| 47 return null; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 static AnimationTweenType decode(bindings.Decoder decoder0, int offset) { | |
| 52 int v = decoder0.decodeUint32(offset); | |
| 53 AnimationTweenType result = new AnimationTweenType(v); | |
| 54 if (result == null) { | |
| 55 throw new bindings.MojoCodecError( | |
| 56 'Bad value $v for enum AnimationTweenType.'); | |
| 57 } | |
| 58 return result; | |
| 59 } | |
| 60 | |
| 61 String toString() { | |
| 62 switch(this) { | |
| 63 case linear: | |
| 64 return 'AnimationTweenType.linear'; | |
| 65 case easeIn: | |
| 66 return 'AnimationTweenType.easeIn'; | |
| 67 case easeOut: | |
| 68 return 'AnimationTweenType.easeOut'; | |
| 69 case easeInOut: | |
| 70 return 'AnimationTweenType.easeInOut'; | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 int toJson() => mojoEnumValue; | |
| 75 } | |
| 76 | |
| 77 class AnimationProperty extends bindings.MojoEnum { | |
| 78 static const AnimationProperty none = const AnimationProperty._(0); | |
| 79 static const AnimationProperty opacity = const AnimationProperty._(1); | |
| 80 static const AnimationProperty transform = const AnimationProperty._(2); | |
| 81 | |
| 82 const AnimationProperty._(int v) : super(v); | |
| 83 | |
| 84 static const Map<String, AnimationProperty> valuesMap = const { | |
| 85 "none": none, | |
| 86 "opacity": opacity, | |
| 87 "transform": transform, | |
| 88 }; | |
| 89 static const List<AnimationProperty> values = const [ | |
| 90 none, | |
| 91 opacity, | |
| 92 transform, | |
| 93 ]; | |
| 94 | |
| 95 static AnimationProperty valueOf(String name) => valuesMap[name]; | |
| 96 | |
| 97 factory AnimationProperty(int v) { | |
| 98 switch (v) { | |
| 99 case 0: | |
| 100 return none; | |
| 101 case 1: | |
| 102 return opacity; | |
| 103 case 2: | |
| 104 return transform; | |
| 105 default: | |
| 106 return null; | |
| 107 } | |
| 108 } | |
| 109 | |
| 110 static AnimationProperty decode(bindings.Decoder decoder0, int offset) { | |
| 111 int v = decoder0.decodeUint32(offset); | |
| 112 AnimationProperty result = new AnimationProperty(v); | |
| 113 if (result == null) { | |
| 114 throw new bindings.MojoCodecError( | |
| 115 'Bad value $v for enum AnimationProperty.'); | |
| 116 } | |
| 117 return result; | |
| 118 } | |
| 119 | |
| 120 String toString() { | |
| 121 switch(this) { | |
| 122 case none: | |
| 123 return 'AnimationProperty.none'; | |
| 124 case opacity: | |
| 125 return 'AnimationProperty.opacity'; | |
| 126 case transform: | |
| 127 return 'AnimationProperty.transform'; | |
| 128 } | |
| 129 } | |
| 130 | |
| 131 int toJson() => mojoEnumValue; | |
| 132 } | |
| 133 | |
| 134 | |
| 135 | |
| 136 class AnimationValue extends bindings.Struct { | |
| 137 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 138 const bindings.StructDataHeader(24, 0) | |
| 139 ]; | |
| 140 double floatValue = 0.0; | |
| 141 geometry_mojom.Transform transform = null; | |
| 142 | |
| 143 AnimationValue() : super(kVersions.last.size); | |
| 144 | |
| 145 static AnimationValue deserialize(bindings.Message message) { | |
| 146 var decoder = new bindings.Decoder(message); | |
| 147 var result = decode(decoder); | |
| 148 if (decoder.excessHandles != null) { | |
| 149 decoder.excessHandles.forEach((h) => h.close()); | |
| 150 } | |
| 151 return result; | |
| 152 } | |
| 153 | |
| 154 static AnimationValue decode(bindings.Decoder decoder0) { | |
| 155 if (decoder0 == null) { | |
| 156 return null; | |
| 157 } | |
| 158 AnimationValue result = new AnimationValue(); | |
| 159 | |
| 160 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 161 if (mainDataHeader.version <= kVersions.last.version) { | |
| 162 // Scan in reverse order to optimize for more recent versions. | |
| 163 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 164 if (mainDataHeader.version >= kVersions[i].version) { | |
| 165 if (mainDataHeader.size == kVersions[i].size) { | |
| 166 // Found a match. | |
| 167 break; | |
| 168 } | |
| 169 throw new bindings.MojoCodecError( | |
| 170 'Header size doesn\'t correspond to known version size.'); | |
| 171 } | |
| 172 } | |
| 173 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 174 throw new bindings.MojoCodecError( | |
| 175 'Message newer than the last known version cannot be shorter than ' | |
| 176 'required by the last known version.'); | |
| 177 } | |
| 178 if (mainDataHeader.version >= 0) { | |
| 179 | |
| 180 result.floatValue = decoder0.decodeFloat(8); | |
| 181 } | |
| 182 if (mainDataHeader.version >= 0) { | |
| 183 | |
| 184 var decoder1 = decoder0.decodePointer(16, false); | |
| 185 result.transform = geometry_mojom.Transform.decode(decoder1); | |
| 186 } | |
| 187 return result; | |
| 188 } | |
| 189 | |
| 190 void encode(bindings.Encoder encoder) { | |
| 191 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 192 | |
| 193 encoder0.encodeFloat(floatValue, 8); | |
| 194 | |
| 195 encoder0.encodeStruct(transform, 16, false); | |
| 196 } | |
| 197 | |
| 198 String toString() { | |
| 199 return "AnimationValue(" | |
| 200 "floatValue: $floatValue" ", " | |
| 201 "transform: $transform" ")"; | |
| 202 } | |
| 203 | |
| 204 Map toJson() { | |
| 205 Map map = new Map(); | |
| 206 map["floatValue"] = floatValue; | |
| 207 map["transform"] = transform; | |
| 208 return map; | |
| 209 } | |
| 210 } | |
| 211 | |
| 212 | |
| 213 class AnimationElement extends bindings.Struct { | |
| 214 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 215 const bindings.StructDataHeader(40, 0) | |
| 216 ]; | |
| 217 AnimationProperty property = null; | |
| 218 AnimationTweenType tweenType = null; | |
| 219 int duration = 0; | |
| 220 AnimationValue startValue = null; | |
| 221 AnimationValue targetValue = null; | |
| 222 | |
| 223 AnimationElement() : super(kVersions.last.size); | |
| 224 | |
| 225 static AnimationElement deserialize(bindings.Message message) { | |
| 226 var decoder = new bindings.Decoder(message); | |
| 227 var result = decode(decoder); | |
| 228 if (decoder.excessHandles != null) { | |
| 229 decoder.excessHandles.forEach((h) => h.close()); | |
| 230 } | |
| 231 return result; | |
| 232 } | |
| 233 | |
| 234 static AnimationElement decode(bindings.Decoder decoder0) { | |
| 235 if (decoder0 == null) { | |
| 236 return null; | |
| 237 } | |
| 238 AnimationElement result = new AnimationElement(); | |
| 239 | |
| 240 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 241 if (mainDataHeader.version <= kVersions.last.version) { | |
| 242 // Scan in reverse order to optimize for more recent versions. | |
| 243 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 244 if (mainDataHeader.version >= kVersions[i].version) { | |
| 245 if (mainDataHeader.size == kVersions[i].size) { | |
| 246 // Found a match. | |
| 247 break; | |
| 248 } | |
| 249 throw new bindings.MojoCodecError( | |
| 250 'Header size doesn\'t correspond to known version size.'); | |
| 251 } | |
| 252 } | |
| 253 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 254 throw new bindings.MojoCodecError( | |
| 255 'Message newer than the last known version cannot be shorter than ' | |
| 256 'required by the last known version.'); | |
| 257 } | |
| 258 if (mainDataHeader.version >= 0) { | |
| 259 | |
| 260 result.property = AnimationProperty.decode(decoder0, 8); | |
| 261 if (result.property == null) { | |
| 262 throw new bindings.MojoCodecError( | |
| 263 'Trying to decode null union for non-nullable AnimationProperty.'); | |
| 264 } | |
| 265 } | |
| 266 if (mainDataHeader.version >= 0) { | |
| 267 | |
| 268 result.tweenType = AnimationTweenType.decode(decoder0, 12); | |
| 269 if (result.tweenType == null) { | |
| 270 throw new bindings.MojoCodecError( | |
| 271 'Trying to decode null union for non-nullable AnimationTweenType.'); | |
| 272 } | |
| 273 } | |
| 274 if (mainDataHeader.version >= 0) { | |
| 275 | |
| 276 result.duration = decoder0.decodeInt64(16); | |
| 277 } | |
| 278 if (mainDataHeader.version >= 0) { | |
| 279 | |
| 280 var decoder1 = decoder0.decodePointer(24, true); | |
| 281 result.startValue = AnimationValue.decode(decoder1); | |
| 282 } | |
| 283 if (mainDataHeader.version >= 0) { | |
| 284 | |
| 285 var decoder1 = decoder0.decodePointer(32, true); | |
| 286 result.targetValue = AnimationValue.decode(decoder1); | |
| 287 } | |
| 288 return result; | |
| 289 } | |
| 290 | |
| 291 void encode(bindings.Encoder encoder) { | |
| 292 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 293 | |
| 294 encoder0.encodeEnum(property, 8); | |
| 295 | |
| 296 encoder0.encodeEnum(tweenType, 12); | |
| 297 | |
| 298 encoder0.encodeInt64(duration, 16); | |
| 299 | |
| 300 encoder0.encodeStruct(startValue, 24, true); | |
| 301 | |
| 302 encoder0.encodeStruct(targetValue, 32, true); | |
| 303 } | |
| 304 | |
| 305 String toString() { | |
| 306 return "AnimationElement(" | |
| 307 "property: $property" ", " | |
| 308 "tweenType: $tweenType" ", " | |
| 309 "duration: $duration" ", " | |
| 310 "startValue: $startValue" ", " | |
| 311 "targetValue: $targetValue" ")"; | |
| 312 } | |
| 313 | |
| 314 Map toJson() { | |
| 315 Map map = new Map(); | |
| 316 map["property"] = property; | |
| 317 map["tweenType"] = tweenType; | |
| 318 map["duration"] = duration; | |
| 319 map["startValue"] = startValue; | |
| 320 map["targetValue"] = targetValue; | |
| 321 return map; | |
| 322 } | |
| 323 } | |
| 324 | |
| 325 | |
| 326 class AnimationSequence extends bindings.Struct { | |
| 327 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 328 const bindings.StructDataHeader(24, 0) | |
| 329 ]; | |
| 330 int cycleCount = 0; | |
| 331 List<AnimationElement> elements = null; | |
| 332 | |
| 333 AnimationSequence() : super(kVersions.last.size); | |
| 334 | |
| 335 static AnimationSequence deserialize(bindings.Message message) { | |
| 336 var decoder = new bindings.Decoder(message); | |
| 337 var result = decode(decoder); | |
| 338 if (decoder.excessHandles != null) { | |
| 339 decoder.excessHandles.forEach((h) => h.close()); | |
| 340 } | |
| 341 return result; | |
| 342 } | |
| 343 | |
| 344 static AnimationSequence decode(bindings.Decoder decoder0) { | |
| 345 if (decoder0 == null) { | |
| 346 return null; | |
| 347 } | |
| 348 AnimationSequence result = new AnimationSequence(); | |
| 349 | |
| 350 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 351 if (mainDataHeader.version <= kVersions.last.version) { | |
| 352 // Scan in reverse order to optimize for more recent versions. | |
| 353 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 354 if (mainDataHeader.version >= kVersions[i].version) { | |
| 355 if (mainDataHeader.size == kVersions[i].size) { | |
| 356 // Found a match. | |
| 357 break; | |
| 358 } | |
| 359 throw new bindings.MojoCodecError( | |
| 360 'Header size doesn\'t correspond to known version size.'); | |
| 361 } | |
| 362 } | |
| 363 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 364 throw new bindings.MojoCodecError( | |
| 365 'Message newer than the last known version cannot be shorter than ' | |
| 366 'required by the last known version.'); | |
| 367 } | |
| 368 if (mainDataHeader.version >= 0) { | |
| 369 | |
| 370 result.cycleCount = decoder0.decodeUint32(8); | |
| 371 } | |
| 372 if (mainDataHeader.version >= 0) { | |
| 373 | |
| 374 var decoder1 = decoder0.decodePointer(16, false); | |
| 375 { | |
| 376 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); | |
| 377 result.elements = new List<AnimationElement>(si1.numElements); | |
| 378 for (int i1 = 0; i1 < si1.numElements; ++i1) { | |
| 379 | |
| 380 var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHeader
Size + bindings.kPointerSize * i1, false); | |
| 381 result.elements[i1] = AnimationElement.decode(decoder2); | |
| 382 } | |
| 383 } | |
| 384 } | |
| 385 return result; | |
| 386 } | |
| 387 | |
| 388 void encode(bindings.Encoder encoder) { | |
| 389 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 390 | |
| 391 encoder0.encodeUint32(cycleCount, 8); | |
| 392 | |
| 393 if (elements == null) { | |
| 394 encoder0.encodeNullPointer(16, false); | |
| 395 } else { | |
| 396 var encoder1 = encoder0.encodePointerArray(elements.length, 16, bindings.k
UnspecifiedArrayLength); | |
| 397 for (int i0 = 0; i0 < elements.length; ++i0) { | |
| 398 | |
| 399 encoder1.encodeStruct(elements[i0], bindings.ArrayDataHeader.kHeaderSize
+ bindings.kPointerSize * i0, false); | |
| 400 } | |
| 401 } | |
| 402 } | |
| 403 | |
| 404 String toString() { | |
| 405 return "AnimationSequence(" | |
| 406 "cycleCount: $cycleCount" ", " | |
| 407 "elements: $elements" ")"; | |
| 408 } | |
| 409 | |
| 410 Map toJson() { | |
| 411 Map map = new Map(); | |
| 412 map["cycleCount"] = cycleCount; | |
| 413 map["elements"] = elements; | |
| 414 return map; | |
| 415 } | |
| 416 } | |
| 417 | |
| 418 | |
| 419 class AnimationGroup extends bindings.Struct { | |
| 420 static const List<bindings.StructDataHeader> kVersions = const [ | |
| 421 const bindings.StructDataHeader(24, 0) | |
| 422 ]; | |
| 423 int viewId = 0; | |
| 424 List<AnimationSequence> sequences = null; | |
| 425 | |
| 426 AnimationGroup() : super(kVersions.last.size); | |
| 427 | |
| 428 static AnimationGroup deserialize(bindings.Message message) { | |
| 429 var decoder = new bindings.Decoder(message); | |
| 430 var result = decode(decoder); | |
| 431 if (decoder.excessHandles != null) { | |
| 432 decoder.excessHandles.forEach((h) => h.close()); | |
| 433 } | |
| 434 return result; | |
| 435 } | |
| 436 | |
| 437 static AnimationGroup decode(bindings.Decoder decoder0) { | |
| 438 if (decoder0 == null) { | |
| 439 return null; | |
| 440 } | |
| 441 AnimationGroup result = new AnimationGroup(); | |
| 442 | |
| 443 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
| 444 if (mainDataHeader.version <= kVersions.last.version) { | |
| 445 // Scan in reverse order to optimize for more recent versions. | |
| 446 for (int i = kVersions.length - 1; i >= 0; --i) { | |
| 447 if (mainDataHeader.version >= kVersions[i].version) { | |
| 448 if (mainDataHeader.size == kVersions[i].size) { | |
| 449 // Found a match. | |
| 450 break; | |
| 451 } | |
| 452 throw new bindings.MojoCodecError( | |
| 453 'Header size doesn\'t correspond to known version size.'); | |
| 454 } | |
| 455 } | |
| 456 } else if (mainDataHeader.size < kVersions.last.size) { | |
| 457 throw new bindings.MojoCodecError( | |
| 458 'Message newer than the last known version cannot be shorter than ' | |
| 459 'required by the last known version.'); | |
| 460 } | |
| 461 if (mainDataHeader.version >= 0) { | |
| 462 | |
| 463 result.viewId = decoder0.decodeUint32(8); | |
| 464 } | |
| 465 if (mainDataHeader.version >= 0) { | |
| 466 | |
| 467 var decoder1 = decoder0.decodePointer(16, false); | |
| 468 { | |
| 469 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); | |
| 470 result.sequences = new List<AnimationSequence>(si1.numElements); | |
| 471 for (int i1 = 0; i1 < si1.numElements; ++i1) { | |
| 472 | |
| 473 var decoder2 = decoder1.decodePointer(bindings.ArrayDataHeader.kHeader
Size + bindings.kPointerSize * i1, false); | |
| 474 result.sequences[i1] = AnimationSequence.decode(decoder2); | |
| 475 } | |
| 476 } | |
| 477 } | |
| 478 return result; | |
| 479 } | |
| 480 | |
| 481 void encode(bindings.Encoder encoder) { | |
| 482 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
| 483 | |
| 484 encoder0.encodeUint32(viewId, 8); | |
| 485 | |
| 486 if (sequences == null) { | |
| 487 encoder0.encodeNullPointer(16, false); | |
| 488 } else { | |
| 489 var encoder1 = encoder0.encodePointerArray(sequences.length, 16, bindings.
kUnspecifiedArrayLength); | |
| 490 for (int i0 = 0; i0 < sequences.length; ++i0) { | |
| 491 | |
| 492 encoder1.encodeStruct(sequences[i0], bindings.ArrayDataHeader.kHeaderSiz
e + bindings.kPointerSize * i0, false); | |
| 493 } | |
| 494 } | |
| 495 } | |
| 496 | |
| 497 String toString() { | |
| 498 return "AnimationGroup(" | |
| 499 "viewId: $viewId" ", " | |
| 500 "sequences: $sequences" ")"; | |
| 501 } | |
| 502 | |
| 503 Map toJson() { | |
| 504 Map map = new Map(); | |
| 505 map["viewId"] = viewId; | |
| 506 map["sequences"] = sequences; | |
| 507 return map; | |
| 508 } | |
| 509 } | |
| 510 | |
| 511 | |
| OLD | NEW |