Commit Graph

4960 Commits

Author SHA1 Message Date
Adrian Wielgosik 34d54dbc05
avm1: Fix string methods handling of negative args (fix #4437)
* Improve string.substr handling of negative args
* Add tests for more substr() combinations
2021-05-30 12:04:17 -07:00
Mike Welsh b4dd64a568 tests: Add test for overriding Object.prototype.toString 2021-05-24 17:52:15 -07:00
Mike Welsh 1304b2c55a avm2: Move Object properties to Object.prototype 2021-05-24 17:52:15 -07:00
Moulins af5694b642 [avm1] extend impl_custom_object! to reduce boilerplate
This add two knobs to the impl_custom_object! macro:
  - `set(...)`, for using a specific prototype in the `set`
method;
  - `bare_object(...)`, for objects that are convertible to a raw object
type.
2021-05-24 17:06:47 -07:00
dependabot[bot] 2c8cab6abf chore: Bump thiserror from 1.0.24 to 1.0.25
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.24...1.0.25)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 10:09:27 -07:00
dependabot[bot] b8f9e705ad chore: Bump indicatif from 0.16.0 to 0.16.1
Bumps [indicatif](https://github.com/mitsuhiko/indicatif) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/mitsuhiko/indicatif/releases)
- [Commits](https://github.com/mitsuhiko/indicatif/compare/0.16.0...0.16.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 10:07:02 -07:00
dependabot[bot] f983af277f chore: Bump getrandom from 0.2.2 to 0.2.3
Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/rust-random/getrandom/releases)
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.2...v0.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-24 10:06:48 -07:00
Mike Welsh 3ddb97d2f6 core: Add SwfMovie::frame_rate and num_frames 2021-05-23 23:02:38 -07:00
Mike Welsh 172ad82aa5 core: Add SwfMovie::uncompressed_len 2021-05-23 23:02:38 -07:00
Mike Welsh 077c7f045e core: Add SwfMovie::stage_size
Change `SwfMovie::width` and `height` to return `Twips`.
2021-05-23 23:02:38 -07:00
Mike Welsh 22948789b8 web: Add MovieData.isActionScript3 and backgroundColor 2021-05-23 23:02:38 -07:00
Mike Welsh bec6eb9dd3 core: Use SwfMovie::avm_type instead of MovieLibrary::avm_type 2021-05-23 23:02:38 -07:00
Mike Welsh e1439f4105 swf: Add HeaderExt struct providing additional info
When reading an SWF, search for FileAttributes and
SetBackgroundColor and return this along with the header data
because it's useful (in particular, the AS3 flag).
2021-05-23 23:02:38 -07:00
Chris Midgley aa7dc50385
core: Handle visible flag from PlaceObject (fix #3403) 2021-05-23 11:48:12 -07:00
relrelb a6387c3c10 core: Fix build without serde feature
Previously `cargo build --no-default-features` failed because then
`serde` was not found.
Fix that by not implementing serde's traits in that case, similarly
to `config.rs`.
2021-05-22 22:50:20 -07:00
Mike Welsh 61e20024e9 chore: Appease clippy 2021-05-22 20:28:31 -07:00
Mike Welsh 8960414436 swf: Use bitflags for FileAttributes 2021-05-22 15:53:02 -07:00
Mike Welsh aacdcc43ca chore: Update issue templates 2021-05-22 12:08:53 -07:00
relrelb 3fbadbe26f avm1: Remove unnecessary gc_context parameters
`add_property_with_case`, `set_watcher` and `remove_watcher` already
take an `activation`, from which the `gc_context` can be retrieved.
2021-05-22 10:49:27 -07:00
Mike Welsh bb22a5aba2 avm1: Remove extraneous self parameters from MovieClip methods
Previously these were used because the methods were on `MovieClipData`
instead of `MovieClip`, but now they are no longer necessary.
2021-05-21 17:50:25 -07:00
relrelb 7717b97027 avm1: Remove unnecessary calls to create_bare_object
In favor of ScriptObject::object and ScriptObject::array, which
always succeed.
2021-05-21 16:13:25 -07:00
relrelb aeb8902f8c avm1: Remove unused TObject::as_string 2021-05-21 15:27:35 -07:00
sn-o-w 41c4ac2834 i18n: Add Romanian 2021-05-19 14:49:01 -07:00
Mike Welsh 1dd669a0e3 canvas: Fix alpha calculation in canvas renderer 2021-05-18 16:20:45 -07:00
dependabot[bot] 30f088d16f chore: Bump futures from 0.3.14 to 0.3.15
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.14 to 0.3.15.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.14...0.3.15)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 12:41:29 -07:00
Moulins 35b9fb7317 avm1: add property_decl::declare_properties! macro for defining built-ins
This allows for reduced boilerplate when defining native methods,
properties, and constants (but not values depending on other runtime
values, like built-ins objects and prototypes).

Also remove ScriptObject::force_set_function (replaced by DeclKind::Method)
2021-05-17 10:34:41 -07:00
dependabot[bot] 9c837c4b85 chore: Bump winit from 0.24.0 to 0.25.0
Bumps [winit](https://github.com/rust-windowing/winit) from 0.24.0 to 0.25.0.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/compare/v0.24.0...v0.25.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:27:54 -07:00
dependabot[bot] 00194e351e chore: Bump serde from 1.0.125 to 1.0.126
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.125 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:13:02 -07:00
dependabot[bot] 2be5f2bc7e chore: Bump enum-map from 1.1.0 to 1.1.1
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map) from 1.1.0 to 1.1.1.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags)
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:11:31 -07:00
dependabot[bot] 1082d2fea7 chore: Bump isahc from 1.3.1 to 1.4.0
Bumps [isahc](https://github.com/sagebind/isahc) from 1.3.1 to 1.4.0.
- [Release notes](https://github.com/sagebind/isahc/releases)
- [Commits](https://github.com/sagebind/isahc/compare/1.3.1...1.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:09:45 -07:00
Toad06 c5233ed172 web: Make `unmuteOverlay: "hidden"` resume audio without extra click 2021-05-16 23:34:11 -07:00
Toad06 0ee6b62517 web: Add a `none` value to completely disable the unmute overlay 2021-05-16 23:34:11 -07:00
Jmousy 27bf4c5ccc i18n: Add Korean 2021-05-16 22:57:23 -07:00
Mike Welsh f478ee7b2f avm2: Properly implement Avm2Button::hit_test_shape and mouse_pick
The hit area is not a proper child of the Avm2Button, so manually
transform the test point into local space before passing it to the
hit area.
2021-05-16 17:53:07 -07:00
Mike Welsh dfc8c32937 core: Do not include stage transform in DisplayObject::local_to_global_matrix
TODO: Eventually we may want to include the stage transform here,
and the deeper ActionScript APIs transform it to remove the stage
scaling.
2021-05-16 17:53:07 -07:00
Mike Welsh 7784d8c099 avm2: Remove some AVM1 leftovers from Avm2Button 2021-05-16 17:53:07 -07:00
Mike Welsh 9b58dac841 avm2: Fix up DisplayObject root and stage properties
Move `MovieClip::is_swf` flag to `DisplayObject::is_root`, and use
this flag to handle the behavior of `DisplayObject.root` crawling
upwards until it hits a top-most loaded SWF/Bitmap.

Simplify `root` and `stage` so that they don't have to consider
buttons. Instead, do some trickery to ensure the button's states
see the proper values of `parent`, `root`, and `stage` during
construction.
2021-05-16 17:53:07 -07:00
Mike Welsh 2176e30e22 avm2: Use define_public_builtin_instance_properties for SimpleButton 2021-05-16 17:53:07 -07:00
David Wendt e555a6b488 avm2: Impl `SimpleButton.useHandCursor` 2021-05-16 17:53:07 -07:00
David Wendt 6f6e2c1b9f avm2: Impl `SimpleButton.enabled` 2021-05-16 17:53:07 -07:00
David Wendt 514c51510c avm2: Impl `SimpleButton.trackAsMenu` 2021-05-16 17:53:07 -07:00
David Wendt b383aec78d tests: Move the button tests into the new test directory. 2021-05-16 17:53:07 -07:00
David Wendt 71bb0c901a avm2: Impl the constructor parameters for `SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt a82e78b597 tests: Don't check the `exitFrame` or `frameConstructed` events in the nested test as it appears to fire the events redundantly 2021-05-16 17:53:07 -07:00
David Wendt cfd95e3b3b core: `root` and `stage` should yield `None` if an inactive state child of an `Avm2Button` is involved in the parent chain. 2021-05-16 17:53:07 -07:00
David Wendt 169a99397a core: `stage` also yields the current context's stage if there isn't one in the parent chain and we aren't in a button 2021-05-16 17:53:07 -07:00
David Wendt bfebc3c78f core: AVM2Button does not set the parent of the movie until after it's constructors have run 2021-05-16 17:53:07 -07:00
David Wendt 6a9249e52f core: Store the root of each loaded movie and use it as a last-ditch way to get the root 2021-05-16 17:53:07 -07:00
David Wendt 9ded256c23 core: Implement the AVM2 concept of `stage`. 2021-05-16 17:53:07 -07:00
David Wendt 39e9ef9dc5 core: Implement a separate `avm2_root` method that provides an AS3 notion of root 2021-05-16 17:53:07 -07:00