Commit Graph

2213 Commits

Author SHA1 Message Date
David Wendt 200581e1e3 avm2: Expose `x` and `y` properties. 2020-12-09 14:00:06 -08:00
David Wendt 4784dc3c03 tests: Add more stringent height/width test that we're only accurate to within 1 twip. 2020-12-09 14:00:06 -08:00
David Wendt abca120628 avm2: Expose `width` to AS3 code. 2020-12-09 14:00:06 -08:00
David Wendt 3225cd40e2 core: Avoid panic when display objects are manipulated in clearly invalid ways. 2020-12-09 14:00:06 -08:00
David Wendt 990401a09c core: Allow percentages (e.g. scalex/y) to be specified, stored, and cached at either [0..1] or [0..100] scale. 2020-12-09 14:00:06 -08:00
David Wendt 6da658a845 avm2: `pushshort` has an undocumented coercion step 2020-12-09 14:00:06 -08:00
David Wendt 90e203b004 avm2: `this.height` ignores negative values 2020-12-09 14:00:06 -08:00
David Wendt bd00bea744 avm2: Expose `alpha`, `height`, `scaleY`, and `scaleX` to script code. 2020-12-09 14:00:06 -08:00
David Wendt 69db45131b tests: Add inactive tests for `alpha`, `height`, `rotation`, `width`, `x`, and `y`. 2020-12-09 14:00:06 -08:00
dependabot-preview[bot] d1c79a5dd5 build(deps): bump png from 0.16.7 to 0.16.8
Bumps [png](https://github.com/image-rs/image-png) from 0.16.7 to 0.16.8.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-08 21:13:22 -08:00
jmckiern 3cab11d18e avm1: Implement TextField.textColor (close #1863) 2020-12-07 15:09:36 -08:00
dependabot-preview[bot] 17eb651682 build(deps): bump syn from 1.0.53 to 1.0.54
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.53 to 1.0.54.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.53...1.0.54)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-07 13:08:20 -08:00
Mike Welsh 9901738249 chore: Appease rustfmt 2020-12-07 10:35:40 -08:00
relrelb 989bfb8f3e avm1: Improve loops treatment in Sound.start
The second argument of Sound.start, loops, can be greater than
std::u16::MAX, but previously greater values were treated as 1.
Ideally, the solution is to respect those values, but since SoundInfo
holds a u16, a short-term solution is to treat them as std::u16::MAX
instead.
2020-12-06 14:22:38 -08:00
Mike Welsh 16b9c77d02 core: Remove panic in morph shape lerp 2020-12-05 00:19:30 -08:00
dependabot-preview[bot] f45fa80e29 build(deps): bump smallvec from 1.5.0 to 1.5.1
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.0...v1.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-04 17:54:47 -08:00
bbb651 92bd0874e1 Fixed "Swap" only working for i32 2020-12-03 15:51:37 -08:00
bbb651 8baf35e7af Added AVM2 op "Swap" 2020-12-03 15:51:37 -08:00
Mike Welsh 758a32f5f0 core: Remove unimplemented! in decode_define_bits_lossless 2020-12-02 23:58:03 -08:00
Zeh Fernando c018ac065c tests: Add test for MovieClip._lockroot in avm1 2020-12-02 11:59:01 -08:00
Mike Welsh a0d56aad44 core: Don't panic on DefineFont4 2020-12-01 23:01:35 -08:00
Mike Welsh 25e7ec99a0 core: Handle serializing arrays in SharedObjects 2020-11-30 22:15:34 -08:00
Mike Welsh ad5028817a core: Remove unnecssary parameter from Button::set_state 2020-11-30 01:15:43 -08:00
Mike Welsh 0d79d85d83 avm1: Fix MovieClip properties being attached to Object.prototype 2020-11-30 01:15:43 -08:00
Mike Welsh aedddd29ab avm1: Implement Button.enabled and MovieClip.enabled 2020-11-30 01:15:43 -08:00
dependabot-preview[bot] 827a8ee18d build(deps): bump syn from 1.0.52 to 1.0.53
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.52 to 1.0.53.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.52...1.0.53)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-29 22:46:08 -08:00
Mike Welsh ab200b6dc0 avm1: Don't fire button events when invisible (fix #1521) 2020-11-29 12:47:36 -08:00
Mike Welsh dafe7e5027 avm1: Implement Key.getAscii 2020-11-29 02:31:10 -08:00
Mike Welsh 18addef831 core: Don't run stream sounds when stopped (fix #1719) 2020-11-27 21:11:15 -08:00
dependabot-preview[bot] 3d9ebbde9c build(deps): bump syn from 1.0.51 to 1.0.52
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.51 to 1.0.52.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.51...1.0.52)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-27 15:46:54 -08:00
David Wendt a978b649b9 core: Also gate the `set_parent` change on `remove_range` just in case 2020-11-27 13:23:34 -08:00
David Wendt 0f1d4d5248 core: Always remove children from their old render list positions regardless of what depth list position they had 2020-11-27 13:23:34 -08:00
David Wendt e69e6fcc5e core: Fix regression on Super Mario 63 2020-11-27 13:23:34 -08:00
David Wendt 6e565d4da2 core: Fix compliation error caused by the `TDisplayObjectContainer` refactor 2020-11-27 13:23:34 -08:00
David Wendt 5a2f17a642 core: Consistently refer to render list positions as an `index` for consistency with Rust naming conventions 2020-11-27 13:23:34 -08:00
David Wendt c011c028de avm2: Correctly coerce render list indicies as `i32`, not `u32`. 2020-11-27 13:23:34 -08:00
David Wendt 01539baf5d core: Move `render_children` into `TDisplayObjectContainer`. 2020-11-27 13:23:34 -08:00
David Wendt ba311dd5b4 core: Remove previous changes to make certain `DisplayObject` methods take `&mut self`, which noises up the PR 2020-11-27 13:23:34 -08:00
David Wendt 6d992e239a core: Re-fix #1580 as it's fix didn't make it into the `DisplayObjectContainer` refactor the first time 2020-11-27 13:23:34 -08:00
David Wendt 8764831533 chore: cargo 1.47 changed the formatting algorithm 2020-11-27 13:23:34 -08:00
David Wendt 365601f2d9 core: New-depth children should always be placed before higher children, not after lower ones.
We will call this the "before-above" rule, to contrast with the previous "after-below" behavior. The main difference is how off-depth-list children are handled, which more closely matches AVM2.

