Commit Graph

3092 Commits

Author SHA1 Message Date
David Wendt 157ced3dc3 core: Split the parent accessor further into `parent` and `avm1_parent`.
`parent` is now a bare accessor, `avm1_parent` returns what AVM1 thinks the parent should be, and `avm2_parent` returns what AVM2 thinks the parent should be.
2021-05-16 17:53:07 -07:00
David Wendt f90cfb3bd0 core: Ensure sprite children get linked up correctly 2021-05-16 17:53:07 -07:00
David Wendt 5274df11f7 core: `Shape` should always expose it's defining movie instead of punting to the parent clip 2021-05-16 17:53:07 -07:00
David Wendt 826b20e8e4 tests: Don't assert execution order of frame scripts within buttons 2021-05-16 17:53:07 -07:00
David Wendt ef4de4d0d7 core: Order of events for child `Avm2Button` states is hit-up-down-over.
Ok, it's not *actually* that - all our tests actually have different, conflicting information. As far as I can tell there doesn't seem to be a single set order for these; so I'm going to just pick one and then stop testing the order in which states run.
2021-05-16 17:53:07 -07:00
David Wendt c936ccd4b4 avm2: When constructing new `SimpleButton`s, make sure the display object sees it's AVM2 side, else we replace all it's contents with AVM1 objects somehow(?!) 2021-05-16 17:53:07 -07:00
David Wendt 208c191d88 core: `Avm2Button` always runs a frame on set children, even if it's not the current state 2021-05-16 17:53:07 -07:00
David Wendt bf1fb93b83 core: Allow linking `Avm2Button`'s object 2021-05-16 17:53:07 -07:00
David Wendt d7deaf5e00 tests: Add currently-failing tests for the `SimpleButton` constructor and order-of-events. 2021-05-16 17:53:07 -07:00
David Wendt 44e82ea480 core: `Avm2Button` fires off events in this order when you set one of it's children:
1. `added`/`addedToStage` on the new state
2. `removed` (presumably) on the old state
3. `frameConstructed` on the new state
4. Any frame scripts on the new state
5. `exitFrame` on the new state

