Commit Graph

3377 Commits

Author SHA1 Message Date
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
dependabot-preview[bot] f843399aff build(deps-dev): bump @wdio/cli from 6.10.0 to 6.10.2 in /web
Bumps [@wdio/cli](https://github.com/webdriverio/webdriverio) from 6.10.0 to 6.10.2.
- [Release notes](https://github.com/webdriverio/webdriverio/releases)
- [Changelog](https://github.com/webdriverio/webdriverio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webdriverio/webdriverio/compare/v6.10.0...v6.10.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-27 13:14:37 -08:00
Mike Welsh 7898776e0c tests: Add polyfill tests for missing movie 2020-11-26 18:19:57 -08:00
Mike Welsh 5d99dce16c tests: Add polyfill test for object+embed with only clsid 2020-11-26 18:19:57 -08:00
Mike Welsh b128c876ea tests: Alter embed-inside-object polyfill tests to expect ruffle-embed 2020-11-26 18:19:57 -08:00
Mike Welsh e66fc6f6a1 web: Avoid double polyfilling embed-inside-object 2020-11-26 18:19:57 -08:00
Nathan Adams f053562408 chore: Fix publish of js docs 2020-11-26 17:07:58 -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 eca4ba0313 desktop: Potentially fixed panic when windows can't make a path absolute 2020-11-26 14:04:18 -08:00
dependabot-preview[bot] ed50b9ae33 build(deps-dev): bump webpack from 5.7.0 to 5.8.0 in /web
Bumps [webpack](https://github.com/webpack/webpack) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.7.0...v5.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-26 11:21:33 -08:00