Commit Graph

2726 Commits

Author SHA1 Message Date
relrelb 2c1dfea3ce avm1: Migrate Player to proto_value 2021-04-01 17:06:07 -06:00
relrelb 76d80061a7 avm1: Migrate Object to proto_value 2021-04-01 17:06:07 -06:00
relrelb e712a4fd59 avm1: Migrate FunctionObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb dc174b9d9f avm1: Migrate StageObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb be60aa5941 avm1: Migrate XmlIdMapObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb ea52562d06 avm1: Migrate XmlAttributesObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb 161db474a2 avm1: Migrate SuperObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb 766a5db31c avm1: Migrate ScriptObject to proto_value 2021-04-01 17:06:07 -06:00
relrelb 18a32424bd amv1: Migrate custom_object.rs to proto_value 2021-04-01 17:06:07 -06:00
CUB3D 209b9cec36 chore: Format 2021-03-31 18:36:24 -06:00
CUB3D ecbf6118bb avm2: Update tests 2021-03-31 18:36:24 -06:00
CUB3D 9453743f9f avm2: Add test for Op::EscXElem 2021-03-31 18:36:24 -06:00
CUB3D 0ea564f75c avm2: Implement Op::EscXAttr and Op::EscXElem 2021-03-31 18:36:24 -06:00
relrelb e453cbf0ef tests: Expand object_prototypes 2021-03-31 18:04:52 -06:00
relrelb e5660bc0c7 avm1: Allow primitive prototypes
Prototypes can be primitive, not just objects. However, TObject's
proto() and set_proto() work with Object and not Value. To allow
easier and more incremental migration from Object to Value, this
commit introduces a new pair of proto_value/set_proto_value functions
in TObject, preserving the existing proto/set_proto functions.
Both pairs have default implementations, so it's enough to implement
only one pair in each TObject implementation.
For now only ScriptObject uses the new pair, which fixes the behavior
of incorrectly coercing __proto__ to object.

Follow-up migration plan:
1. Replace all old proto/set_proto implementations by the new
proto_value/set_proto_value in all TObject implementations on a
one-by-one basis.
2. After proto/set_proto become unused, delete them and rename
proto_value/set_proto_value to proto/set_proto for more concise code.
2021-03-31 18:04:52 -06:00
relrelb 014e85b1f0 tests: Expand funky_function_calls 2021-03-31 17:59:58 -06:00
relrelb 5beb0164dd tests: Cleanup funky_function_calls 2021-03-31 17:59:58 -06:00
relrelb a3727e0727 avm1: Fix "this" argument conversion in Function.prototype.{call,apply}
The "this" argument should fall-back to the global object only for
undefined or null. Other primitives should be coerced to an object
rather than falling-back to the global object.