This is a rough approximation; I have several tests that fail in weird and interesting ways. Also, this only happens if you set the *active* state; presumably these events are all fired when the state changes but I can't automate tests for that yet.
2021-05-16 17:53:07 -07:00
David Wendt 434563da2f avm2: `SimpleButton` should build a button when constructed 2021-05-16 17:53:07 -07:00
David Wendt 67c7f156ac avm2: `instanceof` accepts `null` and `undefined` 2021-05-16 17:53:07 -07:00
David Wendt 7f294f5209 avm2: Constructor-based symbol instantiation should also post-instantiate before constructing a frame 2021-05-16 17:53:07 -07:00
David Wendt ea80d999da tests: Add an almost-passing test for buttons with multiple levels of children 2021-05-16 17:53:07 -07:00
David Wendt 07513da3ba core: State-constructed sprites in `Avm2Button` should be post-instantiated after everything else so they get their instance numbers later 2021-05-16 17:53:07 -07:00
David Wendt bba2ecae8e core: `Shape` gets an instance number 2021-05-16 17:53:07 -07:00
David Wendt 3707ef7fec tests: Add a test for child events using the same timeline structure as the structure test. 2021-05-16 17:53:07 -07:00
David Wendt 11d7fe5107 core: Correct the order of events that are fired when an `Avm2Button` is instantiated on the timeline. 2021-05-16 17:53:07 -07:00
David Wendt 6a70c1b3e0 tests: Extend the simplebutton structure test to include frame 2 2021-05-16 17:53:07 -07:00
David Wendt a013a7dfdf core: Initial construction should also prevent normal frame execution first frame 2021-05-16 17:53:07 -07:00
David Wendt 9f5a7f5065 core: AVM2 `Button`s run their children one frame at construction time 2021-05-16 17:53:07 -07:00
David Wendt bfef7f9969 core: `Avm2Button` should always construct a sprite for each state, even if it's not used. 2021-05-16 17:53:07 -07:00
David Wendt afefdb892f tests: Add a test for timeline-constructed AS3 `SimpleButton` contents 2021-05-16 17:53:07 -07:00
David Wendt 821ed25374 avm2: `Avm2Button` should construct it's children 2021-05-16 17:53:07 -07:00
David Wendt 71b87f8935 avm2: Also impl `construct_frame` and `run_frame_scripts` for `Avm2Button` 2021-05-16 17:53:07 -07:00
David Wendt 4869ec650e core: `Avm2Button` should construct a sprite whenever there's anything other than one child 2021-05-16 17:53:07 -07:00
David Wendt c317d77916 core: `Avm2Button` shouldn't try to construct a Sprite using it's prototype 2021-05-16 17:53:07 -07:00
David Wendt 10bed4fe30 core: `set_avm2_constructor` works on constructors, not prototypes 2021-05-16 17:53:07 -07:00
David Wendt d049ba8c0f core: Child instantiation should print the error message it got when it fails 2021-05-16 17:53:07 -07:00
David Wendt 25473ac1dc core: Allow AVM2 movies to define `Avm2Button` characters in their libraries 2021-05-16 17:53:07 -07:00
David Wendt cb44554135 avm2: Add setters and getters for the four states of `SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt 494083673c core: Add AVM2 version of Button 2021-05-16 17:53:07 -07:00
David Wendt 22eac776be avm2: Stub `flash.display.SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt cffa739a54 avm2: Store the sprite proto 2021-05-16 17:53:07 -07:00
David Wendt c0296d9963 core: Rename `Button` to `Avm1Button` 2021-05-16 17:53:07 -07:00
Reiner Gerecke efdb9c153d core: Fix endless loop when layouting text
If a textfield has word wrapping enabled, is very small in size and
tries to layout a single character onto it, the layout code can run into
an endless loop where it's creating new lines and trying to fit the text
again.

If text doesn't fit at the start of a line, it won't fit on the next
either, so abort and display the whole text span on the line. Text will
be cut-off.

This can be reproduced with a AS2 file like this:

    class Test {
      static var app : Test;

      function Test() {
        _root.createTextField("tf",0,0,0,6,20);
        _root.tf.text = "0";
        _root.tf.wordWrap = true;
      }

      static function main(mc) {
        app = new Test();
      }
    }

Build it with `mtasc -main -header 100💯30 test.as -swf test.swf`
2021-05-15 18:56:51 -07:00
Mike Welsh 69a0700ca1 core: Remove collect::CollectWrapper
No longer necessary, it is possible to mark individual fields
as `#[collect(require_static)]`.
2021-05-13 23:24:10 -07:00
Mike Welsh b882284fc9 core: Use bitflags for HitTestOptions 2021-05-12 23:02:06 -07:00
relrelb 85b234003f avm1: Handle undefined/empty method name in NewMethod
Seems like it behaves similarly to CallMethod with an undefined/empty
method name.
2021-05-12 20:47:06 -07:00
relrelb 2589ecdde0 avm1: Correct ImplementsOp 2021-05-12 20:47:06 -07:00
relrelb 3bf3f1015d avm1: Return undefined on invalid count in InitArray and InitObject
Both InitArray and InitObject should bail-out without popping anything
off the stack when the elements/properties count is negative or greater
than or equals 2147483648.
2021-05-12 20:47:06 -07:00
relrelb 72531eddff avm1: Cleanup CallMethod 2021-05-12 20:47:06 -07:00
relrelb 2e0bc78cd6 avm1: Fix variadic arguments
Previously, if the arguments count was greater than the actual
stack size, then a stack underflow occurred which resulted in a
sequence of undefined values. That didn't match Flash's behavior.

Also, this prevents potential huge allocations that hang Ruffle.

