Commit Graph

1109 Commits

Author SHA1 Message Date
David Wendt b491dd034e Don't overflow stack when debug-printing an entire document, either. 2020-01-04 19:00:16 -05:00
David Wendt e47a1d1e38 Fix newly constructed XML trees not actually containing the XML they just parsed. 2020-01-04 19:00:16 -05:00
David Wendt 960e4dad90 Don't cause stack overflow when debug-printing XML nodes. 2020-01-04 19:00:16 -05:00
David Wendt bec60acc1e `XML.prototype` should be an `XMLObject` so that instances of `XML` can hold a node 2020-01-04 19:00:15 -05:00
David Wendt d058c83ac0 Document roots should accept children. 2020-01-04 19:00:15 -05:00
David Wendt 571c4bbd52 Cargo fmt compliance 2020-01-04 19:00:15 -05:00
David Wendt 0af248d81f Expose `childNodes` to ActionScript 2020-01-04 19:00:14 -05:00
David Wendt e7768d0802 Add methods to allow storing XML objects on the accompanying tree nodes, so that expando properties on child nodes will work. 2020-01-04 19:00:13 -05:00
David Wendt b06dd5d15e Add a special node to represent the document root in the node tree, and get rid of the explicit document reference type in `XMLObject`. 2020-01-04 19:00:12 -05:00
David Wendt 0fe0e4fe90 Separate `XMLName` into another module 2020-01-04 19:00:11 -05:00
David Wendt 3928c7cc51 Reject empty text nodes 2020-01-04 19:00:11 -05:00
David Wendt 7a9a16e598 Don't repeat yourself. 2020-01-04 19:00:11 -05:00
David Wendt bd1ea56cc3 Implement `XMLNode` properties that don't require child or attribute iteration. 2020-01-04 19:00:10 -05:00
David Wendt e2eb3d0bde Add a test of XMLDocument::from_str.
This test technically works, but the results were slightly surprising. If it turns out Flash works differently from `quick_xml`, we'll change this test to match Flash.
2020-01-04 19:00:10 -05:00
David Wendt 6ae5ae3038 Add Comment parsing support 2020-01-04 19:00:10 -05:00
David Wendt 4f5ac09b73 Expose XML document constructor, including text parsing ability 2020-01-04 19:00:09 -05:00
David Wendt 554f0dc1e5 Add XMLNode class and constructor impl 2020-01-04 19:00:07 -05:00
David Wendt 6a65e984ae Add a new `XMLObject` variant to the AVM1 object ecosystem.
This particular variant is actually a two-in-one deal: `XMLObject`s may either refer to a document or a node.
2020-01-04 18:58:42 -05:00
David Wendt 89c9753520 Add rudimentary custom DOM impl on top of `quick_xml`.
`quick_xml` was chosen due to it's high performance and support for zero-copy use cases. However, we are not using `minidom`, which is the already-extant DOM impl that uses `quick_xml` as it's parsing provider. This is because `minidom` nodes are not amenable to garbage collection.

Specifically: we want to be able to construct a new `Object` variant that holds part of an XML node. However, `minidom::Element` directly owns it's children, meaning that we can't hold references to it from within `Object` while also keeping those objects to the `'gc` lifetime. Hence, we provide a GC-exclusive DOM implementation.

