Commit Graph

2433 Commits

Author SHA1 Message Date
David Wendt 2e38caafff tests: Add further tests for various timeline interaction scenarios and events 2021-03-03 03:08:01 -08:00
David Wendt 3df97d8da2 avm2: Stub `System.gc`.
Our current garbage collector design precludes the ability to actually collect garbage during player updates, so this is a no-op.
2021-03-03 03:08:01 -08:00
David Wendt 464f388324 avm2: Unstaged display objects are treated as unrooted. 2021-03-03 03:08:01 -08:00
David Wendt 279f2d0652 core: Re-allow reinsertions into the same parent (but still gate off the extra events it would otherwise use) 2021-03-03 03:08:01 -08:00
David Wendt cea65f95db avm2: Dispatch `addedToStage` and `removedFromStage` events 2021-03-03 03:08:01 -08:00
David Wendt 7f78bfa51d core: Add a utility method to check if a display object is rooted to the current stage 2021-03-03 03:08:01 -08:00
David Wendt 5acaf0bd01 core: `iter_render_list` returns a non-locking iterator and should be documented as such. 2021-03-03 03:08:01 -08:00
David Wendt 094563e28f tests: Add a (currently failing) test for the execution order of various events in the presence of programmed display tree manipulations. 2021-03-03 03:08:01 -08:00
David Wendt df5520f3e0 avm2: Dispatch `added` and `removed` events 2021-03-03 03:08:01 -08:00
David Wendt 76ef0d4740 avm2: Event phase should be counted from 1 in `valueOf`. 2021-03-03 03:08:01 -08:00
David Wendt c4a5c6f4d3 avm2: Constructed events start in phase 2, not 3 2021-03-03 03:08:01 -08:00
David Wendt 4521c2b599 avm2: Manually-constructed movie clips (and their subclasses) should be accessible from the display object tree. 2021-03-03 03:08:01 -08:00
David Wendt 63af38be9a avm2: Add convenience method for natively-dispatched events. 2021-03-03 03:08:01 -08:00
Adrian Wielgosik 14e0980226 avm1: Implement getInstanceAtDepth 2021-03-01 15:31:30 -08:00
Mads Marquart 24780003e7 swf: Deduplicate different read methods 2021-02-27 17:04:42 -08:00
Mads Marquart dad21d4398 swf: Make avm2 Reader operate directly with byte slices 2021-02-27 17:04:42 -08:00
Tempy111 00e1f36984 core: Add missing support for Tab keycode 2021-02-27 16:44:39 -08:00
Mike Welsh 3099914374 chore: Appease clippy 2021-02-27 16:10:46 -08:00
dependabot-preview[bot] 8500a676cf build(deps): bump quick-xml from 0.20.0 to 0.22.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.20.0 to 0.22.0.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](https://github.com/tafia/quick-xml/compare/v0.20.0...v0.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 11:44:48 -08:00
Aaron Hill ff1aff607a
avm1: Explicitly drop `obj` when it is no longer needed
Explicitly drop `obj` when it is no longer needed to avoid borrow errors, and add a test case similar to #3169.

Co-authored-by: Mike Welsh <mwelsh@gmail.com>
2021-02-19 03:30:21 -08:00
dependabot-preview[bot] 75fca8f6b6 build(deps): bump url from 2.2.0 to 2.2.1
Bumps [url](https://github.com/servo/rust-url) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.2.0...v2.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-18 14:22:06 -08:00
Aaron Hill 6050dd8204
Replace most manual `Collect` impls with `#[derive(Collect)]`
* Replace most unsafe impls with Collect.
 * Switch to local gc-arena fork.
2021-02-17 18:38:55 -08:00
desuwa 809d0a9245 avm1: Implement useHandCursor 2021-02-17 18:29:32 -08:00
Adrian Wielgosik 916bd8a9b8
core: Make EditText.border and EditText.background independent 2021-02-17 17:55:17 -08:00
Aaron Hill f745c39a42
chore: Remove `Collect` impls from `Activation` and `UpdateContext`
Neither of these impls are actually used.

As a result of this change, several fields in `avm2::Activation` became
unused. I assumed that these fields will become used as more of avm2 is
implemented, so I suppressed the warnings for now
2021-02-16 20:35:26 -08:00
CUB3D b93e556f89 avm2: Implement Op::Typeof and dummy XML/XMLList 2021-02-16 20:21:40 -08:00
David Wendt df5e97481c core: Adjust documentation 2021-02-16 19:03:48 -08:00
David Wendt 5e9d91710d core: Future-proof the non-keyframe seek for other stream types. 2021-02-16 19:03:48 -08:00
TÖRÖK Attila b3992dbc1a core/video: Loop to frame modulo num_frames. Fixes z0r.de/1843 2021-02-16 19:03:48 -08:00
TÖRÖK Attila 2e6d3eae18 core/video: Make seeking to non-keyframes possible. 2021-02-16 19:03:48 -08:00
David Wendt 8709bb2489 chore: Clippy wants this too 2021-02-16 19:03:48 -08:00
David Wendt 0bc101dbde chore: Spelling matters 2021-02-16 19:03:48 -08:00
David Wendt 5fcdb79528 core: Rename the video dependency enums to better describe their meaning. 2021-02-16 19:03:48 -08:00
David Wendt 4d0b73feeb core: Seeks before instantiation are valid and should be cached for later execution 2021-02-16 19:03:48 -08:00
David Wendt 4905e9a83d avm2: `Video` is a sealed class. 2021-02-16 19:03:48 -08:00
David Wendt d9541e1ea6 core: Fix various documentation errors in video 2021-02-16 19:03:48 -08:00
David Wendt c5fa9eb4a8 chore: Clippy compliance for stub video backend 2021-02-16 19:03:48 -08:00
David Wendt 964b1c4359 video: Frames with no data associated are treated as empty Pframes. 2021-02-16 19:03:48 -08:00
David Wendt 93ef62bac0 video: Snap seeks to nearest keyframe 2021-02-16 19:03:48 -08:00
David Wendt 02b94649c3 avm2: Stub the `Video` class. 2021-02-16 19:03:48 -08:00
David Wendt aa98fad126 avm1: Stub impl the `Video` class. 2021-02-16 19:03:48 -08:00
David Wendt 828ff39802 video: Warn if duplicate video frames are encountered 2021-02-16 19:03:48 -08:00
David Wendt 0e2b328073 video: Warn if we are missing a frame to render. 2021-02-16 19:03:48 -08:00
David Wendt c6a9e27916 video: Report what frame gave an error 2021-02-16 19:03:48 -08:00
David Wendt 5b546bf2d8 video: Always decode the first frame 2021-02-16 19:03:48 -08:00
David Wendt 368c1cf3c5 video: Implement a very basic video decoding loop 2021-02-16 19:03:48 -08:00
David Wendt 6dc96f5d58 core: Allow instantiation of videos 2021-02-16 19:03:48 -08:00
David Wendt 50d61b07f2 video: Stub seeking.
`PlaceObject`'s `ratio` field is treated as a seek parameter for video streams.
2021-02-16 19:03:48 -08:00
David Wendt b78baeb41d core: Add software video backend, separate from the null backend, to store software decoders. 2021-02-16 19:03:48 -08:00
David Wendt 57dab4327e core: Further adjustment to video backend type 2021-02-16 19:03:48 -08:00
David Wendt 1e3cc60f05 core: Also implement `VideoFrame` tag.
This is far more awkward and copy-heavy than it needs to be.
2021-02-16 19:03:48 -08:00
David Wendt 9b161889f8 core: Parse `DefineVideoStream` and use it to put videos into the character library. 2021-02-16 19:03:48 -08:00
David Wendt 34577057e4 core: Add video display object 2021-02-16 19:03:48 -08:00
David Wendt 80bceeacab core: Add `VideoBackend` to host video decoders 2021-02-16 19:03:48 -08:00
bunnyhero 6b58afa408
avm1: Make disabled MovieClips handle more events
Fixes #3250.
2021-02-15 09:48:18 -08:00
Mike Welsh ecd873eb39 tests: Add test for TextField.autoSize/background 2021-02-13 06:34:20 -08:00
Adrian Wielgosik df6aa85948 text: Implement TextField.background, disable it by default 2021-02-13 06:34:20 -08:00
Adrian Wielgosik 26ffbdfe23 text: Improve autoSize logic for non-wrapping text layout 2021-02-13 06:34:20 -08:00
Mads Marquart 8ba4fdbbbe core: Enable logging in tests, which makes it easier to spot mistakes 2021-02-13 03:49:12 -08:00
relrelb bb89391f3a chore: Avoid deprecated constants
The Rust documentation considers numeric constants prefixed with std::
as deprecated.
For example: https://doc.rust-lang.org/std/u16/constant.MAX.html.
2021-02-12 06:36:17 -08:00
Mike Welsh e5fb1f09e7 chore: Appease clippy
* #[derive(Collect)] should be before #[collect]
 * Replace redunant `&buf[..]` with `buf`
 * Changes most cases of UPPERCase to UpperCase
 * Allow upper_case_acronym on most SWF types, as they are from
   SWF spec/more annoying to change.
2021-02-12 06:32:42 -08:00
dependabot-preview[bot] 2fbbbe81b8 build(deps): bump quote from 1.0.8 to 1.0.9
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.8...1.0.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-12 02:32:42 -08:00
Adrian Wielgosik da86f7fc5a
avm1: Don't mutably borrow display_properties for reading
Fixes #3199.
2021-02-11 13:41:03 -08:00
Mike Welsh 16bd7fade6 web: Use case-insensitive check for detecting javascript scheme 2021-02-08 03:41:16 -08:00
paq 5cca3884d6 avm2: Implement `Array.length`'s setter 2021-02-07 23:49:52 -08:00
paq 8aaead90de avm2: Implement String.charCodeAt 2021-02-07 16:11:24 -08:00
paq c7c025277f avm2: Implement String.charAt 2021-02-07 16:11:24 -08:00
paq 2ec21bdd07 avm2: Implement String.length 2021-02-07 16:11:24 -08:00
paq 4a87d707f0 avm2: Implement String constructor 2021-02-07 16:11:24 -08:00
David A Roberts 6af18c1c4d avm1: Implement MovieClip.setMask - #17 #263 2021-02-05 13:53:54 -08:00
Mike Welsh 937393ce07 core: Fix panic from negative array indices in SharedObject (fix #3094) 2021-02-04 19:56:29 -08:00
Mike Welsh cfbb5751e8 tests: Add test for local SharedObject 2021-02-04 19:56:29 -08:00
Adrian Wielgosik 1454e0d126
core: Don't copy Glyphs around; make Font methods take &self 2021-02-04 11:54:17 -08:00
dependabot-preview[bot] dd4860c469 build(deps): bump encoding_rs from 0.8.26 to 0.8.28
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs) from 0.8.26 to 0.8.28.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases)
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.26...v0.8.28)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-04 11:22:31 -08:00
Adrian Wielgosik d78e4e5e00 Core: Avoid framerate dropping down 5x if frames can't be handled in time. 2021-02-03 17:04:03 -08:00
Adrian Wielgosik ac47b56fef
chore: Revert "build(deps): bump quick-xml from 0.20.0 to 0.21.0"
This reverts commit 0c6c339a64.
2021-02-03 14:36:13 -08:00
dependabot-preview[bot] 0c6c339a64 build(deps): bump quick-xml from 0.20.0 to 0.21.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](https://github.com/tafia/quick-xml/compare/v0.20.0...v0.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-03 11:09:26 -08:00
Mike Welsh 47f0f980b8 core: Handle PlaceObject tags with malformed clip actions
Some SWFs in the wild have PlaceObject tags with ending ClipActions
that are 2 bytes instead of the required 4 bytes (see #2899).
Swallow the error in this case so that the tag can run.
2021-02-02 23:56:48 -08:00
paq 48d59c0340 chore: Minor refactor names.rs 2021-02-02 10:16:41 -08:00
relrelb 074731e1a4 audio: Add Nellymoser support 2021-02-02 00:41:01 -08:00
Adrian Wielgosik 2c2a9367ae avm1: Respect case-(in)sensitivity in text bindings
Fixes #3031.
2021-02-01 18:09:32 -08:00
Mike Welsh 02d99c3686 core: CSMTextSettings tag alters text hit testing
Normally, a hit test on static text will consider the text glyphs.
However, a CSMTextSettings tag can change the text to use the
"advanced rendering engine", which causes hit tests to only consider
the bounds. This is toggled by the "Anti-alias for readibility"
setting in the Flash IDE.

Wire up the CSMTextSettings tag and adjust hit test behavior based
on this flag.

Fixes #2987.
2021-02-01 17:17:41 -08:00
Mads Marquart 1990e51639 avm2: Add UiBackend::display_unsupported_message
To allow displaying rich content when unsupported ActionScript 3 content is encountered.
2021-01-31 23:04:20 -08:00
Brian Gontowski 31dd2729e2 web: Add an onFSCommand callback into JavaScript 2021-01-31 18:03:31 -08:00
EmperorBale 4122e8a1b0
core: Implement TextField.password property 2021-01-31 12:26:58 -08:00
relrelb 7431cd9b10
core: Merge InputBackend into UiBackend 2021-01-30 16:36:45 -08:00
CUB3D 206ac43703 avm1: Correct ToInteger for undefined, null and object inputs 2021-01-29 19:44:32 -08:00
relrelb 02dfb23c67 core: Remove unneeded pub 2021-01-29 13:05:37 -08:00
relrelb eaf0441f9a avm1: Small refactors 2021-01-29 13:05:37 -08:00
relrelb beff73b815 core: Small refactor 2021-01-29 13:05:37 -08:00
dependabot-preview[bot] 67f793549e build(deps): bump flate2 from 1.0.19 to 1.0.20
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.19...1.0.20)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:43:05 -08:00
dependabot-preview[bot] 6f14490f84 build(deps): bump jpeg-decoder from 0.1.21 to 0.1.22
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.21 to 0.1.22.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.1.21...v0.1.22)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:42:19 -08:00
Mike Welsh 477fa06daf avm1: Fix off-by-one error in String.lastIndexOf
Fixes #2873.