The previous implementation of after-below wouldn't work unless we made the fallback case of not having a below child put it to the *end* of the list. This gave us test pass but broke animations. The first one I tried, Cirno's Perfect Math Class, prepends the entire depth list, which with the half-broken after-below behavior wound up appending to the render list.

There isn't an inverse problem with before-below and the end of the list, since we cover that case and we don't have to put weird exceptions.
2020-11-27 13:23:34 -08:00
David Wendt 74b50f2586 core: AVM2-locked children should still be removable from the depth list. 2020-11-27 13:23:34 -08:00
David Wendt 3769d24715 core: Fix incorrect placement of clips where depth placements intended to place objects at the bottom of the list instead placed them at the top. 2020-11-27 13:23:34 -08:00
David Wendt 35bc43cce2 avm2: Swapping children should lock them from depth manipulation. 2020-11-27 13:23:34 -08:00
David Wendt c8cd4a9192 avm2: Remove outdated documentation on some internal functions. 2020-11-27 13:23:34 -08:00
David Wendt 6cb3ff9632 avm2: Stub `getObjectsUnderPoint` and `areInaccessibleObjectsUnderPoint` as we do not yet support the `Point` class 2020-11-27 13:23:34 -08:00
David Wendt fec4e3c0a9 core: Replace direct container manipulation with `TDisplayObjectContainer` methods wherever possible.
The purpose of this refactor is twofold:

1. Ensure `TDisplayObjectContainer` holds all the container methods we need
2. Ensure that future adjustments to trait methods automatically apply to the display object's own use of the container, in case we want to do things in those methods that can't be done in a borrowed container

There are two places where we cannot use the new trait methods:

1. `Button.set_state` as it holds a borrow at the point we want to clear the container
2. `MovieClipData.goto_remove_object`, since it's a method on the data and thus cannot access trait methods

