Commit Graph

2726 Commits

Author SHA1 Message Date
Callum Thomson a570d96433
avm2: Implement flash.geom.Point (#3681) 2021-03-18 12:03:04 -07:00
Adrian Wielgosik 1aa77b04fe
avm1: Reduce frequency of timeout checks by 10+ times 2021-03-13 01:19:58 -08:00
relrelb d16d142c60 chore: Appease clippy 2021-03-13 00:56:04 -08:00
relrelb e594f602b6 chore: Twips::new(0) -> Twips::zero() 2021-03-13 00:56:04 -08:00
dependabot-preview[bot] 934f95cd52 build(deps): bump syn from 1.0.62 to 1.0.63
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.62 to 1.0.63.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.62...1.0.63)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 12:25:56 -08:00
dependabot-preview[bot] 8bd13203a1 build(deps): bump pretty_assertions from 0.6.1 to 0.7.1
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.6.1 to 0.7.1.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.6.1...v0.7.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 12:25:47 -08:00
relrelb 866e143073 chore: Cleanup bounds related code 2021-03-08 14:34:26 -08:00
EmperorBale 4d7b2fa1b9
avm1: Fix #3446
Thanks!
2021-03-08 00:52:35 -08:00
TÖRÖK Attila 339d0330a2 avm1: Fix seeking
The problem was most likely with negative relative offsets
2021-03-08 00:49:16 -08:00
relrelb 8f21c17683 chore: Rename MutationContext parameters to gc_context 2021-03-06 23:30:06 -08:00
relrelb 8318d4d0ed chore: Remove unnecessary context parameters 2021-03-06 23:30:06 -08:00
relrelb fff6eb2ffd chore: Use bitflags set method 2021-03-06 23:30:06 -08:00
dependabot-preview[bot] d8c140fce1 build(deps): bump syn from 1.0.61 to 1.0.62
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.61...1.0.62)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-06 23:28:38 -08:00
dependabot-preview[bot] c4af8114d0 build(deps): bump serde from 1.0.123 to 1.0.124
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.123 to 1.0.124.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.123...v1.0.124)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 22:29:54 -08:00
EmperorBale b68eeeae26
avm2: Implement ByteArray 2021-03-05 15:01:02 -08:00
desuwa 0d98fe8b7c core: Clear masker/maskee properties when unloading objects 2021-03-05 14:15:25 -08:00
dependabot-preview[bot] b586c7f74e build(deps): bump indexmap from 1.6.1 to 1.6.2
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.6.1...1.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 14:10:36 -08:00
dependabot-preview[bot] b6559214b8 build(deps): bump syn from 1.0.60 to 1.0.61
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.60...1.0.61)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 10:31:55 -08:00
TÖRÖK Attila 873736950e core/avm1: Implement BitmapData.paletteMap() 2021-03-03 05:26:24 -08:00
paq 922998b4a2 tests: Add test for RegExp's exec 2021-03-03 03:37:34 -08:00
paq 71588b32f1 tests: Add test for RegExp's test 2021-03-03 03:37:34 -08:00
paq ae2de6315d tests: AVM2 RegExp constructor and flags 2021-03-03 03:37:34 -08:00
paq d866f73c5e avm2: Implement RegExp 2021-03-03 03:37:34 -08:00
paq b8c1f1627a chore: Add `regress` crate for implementing RegExp class. 2021-03-03 03:37:34 -08:00
David Wendt 999100a332 avm2: Only track broadcast lists for events that are actually broadcasts. 2021-03-03 03:08:01 -08:00
David Wendt 540a68fb68 avm2: Grant each event it's own, separate broadcast list. 2021-03-03 03:08:01 -08:00
David Wendt 8e8de09f63 core: Ensure absolutely nothing runs in frame scripts unless the object is AVM2. 2021-03-03 03:08:01 -08:00
David Wendt d90ad1ab08 core: Account for the fact that AVM2 constructs objects far earlier than the frame number advances.
This is most certainly *not* the correct behavior; though it does work. If I track the frame number in event handlers we can see it change before `enterFrame` is broadcast. However, when I tried to do that, all hell broke loose and every AVM1 and AVM2 test failed (gating the behavior to AVM2 did *not* help).
2021-03-03 03:08:01 -08:00
David Wendt a5b4e168d3 avm2: Stub `flash.display.Shape`. 2021-03-03 03:08:01 -08:00
David Wendt d157a9995b core: When a programmatic goto happens, *all* frame scripts run immediately. 2021-03-03 03:08:01 -08:00
David Wendt 452d878cd9 core: When triggered by ActionScript, clip gotos should trigger AS3 frame lifecycle events.
For some reason, only *some* of the events actually trigger; notably programmatic gotos do not trigger `enterFrame`.

