Commit Graph

261 Commits

Author SHA1 Message Date
Mike Welsh 774aa59210 web: Default public_path to currentScript URL
Also automatically add trailing slash on public_path if necessary.
2020-03-25 00:54:21 -07:00
Mike Welsh 5591cec0f7 web: Fix #412, incorrect bitmap rendering when cached 2020-03-24 23:08:15 -07:00
Mike Welsh fa063a6f53 web: Enable dynamic-content polyfill by default
Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
Mike Welsh e332e5c24c web: Simplify polyfill code
Addresses #464. Use `document.getElementsByTagName` to find all
object and embed tags in the document. For dynamic content,
we keep these live collections around, and re-check them whenever
a MutationObserver fires.

Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
dependabot-preview[bot] 80bfaa5f11 build(deps-dev): bump webpack from 4.42.0 to 4.42.1 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.42.0 to 4.42.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.42.0...v4.42.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-24 19:29:20 +00:00
Mike Welsh 4561b591bf web: Handle percentage dimensions in polyfill (fix #433)
When Ruffle replaces a Flash embed, the width/height of the embed
are copied over to CSS of the Ruffle element. "px" was being
appended even if the dimensions were a % value, which CSS rejected.

Try to be a little smarter about parsing out the HTML dimension
attributes (HTML is more lenient). Append "px" only if the value
isn't a percentage.

Fixes #433.
2020-03-21 01:23:23 -07:00
Mike Welsh 9e6fe41a91 web: Ignore errors on `Element.setAttribute` in polyfill
Ruffle would not polyfill a Flash embed if it had bogus attributes
in the embed tag. Now these errors are silently ignored.

Fixes the other part of #457.
2020-03-20 20:47:58 -07:00
Mike Welsh 099c497a91 web: Activate polyfill if embed src ends in .swf
Fixes part of #457. Even if the MIME type/class IDs are missing
on the embed/object tags, browsers will still attempt to play
the file as Flash if it ends in a .swf extension.
2020-03-20 20:47:58 -07:00
Mike Welsh 26914d7b62 web: Fix off-center gradient rendering
Regression caused by 223edb9. Write twips value to SVG matrix.
Addresses some incorrect rendering in #437.
2020-03-16 02:44:32 -07:00
Mike Welsh b3b81c5e20 chore: Explicitly install wasm-pack on CI 2020-03-16 02:15:55 -07:00
Mike Welsh 17a7b02f14 chore: Bump npm packages 2020-03-16 02:15:55 -07:00
dependabot[bot] 623849483c
build(deps): bump acorn from 6.4.0 to 6.4.1 in /web/demo
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-16 06:09:43 +00:00
dependabot-preview[bot] 2c1495eebd build(deps): [security] bump acorn in /web/selfhosted
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1. **This update includes a security fix.**
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 06:09:05 +00:00
Sean-Thomas 609b6671b3 Spruced up Web Demo Page
Edited styling for web demo page to look more like the https://ruffle.rs homepage.
2020-03-09 19:33:03 -04:00
dependabot-preview[bot] 05d74f4870 build(deps): bump base64 from 0.11.0 to 0.12.0
Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.11.0...v0.12.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-09 01:07:16 +00:00
dependabot-preview[bot] fb02a8b57f build(deps): bump png from 0.16.0 to 0.16.1
Bumps [png](https://github.com/image-rs/image-png) from 0.16.0 to 0.16.1.
- [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/compare/v0.16.0...v0.16.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-03 23:13:22 +00:00
dependabot-preview[bot] 924fb05981 build(deps): bump svg from 0.7.0 to 0.7.1
Bumps [svg](https://github.com/bodoni/svg) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/bodoni/svg/releases)
- [Commits](https://github.com/bodoni/svg/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-03 22:30:38 +00:00
Mike Welsh cd334bcd3f web: Fix bitmap fills not using twips 2020-03-02 18:31:49 -08:00
dependabot-preview[bot] 23b0478796 build(deps): bump png from 0.15.3 to 0.16.0
Bumps [png](https://github.com/image-rs/image-png) from 0.15.3 to 0.16.0.
- [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/compare/v0.15.3...v0.16.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 23:32:44 +00:00
dependabot-preview[bot] 55a568a42b build(deps): bump svg from 0.6.0 to 0.7.0
Bumps [svg](https://github.com/bodoni/svg) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/bodoni/svg/releases)
- [Commits](https://github.com/bodoni/svg/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 21:49:30 +00:00
dependabot-preview[bot] d30928e634 build(deps-dev): bump webpack from 4.41.6 to 4.42.0 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.6 to 4.42.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.6...v4.42.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 18:06:33 +00:00
Mike Welsh 223edb9bc1 core: Matrix translation is in twips 2020-02-26 12:47:47 -08:00
Mike Welsh c4c02260fb core: Implement keyUp event 2020-02-26 03:48:07 -08:00
Mike Welsh acd5f2c74f web: Fix invisible cursor 2020-02-26 01:47:08 -08:00
Mike Welsh c620f95c4f chore: Expose lzma feature on targets 2020-02-26 00:47:15 -08:00
Mike Welsh 86ec2c6cb8 input: Add InputBackend::set_mouse_cursor. Change cursor on buttons
It doesn't feel like Flash without having the hand cursor display
when hovering over buttons. First pass at implementing this;
core communicates which mouse cursor to use via
`InputBackend::set_mouse_cursor`.

TODO: Hand cursor only displayed for Button display objects
currently. Movie clips should also display this when they are in
"button mode" (when a button mouse event is set on them in AVM1,
or `buttonMode` property in AVM2).
2020-02-25 02:50:26 -08:00
David Wendt 33d26b9149 Shorten `Pin<Box<dyn Future<Output=Result<T,E>> + 'static>>` into `OwnedFuture<T,E>`.
This is technically stricter on `fetch` impls, but right now we can't support non-`'static` futures at all.
2020-02-22 00:02:45 -05:00
David Wendt c7539872f7 Add the ability to POST data from `fetch`, and allow methods that read AVM locals into form data to `GET` or `POST` them. 2020-02-21 23:58:00 -05:00
David Wendt f4e4171ebe Make spawned futures falliable, and report those errors. 2020-02-21 23:57:56 -05:00
David Wendt 55149b7b7e Reference count the Player and provide a weak reference in UpdateContext.
This allows the formation of `'static` futures that can still interact with a player. Async code will need to upgrade the weak reference in order to be able to interact with the player.
2020-02-21 23:44:06 -05:00
David Wendt 8d83bbb864 Impl fetch for web 2020-02-21 23:44:05 -05:00
David Wendt 491d94c947 Pinbox all Futures.
Due to some strangeness with the way Rust implemented unsafe-to-move behavior, boxed futures are implicitly `Unpin`. Which is useless to us.

The reason for this is a little counter-intuitive. Actually, the fact that Rust supports memory pinning at all is a little odd, because the core language explicitly requires all types be movable. To get around this, Pin requires that all !Unpin types be *born pinned*. This is because you can't re-pin an already unpinned value in memory.

Anyway, this necessitates this silly API change.
2020-02-21 23:44:05 -05:00
David Wendt 00d25a768c Extremely basic impl of fetch/spawn methods for getting data off the web 2020-02-21 23:44:05 -05:00
David Wendt 2137b9f1fd Migrate `set_frame_rate` into the core `AudioBackend` trait 2020-02-21 23:44:05 -05:00
dependabot-preview[bot] d9deaab5f1 build(deps-dev): bump webpack-cli in /web/selfhosted
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.10 to 3.3.11.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/next/CHANGELOG_v3.md)
- [Commits](https://github.com/webpack/webpack-cli/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 01:59:04 +00:00
dependabot-preview[bot] fde5e0a730 build(deps-dev): bump webpack from 4.41.5 to 4.41.6 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.5 to 4.41.6.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.5...v4.41.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 01:25:30 +00:00
dependabot-preview[bot] 6681e843a9 build(deps): bump byteorder from 1.3.2 to 1.3.4
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.2...1.3.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 00:57:11 +00:00
dependabot-preview[bot] c17fa52565 build(deps-dev): bump webpack-dev-server in /web/selfhosted
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.10.2 to 3.10.3.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.10.2...v3.10.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 00:53:47 +00:00
Mike Welsh 6b7966f3fc chore: Update comments in canvas mask rendering 2020-01-31 20:27:24 -08:00
dependabot-preview[bot] 9d950e3705 build(deps-dev): bump webpack-dev-server in /web/selfhosted
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.10.1 to 3.10.2.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.10.1...v3.10.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-31 19:05:42 +00:00
Mike Welsh 3ab0d4ef80
web: Merge #352, improved performance on canvas
Shape-drawing performance improvements on the canvas backend.
2020-01-30 15:16:09 -08:00
Mike Welsh 087f15f28c web: Clear audio decoding buffer before each decode (fix #357) 2020-01-29 12:29:54 -08:00
David Wendt abedb1262a Make sure `DrawImage` commands get the image filter. 2020-01-29 14:19:19 -05:00
David Wendt 30fc56649b Clamp u8 values to the [0, 255] range. 2020-01-29 14:19:19 -05:00
David Wendt a57d0e12b3 Do not apply a color filter at all unless rendering a bitmap or gradient.
This significantly improves render times, as browsers appear to apply filters in the most general, inefficient way possible.
2020-01-29 14:19:18 -05:00
David Wendt 746971e38a Avoid unnecessary calls to `set_attribute`/`set_filter`. 2020-01-29 14:19:18 -05:00
David Wendt 693537a294 Line widths and miter limits should be in pixels, not twips 2020-01-29 14:19:18 -05:00
David Wendt b611067bc5 First pass on a more-optimized render path that uses canvas draw commands directly rather than precompiling SVGs as images. 2020-01-29 14:19:18 -05:00
David Wendt 4ee60d9214 Make `swf_shape_to_svg` output the entire `ShapeData` list itself, and also it's not called that anymore. 2020-01-29 14:19:18 -05:00
David Wendt 70cdcb60a7 Break shape data up into a series of canvas commands, including direct fills and strokes. 2020-01-29 14:19:18 -05:00