This particular commit generates a lot of noise as several `DisplayObject` methods were incorrectly marked as non-mutating.
2020-11-27 13:23:34 -08:00
David Wendt 9dde91e0fd core: Store named children on AVM2 movieclips as object properties 2020-11-27 13:23:34 -08:00
David Wendt 86e1037940 avm2: Implement `stopAllMovieClips` 2020-11-27 13:23:34 -08:00
David Wendt 3cac03857c chore: Clippy beta compliance 2020-11-27 13:23:34 -08:00
David Wendt cad2c4ecee tests: Add a button child execution order test. 2020-11-27 13:23:34 -08:00
David Wendt e2e598edde avm2: Implement `swapChildren` and `swapChildrenAt`. 2020-11-27 13:23:34 -08:00
David Wendt 71cdbd7194 avm2: Implement `setChildIndex` 2020-11-27 13:23:34 -08:00
David Wendt cf0ab2d82f avm2: Implement `removeChildren`.
This also changes the underlying `DisplayObjectContainer` method to accept any type of range. Turns out enum trait objects aren't actually trait objects and don't need to worry about object safety!
2020-11-27 13:23:34 -08:00
David Wendt 38fd29ae5f avm2: Implement `removeChildAt` 2020-11-27 13:23:34 -08:00
David Wendt c97ff2b024 core: Implement remove-by-range functionality 2020-11-27 13:23:34 -08:00
David Wendt 495dcf9d05 core: Remove direct execution list head manipulation and the `replace_at_depth` flag that indicates that it has occured.
Depending on how I'm reading the old code I replaced, it appeared to be constructing execution lists backwards. I have no idea if this was intended behavior or not. If so, then I'll need to add reverse-add capability to `replace_at_depth`.
2020-11-27 13:23:34 -08:00
David Wendt 80d7409fc5 core: Separate off container management into a separate `DisplayObjectContainer` trait 2020-11-27 13:23:34 -08:00
David Wendt fed28a7b46 chore: Add `Default` for `ChildContainer` as per clippy 2020-11-27 13:23:34 -08:00
David Wendt 759a590d76 avm2: Implement `getChildIndex` 2020-11-27 13:23:34 -08:00
David Wendt 2454287342 tests: Enable the `removeChild` test that tests timeline manipulation. 2020-11-27 13:23:34 -08:00
David Wendt 85fa8f327d avm2: Impl `contains` w/ test 2020-11-27 13:23:34 -08:00
David Wendt e4b5a3f8fc core: When removing a child from it's parent, make sure it's marked as having no parent. 2020-11-27 13:23:34 -08:00
David Wendt a2d876bc8c core: Remove double-ended support for `ChildIter` as it's unnecessary and wastes time 2020-11-27 13:23:34 -08:00
David Wendt 1f2c194ffd avm2: Remove unnecessary execution list accesses and debugging statements from `DisplayObjectContainer`. 2020-11-27 13:23:34 -08:00
David Wendt bcef9ef415 tests: Add a whole number of tests of depth/render list interaction from the AS3 side 2020-11-27 13:23:34 -08:00
David Wendt ab4dd984e8 core: Refactor display list management into a separate `ChildContainer` struct.
`ChildContainer` is responsible for maintaining child lists for all display objects that can hold children. Currently, this is just `Button` and `MovieClip` since those are the only objects in AVM1 that can have children, but this will be extended to other objects in future commits.

