Commit Graph

2776 Commits

Author SHA1 Message Date
Mike Welsh e8ec02418b avm2: Fix Array.splice
Fix `Array.splice` in cases where elements are added but not
deleted, and when the starting index is larger than the length
of the array.
2021-04-30 13:48:27 -07:00
Mike Welsh 2a46c72bb2 avm1: Fix Array.splice
Clamp the index parameters to the length of the array. This fixes
`[].splice(1, 0, 'obj');` to add the object at the proper
position (0, because the start index 1 is larger than the length).
2021-04-30 13:48:27 -07:00
dependabot-preview[bot] b57e1a14f0 build(deps): bump syn from 1.0.70 to 1.0.71
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.70 to 1.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.70...1.0.71)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-28 10:02:43 -07:00
David Wendt 041003f256 avm2: Slot lookups don't need the whole trait list, just the first one we find. 2021-04-28 00:01:47 -07:00
David Wendt fd08a6ebf6 avm2: Instantiate slot traits on `get_slot`, `set_slot` etc.
Previously, we only instantiated slot traits when named as a property, which is only half the picture.
2021-04-28 00:01:47 -07:00
David Wendt e35d1edbf0 avm2: Allow pulling traits by slot id 2021-04-28 00:01:47 -07:00
David Wendt 07db1786f1 tests: Add a test for AVM2 nested closures (which thus tests `newactivation`) 2021-04-28 00:01:47 -07:00
David Wendt 9318028b52 avm2: `newactivation` should return an object which implements the traits listed in the associated method `body`'s trait list 2021-04-28 00:01:47 -07:00
David Wendt 6c5098d3c7 avm2: Fix order in which `setslot` takes it's parameters 2021-04-28 00:01:47 -07:00
Adrian Wielgosik 5a6117722d core: Also hide playback controls on single-frame SWFs 2021-04-27 16:42:02 -07:00
Adrian Wielgosik a1737b5922 avm1: Respect menu.builtInItems, but on root clip only 2021-04-27 16:42:02 -07:00
Adrian Wielgosik c3a16cb992 avm2: Support Stage.showDefaultContextMenu 2021-04-27 16:42:02 -07:00
Adrian Wielgosik ce4d66e0f4 avm1: support Stage.showMenu 2021-04-27 16:42:02 -07:00
Adrian Wielgosik 41a126885c web: Minimal context menu buttons for movie control 2021-04-27 16:42:02 -07:00
TÖRÖK Attila 61fddf530e core/display_object: Correctly draw videos that have different bounds than the size of their actual frame data 2021-04-27 11:49:16 -07:00
Mike Welsh 1f8434aee6 tests: Add test for Stage.scaleMode/align 2021-04-26 01:15:42 -07:00
Mike Welsh a57f227bda core: Implement Stage resize events 2021-04-26 01:15:42 -07:00
Mike Welsh 251fd55567 core: Adjust stage size by DPI factor in NoScale scale mode 2021-04-26 01:15:42 -07:00
Mike Welsh 98befe678e avm2: Add flash.display.StageScaleMode and Stage.scaleMode 2021-04-26 01:15:42 -07:00
Mike Welsh 80bcf68634 avm1: Add StageScaleMode and StageAlign properties to Stage 2021-04-26 01:15:42 -07:00
Mike Welsh b4717130e3 core: Add StageScaleMode and StageAlign properties to Stage 2021-04-26 01:15:42 -07:00
David Wendt a877fe8c67 tests: Add a new test for properties unique to the `Stage` 2021-04-26 01:15:42 -07:00
David Wendt 52c3b0f1bc avm2: `Stage.color` yields background color alpha (always 0xFF) in the high bits of the u32 2021-04-26 01:15:42 -07:00
David Wendt 41fe51e9db avm2: Impl `flash.display.StageQuality` enum 2021-04-26 01:15:42 -07:00
David Wendt 93d7f0b450 avm2: Stub `Stage.quality` 2021-04-26 01:15:42 -07:00
David Wendt 327a425fde avm2: Stub `Stage.allowsFullScreen` and `Stage.allowsFullScreenInteractive` 2021-04-26 01:15:42 -07:00
David Wendt cb167e0814 avm2: Impl `Stage.stageWidth`/`Stage.stageHeight`, sorta 2021-04-26 01:15:42 -07:00
David Wendt 1ee5bbf7ba avm2: Impl `Stage.frameRate` 2021-04-26 01:15:42 -07:00
David Wendt 5d8f70d695 avm2: Implement `Stage.focus` 2021-04-26 01:15:42 -07:00
David Wendt 524f5fe57f avm2: Impl `Stage.color`'s setter 2021-04-26 01:15:42 -07:00
David Wendt 6c6bd74af9 avm2: Impl `Stage.displayState`'s getter 2021-04-26 01:15:42 -07:00
David Wendt ae080fd65f avm2: Impl `flash.display.StageDisplayState` 2021-04-26 01:15:42 -07:00
David Wendt b858f74139 avm2: Impl `Stage.contentsScaleFactor` 2021-04-26 01:15:42 -07:00
David Wendt 247f7e3de4 avm2: Impl `Stage.color` 2021-04-26 01:15:42 -07:00
David Wendt d7a0d15fd8 avm2: Expose `Stage.browserZoomFactor` 2021-04-26 01:15:42 -07:00
David Wendt 0c6584ca03 core: Store the viewport's scale factor on the stage 2021-04-26 01:15:42 -07:00
David Wendt 98788ef194 avm2: Impl `flash.display.StageAlign` 2021-04-26 01:15:42 -07:00
David Wendt 2a30887660 avm2: Support the half-broken `loaderInfo` on the `Stage` 2021-04-26 01:15:42 -07:00
David Wendt ef4db9ba16 avm2: Add overrides for every property that cannot be set on the `Stage`.
Yes, this includes properties that aren't implemented yet. They'll return a different error, but they'll still error out regardless, so I'm fine with this.
2021-04-26 01:15:42 -07:00
David Wendt bc9affb09d tests: Add tests for stage access and basic display object properties 2021-04-26 01:15:42 -07:00
David Wendt 716d492006 avm2: The stage's name should be `null`, not an empty string; and setting it should except. 2021-04-26 01:15:42 -07:00
David Wendt 01f74f6eb1 avm2: Add a convenience method for marking a builtin override trait. 2021-04-26 01:15:42 -07:00
David Wendt 8452e23382 avm2: Allow access to the `Stage`, both directly and indirectly 2021-04-26 01:15:42 -07:00
David Wendt ba66c62947 core: Ensure `Stage` always has an AVM2 representation 2021-04-26 01:15:42 -07:00
David Wendt 81de112774 avm2: Add `Stage` class stub 2021-04-26 01:15:42 -07:00
David Wendt 7f4a99ca60 core: Add a `root_clip` method for `Stage` and make everything grabbing depth 0 off the stage use it 2021-04-26 01:15:42 -07:00
David Wendt 36e486b1d0 core: We don't need `CollectWrapper` anymore 2021-04-26 01:15:42 -07:00
David Wendt f6fe0a84a2 core: Move the viewport and stage dimensions into the `Stage`. 2021-04-26 01:15:42 -07:00
David Wendt c09bd0520c core: Run all of the steps of a frame update on the `Stage` 2021-04-26 01:15:42 -07:00
David Wendt b021d04345 core: Correct order of viewport bounds in render context 2021-04-26 01:15:42 -07:00
David Wendt 4e4f1dce26 core: `Stage` should render it's children 2021-04-26 01:15:42 -07:00
David Wendt 7341fa0554 core: Remove the explicit view bounding box and instead have all the culling code ask the `Stage` what it's bounding box is 2021-04-26 01:15:42 -07:00
David Wendt 67724bfc71 core: Move most of the player rendering code into the `Stage`'s render method. 2021-04-26 01:15:42 -07:00
David Wendt 44af21b398 core: `Letterbox` should be `Collect` 2021-04-26 01:15:42 -07:00
David Wendt 6bf3206d95 core: Replace `context.levels` with a root stage 2021-04-26 01:15:42 -07:00
David Wendt 0011753914 core: Add the ability to iterate over the depth list of any container 2021-04-26 01:15:42 -07:00
David Wendt 14430b9eb0 core: Add a `Stage` display object type 2021-04-26 01:15:42 -07:00
Mike Welsh c422a66aa6 chore: Appease clippy
Fix `bool_assert_comparison` and `from_iter_instead_of_collect` lints.
2021-04-24 21:42:30 -07:00
Mike Welsh d43b033caa tests: Add tests for BitmapData max size 2021-04-24 16:16:24 -07:00
relrelb bab0ae8f30 avm1: Limit width and height of BitmapData 2021-04-24 16:16:24 -07:00
relrelb c78501f2bd avm1: Fix panic in BitmapData.loadBitmap
BitmapData.loadBitmap is not subject to the size limit. That is,
it can load larger bitmaps than the BitmapData constructor.
Fix panic for large bitmaps by not invoking the BitmapData constructor
directly. This should also improve performance.