In addition, num_args seems like it should use coerce_to_u32
(wraps at 4294967297). This also means that -1 ends up acting like
u32::MAX and would pop all values off of the stack.
2021-05-12 20:47:06 -07:00
dependabot[bot] 62301dea54 chore: Bump syn from 1.0.71 to 1.0.72
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:40:26 -07:00
Mike Welsh 6051ee4cb1 core: Disallow .. in shared object paths (fix #3961)
Toss out any shared objects that contain ".." in the name
to avoid accessing files outside of the Ruffle data directory.

The DiskStorageBackend also will fail any requests with a ".."
component as an extra precaution.

Fixes #3961.
2021-05-09 23:20:32 -07:00
CUB3D 61298b2be3 avm1: Add parsing of legacy json SharedObjects for backwards compatability 2021-05-09 23:20:32 -07:00
CUB3D f4a9446829 avm1: Fix tests for SharedObject 2021-05-09 23:20:32 -07:00
CUB3D c398aded68 chore: Remove debug printing 2021-05-09 23:20:32 -07:00
CUB3D cd1cde1708 avm1: Implement de/serialization of shared objects into Flash Player Lso format 2021-05-09 23:20:32 -07:00
relrelb 6b6b335440 avm1: Use bitflags for Array.sort flags 2021-05-08 01:37:05 -07:00
Mike Welsh ba7fd1b2b9 chore: Appease clippy, bump url
Bump url and avoid `Url::into_string` deprecation warnings.
Fix `single_char_pattern` clippy lints.
2021-05-07 20:51:26 -07:00
relrelb b2bc24919a avm1: Replace `current_swf_version` with `swf_version`
They happen to be identical, and `swf_version` is more idomatic.
2021-05-07 13:26:20 -07:00
Mike Welsh ef617eebad avm1: Use `set_html_text` when initializing textfield from a variable binding
If a textfield was created with a variable binding, and the variable
already existed, the initial text of the textfield is set to the
variable value. However, this was not obeying the HTML setting of
the text field, so HTML tags were mistakenly shown in some content.

Fixes #3522.
2021-05-06 16:58:33 -07:00
Adrian Wielgosik 5319a5bb81 Remove lifetime from constants 2021-05-06 10:54:33 -07:00
Adrian Wielgosik faa0e50e89 avm2: Unify NativeMethod and GenericNativeMethod 2021-05-06 10:54:33 -07:00
Adrian Wielgosik 46ddb9be82 avm2: Generate class traits from const arrays 2021-05-06 10:54:33 -07:00
Adrian Wielgosik 8312243f42 avm2: Don't repeatedly call class.write(mc) 2021-05-06 10:54:33 -07:00
Mike Welsh b82391726f avm1: MovieClip.getBytesLoaded/Total should return the clip's length
MovieClip.getBytesLoaded and getBytesTotal return the size of that
specific clip, even if it's not a loaded SWF.  The previous logic
only returned the size of the parent SWF.

If the clip is an SWF, the uncompressed size of the SWF is returned.
Otherwise, the length of the tag list inside the clip's DefineSprite
tag is returned.
2021-05-04 16:36:56 -07:00
Aaron Hill 08d0829177 Move all SWF tests out of `core` to new `tests` package
This allows `regressions_tests.rs` to depend on other crates in the
workspace, such as `render`, without introducing a cyclic dependency.

Split out from #4054
2021-05-04 11:47:59 -07:00
Mike Welsh f9769451d6 avm1: Handle CDATA sections in XML 2021-05-03 16:23:04 -07:00
Moulins 78627acc92 chore: Move core::property_map to core::avm1::property_map 2021-05-03 13:47:14 -07:00
Moulins 272841729e core: Replace SwfMovie's PropertyMap by a list of key-value pairs
PropertyMap is an AVM1-only concept, and shouldn't be used on cross-VM
types.
2021-05-03 13:47:14 -07:00
Mike Welsh dca97afdd7 chore: Remove puremp3 feature
Wasn't being used, remove the puremp3 dependency.
2021-05-02 19:31:01 -07:00
Adrian Wielgosik 8ca22c1f02
core: Support for custom context menu items on movie root 2021-05-02 15:28:00 -07:00
Chris Midgley 31911d24ab tests: replace existing shared object test using mtasc 2021-05-01 17:40:01 -07:00
Chris Midgley c03bc62074 fix: SharedObject data property is not deleteable 2021-05-01 17:40:01 -07:00
Mike Welsh e8ec02418b avm2: Fix Array.splice
Fix `Array.splice` in cases where elements are added but not
deleted, and when the starting index is larger than the length
of the array.
2021-04-30 13:48:27 -07:00
Mike Welsh 2a46c72bb2 avm1: Fix Array.splice
Clamp the index parameters to the length of the array. This fixes
`[].splice(1, 0, 'obj');` to add the object at the proper
position (0, because the start index 1 is larger than the length).
2021-04-30 13:48:27 -07:00
dependabot-preview[bot] b57e1a14f0 build(deps): bump syn from 1.0.70 to 1.0.71
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.70 to 1.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.70...1.0.71)

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

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

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

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-21 18:31:39 -07:00
Adrian Wielgosik 8176e0a633
avm2: minor changes to domain memory
* Do not use as_bytearray_mut when we don't need mutability
* Set default domain memory size to 1024b.
2021-04-21 15:08:13 -07:00
CUB3D 9812fab9f8 chore: Format and fix clippy lints 2021-04-21 00:33:11 -07:00
CUB3D 7c4eb0d7ff avm2: Implement ApplicationDomain.domainMemory 2021-04-21 00:33:11 -07:00
CUB3D b3b1e69fc2 avm2: Store ByteArrayObject in Domain rather than ByteArrayStorage 2021-04-21 00:33:11 -07:00
CUB3D 4dc1210b37 avm2: Use try_into for converting slice->array 2021-04-21 00:33:11 -07:00
CUB3D 98d9bd06b6 avm2: Remove more unused code from test 2021-04-21 00:33:11 -07:00
CUB3D d6a3b5bfda avm2: Remove unused code from test 2021-04-21 00:33:11 -07:00
CUB3D 397ceed33c avm2: Dont panic when domain memory not available 2021-04-21 00:33:11 -07:00
CUB3D 136add866a chore: Fix clippy lints 2021-04-21 00:33:11 -07:00
CUB3D 63120806bf avm2: Correct Sxi8 and Sxi16 2021-04-21 00:33:11 -07:00
CUB3D 6d2339b151 avm2: Add tests for Op::Sxi1 2021-04-21 00:33:11 -07:00
CUB3D f34579926c chore: Format 2021-04-21 00:33:11 -07:00
CUB3D 99edb5ab2b avm2: Implement Op::Sxi1 2021-04-21 00:33:11 -07:00
CUB3D 9ffa4f1f50 avm2: Implement Op::Lf64 2021-04-21 00:33:11 -07:00
CUB3D b4736413fa avm2: Implement Op::Sf64 2021-04-21 00:33:11 -07:00
CUB3D 2b4becf41f avm2: Implement Op::Lf32 2021-04-21 00:33:11 -07:00
CUB3D 509392db8e avm2: Implement Op::Sf32 2021-04-21 00:33:11 -07:00
CUB3D dce2626482 avm2: Use from/to_le_bytes 2021-04-21 00:33:11 -07:00
CUB3D 35d7c5a7e3 chore: Format 2021-04-21 00:33:11 -07:00
CUB3D ae9d5fd328 avm2: Implement Op::Li32 2021-04-21 00:33:11 -07:00
CUB3D 951d557a90 avm2: Implement Op::Si32 2021-04-21 00:33:11 -07:00
CUB3D 96ad0e3d00 avm2: Implement Op::Li16 2021-04-21 00:33:11 -07:00
CUB3D aaaf6ace3e avm2: Implement Op::Si16 2021-04-21 00:33:11 -07:00
CUB3D f437539f73 avm2: Some domain memory is available by default and error when range invalid 2021-04-21 00:33:11 -07:00
CUB3D 5a0cdf60bc avm2: Implement Op::Si8 and Op::Li8 badly 2021-04-21 00:33:11 -07:00
CUB3D 12a198f671 avm2: Implement Op::Coerce and add tests 2021-04-21 00:33:11 -07:00
CUB3D c2969895b2 avm2: Add domain memory tests 2021-04-21 00:33:11 -07:00
CUB3D 89c01dca18 swf: Add support for AVM2 domain memory opcodes 2021-04-21 00:33:11 -07:00
TÖRÖK Attila 46ddc31254 avm2: Call the super initializer of LoaderInfo after construction 2021-04-19 18:16:47 -07:00
Mike Welsh cbe685f8d5 tests: Update transform test to verify color transform rounding 2021-04-19 15:47:52 -07:00
Mike Welsh 0552d26551 core: Use Fixed8 and i16 for ColorTransform
Use the proper types for ColorTransform:
 * Fixed8 (8.8) format for multiplicative component
 * i16 format for additive component