Implicit gotos (like looping around to frame 1) also do not trigger frame scripts; they instead run at the usual time.
2021-03-03 03:08:01 -08:00
David Wendt c9b68f600c core: Avoid skipping queued script frames in the case where a frame script queues up additional frame scripts via gotos 2021-03-03 03:08:01 -08:00
David Wendt f3a8eb821f core: Gotos still trigger new frame scripts 2021-03-03 03:08:01 -08:00
David Wendt e9f8636fe5 core: Frame scripts should run immediately and not queue 2021-03-03 03:08:01 -08:00
David Wendt dc499a13a2 core: Gotos do not issue frame progression events on their own. 2021-03-03 03:08:01 -08:00
David Wendt 69e8a33a8e Debug event dispatches. 2021-03-03 03:08:01 -08:00
David Wendt a2d56016cb avm2: Don't except when dispatching events on unconstructed objects. 2021-03-03 03:08:01 -08:00
David Wendt 50546512fe core: Add a separate construct step before running display objects.
This appears to only be in use for AVM2. Objects placed on a given frame are constructed before anything else happens with it's parent - even it's constructor being called. This involves splitting AVM2 up into a bunch of steps that really don't make sense for AVM1 content. Hence, `construct_frame` is a no-op for AVM1 and pre-running the first frame when instantiated is AVM1 exclusive now.
2021-03-03 03:08:01 -08:00
David Wendt a91273530f tests: Display events tests should log construction events 2021-03-03 03:08:01 -08:00
David Wendt a308b9d4f9 Re-dispatch the added event after post-instantiating an object since the automatic dispatch happens too early 2021-03-03 03:08:01 -08:00
David Wendt ac6a206257 Fire `exitFrame`, `enterFrame`, and `frameConstructed` events as broadcasts. 2021-03-03 03:08:01 -08:00
David Wendt d1ffa3254b Store a list of every constructed event dispatcher so we can broadcast events on them. 2021-03-03 03:08:01 -08:00
David Wendt 731c18ad80 avm2: Issue (or attempt to issue) events for entering, exiting, and constructing, a frame. 2021-03-03 03:08:01 -08:00
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
Mike Welsh 95ce2abf17 audio: Remove AudioBackend::stop_sounds_with_handle/is_sound_playing_with_handle 2021-01-27 15:25:04 -08:00
Mike Welsh da2dd3b36c core: Implement sound transforms and Sound.setPan 2021-01-27 15:25:04 -08:00
Mike Welsh 98e6c54c3b avm1: Implement Sound.onSoundComplete 2021-01-27 15:25:04 -08:00
Mike Welsh 34f60b127a core: Add AudioManager to handle actively playing sounds
Add an AudioManager struct to handle this list of actively playing
sounds. This will maintain information for each sound instance,
such as the owning display object, AVM1 object, etc.