The number of lists managed has also increased from two to three. The execution list is unchanged save for it's migration into the `ChildContainer` struct. The render list has been split in two to support AS3. Specifically, the render list is now a `Vec`. Render children are still rendered in order but they are now referenced by AS3 `id`s rather than depths. The old `BTreeMap` that served as a render list is now the depth list and serves to maintain compatibility with SWF tags and AVM1 code that refers to things on the timeline by depth.
2020-11-27 13:23:34 -08:00
David Wendt a5f09d3c09 avm2: Implement `removeChild`. 2020-11-27 13:23:34 -08:00
David Wendt a5ea9795f6 avm2: Implement `addChild` and `addChildAt`, with tests 2020-11-27 13:23:34 -08:00
David Wendt c7199ff83f core: Add a utility for placing a display object at a particular relative position (rather than a static depth) on the render list.
For example, let's say we had two objects on the clip at depths 5 and 6. AS3 would see them as children IDs 0 and 1. Adding something at ID 1 translates to putting something between depth 5 and 6. To do this, we shift all higher-depth children up one depth to make room for the incoming clip, producing a new order of depths 5, 6, and 7.
2020-11-27 13:23:34 -08:00
David Wendt 52efbd98a8 core: Remove child's sibling pointers when removing the child from the parent's exec list.
This fixes a hang in as-of-yet uncommitted AS3 tests that reused display objects, where repeated removals and additions to the same MovieClip caused the construction of a cyclic render list.
2020-11-27 13:23:34 -08:00
David Wendt cfd6965b2c avm2: Use order in the render list (but NOT depths) rather than the execution list for `get_child_by_id` 2020-11-27 13:23:34 -08:00
David Wendt b263b52bca avm2: Correctly instantiate timeline clips whose AVM2 constructor isn't specified as a `flash.display.MovieClip`. 2020-11-27 13:23:34 -08:00
David Wendt 4817e92992 avm2: `getChildAt` works in reverse execution list order, not by depth 2020-11-27 13:23:34 -08:00
David Wendt f3ae65df93 core: Add flag for display objects which were placed by AS3.
In AS3. objects placed by scripts *cannot* be removed by `RemoveObject` tags. This enforces that in Ruffle.
2020-11-27 13:23:34 -08:00
David Wendt 8c9f8520b3 avm2: Implement `DisplayObjectContainer.numChildren` 2020-11-27 13:23:34 -08:00
David Wendt f748576927 avm2: Implement `getChildByName` 2020-11-27 13:23:34 -08:00
David Wendt 827567bb58 avm2: `toString` of stage objects should work the same way as other objects 2020-11-27 13:23:34 -08:00
David Wendt dc629af177 avm2: `getChildById` indexes by zero, but it gives me the child at depth one. 2020-11-27 13:23:34 -08:00
David Wendt d04f131cfe avm2: Implement `DisplayObjectContainer.getChildAt`.
This test doesn't work yet because it needs `avm2-domainscope` to get merged in.
2020-11-27 13:23:34 -08:00
relrelb 1d648a1d55 core: Use encoding_rs in load_vars_loader
This adds support for BOM.
2020-11-26 15:41:50 -08:00
Nathan Adams d8728bbf25 avm1: Made firstChild and lastChild ignore non-node children 2020-11-26 11:18:00 -08:00
Nathan Adams c8bb54977b core: Fix panic loading 'invalid-ish' html in text fields - fixes #1193 2020-11-26 11:17:00 -08:00
Mike Welsh aff34a4233 core: Seed RNG with timestamp 2020-11-26 00:07:59 -08:00
Mike Welsh 53212f192c chore: Appease clippy, squelch unnecessary_wraps lint 2020-11-24 18:59:42 -08:00
Mike Welsh e655cf0c08 web: Add Ruffle::audio_context getter 2020-11-24 16:36:33 -08:00
Mike Welsh 8db4482fcf core: Avoid panic on truncated SWF (fix #1583) 2020-11-24 00:29:28 -08:00
dependabot-preview[bot] 6b60fbe432 build(deps): bump syn from 1.0.50 to 1.0.51
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.50 to 1.0.51.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.50...1.0.51)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-23 17:21:29 -08:00
Mike Welsh d9ac9fa076 avm1: Array.reverse should return itself 2020-11-22 13:50:49 -08:00
Mike Welsh 7ac53be24f avm1: Implement TextField.removeTextField 2020-11-22 01:55:46 -08:00
Mike Welsh 03ab4e28d1 chore: Bump quickxml to 0.20 2020-11-22 01:55:01 -08:00
Mike Welsh a61d2b54ae avm1: Implement TextField.type 2020-11-21 16:58:19 -08:00
dependabot-preview[bot] 22d695421f build(deps): bump syn from 1.0.48 to 1.0.50
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.48 to 1.0.50.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.48...1.0.50)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-21 15:20:54 -08:00
Mike Welsh 8d78ee5172 avm1: Use f64 when calculating scale/rotation (fix #1622) 2020-11-21 11:39:41 -08:00
MrCheeze 5ea3814097 core: Fix issue where unloaded buttons can still trigger mouse rollout events (close #1603) 2020-11-21 11:36:21 -08:00
David Wendt 5d542680ae avm1: Remove bounds checks from `ActionDefineFunction`, `ActionWith`, `ActionDefineFunction2`, and `ActionTry`. 2020-11-20 00:28:56 -08:00
David Wendt 8ff085b464 avm1: Allow execution of opcodes before the start of an action or function. 2020-11-20 00:28:56 -08:00
Mike Welsh 2d463629e2 core: Avoid borrow panic when text is removed (fix #1580) 2020-11-19 18:42:31 -08:00
Mike Welsh d3265bfd60 avm1: Add allow_empty param to Activation:resolve_target_display_object
In some cases, the empty string path "" should resolve to the
starting clip. In other cases, it should be considered invalid.

Add a parameter to control this behavior, and set this to false
for MovieClip::hit_test to prevent `clip.hitTest("")` from
returning true.
2020-11-18 17:58:42 -08:00
Mike Welsh 4c01022a38 avm1: Allow string paths in hitTest (fix #1559) 2020-11-18 17:58:42 -08:00
dependabot-preview[bot] 6bfa3144c3 build(deps): bump smallvec from 1.4.2 to 1.5.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.2...v1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-18 16:30:15 -08:00
relrelb 2e0509694c docs: Miscellaneous spelling corrections 2020-11-12 13:34:05 -08:00
Mike Welsh 48ee47d88a tests: Add test for AVM2 Math
Also allow specifying relative epsilon for swf_tests_approx.
2020-11-12 04:24:47 -08:00
Mike Welsh 3ce8bc3c4b avm2: Implement Math 2020-11-12 04:24:47 -08:00
Mike Welsh b927acb2c2 avm2: trace accepts multiple arguments 2020-11-10 17:05:56 -08:00
Mike Welsh 2e73eba6c9 tests: Add test for unload clip event 2020-11-09 17:26:19 -08:00
Mike Welsh 15d0d814a7 avm1: Exclude unload clip event from continue_if_base_clip_exists
Unload event handlers should not halt if their clip is removed
(because it is already removed when an unload handler starts).

This will probably get cleaner if #1535 is fixed (unload clips
stay alive for one frame).

Fixes #447.
2020-11-09 17:26:19 -08:00
Mike Welsh fe6ff77889 tests: Add test for initialize clip event 2020-11-09 10:43:18 -08:00
Mike Welsh 3905837679 avm1: Fire initialize clip event
This event fires for new clips before any construct clip events.

Split the action queue up into separate priorities, giving
initialize the highest priority.
2020-11-09 10:43:18 -08:00
Mike Welsh 316bc4e920 chore: Appease clippy 2020-11-09 01:52:57 -08:00
relrelb 930d6ebe59 core: Correct MovieClip method names in error messages
They all were MovieClip.attachMovie probably becuase of copy-pasting.
2020-11-06 12:33:05 -08:00
David A Roberts 1a978600c6 avm1: Swap rendering order of MovieClip
Renders drawing API behind siblings in the same clip.
2020-11-06 12:31:56 -08:00
dependabot-preview[bot] fcf665fbe9 build(deps): bump url from 2.1.1 to 2.2.0
Bumps [url](https://github.com/servo/rust-url) from 2.1.1 to 2.2.0.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.1.1...v2.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-06 00:45:35 -08:00
Mike Welsh 4fe5fc44a6 tests: Bump script timeout to 200 secs 2020-11-03 16:02:53 -08:00
Nathan Adams 6c270d8c3a core: Fix double borrow in button post_init - fixes #1450 and #1190 2020-11-03 15:15:47 -08:00
Nathan Adams 8f064eea6e core: Strip newlines when loading editboxes that contain them and are marked singleline. This appears to be the correct behaviour - they're never stripped anywhere else but on load 2020-11-02 11:43:10 -08:00
Nathan Adams f285c990c0 avm1: _root should be allowed in text variable bindings 2020-11-02 11:43:10 -08:00
Nathan Adams 51f986e274 core: Propagate text variable bindings when text is typed 2020-11-02 11:43:10 -08:00
Nathan Adams 3b15babec6 core: Show caret on empty edit boxes 2020-11-02 11:43:10 -08:00
Nathan Adams a067170afd core: Rename EditText::get_selection to ::selection 2020-11-02 11:43:10 -08:00
Nathan Adams c520ff1f50 core: Only show carets for editable text 2020-11-02 11:43:10 -08:00
Nathan Adams e6d39658b9 core: Change text input to be a match statement 2020-11-02 11:43:10 -08:00
Nathan Adams 8abf5a5be8 core: Limit text input to only editable text 2020-11-02 11:43:10 -08:00
Nathan Adams e856968f75 core: Allow arrow keys in edit boxes 2020-11-02 11:43:10 -08:00
Nathan Adams 5592a6ca9d core: Perform delete & backspace in edit boxes 2020-11-02 11:43:10 -08:00
Nathan Adams cefa42fae0 tests: Add an avm1 test for Selection 2020-11-02 11:43:10 -08:00
Nathan Adams c910824de8 core: Fix caret position in multi layout text 2020-11-02 11:43:10 -08:00
Nathan Adams 9893972710 core: Allow typing of text in edit boxes 2020-11-02 11:43:10 -08:00
Nathan Adams 881bf3789e core: Clicking on text will place the caret at the position clicked 2020-11-02 11:43:10 -08:00
Nathan Adams 8a43eb9972 core: Display a caret when the text selection isn't a highlight 2020-11-02 11:43:10 -08:00
Nathan Adams 01c34b97f3 core: Show highlighted text in a slightly different colour (todo: background) 2020-11-02 11:43:10 -08:00
Nathan Adams 163e9fd21b core: Clicking on (selectable) texts will make that text focused 2020-11-02 11:43:10 -08:00
Nathan Adams 1a230bda09 core: Remove focus when the focused object is removed 2020-11-02 11:43:10 -08:00
Nathan Adams a4a2cd00b2 avm1: Implement Selection index getters & setSelection - #271 2020-11-02 11:43:10 -08:00
Nathan Adams 3f2057b53e core: Edit boxes are always focusable, regardless of settings 2020-11-02 11:43:10 -08:00
Nathan Adams 171e23e9e1 avm1: Implement Selection.getFocus and setFocus - #271 2020-11-02 11:43:10 -08:00
Nathan Adams efbab816e7 avm1: Implement MovieClip.focusEnabled - #263 2020-11-02 11:43:10 -08:00
Nathan Adams b61a72166f avm1: Stubbed out Selection - #271 2020-11-02 11:43:10 -08:00
Nathan Adams 93acb07374 core: Introduce a focus tracker, to keep track of one (and only one) focused object 2020-11-02 11:43:10 -08:00
Nathan Adams f72310be43 core: Change the cursor to an IBeam on selectable text 2020-11-02 11:43:10 -08:00
Nathan Adams f6b46cb615 core: Implement EditBox.selectable - #280 2020-11-02 11:43:10 -08:00
dependabot-preview[bot] f04f4ef961 build(deps): bump flate2 from 1.0.18 to 1.0.19
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.18 to 1.0.19.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.18...1.0.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-02 10:52:04 -08:00
Mike Welsh 93e7f657f1 tests: Update Array.concat test to print out entire array 2020-10-31 02:42:34 -07:00
Mike Welsh ff74f67db8 avm1: Fix Array.concat incorrectly creating arrays 2020-10-31 02:42:34 -07:00
relrelb e74e115cd0 core: Fix bug in PcmDecoder::next
It looks like the mono and stereo cases were mistakenly swapped
for 8-bit sounds. This commit simply swaps them to the correct
order.
2020-10-30 12:39:57 -07:00
Mike Welsh 0f4219610d core: Properly handle masker-inside-masker (fix #1347)
If a masker is placed inside a masker, the inner mask is inactive
and instead renders as normal art, masked by the outer mask. Properly
handle this case by only pushing new masks if we are not currently
drawing the mask stencil.

Maskee inside maskee still functions as expected. (i.e., a clip
using a mask is masked itself).
2020-10-25 20:41:31 -07:00
dependabot-preview[bot] 55d16c200a build(deps): bump approx from 0.3.2 to 0.4.0
Bumps [approx](https://github.com/brendanzab/approx) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/brendanzab/approx/releases)
- [Commits](https://github.com/brendanzab/approx/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-25 12:07:13 -07:00
Mike Welsh bc31c33f65 avm1: Test for removed clip after a function call
0482d1c made it so that a stack frame halts if its base clip gets
removed (e.g. from a goto). It actually seems like this check
only occurs after a function/method call (see #1370). So
and gotoAndPlay method call can cause the stack frame to pop, but
a GotoFrame action cannot.

Only check if the base clip has been removed in CallFunction,
CallMethod, NewObject, NewMethod ops.

Fixes #1370.
2020-10-24 17:36:38 -07:00
Mike Welsh e55346a211 tests: Test for removed clip after a function call 2020-10-24 17:36:38 -07:00
dependabot-preview[bot] 05edb73d72 build(deps): bump syn from 1.0.46 to 1.0.48
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.46 to 1.0.48.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.46...1.0.48)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-24 17:20:21 -07:00
Mike Welsh 21818a896d text: Draw white background for bordered text fields 2020-10-23 16:13:36 -07:00
relrelb 083e2a2ff5 core: Implement getBytes{Loaded,Total} (simpler approach) 2020-10-23 13:13:00 -07:00
relrelb 14a71b69cc core: Implement getBytes{Loaded,Total} 2020-10-23 13:13:00 -07:00
Nathan Adams bac4d8c2bf avm1: Ratelimit timeout check to help ease performance 2020-10-23 13:03:47 -07:00
Mike Welsh c2d4d56f88 avm1: Allow this in GetVariable/SetVariable paths 2020-10-22 17:23:22 -07:00
Mike Welsh 8da1eeafcb tests: Add test for this in GetVariable action 2020-10-22 17:23:22 -07:00
Mike Welsh 41f77fade1 avm1: Export names are case insensitive
Fixes capital letters not appearing in #1346
2020-10-21 17:09:31 -07:00
Mike Welsh e093f05656 tests: Add case insensitivity test for attachMovie 2020-10-21 17:09:31 -07:00
dependabot-preview[bot] 3e5457f712 build(deps): bump syn from 1.0.45 to 1.0.46
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.45 to 1.0.46.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.45...1.0.46)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-21 17:08:57 -07:00
Colin Berry c51a31fde8 desktop: Support URL paths and Proxy options 2020-10-20 23:31:23 -07:00
dependabot-preview[bot] 2fdb378e4f build(deps): bump syn from 1.0.44 to 1.0.45
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.44 to 1.0.45.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.44...1.0.45)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-17 13:00:00 -07:00
Nathan Adams a2d53df49c render: Store immutable part of wgpu rendering as a reusable object, to speed up exporting 2020-10-17 04:16:24 -07:00
David Wendt 6f659db342 tests: Fix the lazyinit test so that it actually passes on Ruffle 2020-10-17 03:32:09 -07:00
David Wendt 50d6ffb510 avm2: Prevent circularly referential scripts from causing stack overflows or double-borrows. 2020-10-17 03:32:09 -07:00
David Wendt a484861f79 tests: Add a test for lazy initialization load order. 2020-10-17 03:32:09 -07:00
David Wendt d27360b282 avm2: Enable lazy initialization for ABCs that request it. 2020-10-17 03:32:09 -07:00
David Wendt 0d1676afda avm2: Create a separate domain for each loaded movie and pull symbols out of each. 2020-10-17 03:32:09 -07:00
David Wendt cdab885979 avm2: Implement `ApplicationDomain` and all methods that don't require `Vector` or domain memory 2020-10-17 03:32:09 -07:00
David Wendt 1aceb7776d avm2: Superclasses should resolve out of the current scope stack. 2020-10-17 03:32:09 -07:00
David Wendt 00fcc5ffa4 avm2: Reference the current domain at the bottom of the scope stack. 2020-10-17 03:32:09 -07:00
David Wendt f2caf60d3e avm2: Scripts should run in a child of the global domain. 2020-10-17 03:32:09 -07:00
David Wendt 1792939212 avm2: Script scopes should hold the domains they are a part of.
Also, this means we have a `TObject` representation for domains now.
2020-10-17 03:32:09 -07:00
David Wendt 6a736b0d2b avm2: Wrap all player globals in a separate appdomain and script.
This entirely abolishes the "global scope object" in AVM2. I even had to redefine several global object functions to work with the bottom of the scope stack, which seems to be where ASC likes to stick the script scope.
2020-10-17 03:32:09 -07:00
David Wendt add7c4d43d avm2: Collect all script definition names and associated scripts into a `Domain`. 2020-10-17 03:32:09 -07:00
David Wendt 02e05e3d7f Add separate scope object for each script. 2020-10-17 03:32:09 -07:00
Mike Welsh 4558be948e render: Fix masking issues on wgpu/webgl backends
Change the usage of the stencil buffer to avoid running out of
stencil bits when too many nested masks are active.

This also cleans things up on wgpu which requires us to make
pipeline states in advice; now we only need a few stencil states
for masking as opposed to hundreds.
2020-10-17 02:42:56 -07:00
Mike Welsh 97a3ef73a3 tests: Add tests for issue #893 2020-10-15 00:10:55 -07:00
Mike Welsh e66b71817b avm1: Stop execution if base clip is removed (fix #893)
Stop execution of the current stack frame if the base clip was
removed (for example, due to a goto).
2020-10-15 00:10:55 -07:00
Nathan Adams 6d9155477c core: Add flashvars support - #312 2020-10-12 15:28:16 -07:00
Mike Welsh a6b952e44e core: Switch from libflate to flate2 2020-10-12 13:47:35 -07:00
Mike Welsh 2c2aa82730 chore: Remove debug message 2020-10-12 13:30:03 -07:00
Nathan Adams fd6431f724 core: Don't use std Instant as it doesn't work for web, use a wrapper 2020-10-11 13:34:15 -07:00
Nathan Adams 4abd02e2f7 core: Implement a timeout for script execution, defaulting to 15 seconds. Fixes #554 2020-10-11 13:34:15 -07:00
Mike Welsh 137ac2887e core: Don't mouse pick children when invisible (fix #1242) 2020-10-11 04:10:25 -07:00
Mike Welsh 2c9cf6802d core: Squelch false AS3 error before initial SWF loads 2020-10-10 19:28:01 -07:00
Mike Welsh 5c3dd25638 avm1: Avoid unwrap in Sound constructor
At least avoid the panic in this case, but it can possibly fail
(see #701).
2020-10-10 18:13:08 -07:00
dependabot-preview[bot] 2c2a70e714 build(deps): bump syn from 1.0.43 to 1.0.44
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.43 to 1.0.44.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.43...1.0.44)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-10 16:35:50 -07:00
Mike Welsh 23660e49c9 core: Avoid panic due to invalid style IDs
If the shape converter encountered a fill/line style with an
ID > the number of styles, Ruffle would panic as it tried to grab
the non-existent style. This could occur if we mis-parsed some
shape data, or the SWF contained incorrect data. Now we the invalid
style is gracefully ignored.
2020-10-10 16:35:37 -07:00
Mike Welsh 10aaae9247 chore: Appease nightly clippy 2020-10-10 00:03:25 -07:00
dependabot-preview[bot] 4af9632761 build(deps): bump syn from 1.0.42 to 1.0.43
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.42 to 1.0.43.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.42...1.0.43)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-09 12:22:43 -07:00
David Wendt 5abebd5433 avm2: Yield an error if the caller specifies a label/scene pair and the label is not present within the scene. 2020-10-06 06:03:22 -07:00
David Wendt 1a10f1e004 avm2: Lock old movies (SWFv8 and earlier) to always use AVM1 2020-10-06 06:03:22 -07:00
David Wendt 693e56dc67 core: Always instantiate a new movie's library before creating it's root movieclip. 2020-10-06 06:03:22 -07:00
David Wendt 7c719bfb0c Only the first tag in a SWF file should be trusted to deliver file attributes. 2020-10-06 06:03:22 -07:00
David Wendt ddccede9d3 avm2: Make VM type non-optional.
This has the side effect of forcing the AVM check to happen at the time of library construction, which is already very early on in movie loading.
2020-10-06 06:03:22 -07:00
David Wendt ef665acaec avm2: Movie clips not explicitly granted a `symbol_class` should be constructed using the `MovieClip` class directly 2020-10-06 06:03:22 -07:00
David Wendt 12cf8022cd core: Remove useless uses of `matches!`. 2020-10-06 06:03:22 -07:00
David Wendt 007d54b389 avm2: Remove redundant implementations of `prev_frame` and `next_frame` 2020-10-06 06:03:22 -07:00
David Wendt 4c44ca8e77 avm2: Non-integer numbers should be handled as strings and integer-parsible strings should be handled as numbers. 2020-10-06 06:03:22 -07:00
David Wendt e2f21d0a7d avm2: Retire old references to the "VM tendency" nomenclature 2020-10-06 06:03:22 -07:00