Commit Graph

6482 Commits

Author SHA1 Message Date
relrelb 7e4b3c1003 core: Refactor `LoadManager::load_root_movie`
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
Moulins 3bbbf2f764 wstr: make the crate no_std
This requires removing the Error impl of ParseNumError, because the
Error trait is std-only.
2022-03-26 13:42:57 -07:00
Moulins 1bff5c517a Move back AvmString into ruffle_core::string
This allows removing the gc_arena dependency in ruffle_wstr
2022-03-26 13:42:57 -07:00
Moulins bd576639d5 wstr: refactor traits macro (again) to make it usable outside the crate
And add the AsRef, Borrow, wstr::Pattern to the macro
2022-03-26 13:42:57 -07:00
Moulins 826708a91b wstr: refactor traits macro so that each wstr type uses it separately 2022-03-26 13:42:57 -07:00
Moulins 1911aa9a6b Move core::string into separate ruffle_wstr crate. 2022-03-26 13:42:57 -07:00
relrelb 9234336dfc swf: Rename `PlaceFlag::IS_IMAGE` to `PlaceFlag::HAS_IMAGE`
To match the SWF19 spec.
2022-03-26 11:33:26 -07:00
relrelb 094da8f1a4 swf: Organize clippy attributes
Move them to specific places as possible.
2022-03-26 11:33:26 -07:00
relrelb 71b0a6e32e swf: Use bitflags for `FontInfoFlag` 2022-03-26 11:33:26 -07:00
relrelb fd06fa0537 swf: Use bitflags for `LineStyleFlag` 2022-03-26 11:33:26 -07:00
relrelb e88c7102f5 swf: Use bitflags for `PlaceFlag` 2022-03-26 11:33:26 -07:00
relrelb 6d2005c2fe swf: Simplify `read_str_with_len`
Read the length in the function itself rather than receiving it as
an argument.
2022-03-26 11:33:26 -07:00
relrelb 1230b5e713 swf: Use bitflags for `FontFlag` 2022-03-26 11:33:26 -07:00
relrelb 71a1757d29 swf: Make `Glyph::advance` non-`Option`
Simply use `0` instead of `None`.
2022-03-26 11:33:26 -07:00
relrelb 984342abf3 swf: Avoid some `Vec::resize` usages
Use the `vec![]` macro instead.
2022-03-26 11:33:26 -07:00
dependabot[bot] da613a6fc5 build(deps): bump libflate from 1.1.2 to 1.2.0
Bumps [libflate](https://github.com/sile/libflate) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/sile/libflate/releases)
- [Commits](https://github.com/sile/libflate/compare/1.1.2...1.2.0)

---
updated-dependencies:
- dependency-name: libflate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 11:20:34 -07:00
dependabot[bot] 755d5f05ad build(deps): bump enum-map from 2.0.3 to 2.1.0
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map) from 2.0.3 to 2.1.0.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags)
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master)

---
updated-dependencies:
- dependency-name: enum-map
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 11:07:23 -07:00
dependabot[bot] 392da2274c build(deps): bump log from 0.4.14 to 0.4.16
Bumps [log](https://github.com/rust-lang/log) from 0.4.14 to 0.4.16.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/commits)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 11:00:41 -07:00
dependabot[bot] f9e361ddae build(deps): bump bitstream-io from 1.2.0 to 1.3.0
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases)
- [Commits](https://github.com/tuffy/bitstream-io/commits)

---
updated-dependencies:
- dependency-name: bitstream-io
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:52:26 -07:00
dependabot[bot] 0c4806854c build(deps): bump quote from 1.0.16 to 1.0.17
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.16...1.0.17)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:30:46 -07:00
relrelb 8f7b8c4b76 xml: Make `XmlNodeData` a struct
The difference between element nodes and text nodes is very minor.
So instead of representing them by two distinct enum members, make
`XmlNodeData` a single unified struct that can represent both. A new
`node_type` field is introduced, in order to still distinguish
between element and text nodes. Also, Ruffle made some incorrect
assumptions, which are now corrected, including:

* Nodes can have any arbitrary `u8` type. This is resolved by the
introduction of the `node_type` field which is a `u8`.
* Text nodes can have children. This is resolved by simply not checking
for text nodes in `append_child` etc.
2022-03-26 10:12:47 -07:00
relrelb 161071e8c4 core: Re-implement `NullExecutor`
Make it a thin abstraction layer over either the `futures` or `wasm-bindgen-futures`
crates, as already done in `render/wgpu/src/uniform_buffer.rs`,
instead of a hand-made single-thread executor.