Do the same for BitmapData.clone.
2021-04-24 16:16:24 -07:00
relrelb 2d3a4910fc avm1: Correct BitmapData constructor
* Extract is_size_valid, which respects 3 different limits:
SWF<=9, SWF10 and SWF>=11.
* Delay is_size_valid check after all arguments coercing.
* Swap the transparency and fill_color parameters of init_pixels.
2021-04-24 16:16:24 -07:00
Mike Welsh d34b72cc47 web: Expose SWF metadata to JavaScript
Add `RufflePlayer.metadata` that exposes the SWF header fields to
JavaScript.

Add `RufflePlayer.readyState` and fire a `loadedmetadata` event
once the metadata is available, mimicking the HTML5 media APIs.
2021-04-23 16:58:24 -07:00
Mike Welsh 33a73c5262 tests: Bump test script timeout 2021-04-23 16:57:28 -07:00
Mike Welsh d58bc9b5c5 core: Disable script timeout in debug builds 2021-04-23 16:57:28 -07:00
David Wendt f33976f4c0 avm2: Store symbol / class relationships using the class constructor, not the prototype. 2021-04-23 00:26:10 -07:00
David Wendt 0ee9e0f820 tests: Add a test for constructing symbol classes in AVM2 2021-04-23 00:26:10 -07:00
David Wendt aa6dc600c0 avm2: Treat construction of symbol classes as symbol instantiation. 2021-04-23 00:26:10 -07:00
David Wendt 815d0fb540 core: Add `DisplayObject` method for setting the AVM2 side of a display object 2021-04-23 00:26:10 -07:00
David Wendt 9b19cc1570 Store the movie associated with a given symbol being constructed. 2021-04-23 00:26:10 -07:00
David Wendt 282508a281 core: Make the AVM2 constructor registry global 2021-04-23 00:26:10 -07:00
David Wendt b1be111a4e core: Store constructor prototypes in the constructor registry when defining symbols 2021-04-23 00:26:10 -07:00
David Wendt 555d97006a core: Add an AVM2 constructor registry 2021-04-23 00:26:10 -07:00
David Wendt 68c270e7c0 avm2: Impl `Eq`, `Hash` for `Object` using ptr values 2021-04-23 00:26:10 -07:00
TÖRÖK Attila 3f583088a2 core/avm1: Coerce Rectangle and Point parameter fields to f64 first 2021-04-21 18:46:03 -07:00
TÖRÖK Attila 22306cc8d9 core/avm1: Switch to i32 in BitmapData.merge(), clamp *_mult parameters 2021-04-21 18:46:03 -07:00
TÖRÖK Attila 40eedb6405 core/avm1: Implement BitmapData.merge() 2021-04-21 18:46:03 -07:00
dependabot-preview[bot] 63e8c0c88a build(deps): bump syn from 1.0.69 to 1.0.70
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.69...1.0.70)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-21 18:31:39 -07:00
Adrian Wielgosik 8176e0a633
avm2: minor changes to domain memory
* Do not use as_bytearray_mut when we don't need mutability
* Set default domain memory size to 1024b.
2021-04-21 15:08:13 -07:00
CUB3D 9812fab9f8 chore: Format and fix clippy lints 2021-04-21 00:33:11 -07:00
CUB3D 7c4eb0d7ff avm2: Implement ApplicationDomain.domainMemory 2021-04-21 00:33:11 -07:00
CUB3D b3b1e69fc2 avm2: Store ByteArrayObject in Domain rather than ByteArrayStorage 2021-04-21 00:33:11 -07:00
CUB3D 4dc1210b37 avm2: Use try_into for converting slice->array 2021-04-21 00:33:11 -07:00
CUB3D 98d9bd06b6 avm2: Remove more unused code from test 2021-04-21 00:33:11 -07:00
CUB3D d6a3b5bfda avm2: Remove unused code from test 2021-04-21 00:33:11 -07:00
CUB3D 397ceed33c avm2: Dont panic when domain memory not available 2021-04-21 00:33:11 -07:00
CUB3D 136add866a chore: Fix clippy lints 2021-04-21 00:33:11 -07:00
CUB3D 63120806bf avm2: Correct Sxi8 and Sxi16 2021-04-21 00:33:11 -07:00
CUB3D 6d2339b151 avm2: Add tests for Op::Sxi1 2021-04-21 00:33:11 -07:00
CUB3D f34579926c chore: Format 2021-04-21 00:33:11 -07:00
CUB3D 99edb5ab2b avm2: Implement Op::Sxi1 2021-04-21 00:33:11 -07:00
CUB3D 9ffa4f1f50 avm2: Implement Op::Lf64 2021-04-21 00:33:11 -07:00
CUB3D b4736413fa avm2: Implement Op::Sf64 2021-04-21 00:33:11 -07:00
CUB3D 2b4becf41f avm2: Implement Op::Lf32 2021-04-21 00:33:11 -07:00
CUB3D 509392db8e avm2: Implement Op::Sf32 2021-04-21 00:33:11 -07:00
CUB3D dce2626482 avm2: Use from/to_le_bytes 2021-04-21 00:33:11 -07:00
CUB3D 35d7c5a7e3 chore: Format 2021-04-21 00:33:11 -07:00
CUB3D ae9d5fd328 avm2: Implement Op::Li32 2021-04-21 00:33:11 -07:00
CUB3D 951d557a90 avm2: Implement Op::Si32 2021-04-21 00:33:11 -07:00
CUB3D 96ad0e3d00 avm2: Implement Op::Li16 2021-04-21 00:33:11 -07:00