I ruled out solutions such as holding an entire XML tree in an `Rc` and having AVM objects that shadow them. This works for `SwfSlice` because indexing an array is cheap; but traversing a tree can get very expensive. XML is used in many places in Flash Player, so it's important that we treat it like a first-class citizen.
2020-01-04 18:48:17 -05:00
Mike Welsh 4ce67535b0 tests: Add test for Color 2020-01-03 20:31:32 -08:00
Mike Welsh 36b3e5b34f avm1: Implement Color class 2020-01-03 20:31:32 -08:00
Mike Welsh 4bf29f677f avm1: Implement Sound.duration
Add AudioBackend::get_sound_duration.
2020-01-03 17:11:00 -08:00
Mike Welsh b9d24d9a49 avm1: First pass at implementing Sound.stop 2020-01-03 17:11:00 -08:00
Mike Welsh d0142f1d67 audio: Add AudioBackend::stop_sound 2020-01-03 17:11:00 -08:00
Mike Welsh 63dd92259b avm1: First pass of Sound object 2020-01-03 17:11:00 -08:00
dependabot-preview[bot] c966f9bf59 build(deps): bump winit from 0.20.0-alpha5 to 0.20.0-alpha6
Bumps [winit](https://github.com/rust-windowing/winit) from 0.20.0-alpha5 to 0.20.0-alpha6.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-04 00:02:22 +00:00
dependabot-preview[bot] a01e5b7854 build(deps): bump syn from 1.0.12 to 1.0.13
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.12 to 1.0.13.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.12...1.0.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-03 19:15:37 +00:00
dependabot-preview[bot] b4a47e17da build(deps): bump generational-arena from 0.2.6 to 0.2.7
Bumps [generational-arena](https://github.com/fitzgen/generational-arena) from 0.2.6 to 0.2.7.
- [Release notes](https://github.com/fitzgen/generational-arena/releases)
- [Changelog](https://github.com/fitzgen/generational-arena/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/generational-arena/compare/0.2.6...0.2.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-03 19:14:43 +00:00
dependabot-preview[bot] 353dc5c229 build(deps-dev): bump webpack from 4.41.4 to 4.41.5 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.4 to 4.41.5.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.4...v4.41.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-03 08:25:48 +00:00
dependabot-preview[bot] 1048170235 build(deps): bump syn from 1.0.11 to 1.0.12
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.11 to 1.0.12.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.11...1.0.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-03 08:24:29 +00:00
dependabot-preview[bot] 861a4484a5 build(deps): bump structopt from 0.3.6 to 0.3.7
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.6...v0.3.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-29 23:10:17 +00:00
dependabot-preview[bot] 71ba4cb86e build(deps): bump lyon from 0.15.1 to 0.15.3
Bumps [lyon](https://github.com/nical/lyon) from 0.15.1 to 0.15.3.
- [Release notes](https://github.com/nical/lyon/releases)
- [Changelog](https://github.com/nical/lyon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nical/lyon/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-29 22:56:08 +00:00
Mike Welsh 7feddfcb03 desktop: Bump to lyon 0.15.2 (fix #196)
The new tessellator in lyon seems to fix many of the cases where
art would not tessellate correctly.
2019-12-27 17:21:48 -08:00
Mike Welsh 87158647d1 core: Implement keyPress button events 2019-12-24 03:06:03 -08:00
Mike Welsh 30983c5bab web: Use pointer events on web 2019-12-23 13:16:58 -08:00
dependabot-preview[bot] db8e0bd997 build(deps): bump wasm-bindgen-test from 0.3.5 to 0.3.6
Bumps [wasm-bindgen-test](https://github.com/rustwasm/wasm-bindgen) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-23 19:39:55 +00:00
Mike Welsh 2f0963fa6c core: Fix button action with multiple conditions not firing (fix #195)
If a button event had both a keyPress condition and another
condition:

on(release, keyPress "A") { }

these actions would not fire on click, because it would still
check if the key was down (which doesn't apply to clicks!)

Fixes #195.
2019-12-22 15:55:03 -08:00
dependabot-preview[bot] 9211c7ac05 build(deps): bump structopt from 0.3.5 to 0.3.6
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.5...v0.3.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-22 22:54:14 +00:00
Nathan Adams 9000451d58 core: Implemented Mouse.show() & Mouse.hide() 2019-12-22 14:33:46 -08:00
Mike Welsh 4cdeec5b64 avm1: Fix number coercion in arithmetic ops
A lot of the arithmetic ops were still using SWFv4 style coercion
(`Value::into_number_v1`) even though they use full ECMA-262
coercion in SWF5+. This would cause `undefined` to turn into 0
isntead of NaN, for example.

Fixes disappearing player in Achievement Unlocked
(https://www.newgrounds.com/portal/view/474371)

It's possible even the older ops such as ActionAdd should do this,
too. Handcrafted bytecode will need to be used to test as you
cannot export these ops in newer SWF versions from the Flash IDE.
2019-12-22 03:01:58 -08:00
Mike Welsh c9e0bdeaf5 core: GC trace Button::object 2019-12-21 23:54:50 -08:00
Mike Welsh 1d8ae9154b tests: Add tests for AVM1 logical ops 2019-12-21 23:01:10 -08:00
Mike Welsh a4a307cf9a avm1: Use proper bool conversions for logical ops
ActionAnd, ActionOr, and ActionNot were incorrectly comparing
to 0. This only works for SWF<4. Now they all go through the
Value::as_bool method to handle version specific behavior.

Value::from_bool_v1 was also renamed to Value::from_bool.
2019-12-21 23:01:10 -08:00
Mike Welsh 00fdc74f1f tests: Add test for property updating in fast-forward gotos 2019-12-21 21:16:27 -08:00
Mike Welsh fd92bd5f78 core: Fix PlaceObject modifications in fast-forward gotos
When fast-forwarding with a goto, modifications were not taking
effect to objects that exist both in the starting and the final
frame.
2019-12-21 21:16:27 -08:00
Mike Welsh c05b03dd06 web: Handle keydown/keyup and preventDefault if Ruffle has focus 2019-12-21 19:08:06 -08:00
David Wendt 69094b56b5 Add input support to the web backend. 2019-12-21 19:08:06 -08:00
Nathan Adams 3fd79a6982 chore: Rename GliumInputBackend -> WinitInputBackend 2019-12-21 19:08:06 -08:00
Nathan Adams 856a2f2910 desktop: Implemented glium based input handler for Key.isDown 2019-12-21 19:08:06 -08:00
Nathan Adams eedc4bbe24 core: Added Input backend, currently unimplemented, for polling user input 2019-12-21 19:08:06 -08:00