This matches the behavior of Flash (for example, alpha only changes
in units of 1/256).
2021-04-19 15:47:52 -07:00
dependabot-preview[bot] 9c466c65da build(deps): bump syn from 1.0.67 to 1.0.69
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.67 to 1.0.69.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.67...1.0.69)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-18 23:54:37 -07:00
relrelb cd8ab813a4 avm1: Return an unboxed undefined in `TransformObject` constructor
This is now possible thanks to #2415.
2021-04-17 09:27:29 -07:00
relrelb 6d68460196 tests: Expand funky_function_calls 2021-04-17 09:25:24 -07:00
relrelb 95cffdc2f9 avm1: Pass undefined this for CallMethod with non-string method_name
This isn't the most accurate behavior, since it should be an unboxed
Value, but currently it's not possible due to #843.
2021-04-17 09:25:24 -07:00
relrelb 6a34070e76 tests: Expand sound
Check Sound.duration and Sound.getDuration() for detached sounds.
Check rounding behavior of Sound.duration and Sound.getDuration()
behind a comment because NullAudioBackend doesn't respect durations.
TODO: Uncomment it once NullAudioBackend returns real durations.
2021-04-17 09:11:50 -07:00
relrelb e3478248ac avm1: Implement Sound.getDuration() and Sound.setDuration()
These seem to be undocumented.
Looks like Sound.getDuration() behaves exactly as Sound.duration,
and Sound.setDuration() does nothing.
2021-04-17 09:11:50 -07:00
relrelb 6310e31023 avm1: Sound.duration should return undefined when no sound is attached
Previously it returned 0.
2021-04-17 09:11:50 -07:00
relrelb 4d41297b04 avm1: Remove reduntant new_ret_no_self annotation
Per https://rust-lang.github.io/rust-clippy/master/#new_ret_no_self,
`new_ret_no_self` applies only to functions named `new`.
`TObject::create_bare_object` used to be named `new`, but was renamed
in 79af3ffe44.
2021-04-16 15:25:22 -07:00
relrelb 1f934c5fc6 avm1: Remove redundant newlines 2021-04-16 15:25:22 -07:00
relrelb dac60da936 avm1: ValueObject::boxed -> coerce_to_object 2021-04-16 15:25:22 -07:00
relrelb 0f8f0986e9 chore: Use matches!(...) in more places 2021-04-16 15:25:22 -07:00
relrelb 9dc63a7831 core: Remove redundant tuple 2021-04-16 15:25:22 -07:00
relrelb a2e162be0d avm1: Add Value::is_primitive
This provides a more convenient and readable way compared to
using matches!(Value::Object(_)).
2021-04-16 15:25:22 -07:00
relrelb 2ba6cada5b avm1: Reserve arguments capacity
This prevents unnecessary re-allocations.
2021-04-16 15:25:22 -07:00
Chris Midgley d89f0bbbfe fix: looks like contentType is ignored (at least in FP6) 2021-04-16 12:36:49 -07:00
Chris Midgley ba185418b9 chore: fmt 2021-04-16 12:36:49 -07:00
Chris Midgley 6c619495f4 chore: fix warnings 2021-04-16 12:36:49 -07:00
Chris Midgley 8e6bba1525 avm1: implement send_and_load 2021-04-16 12:36:49 -07:00
Chris Midgley f1b07bd75b avm1: set contentType on xml; fix initial contentType on load_vars. 2021-04-16 12:36:49 -07:00
dependabot-preview[bot] f90d58703a build(deps): bump pretty_assertions from 0.7.1 to 0.7.2
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.7.1 to 0.7.2.
- [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.7.1...v0.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-15 14:30:00 -07:00
Mike Welsh a45a5c2bcb avm1: _levelN should shadow children instances with the same name
If a child clip is named `_level0`, accessing `_level0` should
return the level and not the child clip.

Move `DisplayObject::get_level_by_path` to `StageObject`, and
change it to return an `Option<Value>`, and return
`Some(Value::Undefined)` if the path is a valid level path but
the level is not occupied. This causes get/set of `_levelN` to
be swallowed, even if the level isn't populated.
2021-04-15 13:49:17 -07:00
Mike Welsh 34886933e5 avm1: Adjust precedence of children in StageObject::get
Children instances should shadow display object magic properties.
For example, a child named "_x" will be returned instead of the
parent's _x position in GetMember.
2021-04-15 13:49:17 -07:00
Mike Welsh 9224e85a2d avm1: Delete2 returns true only if a property was actually deleted
This was incorrectly returning true for children instances
(`delete "clip"`).
2021-04-15 13:49:17 -07:00
Mike Welsh d04989cf49 tests: Update stage_object_children test
Add a few tests for shadowing of child instances vs. display
object magic properties (for example, when a child clip is named
"_x" or "_level0").
2021-04-15 13:49:17 -07:00
desuwa 0d6c548be4 tests: Add tests for Player::run_actions at timer callbacks. 2021-04-15 13:48:27 -07:00
desuwa 3030f2098a avm1: Run Player::run_actions after every timer callback. 2021-04-15 13:48:27 -07:00
EmperorBale 04d80e5e4e chore: Fix more typos 2021-04-15 00:02:40 -07:00
EmperorBale 0ea02919b3 chore: Fix typo 2021-04-15 00:02:40 -07:00
EmperorBale d227c6cbce chore: Fix formatting 2021-04-15 00:02:40 -07:00
EmperorBale 153da75304 tests: Add test for IsType 2021-04-15 00:02:40 -07:00
EmperorBale cbf8d77006 avm2: Fix IsType 2021-04-15 00:02:40 -07:00
EmperorBale e4ba4b074a tests: Add test for AsType 2021-04-15 00:02:40 -07:00
EmperorBale ca2709f594 avm2: Implement AsType 2021-04-15 00:02:40 -07:00
EmperorBale 17acebb108 chore: Fix formatting 2021-04-15 00:02:40 -07:00
EmperorBale f459e18b1a tests: Update regression tests 2021-04-15 00:02:40 -07:00
EmperorBale 1d0c2b78b2 tests: Add test for AsTypeLate 2021-04-15 00:02:40 -07:00
EmperorBale c0a56b14c0 avm2: Implement AsTypeLate 2021-04-15 00:02:40 -07:00
Mike Welsh b9d84c0a82 chore: Appease clippy
Honor the branches-sharing-code lint.
2021-04-15 00:02:27 -07:00
Mike Welsh d87be39e3c avm2: Don't parse "inf" as Infinity 2021-04-14 21:51:48 -07:00
Mike Welsh b6945395a8 avm1: Don't parse "inf" as Infinity
Rust nightly 4/13 allows f64::parse to handle "infinity", case
insensitive. This broke cases such as `Number("Infinity")`, which
should return `NaN` in AVM1.

Additionally, Rust will now print "-0" for negative zero, when
previously it would print "0".

 * Return NaN for inf cases ("inf", "-Infinity", "+INF", etc.)
 * Add a test for `Number("inf")` (this was also incorrect before
   the latest nightly)
 * Add a special case for zero in `f64_to_string` to ensure
   that -0.0 gets coerced to "0".

For more info, see:
https://github.com/rust-lang/rfcs/issues/1074
2021-04-14 21:51:48 -07:00
Adrian Wielgosik b2bed7a18d
avm1: Add missing clearTimeout() (fix #4003) 2021-04-14 11:02:04 -07:00
Moulins f9bbe96812 core: Remove extra Option/Results from XmlNode getters
This removes some special cases and simplifies the code.
2021-04-11 14:16:48 -07:00
Moulins ae1a01d181 avm1: Allow XMLNode reparenting (closes #3962)
`XMLNode.{appendChild, insertNode}` can now be used to move
child nodes from a parent to another.

There are two special cases:
  - if the node is already a child of the destination, nothing happens
  - if moving the node would create a cycle, nothing happens
2021-04-11 14:16:48 -07:00
relrelb 20d6fcc128 chore: Remove unnecessary type annotations 2021-04-10 18:39:16 -07:00
Mike Welsh 11f40384da tests: Add test for loading into _root 2021-04-10 13:48:05 -07:00
Mike Welsh aa0707411c avm1: Update movie parameters when loading into _root/_level0
The movie framerate and dimensions should be changed when a movie
is loaded into _root or level 0.
2021-04-10 13:48:05 -07:00
David Wendt 7a781179aa core: Move all of the remaining AVM2 object allocation and/or construction into the `construct_frame` step. 2021-04-09 22:24:22 -07:00
David Wendt dc5b30e460 core: Remove "constructor ran" flag now that we can handle that with a local bool 2021-04-09 22:24:22 -07:00
David Wendt 27d09084fb core: Use the library's AVM type to determine how to name the root.
We cannot check it's constructed AVM value anymore because it is now named before construction.
2021-04-09 22:24:22 -07:00
David Wendt ebc5c3dd64 avm2: Ensure that objects are only *ever* constructed at frame construction time.
This ensures that root movie classes see their children in their constructor.
2021-04-09 22:24:22 -07:00
desuwa e8de3a5a20 tests: Add tests for `MovieClip.hitTest()` with shapeflag and masks. 2021-04-09 22:11:07 -07:00
desuwa 4f90b9d161 avm1: Support masks when mouse-picking. 2021-04-09 22:11:07 -07:00
relrelb f8b589fc24 core: Fix panic in remove_invalid_jpeg_data
`data` could be shorter than 4 bytes.
2021-04-09 14:47:19 -07:00
desuwa 755409673b avm2: Add tests for set_width / set_height setting the scale to non-finite values. 2021-04-07 17:42:28 -06:00
desuwa 3c2d467a5f avm1: Add tests for set_width / set_height setting the scale to non-finite values. 2021-04-07 17:42:28 -06:00
desuwa fa1fde7083 core: Ensure the new scale is finite when setting the width / height of display objects. 2021-04-07 17:42:28 -06:00
desuwa b7bf8334b2 core: Run `update_drag` earlier in the update cycle. Fix #1511 2021-04-06 15:48:06 -06:00
relrelb 732efb27c4 render: Fix RGB15 bitmaps decoding
Each row should be padded to 2.
2021-04-05 20:10:35 -06:00
David Wendt 5d198952e8 chore: Fix merge conflict mis-resolution 2021-04-05 16:18:37 -06:00
David Wendt 5cba07111e avm2: Impl `LoaderInfo.parameters` 2021-04-05 16:18:37 -06:00
David Wendt de1b0d4d0c core: Add support for an explicit loader URL (though nothing sets it yet) and expose it in `LoaderInfo`. 2021-04-05 16:18:37 -06:00
David Wendt 4eee8be911 avm2: Impl `SWFVersion` enumeration 2021-04-05 16:18:37 -06:00
David Wendt 4c314a47cc avm2: Impl `LoaderInfo.bytes` 2021-04-05 16:18:37 -06:00
David Wendt a9328b228f avm2: Allow writing to `ByteArrayStorage` 2021-04-05 16:18:37 -06:00
David Wendt f61ea0b290 chore: Clippy beta/nightly compliance 2021-04-05 16:18:37 -06:00
David Wendt 46bf1b33c4 avm2: Impl `LoaderInfo.width` 2021-04-05 16:18:37 -06:00
David Wendt 28a1cb4308 avm2: Impl `LoaderInfo.url` 2021-04-05 16:18:37 -06:00
David Wendt 5941d6cf66 avm2: Impl `LoaderInfo.swfVersion` 2021-04-05 16:18:37 -06:00
David Wendt 6814fb9c22 avm2: Stub `LoaderInfo.isURLInaccessible` 2021-04-05 16:18:37 -06:00
David Wendt b6e31d8be5 avm2: Impl `LoaderInfo.height` 2021-04-05 16:18:37 -06:00
David Wendt e795da0358 avm2: Impl `LoaderInfo.frameRate` 2021-04-05 16:18:37 -06:00
David Wendt cbd167fd6c avm2: Stub `LoaderInfo.contentType` 2021-04-05 16:18:37 -06:00
David Wendt 76c563146d tests: Grab `contentType` on frame two 2021-04-05 16:18:37 -06:00
David Wendt 7b7d250ce9 avm2: This is a getter, not a method 2021-04-05 16:18:37 -06:00
David Wendt 2a01260f52 avm2: `bytesLoaded` etc reports the compressed file length, not the uncompressed length 2021-04-05 16:18:37 -06:00
David Wendt d0ad894f70 avm2: Impl `LoaderInfo.content` 2021-04-05 16:18:37 -06:00
David Wendt b4cb01d2c9 avm2: Impl `LoaderInfo.bytesTotal`, and `.bytesLoaded`
`bytesLoaded` is currently aliased to `bytesTotal` as we do not yet support streaming loads
2021-04-05 16:18:37 -06:00
David Wendt 55e448ebaa avm2: Impl `LoaderInfo.applicationDomain` 2021-04-05 16:18:37 -06:00
David Wendt c156cd2a16 tests: Add tests for properties that are only accessible on frame 2 2021-04-05 16:18:37 -06:00
David Wendt 12dcfe7c62 avm2: Impl `LoaderInfo.actionScriptVersion` 2021-04-05 16:18:37 -06:00
David Wendt 1a7b33a1af avm2: Impl `ActionScriptVersion` 2021-04-05 16:18:37 -06:00
David Wendt a492c4db4d tests: Add a test for `LoaderInfo`'s properties 2021-04-05 16:18:37 -06:00
David Wendt fc26c26d1d avm2: Allow access to `loaderInfo` on root movies 2021-04-05 16:18:37 -06:00
David Wendt 60c92dde49 avm2: Add Loader Info class & object type 2021-04-05 16:18:37 -06:00
CUB3D e2f124ee34 avm2: Rename current_position -> instruction_start 2021-04-03 16:37:47 -06:00
CUB3D c22ebc1de3 chore: Format on stable 2021-04-03 16:37:47 -06:00
CUB3D d5c2e5559b avm2: Don't mutably borrow for pos() 2021-04-03 16:37:47 -06:00
CUB3D 96f89a1643 avm2: Implement Op::LookupSwitch 2021-04-03 16:37:47 -06:00
relrelb 2d37f4d23e avm1: Migrate `search_prototype` to primitive prototype 2021-04-03 12:40:05 -06:00
relrelb bbded90697 avm1: Rename proto_value to proto 2021-04-01 17:06:07 -06:00
relrelb 89679bba65 avm1: Delete proto and set_proto
In favor of the new proto_value and set_proto_value pair.
In the next commit proto_value and set_proto_value will be renamed
to proto and set_proto.
2021-04-01 17:06:07 -06:00
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