As a drive-by replace `Vec::new` by `Vec::with_capacity` in
`Function.prototype.apply` to minimize unnecessary reallocations.
2021-03-31 17:59:58 -06:00
CUB3D 8d68dcb562 avm2: Update tests 2021-03-29 20:46:02 -06:00
CUB3D 68527c13da avm2: Implement flash.utils.getTimer 2021-03-29 20:46:02 -06:00
dependabot-preview[bot] 23af83f923 build(deps): bump syn from 1.0.64 to 1.0.65
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.64 to 1.0.65.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.64...1.0.65)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-27 01:40:26 -07:00
relrelb 7e1acce150 core: Fix build without default features
Previously `cargo build --no-default-features` failed because then
neither implementation of `Mp3Decoder` is chosen.
Fix that by not handling mp3 sounds at all in that case.
2021-03-27 01:40:11 -07:00
Mike Welsh f96a414036 avm2: Lazily initialize Graphics object
Initialize a Sprite/Shape's Graphics object on the first access,
so that `shape.graphics == shape.graphics` is `true`.
2021-03-24 13:18:06 -07:00
Mike Welsh 040da925e4 avm2: Fix incorrect color in drawing API 2021-03-24 13:18:06 -07:00
Mike Welsh 9a08b9ae4f avm2: flash.display.Graphics is final 2021-03-24 13:18:06 -07:00
David Wendt df466dfba1 core: Start with an empty drawing when a `Shape` is converted into a `Drawing`. 2021-03-24 13:18:06 -07:00
David Wendt b739b8d786 core: Retain the original `swf::Shape` until dynamic behavior is needed, upon which we switch to using a `Drawing`. 2021-03-24 13:18:06 -07:00
David Wendt ff028de8de core: `Drawing` should accept a SWF movie to pull bitmaps from 2021-03-24 13:18:06 -07:00
David Wendt 4238d8bd2a tests: Add another test for drawing on `MovieClip` 2021-03-24 13:18:06 -07:00
David Wendt 1d57eee369 tests: Add a test for shape drawing 2021-03-24 13:18:06 -07:00
David Wendt 1d64f38bb7 avm2: Impl `drawRect` 2021-03-24 13:18:06 -07:00
David Wendt 60f4f2c534 core: `Graphic` should expose it's `Drawing` for external access 2021-03-24 13:18:06 -07:00
David Wendt 85ee005c0f core: `Graphic` should always use it's stored `Drawing`'s bounds 2021-03-24 13:18:06 -07:00
David Wendt e3f2d0f213 avm2: Allow constructing new `Shape`s. 2021-03-24 13:18:06 -07:00
David Wendt 62a779444d avm2: `graphics` is a `Sprite` property, not a `MovieClip` property 2021-03-24 13:18:06 -07:00
David Wendt 5e7327d041 avm2: Allow drawing on `Shape`s. 2021-03-24 13:18:06 -07:00
David Wendt e8b6d1a52a core: Migrate clip drawing commands to exposing the internal `Drawing` to mutation 2021-03-24 13:18:06 -07:00
David Wendt 1a6f401f1f avm2: Implement `Graphics.moveTo` 2021-03-24 13:18:06 -07:00
David Wendt 15d3a1e99d avm2: Implement `Graphics.lineTo` 2021-03-24 13:18:06 -07:00
David Wendt 9464a8800a avm2: Implement `CapsStyle` 2021-03-24 13:18:06 -07:00
David Wendt f7f98cc69e avm2: Implement `LineScaleMode` 2021-03-24 13:18:06 -07:00
David Wendt 582d2447cd avm2: Implement `JointStyle` 2021-03-24 13:18:06 -07:00
David Wendt 6396b90890 avm2: Implement `Graphics.lineStyle` 2021-03-24 13:18:06 -07:00
David Wendt 41ad756792 avm2: Implement `Graphics.endFill` 2021-03-24 13:18:06 -07:00
David Wendt 3dfeeacfcc avm2: Implement `Graphics.curveTo` 2021-03-24 13:18:06 -07:00
David Wendt 71b6bca100 avm2: Implement `Graphics.clear` 2021-03-24 13:18:06 -07:00
David Wendt f1febe33b9 avm2: Implement `Graphics.beginFill` 2021-03-24 13:18:06 -07:00
David Wendt 124e144d02 avm2: Add a class for `graphics` 2021-03-24 13:18:06 -07:00
dependabot-preview[bot] 20b2e55171 build(deps): bump gif from 0.11.1 to 0.11.2
Bumps [gif](https://github.com/image-rs/image-gif) from 0.11.1 to 0.11.2.
- [Release notes](https://github.com/image-rs/image-gif/releases)
- [Changelog](https://github.com/image-rs/image-gif/blob/master/Changes.md)
- [Commits](https://github.com/image-rs/image-gif/compare/v0.11.1...v0.11.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-23 10:03:59 -07:00
dependabot-preview[bot] 19d57941ee build(deps): bump serde from 1.0.124 to 1.0.125
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.124 to 1.0.125.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.124...v1.0.125)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-23 10:03:17 -07:00
Adrian Wielgosik c084d575f4
tests: Speed up builds of regression tests 2021-03-20 14:50:57 -07:00
Adrian Wielgosik 2d1c60e02e
avm1: Fix binary operators not returning signed values
Also enabled AVM2 test that was forgotten before.
2021-03-20 14:49:55 -07:00
EmperorBale ac9d27b2fd
avm1: Avoid panic when setMask called with no arguments (fix #3298) 2021-03-19 17:25:58 -07:00
Chris Midgley aa94f6570e
avm1: fix String.substr behaviour for negative lengths (fix #3626) 2021-03-19 14:32:04 -07:00
David Wendt 05dc538a25 avm2: Use the actual `FromIterator` trait 2021-03-19 12:39:57 -07:00
David Wendt 1baadb93c2 chore: cargo fmt is fickle 2021-03-19 12:39:57 -07:00
David Wendt a40755154d avm2: `TextField` and `TextFormat` are sealed (non-dynamic) classes 2021-03-19 12:39:57 -07:00
David Wendt 6deebf0733 tests: approx the `leading` and `font_size` tests, and increase the epsilon on `autosize` by 1px. 2021-03-19 12:39:57 -07:00
David Wendt a05423d48c avm2: Setting a given text property also sets or resets the `html` mode (since it's not a separate property like in AS2) 2021-03-19 12:39:57 -07:00
David Wendt f5268198b0 avm2: Don't round text metrics (`textWidth` and `textHeight`) 2021-03-19 12:39:57 -07:00
David Wendt f908eb65fc tests: Port AS2 edittext tests to AS3. 2021-03-19 12:39:57 -07:00
David Wendt f188306f4f avm2: `setTextFormat` is range-checked 2021-03-19 12:39:57 -07:00
David Wendt 78c519cce0 avm2: Don't except when creating a dynamic TextField. 2021-03-19 12:39:57 -07:00
David Wendt 4ef01000a8 avm2: Impl `TextField.setTextFormat` 2021-03-19 12:39:57 -07:00
David Wendt a115db49ba avm2: Impl `TextField.setSelection` 2021-03-19 12:39:57 -07:00
David Wendt 7902914aa4 avm2: Impl `TextField.replaceText` 2021-03-19 12:39:57 -07:00
David Wendt c22f30fdf0 avm2: Impl `TextField.replaceSelectedText` 2021-03-19 12:39:57 -07:00
David Wendt b4d97ca183 avm2: Impl `TextField.getTextFormat` 2021-03-19 12:39:57 -07:00
David Wendt f45c9d1889 avm2: Impl `TextField.appendText` 2021-03-19 12:39:57 -07:00
David Wendt 42f717deb8 avm2: Impl `TextField.wordWrap` 2021-03-19 12:39:57 -07:00
David Wendt 4bfc3cfda4 avm2: Impl `TextField.type` 2021-03-19 12:39:57 -07:00
David Wendt 1c2ef3154a avm2: Impl `TextFieldType` 2021-03-19 12:39:57 -07:00
David Wendt da563266d5 avm2: Impl `TextField.textHeight` and `TextField.textWidth` 2021-03-19 12:39:57 -07:00
David Wendt 8165aa5c4a avm2: Impl `TextField.textColor` 2021-03-19 12:39:57 -07:00
David Wendt c0a2547be3 avm2: Impl `TextField.text` 2021-03-19 12:39:57 -07:00
David Wendt dee937ac3a avm2: Impl `TextField.selectable` 2021-03-19 12:39:57 -07:00
David Wendt b6a1bf80c1 avm2: Impl `TextField.multiline` 2021-03-19 12:39:57 -07:00
David Wendt 053b6bd4cc avm2: Impl `TextField.length` 2021-03-19 12:39:57 -07:00
David Wendt 1ce868c51e avm2: Impl `TextField.htmlText` 2021-03-19 12:39:57 -07:00
David Wendt 89c131bf52 avm2: Impl `TextField.embedFonts`
This assumes `embedFonts` is the opposite of device fonts, which sounds reasonable.
2021-03-19 12:39:57 -07:00
David Wendt 62ec106afb avm2: Impl `TextField.displayAsPassword` 2021-03-19 12:39:57 -07:00
David Wendt fa5145b884 avm2: Impl `TextField.defaultTextFormat` 2021-03-19 12:39:57 -07:00
David Wendt 3d8bf90794 core: Also allow converting `TextFormat` back into an AVM2 object. 2021-03-19 12:39:57 -07:00
David Wendt 3d2d2072af avm2: Impl `TextFormatAlign` 2021-03-19 12:39:57 -07:00
David Wendt e10726ef1c core: Add utilities for converting an AVM2 object into a `TextFormat` 2021-03-19 12:39:57 -07:00
David Wendt 50f992b9e6 avm2: Implement `TextField.borderColor` 2021-03-19 12:39:57 -07:00
David Wendt 8913297514 avm2: Fix type of `TextField.backgroundColor` 2021-03-19 12:39:57 -07:00
David Wendt 8d1e0992b5 avm2: Impl `TextField.border` 2021-03-19 12:39:57 -07:00
David Wendt 436b3b2ed3 avm2: Impl `TextField.backgroundColor` 2021-03-19 12:39:57 -07:00
David Wendt a84acd55c3 avm2: Impl `TextFieldAutoSize` 2021-03-19 12:39:57 -07:00
David Wendt e35f66fafe avm2: Impl `TextField.autoSize` 2021-03-19 12:39:57 -07:00
David Wendt b6adc18c9c avm2: Impl `flash.text.TextFormat` 2021-03-19 12:39:57 -07:00
David Wendt f44e54246d avm2: Text fields on AVM2 movies should have AVM2 objects. 2021-03-19 12:39:57 -07:00
David Wendt 9e739f8ceb avm2: Ensure constructed text fields have a DisplayObject side 2021-03-19 12:39:57 -07:00
David Wendt b71286f1c4 avm2: Stub `flash.text.TextField` 2021-03-19 12:39:57 -07:00
relrelb cdb2c279c0 avm2: Implement Nop 2021-03-19 12:39:23 -07:00
relrelb 72626825d3 tests: Expand bitmap_data 2021-03-18 22:04:39 -07:00
relrelb 3b6f0f0ced avm1: Fix color_bounds_rect 2021-03-18 22:04:39 -07:00
Aaron Hill d3744d28df Derive `Collect` for `ActionQueue` 2021-03-18 21:56:04 -07:00
dependabot-preview[bot] 069096e3e7 build(deps): bump syn from 1.0.63 to 1.0.64
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.63 to 1.0.64.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.63...1.0.64)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-18 18:33:14 -07:00
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