This will allow us to implement the awkward AVM1 Sound API in a
fairly backend-agnostic way.
2021-01-27 15:25:04 -08:00
TÖRÖK Attila a89eb6b9b8 avm1: Implement BitmapData.perlinNoise() 2021-01-27 11:53:05 -08:00
Adrian Wielgosik 937b371e30 core: Support grayscale JPEGs 2021-01-26 17:14:27 -08:00
dependabot-preview[bot] 8172ddb1ba build(deps): bump rand from 0.8.2 to 0.8.3
Bumps [rand](https://github.com/rust-random/rand) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 08:52:20 -08:00
dependabot-preview[bot] 7856cdd3d7 build(deps): bump serde from 1.0.122 to 1.0.123
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.122 to 1.0.123.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.122...v1.0.123)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 14:14:33 -08:00
Mike Welsh 306d2ead7f core: Avoid panic in EditText::on_changed (fix #2809) 2021-01-24 19:52:30 -08:00
dependabot-preview[bot] 64983cde22 build(deps): bump serde from 1.0.121 to 1.0.122
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.121 to 1.0.122.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.121...v1.0.122)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 17:26:09 -08:00
dependabot-preview[bot] 32fd3fb71b build(deps): bump syn from 1.0.59 to 1.0.60
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.59 to 1.0.60.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.59...1.0.60)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 14:23:03 -08:00
paq e9ad1587a4 chore: Rename Namespace::public_namespace to Namespace::public 2021-01-24 11:53:43 -08:00
paq b58fcf3b05 chore: Use Namespace::public_namespace() instead of Namespace::package("") 2021-01-24 11:53:43 -08:00
dependabot-preview[bot] 239ccb3511 build(deps): bump jpeg-decoder from 0.1.20 to 0.1.21
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.20 to 0.1.21.
- [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/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 11:52:39 -08:00
dependabot-preview[bot] 86b4c20809 build(deps): bump serde from 1.0.120 to 1.0.121
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.121)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 14:12:08 -08:00
Adrian Wielgosik 0a64c34e73 Make avm11::Value Copy 2021-01-23 12:04:47 -08:00
Adrian Wielgosik 2065812d1a Preallocate AVM1 Values when preparing constant pool 2021-01-23 12:04:47 -08:00
relrelb 19662503ca swf: Convert ButtonActionCondition to bitflags 2021-01-23 11:59:24 -08:00
relrelb 7f4845d777 swf: Convert ButtonState to bitflags 2021-01-23 11:59:24 -08:00
paq c088c18517 chore: Remove Flash's recovery file and add it to .gitignore 2021-01-23 00:29:25 -08:00
dependabot-preview[bot] c0ac8a4a77 build(deps): bump syn from 1.0.58 to 1.0.59
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.58 to 1.0.59.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.58...1.0.59)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 00:29:02 -08:00
CUB3D 0cf3a4abed core: Invert pixel fill order for BitmapData.noise 2021-01-22 13:16:19 -08:00
CUB3D d57fd172f9 core: More special casing for noise 2021-01-22 13:16:19 -08:00
CUB3D 00fe7b6468 avm1: Generate correct values for negative seeds for BitmapData.noise() 2021-01-22 13:16:19 -08:00
CUB3D 9ba38784ef avm1: Properly implement BitmapData.noise() for positive seeds 2021-01-22 13:16:19 -08:00
Mike Welsh 82fd9dfd4e chore: Appease clippy 2021-01-21 18:52:43 -08:00
Mike Welsh 78f85d96f0 chore: Remove some debug spew 2021-01-21 18:22:42 -08:00
Aaron Hill b2f5f807de avm2: Print full multiname for "Property does not exist" errors (#2740)
This makes it easy to see when the error is a result of something in the
"flash" package being unimplemented.
2021-01-21 17:52:17 -08:00
relrelb b05c6540e1
chore: Migrate from enumset to bitflags 2021-01-21 16:35:46 -08:00
relrelb ab92bc1b98 tests: Add tests for target clip in SWF6 2021-01-21 14:52:52 -08:00
relrelb 286bf7ac3f tests: Add tests for target clip in SWF5 2021-01-21 14:52:52 -08:00
Toad06 9866a4baef web: Use enum instead of arbitrary values 2021-01-21 14:52:52 -08:00
Mike Welsh 60a95f3ea0 core: Gracefully handle tag length past EOF 2021-01-21 14:04:46 -08:00
Mike Welsh 34e0763cfe avm1: Don't unwrap in ColorTransform methods 2021-01-21 11:48:26 -08:00
Mike Welsh 6e7e5395aa tests: Add test for subclassing a native type 2021-01-21 11:48:26 -08:00
Mike Welsh 5582da9f8a avm1: create_bare_object should properly wire up proto
When a native class was extended, most native types were grabbing
their normal prototype instead of using the user's supplied prototype.
e.g. `class MyColorTransform extends ColorTransform`.
2021-01-21 11:48:26 -08:00
Mike Welsh a6ea28d9b4 avm1: Create proper underlying type when extending native objects (fix #2682) 2021-01-21 11:48:26 -08:00
Mike Welsh e8efe22dee tests: Add test for SWF5 string encoding 2021-01-20 15:02:31 -08:00
Mike Welsh 66256dd3be swf: SwfStr no longer contains encoding
SwfStr is now an unsized slice analogous to `str` or `bstr`.
The desired encoding must be supplied when converting to String.
2021-01-20 15:02:31 -08:00
Mike Welsh 61628a74fc swf: Rename and organize some util methods
* SwfRead -> SwfReadExt
 * SwfWrite -> SwfWriteExt
 * read_swf_header -> decompress_swf
 * read_swf -> parse_swf
2021-01-20 15:02:31 -08:00
Mike Welsh 1d9c11e145 swf: Add SwfStr type to handle encodings in SWF<6 2021-01-20 15:02:31 -08:00
Mike Welsh 19034b76e4 swf: Return slices in swf::Reader
Avoid copies by returning slices of the decompressed input.
2021-01-20 15:02:31 -08:00
klemens 9488a3fb97 spelling fixes 2021-01-18 22:07:39 -08:00
Mike Welsh da1e2801a2 chore: Appease clippy 2021-01-18 21:23:50 -08:00
relrelb c284a2e47e tests: Add export_assets 2021-01-15 11:48:29 -08:00
relrelb abfa08c964 core: Allow exports to be overridden
Per SWF19 p.54, the latter export name is used.
2021-01-15 11:48:29 -08:00
TÖRÖK Attila a01ea70514 core/avm1: Implement BitmapData.copyPixels() 2021-01-14 13:02:55 -08:00
cheezeygeek 1911708ad1 avm1: Fix onChange firing, remove unwraps, revert as_broadcaster 2021-01-13 15:47:20 -08:00
cheezeygeek b3cd9b0f89 avm1: Implement listeners and onChanged for TextField (close #2297) 2021-01-13 15:47:20 -08:00
Mike Welsh df82194823 tests: Add test for case insensitive Object.registerClass in SWF6 2021-01-13 15:38:38 -08:00
Mike Welsh 3c31336c93 chore: Rename some getters 2021-01-13 15:38:38 -08:00
Moulins 26a2b6e4f7 core: Add test for `Object.registerClass` return values 2021-01-13 15:38:38 -08:00
Moulins f394953331 core: Reimplement `Object.registerClass`.
Maintain an external mapping from symbol names to registered
constructors to properly handle `registerClass` being called on
not-yet-available symbols.

SWFs v6 and v7+ each have a separate global mapping, with
different case sensitivities.

Also returns the correct boolean value to the AVM.

Fixes #2343 and #1864.
2021-01-13 15:38:38 -08:00
Mike Welsh 9bb36885bb web: Add backgroundColor option and support bgcolor attribute
Add `backgroundColor` setting to the config options, allowing
a user to override the background color of an SWF. The polyfill
will now look for the `bgcolor` HTML attribute on the embed
and fill in this setting appropriately.
2021-01-13 11:57:19 -08:00
Mike Welsh 4820d5b044 core: Change Player::background_color to an Option
Player::background_color is now an Option. SetBackgroundColor will
change the background color of the player only when this is None,
i.e. only if no background color has yet been set.

This matches the behavior of the offical Flash Player, for example,
if a parent SWF is missing a SetBackgroundColor tag and loads a
child SWF, the child SWF's SetBackgroundColor tag takes effect.

This is anticipating adding a `bgcolor` option to the web builds,
allowing the HTML embed to override the bgcolor.
2021-01-13 11:57:19 -08:00
Adrian Wielgosik 7242bfb5f0
avm1: In ASSetPropFlags, don't crash on flags > 7 2021-01-13 11:55:35 -08:00
dependabot-preview[bot] a73e85ea6d build(deps): bump rand from 0.8.1 to 0.8.2
Bumps [rand](https://github.com/rust-random/rand) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.1...0.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 04:17:41 -08:00
Mike Welsh 63f2b4f02f avm1: Remove Error::ConstructorFailed
Not necessary now that native constructors can return differing
types. `new BitmapData` can return undefined.
2021-01-12 09:13:24 -08:00
Mike Welsh cd68d4f76a avm1: Properly implement Object constructor 2021-01-12 09:13:24 -08:00
Mike Welsh e93f3b5d3b tests: Add test for Object constructor 2021-01-12 09:13:24 -08:00
Mike Welsh df500282cd avm1: Use the return value of built-in ctors as `this`
* Built-in constructors now return the newly constructed object,
   which will be used as `this`. This allows for constructors such
   as `new Object` which can return differing types.
 * Adjust `FunctionObject::constructor` to take both a constructor
   and a function. Add `constructor_to_fn!` macro to turn most
   simple native constructors into a function that discards the
   return value.
 * Change `TObject::construct` to return `Value` instead of `Object`.
   This is necessary for constructors that return primitive values.
2021-01-12 09:13:24 -08:00
Mike Welsh 4e27818952 core: Don't recreate objects when switching button states
When switching button states, previously we cleared all children
and recreated children for the new state. Now any children that
exist in both states are persisted and not recreated.

Fixes #2354.
2021-01-11 14:06:22 -08:00
Mike Welsh 6b2b0eb2c6 core: Allow mouse picking of children inside buttons
Particularly fixes cases of button-inside-button (#2354).
2021-01-11 14:06:22 -08:00
Toad06 7480e836ec web: Changes from review 2021-01-11 13:16:00 -08:00
TÖRÖK Attila cce3a8199d web: Add a config option to disable the message about unsupported content 2021-01-10 16:02:23 -08:00
Mike Welsh 484ac03ca8 tests: Test removeMovieClip on non-movieclips 2021-01-09 18:31:04 -08:00
Mike Welsh bab88ede8c fix 2021-01-09 18:31:04 -08:00
MrCheeze ff15b67192 avm1: Allow RemoveSprite/removeMovieClip on any display object 2021-01-09 18:31:04 -08:00
Mike Welsh 6638aebde8 tests: Add test verifying proper getBytesTotal value 2021-01-09 14:29:19 -08:00
MrCheeze 5915f2a841 core: Return uncompressed length for getBytesLoaded/Total 2021-01-09 14:29:19 -08:00
Adrian Wielgosik 828dbcb00c Don't panic on invalid JPEG sizes in DefineBitsJpeg* 2021-01-08 13:38:41 -08:00
dependabot-preview[bot] f80d74a3d7 build(deps): bump smallvec from 1.6.0 to 1.6.1
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.0...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 12:09:49 -08:00
relrelb 030ff398ef desktop: Handle fullscreen keyboard shortcut in its own case 2021-01-08 11:59:08 -08:00
relrelb abe608fd4d desktop: Add fullscreen keyboard shortcut 2021-01-07 12:49:36 -08:00
Mike Welsh 44e9185a5f core: Adjust culling area based on letterbox setting 2021-01-07 11:46:07 -08:00
Mike Welsh 01aca9f861 web: Remove upgrade_to_https param from Ruffle::new
Grab it from the `config` directly instead of using an extra param.
2021-01-07 11:46:07 -08:00
Mike Welsh bacb66b97b core: Move Letterbox to config module 2021-01-07 11:46:07 -08:00
Mike Welsh 8728804f28 web: Add letterbox config option 2021-01-07 11:46:07 -08:00
Mike Welsh e9da6a13f0 core: Add letterbox setting
Player::set_letterbox can be used to control the letterbox behavior.
 * Letterbox::Off => no letterbox (flash behavior)
 * Letterbox::Fullscreen => letterbox only in fullscreen (web default)
 * Letterbox::On => always letterbox (desktop default)
2021-01-07 11:46:07 -08:00
Mike Welsh 03b5edd4d1 render: Remove RenderBackend::draw_letterbox
Move letterbox draw logic to `Player`, using renderer.draw_rect
2021-01-07 11:46:07 -08:00
CUB3D 063c8a1234 chore: Fix formatting 2021-01-06 18:06:30 -08:00
CUB3D 01557fba5a core: Add flash.filters.GradientGlowFilter 2021-01-06 18:06:30 -08:00
CUB3D 0cab167e4c core: Add flash.filters.GradientBevelFilter + refactor existing filters 2021-01-06 18:06:30 -08:00
Moulins 02c591958e core/avm1: don't run onLoadInit handler if movie loading failed
Replace Loader::Movie::loader_complete flag by an enum to distinguish
between success and failure.

Fixes #2123
2021-01-06 16:00:58 -08:00
relrelb 468b2ca487
core: Ignore SetBackgroundColor in child movie clips 2021-01-06 16:00:11 -08:00
Callum Thomson 75081c8149
avm1: Implement flash.filters.ConvolutionFilter avm1 built-in 2021-01-04 18:26:11 -08:00
relrelb 9a8edda8a6 chore: Update lyon to 0.17.1 2021-01-04 18:08:14 -08:00
relrelb de761f5b7c chore: Update bitstream-io to 1.0.0 2021-01-04 15:23:36 -08:00
TÖRÖK Attila 21e071384d core/avm1: Handle object aliasing in BitmapData.copyChannel by cloning 2021-01-04 15:10:01 -08:00
dependabot-preview[bot] 51641dad60 build(deps): bump rand from 0.8.0 to 0.8.1
Bumps [rand](https://github.com/rust-random/rand) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.0...0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-04 15:08:40 -08:00
Mike Welsh fae1d6fd6a chore: Appease clippy 2021-01-04 13:17:26 -08:00
Adrian Wielgosik de38bb48eb
core: Fake passage of time to fool busy-loop frame limiters 2021-01-04 12:19:20 -08:00
Kamil Gierada 49a69c8109
core: ADPCM decoder produces less artifacts 2021-01-02 16:44:28 -08:00
Mike Welsh 4c12f27e46 tests: Add tests for #1671 2021-01-02 16:19:08 -08:00
Mike Welsh 146d41c971 avm1: Bail out of swapDepths on dead clips 2021-01-02 16:19:08 -08:00
paq 72be136fb9 avm1: Implement unescape 2021-01-02 14:37:03 -08:00
dependabot-preview[bot] 219f4664d6 build(deps): bump minimp3 from 0.5.0 to 0.5.1
Bumps [minimp3](https://github.com/germangb/minimp3-rs) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/germangb/minimp3-rs/releases)
- [Commits](https://github.com/germangb/minimp3-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-02 14:22:38 -08:00
CUB3D 03e69c5c0b core: Update DisplacementMapFilter tests 2021-01-02 03:12:07 -08:00
CUB3D 631d185014 core: Implmement flash.filters.DisplacementMapFilter 2021-01-02 03:12:07 -08:00
TÖRÖK Attila 3b14437b25 core/avm1: Implement BitmapData.scroll 2021-01-01 19:44:56 -08:00
dependabot-preview[bot] 83c32e8693 build(deps): bump syn from 1.0.56 to 1.0.57
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.56...1.0.57)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-01 13:46:35 -08:00
Mike Welsh a5b5ba46ba avm1: Unspecified arguments should be set to undefined (fix #2166)
Unspecified arguments should be set to undefined to prevent
assignments from leaking to the parent scope, for example:

```
function f(arg0) {
    arg0 = "BAD"; // Previously could set _root.arg0
}
f();
```
2020-12-31 20:01:05 -08:00
Mike Welsh 22ab8df8f5 tests: Add test for #2166 2020-12-31 20:01:05 -08:00
dependabot-preview[bot] 6a3b9f9f53 build(deps): bump smallvec from 1.5.1 to 1.6.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.1...v1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-31 14:37:38 -08:00
Mike Welsh 9b6295f33a render: Pass library to RenderBackend::register_shape (fix #2037)
Pass the movie library to `register_shape` methods so that bitmap
charcter IDs can be resolved immediately on the proper SWF.

This fixes #2037, which cause incorrect bitmaps to be used when
multiple movies were loaded.
2020-12-31 13:10:21 -08:00
Adrian Wielgosik 2b2a7c3c27 Remove redundant SystemPrototypes from UpdateContext. 2020-12-31 13:09:59 -08:00
Mike Welsh ea3b6f59df avm1: Implement XML.ignoreWhite 2020-12-30 16:00:39 -08:00
Mike Welsh caa2d8e383 tests: Add test for XML.ignoreWhite 2020-12-30 16:00:39 -08:00
Mike Welsh d736293425 avm1: Fix method calls with null/empty string name
`f[null]` should call `f["null"]`.
`f[undefined]`, `f[""]`, `f[o]` where o.toString returns the empty
string should call `f` directly.
2020-12-30 13:35:36 -08:00
CUB3D 5fb15c8f80 core: Support CallMethod with non-string method_name (fix #2160) 2020-12-30 13:35:36 -08:00
paq 4f980becb2 avm1: Implement escape 2020-12-30 12:42:03 -08:00
Mike Welsh 3ce4406434 core: Fix memory leak caused by unbound text variables
Text fields without variables would return as unbound in
EditText::try_bind_text_field_variable, causing them to be added
to the unbound textfield list even though they had no variable
setting. Return successful bidning by default to avoid adding
these textfields to the unbound list.
2020-12-29 14:18:07 -08:00
Mike Welsh 802aa9b7a7 avm1: Allow SharedObject creation even if URL is unknown (fix #2150)
Allow SharedObjects to be created even in the case that the movie
URL is None (for example, loading an SWF from bytes). Use a dummy
"localhost" URL.
2020-12-29 14:17:57 -08:00
Mike Welsh ff5ecf9754 avm1: Fix incorrect name used for SharedObject cache (fix #2149) 2020-12-29 14:17:57 -08:00
Callum Thomson 7b202bd2e7
avm1: Implement flash.filters.ColorMatrixFilter avm1 built-in 2020-12-29 03:10:46 -08:00
paq 8c86434e38 avm1: Implement Matrix.deltaTransformPoint 2020-12-28 01:17:00 -08:00
paq 8baa36e801 avm2: Implement isFinite 2020-12-27 23:02:39 -08:00
paq ce2d7efac3 avm2: Implement isNaN 2020-12-27 23:02:39 -08:00
Mike Welsh 7bdbb6c37d text: Fix masking of text area (fix #1496, #1554) 2020-12-27 23:01:24 -08:00
Mike Welsh 8d707bc6ab core: onKeyUp/Down method handlers fire only if clip has focus (fix #2120) 2020-12-27 16:08:27 -08:00
paq 7bfe3f7177 avm1: Implement Matrix.transformPoint (ruffle-rs#303) 2020-12-27 14:27:04 -08:00
Mike Welsh 8222d3095b desktop: Add --timedemo benchmark
Add --timedemo for benchmarking, which will run the given SWF as
quickly as possible for 5000 frames or the end of the root
timeline, whichever comes first. The total duration will be output
upon completion.
2020-12-26 23:59:12 -08:00
jmckiern a3b4074fc4 core: Fix multiline selection bug 2020-12-26 23:18:02 -08:00
jmckiern 208a69d715 core: Move caret to start or end of selection if shift is not held
Previously pressing left with a selection would set `selection.to = selection.start() - 1`, now it sets it to `selection.to = selection.start()`. The same is true for right/selection.end()
2020-12-26 23:18:02 -08:00
jmckiern 464f2b63a9 chore: Fix spelling mistake 2020-12-26 23:18:02 -08:00
jmckiern c277c1083b core: Render selected text as white with black background 2020-12-26 23:18:02 -08:00
jmckiern 0269c31dbc core: Change caret color to text color 2020-12-26 23:18:02 -08:00
dependabot-preview[bot] 1b4c8265b7 build(deps): bump syn from 1.0.55 to 1.0.56
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.55 to 1.0.56.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.55...1.0.56)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-26 14:01:15 -08:00
Sam Morrow 38bdb8b39a web/desktop: Add basic dialog handling (closes #1978) 2020-12-23 19:08:18 -08:00
Mike Welsh 367404ddd8 core: SharedObjects are bucketed by domain
Key SharedObjects on the domain and path where the SWF is hosted,
and implement the localPath and secure parameters.

Fix #855.
2020-12-22 14:18:06 -08:00
Callum Thomson e38d559b1e
avm1: Implement flash.filters.DropShadowFilter
Implements the AVM object for DropShadowFilter. Actual rendering is still TODO.
2020-12-22 14:17:12 -08:00
David Wendt b848e4c5ff avm2: Get rid of `RufflePrivate` and just use regular private namespaces scoped to our own domain. 2020-12-21 21:47:29 -08:00
David Wendt 30d8dc21be avm2: Remove weird `into` constructor on `EventHandler` 2020-12-21 21:47:29 -08:00
David Wendt 7baa3cc06d avm2: Seal the `EventDispatcher` class 2020-12-21 21:47:29 -08:00
David Wendt 3ff9b87261 avm2: `RufflePrivate` namespaces should be treated as private namespaces. 2020-12-21 21:47:29 -08:00
David Wendt 19219ad0c1 avm2: Implement `dispatchEvent`.
Event dispatch is a surprisingly complicated procedure, so this makes sure to test:

1. Event dispatch on bare dispatchers
2. Event dispatch on hierarchial dispatchers (movieclips)
3. Event cancellation (which is reported by `dispatchEvent`)
4. The implicit `this` on unbound event handlers. I'm not yet sure if this is a special property of event dispatch or if all unbound functions inherit their global scope as `this`.
5. The execution order of handlers on both bare and hierarchial dispatchers
6. Delegation to hierarchial dispatchers
7. Modification of the dispatch list during dispatch of an event. Surprisingly enough, you can add handlers to the event you're handling and expect them to execute, *if* you added them to a further object in the order *or* you added a bubble handler in the capture phase.
2020-12-21 21:47:29 -08:00
David Wendt f33e5f893a avm2: Allow builtins to get at the global scope. 2020-12-21 21:47:29 -08:00
David Wendt 8efaed40a0 avm2: `event.eventPhase` is enumerated from 1 2020-12-21 21:47:29 -08:00
David Wendt 87ff679898 avm2: Implement `EventDispatcher.willTrigger` 2020-12-21 21:47:29 -08:00
David Wendt a071800117 avm2: `EventDispatcher` should supercall, too. 2020-12-21 21:47:29 -08:00
David Wendt e8163e43ab avm2: Builtin constructors should supercall. 2020-12-21 21:47:29 -08:00
David Wendt be4e37a55c avm2: Implement `addEventListener`, `removeEventListener`, and `hasEventListener`. 2020-12-21 21:47:29 -08:00
David Wendt 2faf5259ca avm2: Add a representation for event dispatch lists.
For various reasons, we store the dispatch list for an object on a separate property of an `EventDispatcher` rather than dictating that all children of `EventDispatcher` use a specific object type. This is because `EventDispatcher` is a very general class with lots of object representations it needs to cover. So instead, we introduce a new object representation for a *property* and store it in a Ruffle private namespace that is as isolated from user code as alternate object representations are.
2020-12-21 21:47:29 -08:00
David Wendt b02897637f avm2: Add a new namespace type to store runtime-internal properties we don't want user code being able to access ever. 2020-12-21 21:47:29 -08:00
dependabot-preview[bot] 606fd28b3b build(deps): bump quote from 1.0.7 to 1.0.8
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.7...1.0.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:54:45 -08:00
Callum Thomson 69ab12fcc3
avm1: Add flash.filters.GlowFilter 2020-12-20 15:31:09 -08:00
dependabot-preview[bot] 820572f204 build(deps): bump syn from 1.0.54 to 1.0.55
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.54 to 1.0.55.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.54...1.0.55)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:19:11 -08:00
Mike Welsh 8a0e55d74a chore: Bump to rand 0.8 2020-12-19 14:33:12 -08:00
Mike Welsh 9d6e711006 tests: Add test for #2030 2020-12-19 02:14:27 -08:00
Mike Welsh 60d7c0a742 core: Fix incorrect bounds for Bitmap (fix #2030) 2020-12-19 02:14:27 -08:00
Mike Welsh 981a4de9c9 tests: Uncomment arguments.caller avm1 test 2020-12-19 01:46:20 -08:00
Mike Welsh 0dd8b24fec avm1: Implement arguments.caller 2020-12-19 01:46:20 -08:00
Mike Welsh a3f18b80b6 tests: Add test for TextField.replaceSel 2020-12-19 00:35:26 -08:00
Mike Welsh 62a3729b55 avm1: Implement TextField.replaceSel 2020-12-19 00:35:26 -08:00
Mike Welsh 042e9a444b tests: Add parseFloat tests 2020-12-18 02:50:09 -08:00
Mike Welsh 80d5d9cd0a avm1: Initial implementation of parseFloat 2020-12-18 02:50:09 -08:00
Mike Welsh 326a5b6212 core: Move device font to Library (fix #1995) 2020-12-17 23:20:22 -08:00
Mike Welsh a58073cabd core: Fix Collect impl for BitmapData (fix #2009) 2020-12-17 19:35:26 -08:00
Mike Welsh 72a24b9800 tests: Add tests for #1906 2020-12-17 18:07:01 -08:00
Mike Welsh 25cd4ee375 avm1: Color.setTransform/setRGB sets transformed-by-AS flag (fix #1906) 2020-12-17 18:07:01 -08:00
Mike Welsh 7cf217a911 swf: Use lzma-rs for LZMA SWFs (fix #405)
Pure Rust decoder that functions on desktop and wasm.
Enable lzma feature by default.

TODO: Switch to lzma-rs streaming API when stable on crates.io.
Currently decodes entire stream at once.
2020-12-17 16:40:21 -08:00
jmckiern beed570475 core: Add string_utils char boundary functions 2020-12-17 16:15:24 -08:00
jmckiern b81cb1a3eb core: Extend text input to deal with multibyte chars 2020-12-17 16:15:24 -08:00
David Wendt 09f9e99fbb avm2: Implement `rest` parameters in function calls. 2020-12-17 13:21:44 -08:00
David Wendt 453e013c2c avm2: Implement `arguments`. 2020-12-17 13:21:44 -08:00
David Wendt 217890f4a6 avm2: Implement `Function.apply` 2020-12-17 13:21:44 -08:00
Mike Welsh 369c5bda56 render: Implement Bitmap smoothing property 2020-12-15 00:04:51 -08:00
CUB3D 3556ffd778 chore: Fixes after rebase 2020-12-15 00:04:51 -08:00
CUB3D a92b8ffded core: All other changes from review 2020-12-15 00:04:51 -08:00
CUB3D ccd08f14d9 core: Fix naming and safety issues 2020-12-15 00:04:51 -08:00
CUB3D e483d0959f core: Remove unwraps 2020-12-15 00:04:51 -08:00
CUB3D 6f91352d41 chore: Fix clippy lints 2020-12-15 00:04:51 -08:00
CUB3D eea45d6ae6 core: Tidy up loadBitmap 2020-12-15 00:04:51 -08:00
CUB3D 23a9c7143a core: Support failiable constructors 2020-12-15 00:04:51 -08:00
CUB3D b3dd5c0c0b core+renderer: Fix corner cases 2020-12-15 00:04:51 -08:00
CUB3D 666c3db9c6 core: Refactor bitmapData 2020-12-15 00:04:51 -08:00
CUB3D 74ab728cff core: Format 2020-12-15 00:04:51 -08:00
CUB3D 22a7b1d340 core: Add handling of invalid arguments for getColorBoundsRect/colorTransform 2020-12-15 00:04:51 -08:00
CUB3D 353d5a268b core: Add better handling of invalid arguments to BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 9d46d67588 core+web+renderer: Add load/attach Bitmap and handling for invalid args with BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 3c12fa6ee5 core: Implement BitmapData.floodFill and correct getPixel for invalid coordinates 2020-12-15 00:04:51 -08:00
CUB3D 3afd20063f core: Implement get/set pixel(32) functions 2020-12-15 00:04:51 -08:00
CUB3D e45e942a1f core: Start implementation for flash.display.BitmapData 2020-12-15 00:04:51 -08:00
dependabot-preview[bot] 843bc74292 build(deps): bump indexmap from 1.6.0 to 1.6.1
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.6.0...1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-14 17:49:16 -08:00
David Wendt acadcb8fc0 avm2: `Event` is a sealed class. 2020-12-14 16:46:33 -08:00
David Wendt f7f51dcde2 avm2: `EventPhase` and `PropagationMode` should be `Eq` 2020-12-14 16:46:33 -08:00
David Wendt 6caaf0d222 avm2: Implement all of the `Event` class constants.
I'm not writing tests for these, my wrists hurt enough as is.
2020-12-14 16:46:33 -08:00
David Wendt 8a787e6153 avm2: Implement `Event.toString` (which matches it's valueof behavior) 2020-12-14 16:46:33 -08:00
David Wendt dc32d7894c avm2: Remove redundant event phase accessor 2020-12-14 16:46:33 -08:00
David Wendt ec63ff55cb avm2: Implement `Event.stopPropagation` and `Event.stopImmediatePropagation`.
These aren't testable yet.
2020-12-14 16:46:33 -08:00
David Wendt d393a5f4f8 avm2: Implement `Event.preventDefault` and `Event.isDefaultPrevented` 2020-12-14 16:46:33 -08:00
David Wendt 8b9a804ae9 avm2: Implement `Event.formatToString`. 2020-12-14 16:46:33 -08:00
David Wendt 584c6c8b11 avm2: Implement `Event.clone` 2020-12-14 16:46:33 -08:00
David Wendt 3d12929914 avm2: Expose `Event.target`, `currentTarget`, and `eventPhase`.
These have no tests because these properties can only be updated by an event broadcaster.
2020-12-14 16:46:33 -08:00
David Wendt 90da20579c avm2: Implement `Event.bubbles`, `cancelable`, and `type`. 2020-12-14 16:46:33 -08:00
David Wendt 58f4470dc5 avm2: Add `Event` class, object type, and native representation 2020-12-14 16:46:33 -08:00
jmckiern 709561a255 avm1: Use ? on set_text_color so errors are raised 2020-12-14 12:45:45 -08:00
jmckiern ec1ff0be3a avm1: Use ? instead of match Ok()'s so errors are raised 2020-12-14 12:45:45 -08:00
jmckiern a09ac58ebd chore: Remove TODO 2020-12-14 12:45:45 -08:00
jmckiern cfd003de7a avm1: Implement TextField.backgroundColor 2020-12-14 12:45:45 -08:00
jmckiern 61e3214d0a avm1: Implement TextField.borderColor 2020-12-14 12:45:45 -08:00
Sam Morrow c4d7b24629 web: Fix cors issues with http (close ruffle-rs#1486) 2020-12-14 05:51:28 -08:00
Zeh Fernando 8e9de8e16b core: Implement MovieClip._lockroot in avm1
This also enables the (previously ignored) _lockroot tests.
2020-12-13 15:34:42 -08:00
Mike Welsh ee74197a00 avm1: Move TextField properties to prototype
Remove TextField::attach_virtual properties, as properties are
on the prototype, not the textfield itself.

Use the `with_text_field_props` macro for these properties.

Also remove `get_` prefix from most getters to match naming
conventions.
2020-12-09 14:45:20 -08:00
David Wendt ed4d51dfc1 avm1: Don't panic if we encounter an invalid display object hierarchy for AS2. Instead, yield a runtime error. 2020-12-09 14:00:06 -08:00
David Wendt afd033898c avm2: Implement `hitTestObject` 2020-12-09 14:00:06 -08:00
David Wendt d9172780c5 avm2: Implement `hitTestPoint`. 2020-12-09 14:00:06 -08:00