Ideally this would also be usable on desktop, but I didn't manage to
get `LocalPool` working with `winit` (it needs to post a task to the
`EventLoopProxy` as a wake procedure).
2022-03-26 10:03:42 -07:00
Moulins bb63ac2de7 wstr: fix memory leak
WString's Drop impl didn't actually drop anything
2022-03-25 18:36:00 -07:00
dependabot[bot] cb24202d35 build(deps): bump minimist from 1.2.5 to 1.2.6 in /web
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 02:27:07 +03:00
dependabot[bot] 91b8e90941 build(deps): bump node-forge from 1.2.1 to 1.3.0 in /web
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 02:26:57 +03:00
relrelb fa1dc8af4a demo: Rename `serve` command to `start`
`npm start` is a common convention for launching a web server.
Also use the `npm start` and `npm test` shorthands instead of
`npm run start` and `npm run test`.
2022-03-26 01:43:24 +03:00
relrelb 295ca0d836 demo: Copy `swfs.json` to `dist` directory
Otherwise it's not served when running `npm run demo`.
2022-03-26 01:43:24 +03:00
moulins 52d775697c
docs: Mention required Linux development packages in the README (#6511) 2022-03-25 12:22:54 +03:00
Toad06 c1119fdc0b avm1: Apply autosize to a new `EditText` from an SWF `DefineEditText` tag 2022-03-21 20:00:06 -07:00
Aaron Hill a281db3af6 Add `define_indirect_properties` helper macro for property/slot pairs
In both `FrameLabel` and `Scene`, we define multiple
'public property / private slot' pairs.
The public property has a getter which delegates to the private
property. There is no setter for the property, ensuring that
the private slot can only be modified from within Ruffle itself.

This PR adds a macro `define_indirect_properties` to abstract over
this pattern. Currently, it only supports the read-only property
pattern - however, it could be extended in the future to generate
a setter that invokes a caller-provided callback function.

This needs to be a macro (rather than a method) so that we can
generate a function with the property name hard-coded into it.
Using a closure that references an upvar will not work, since
`Method::from_builtin` requires a function pointer.
2022-03-21 19:00:25 -07:00
relrelb b7a60384cf xml: Inline `update_id_map`
Move its logic to `from_start_event`, where `XmlNode`s are created.
2022-03-20 11:04:48 +02:00
dependabot[bot] 881ed01ceb build(deps): bump crossbeam-channel from 0.5.3 to 0.5.4
Bumps [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.3...crossbeam-channel-0.5.4)

---
updated-dependencies:
- dependency-name: crossbeam-channel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-19 19:43:06 -07:00
relrelb 665f045b1f desktop: Disable `env_logger`'s `regex` feature
This feature allows `RUST_LOG` to include a regex filter. While
it's nice to have, it's not worth over 440KB added to the release
binary. `grep` / `findstr` are great and even better alternatives.
2022-03-19 17:25:19 -07:00
relrelb bee70c99de tests: Expand `xml_to_string`
Test that a set `nodeName` is included in the final string
representation.
2022-03-19 16:31:24 -07:00
relrelb bac6f50fa3 tests: Expand `xml_append_child`
Test that document roots can be appended as children.
2022-03-19 16:31:24 -07:00
relrelb 724f4165d6 avm1: Implement `nodeName` and `nodeValue` setters
These are actually handled by the same function.
2022-03-19 16:31:24 -07:00
relrelb f9dff4191b xml: Remove `XmlNodeData::DocumentRoot`
Document roots (a.k.a. `XML` objects) are very similar to regular
element nodes (a.k.a. `XMLNode` objects). The primary difference is
that `XML` objects return `null` for their `nodeName`. But this can
be changed too; Setting `xml.nodeName = "someName"` will make `XML`
objects behave much like `XMLNode`. Moreover, many checks in Ruffle
that refuse to operate on document roots were wrong, and actually
these should be accepted as normal element nodes.
Besides the functional corrections, this also simplifies the code.
2022-03-19 16:31:24 -07:00
Mike Welsh dd45dc81a0 web: Fix hangs on Safari by avoiding getOutputTimestamp
`AudioContext.getOutputTimestamp` returns incorrect values in
Safari 15.1+, and this would cause movies with 'stream' sounds to
soft-lock because the calculated audio position would barely
progress.

See:
https://developer.apple.com/forums/thread/696356

Change the output timestamp calculation to use
`AudioContext.currentTime` instead.
2022-03-19 15:13:49 -07:00
relrelb fa70cc07ab xml: Inline `text_from_text_event` and `is_whitespace_text` 2022-03-19 15:08:16 -07:00
David Wendt 1c308551ae chore: App bundle also needs a Resources directory. 2022-03-18 15:55:11 -06:00
relrelb b31e826ee6 core: Simplify `SwfMovie` parsing in `Loader`
This also slightly changes behavior: Previously `SwfMovie::from_data`
errors were propagated as `FetchError` and `display_root_movie_download_failed_message`
was called, offering the user to sidestep CORS by opening the SWF
in a new tab. But that wouldn't help, obviously, because no network
error is involved. Now, these errors are propagated as `InvalidSwf`,
and `display_root_movie_download_failed_message` is not called.
2022-03-17 20:31:59 -07:00
relrelb ad944800be core: Perfer `Loader`'s `FetchError`
`NetworkError` and `NetworkUnavailable` were rarely used, and they
were very similar to `FetchError`.
2022-03-17 20:31:59 -07:00
relrelb bf32fc8576 core: Remove unused `Loader` types 2022-03-17 20:31:59 -07:00
dependabot[bot] d56377b166 build(deps): bump quote from 1.0.15 to 1.0.16
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.15...1.0.16)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 20:29:26 -07:00
relrelb 7e3c85b0c1 web: Cleanup `web-sys` features
Remove unused ones, sort them alphabetically and wrap to 120 columns
per line.
2022-03-18 03:57:20 +02:00
David Wendt f7af4af818 Since we are building an app bundle now, the macOS packager needs to clone the repo, too 2022-03-17 19:48:17 -06:00
David Wendt e5b6e8c8b7 Specify Ruffle's accent color on macOS. 2022-03-17 17:15:14 -06:00
David Wendt 4e0253ebf0 Package the nightly builds as a MacOS app bundle. 2022-03-17 17:15:14 -06:00
dependabot[bot] 50bdb40914 build(deps): bump syn from 1.0.87 to 1.0.88
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 01:00:16 +02:00
dependabot[bot] 7fc6a7c000 build(deps): bump syn from 1.0.87 to 1.0.88
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 00:21:26 +02:00