Co-authored-by: Toad06 <gd.productions@laposte.net>
2021-01-29 02:59:14 -08:00
Mike Welsh 92e4d781e7 tests: Add test for #2870 2021-01-28 16:36:42 -08:00
Mike Welsh 008f0f596c core: Clip event slices are from parent movie in PlaceObject
Since 19034b7, clip event scripts are returned as slices from the
SWF. This caused a panic when a movie was loaded into a clip,
because the loaded clip's `movie` would be used as the source for
clip events. However, clip events are placed by the parent's
PlaceObject tags, so the movie in this case should be the parent's
movie.

Fixes #2870.
2021-01-28 16:36:42 -08:00
Mads Marquart 39aa7536df core: Remove unsafe NonZeroU32 creation in shape utils 2021-01-28 14:39:35 -08:00
Mike Welsh 0f5bab3e78 core: Use dirty flag for updating sound transforms 2021-01-27 15:25:04 -08:00
Mike Welsh 7eb5389630 core: Avoid vec allocation in AudioManager::update_sounds 2021-01-27 15:25:04 -08:00
Mike Welsh a4699a3ca5 audio: Sound transforms apply to stream sounds
This unifies the code path for event sounds and stream sounds.
Both `AudioBackend::start_stream` and `start_sound` return a
`SoundHandle`. `stop_stream` is removed (`stop_sound` can be
used for both cases).

Also removes references to `CharacterId` from the `AudioBackend`
(instead, an increasing ID is returned to identiy streams while
loading).
2021-01-27 15:25:04 -08:00
Mike Welsh 4c33464115 tests: Add test for Sound 2021-01-27 15:25:04 -08:00