David Wendt
5f5f98ecdc
avm2: Remove `coerce_to_object` calls in `flash.display.Bitmap`
2022-04-24 16:54:19 -07:00
David Wendt
5b5313bf95
avm2: Remove `coerce_to_object` calls in `String` impls
2022-04-24 16:54:19 -07:00
David Wendt
e851b73570
avm2: Remove calls to `coerce_to_object` in `JSON` impls
2022-04-24 16:54:19 -07:00
David Wendt
88f4ebc2a3
avm2: Remove calls to `coerce_to_object` in `Function` impls
2022-04-24 16:54:19 -07:00
David Wendt
26e65368df
avm2: Remove `coerce_to_object` calls in `Array` where possible, and replace with more descriptive error messages otherwise
2022-04-24 16:54:19 -07:00
David Wendt
1383901a94
avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::globals`.
2022-04-24 16:54:19 -07:00
David Wendt
90b239f30d
avm2: Add descriptive error messages for when `Vector` methods encounter `null`/`undefined`.
2022-04-24 16:54:19 -07:00
David Wendt
e486efb4c6
avm2: Remove unnecessary usage of `coerce_to_object` in `ClassObject`.
2022-04-24 16:54:19 -07:00
David Wendt
0f2b77c138
avm2: Alter basic object operations to use more descriptive error messages.
2022-04-24 16:54:19 -07:00
David Wendt
4185acc5a8
avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::events`.
2022-04-24 16:54:19 -07:00
David Wendt
bb70086238
avm2: Replace a number of `coerce_to_object` calls with the previous commits' new messages as appropriate
2022-04-24 16:54:19 -07:00
David Wendt
bea6744682
avm2: Add methods to `Value` and `Activation` for performing common coercions and returning a relevant error if they fail.
...
Those methods are:
* `Value.coerce_to_receiver`: coerce to object for receivers
* `Value.as_callable`: as_object for callables
* `Activation.superclass_object`: get superclass of currently-called object
* `Activation.resolve_class`: resolve scope value, unwrap `ClassObject`, and error out if either step fails
This accounts for ~80% of coercion-related errors in `Activation`.
2022-04-24 16:54:19 -07:00
David Wendt
2ec606c5cb
avm2: Add utilities for formatting `Multiname`s and class instances' names.
2022-04-24 16:54:19 -07:00
relrelb
3dbde841df
avm1: Remove `TObject::type_of`
...
It can be simply determined in `Value::type_of`.
2022-04-23 17:55:48 -07:00
Daniel Jacobs
aa92c3c1bc
core: scale_mode -> window_mode for set_window_mode
2022-04-22 19:31:23 +03:00
Mike Welsh
e2e7ad0df2
avm2: Implement `flash.ui.Keyboard`
...
Add `Keyboard` key code constants and stub out other properties.
2022-04-21 21:40:04 -07:00
Mike Welsh
1cb3d389e8
core: Add some KeyCode variants
2022-04-21 21:40:04 -07:00
TÖRÖK Attila
7cbba5bc8f
avm2: Stub flash.accessibility.AccessibilityProperties
2022-04-19 09:55:09 -07:00
relrelb
25d47da528
render: Improve CMYK to RGB conversion
...
Use integer arithmetic, which is more accurate and efficient.
2022-04-18 22:00:48 -07:00
Mike Welsh
cdccc2a2db
avm1: Array.sortOn does not inspect proto or virtual properties
...
`Array.sortOn` only looks at raw properties and does not inspect
the prototype chain or call virtual properties.
2022-04-18 08:34:04 -07:00
Mike Welsh
3305ac69c4
web: Support wmode parameter
2022-04-17 08:33:51 -07:00
relrelb
87e85e16da
render: Make `rgb5_component` a lambda
...
This way the `compressed` parameter becomes implicit.
2022-04-16 13:52:59 -07:00
relrelb
8feeadf578
render: Use `std::borrow::Cow`
...
Also apply some nearby refactors.
2022-04-16 13:52:59 -07:00
relrelb
eeaec947b3
render: Remove unneeded `pub`s
...
And remove the dead `glue_swf_jpeg_to_tables` function.
2022-04-16 13:52:59 -07:00
relrelb
9b4108444f
render: Strip 16-bit PNG samples to 8-bit
...
PNGs with 16-bit samples were not being normalized to 8-bit, screwing up their
appearance.
Add the `STRIP_16` transformation using `Transformations::normalize_to_color8()`,
which is equivalent to `Transformations::EXPAND | Transformations::STRIP_16`.
Also warn in case `png` outputs a color type other than `Rgb` and `Rgba`.
Due to the `EXPAND` transformation, this may be only `Grayscale` or
`GrayscaleAlpha`. `Indexed` is converted to either `Rgb` or `Rgba`.
Fixes #6662 .
2022-04-16 12:45:55 -07:00
Mike Welsh
bce9398c0d
avm1: Add Accessibility stub
2022-04-16 09:05:16 -07:00
Toad06
b2b1b5fa25
avm1: Correct `Add`, `Equals`, `Less` and `GetProperty` actions
2022-04-13 22:00:25 -07:00
Mike Welsh
146b8adc68
swf: Clean up LineStyle
...
* Remove LineStyle::color, instead using fill_style with
FillStyle::Color to indicate solid color.
* Store `flags` in the struct instead of separate bools/values.
* Add getters/setters for ease of use.
* Add builder-style methods for setting LineStyle properties.
* Fix misnamed ALLOW_CLOSE flag to NO_CLOSE.
2022-04-11 22:50:40 -07:00
Mike Welsh
c0dff98d84
chore: Fix len_zero warning in symphonia Mp3Decoder
2022-04-11 20:15:13 -07:00
Mike Welsh
24f00238a7
audio: Fix symphonia feature
...
This feature stopped building with the bump to symphonia 0.5, which
added a `Sync` bound to its traits.
* Add `Sync` bounds to our own internal audio traits to match.
* nellymoser::Decoder was also tweaked to add a Sync bound.
* Lock the nellymoser dependency to a specific git commit.
2022-04-11 15:25:15 -07:00
dependabot[bot]
a5f7fccca2
build(deps): bump quote from 1.0.17 to 1.0.18
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.17 to 1.0.18.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.17...1.0.18 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:20 -07:00
dependabot[bot]
5973ecc7d9
build(deps): bump flate2 from 1.0.22 to 1.0.23
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.22 to 1.0.23.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.22...1.0.23 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:09 -07:00
Toad06
c6c1f553d5
avm1: Correct `Action::RandomNumber`
2022-04-11 11:02:08 -07:00
Toad06
e2528b04a7
avm1: Coerce booleans to `"1"` or `"0"` in SWFv4
2022-04-10 20:03:39 -07:00
Toad06
b221485288
avm1: Fix `Action::Divide` in SWFv4
2022-04-09 23:17:39 -07:00
Mike Welsh
91346f5fad
avm1: Format floating-point numbers
...
Co-authored-by: Toad06 <gd.productions@laposte.net>
2022-04-09 22:40:59 -07:00
Mike Welsh
478f970fc8
chore: Appease clippy
2022-04-09 18:23:51 -07:00
Aaron Hill
d7532ae654
avm2: Add stubs for `BitmapFilter`, `GlowFilter`, and `DisplayObject.filters`
...
This gets 'Rolling Hero' further in the startup process,
since it just tries to set a filter on an object.
2022-04-08 16:53:16 -07:00
relrelb
ad42b9908f
xml: Refactor `XmlNode` creation methods
...
Unify the previous 3 creation methods to a single `XmlNode::new`.
This allows supporting arbitrary `nodeType` values passed to the
`XMLNode` constructor.
2022-04-08 16:34:57 -07:00
relrelb
7497fb7008
core: Change `Player::set_root_movie` to accept a `SwfMovie`
...
Move the `Arc::new` to within the function.
2022-04-08 15:16:25 -07:00
Toad06
12737b8431
avm1: Fix `Number(String | Object)` in SWFv4
2022-04-08 10:41:21 -07:00
dependabot[bot]
1339d8b93a
build(deps): bump syn from 1.0.90 to 1.0.91
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.90 to 1.0.91.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.90...1.0.91 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:43 -07:00
dependabot[bot]
860c2e313f
build(deps): bump encoding_rs from 0.8.30 to 0.8.31
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.30 to 0.8.31.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.30...v0.8.31 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:26 -07:00
relrelb
eeb5eb18f6
web: Bump wasm-bindgen to 0.2.80
...
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-04-08 09:56:23 -07:00
dependabot[bot]
e456fb3ed6
build(deps): bump jpeg-decoder from 0.2.3 to 0.2.4
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.3...v0.2.4 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 14:42:32 -07:00
Mike Welsh
6ec3049e02
desktop: Use floats for audio start/endpoints calculation ( fix #6569 )
...
Integer math was used when calculating a sound's start/endpoints,
because it was assumed that the sound sample rate was always an
even divisor of 44100Hz. However, some third party tools can embed
MP3s with other samples rates, such as #6569 which has a 16000Hz
MP3. This could also occur for dynamically loaded MP3s. This
results in the sound starting at an incorrect position.
Use floating point math to ensure the correct position is
caluclated.
Fixes #6569 .
2022-04-03 15:50:43 -07:00
Mike Welsh
9687365885
core: Remove morph shape preloading
...
Remove the preload step that would pre-create the shapes for each
morph shape ratio on SWF load. Instead, lazily crate the shapes
when they are needed.
2022-04-03 13:50:09 -07:00
Mike Welsh
b1879f4b99
core: Fix divide-by-zero in Video::seek ( fix #6605 )
2022-04-03 11:33:52 -07:00
Toad06
055e1d4dc1
avm1: Fix `loadVariablesNum` / `Action::GetUrl2`
2022-04-03 10:32:31 -07:00
Toad06
e93d39fdfe
avm1: `DefineLocal` also accepts dot and slash paths
2022-04-02 14:30:56 -07:00
relrelb
c8e7bdbce2
core: Fix loading of unknown data
...
Loading unknown data is not considered an error on Flash; Both
`onLoadProgress` and `onLoadComplete` events are dispatched. But,
`onLoadProgress` reports 0 bytes loaded.
2022-04-02 12:50:43 -07:00
relrelb
e06506c2b9
render: Implement `CMYK32` jpeg pixel format
2022-04-02 01:17:38 +03:00
Aaron Hill
4f23500779
avm2: Implement most of `flash.external.ExternalInterface`
...
This re-uses the logic we have for handling AVM1's `ExternalInterface`.
For now, serialization/deserialization of non-array objects is
left unimplemented.
2022-03-31 22:40:09 -07:00
Mike Welsh
659db7facc
avm1: Add2 calls valueOf for objects
2022-03-31 16:57:07 -07:00
Adrian Wielgosik
a929a4becd
avm2: Do not borrow Object's lock just to get the bound method
2022-03-31 16:56:55 -07:00
Adrian Wielgosik
7e8738d82e
avm2: Add ContextMenuEvent stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
ef64413b8c
avm2: Support ContextMenuItem fields
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
ea56902d80
chore: cargo fmt
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
90b1d4722c
avm2: Add ContextMenuItem stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
2389422c99
avm2: Add ioErrorEvent stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
388dc6fe31
avm2: Add customItems to ContextMenu stub
2022-03-30 21:42:48 +02:00
Mike Welsh
d920dfa9b0
core: Add padding on autosized TextFields
2022-03-29 22:22:32 -07:00
Mike Welsh
a671d2977b
core: Pre-multiply alpha when loading PNG/GIF data ( fix #6559 )
...
When decoding PNG/GIF data, convert the image to premultiplied
alpha so that it plays nicely with the renderer.
This applies to both dynamically loaded images and to PNG/GIF data
embedded inside a DefineBitsJPEG tag. This is in contrast to
DefineBitsLossless and DefineBitsJPEG tags w/ alpha, which are
already premultiplied in the SWF.
Also remove unnecessary clamps now that Rust defines casts as
saturating.
Fixes #6559 .
2022-03-29 13:41:04 -07:00
Mike Welsh
9c50770c1c
avm1: Return Value from `abstract_lt`
...
All callers converted the result to `Value` anyway.
2022-03-28 19:07:12 -07:00
Mike Welsh
98ea2f81b6
avm1: {} < {} returns false
...
The Less2 op returns false if the `valueOf` of either parameter
results in an object. The exception is display objects:
`mc < mc` returns undefined.
2022-03-28 19:07:12 -07:00
dependabot[bot]
fcb5eaec0e
build(deps): bump syn from 1.0.89 to 1.0.90
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.89...1.0.90 )
---
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-29 00:09:22 +03:00
dependabot[bot]
bf57d2c15a
build(deps): bump jpeg-decoder from 0.2.2 to 0.2.3
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.2...v0.2.3 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 00:09:01 +03:00
David Wendt
b9da107339
core: Refactor `MovieClipLoader` broadcast messages into separate `Loader` associated functions.
...
These are *not* methods, because we cannot borrow both the update context and the loader at the same time. At least not without making loaders free-standing objects (`GcCell`s), which I don't want to do yet.
2022-03-27 18:55:38 -07:00
David Wendt
ac7bb84e08
core: Report unexpected content type errors better.
2022-03-27 18:55:38 -07:00
David Wendt
27697c6611
chore: No, loading an image does not replace the clip with a bitmap.
2022-03-27 18:55:38 -07:00
David Wendt
e1d18be7fa
core: First pass at image loading through `loadMovie` et all
2022-03-27 18:55:38 -07:00
Toad06
4ad0253076
avm1: `String(function)` returns `[type Function]`
2022-03-27 11:39:44 -07:00
Mike Welsh
ac765bd187
chore: Update copyright
...
I (Michael R. Welsh) assign to Ruffle LLC all rights, title, and
interest to copyrights of my personal contributions to Ruffle,
effective March 26, 2022.
2022-03-26 18:13:14 -07:00
relrelb
1c576816b6
core: Refactor `LoadManager::load_form_into_load_vars`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb
f3c22d930b
core: Refactor `LoadManager::load_form_into_object`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb
83353e17c5
core: Refactor `LoadManager::load_movie_into_clip`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
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
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
1911aa9a6b
Move core::string into separate ruffle_wstr crate.
2022-03-26 13:42:57 -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]
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
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
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
relrelb
fa70cc07ab
xml: Inline `text_from_text_event` and `is_whitespace_text`
2022-03-19 15:08:16 -07: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
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
relrelb
8a17d88c77
core: Remove `NavigatorBackend::time_since_launch`
...
`core` already depends on the `instant` crate which abstracts
`std::instant::Instant` and polyfills it on Web. Use it to replace
`NavigatorBackend::time_since_launch` in order to make `NavigatorBackend`
a little smaller and more simple.
2022-03-17 00:08:44 +02:00
relrelb
031126a1b8
core: Remove `LocaleBackend`
...
Previously there were 3 implementations of `LocaleBackend`:
`DesktopLocaleBackend`, `WebLocaleBackend` and `NullLocaleBackend`.
While `DesktopLocaleBackend`, `WebLocaleBackend` were identical,
`NullLocaleBackend` always returned a fixed date/time for tests
determinism.
Unify them in a single file, and use `cfg!(test)` and a new dedicated
`deterministic` feature to decide whether to mock date/time or not.
This should not cause any behavioral changes.
2022-03-16 19:57:53 +02:00
relrelb
1db29217eb
chore: Appease clippy
2022-03-16 18:51:39 +02:00
Aaron Hill
e87ad52deb
avm2: Add initial implementation of `Matrix`
...
This implements the `a, b, c, d, tx, ty` properties,
as well as the constructor, `identity`, and `scale` methods.
2022-03-16 13:52:58 +02:00
dependabot[bot]
8d7000cd67
build(deps): bump syn from 1.0.86 to 1.0.87
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.86...1.0.87 )
---
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-14 22:26:58 +02:00
relrelb
f8f2764ac7
chore: Stop using traits available in prelude
...
This commit does the same as 36353df7f7
,
cleaning up any leftovers and new code added since.
2022-03-14 01:16:00 +02:00
relrelb
9c9335dbb8
core: Small cleanup in `Font::measure`
2022-03-13 19:11:06 +02:00
relrelb
3d08f31fa7
avm1: Correct `StageObject::get_level_by_path`
...
Resolving `_levelN` had some inconsistencies with Flash:
1. `_flash` can be a prefix too.
2. The level ID parsing cannot fail; non-digit characters are ignored,
the value wraps around at `i32::MAX`, and negative values are valid.
This logic is relevant also for the `GetUrl` and `GetUrl2` opcodes.
For now only add TODOs for this.
2022-03-12 16:48:55 +02:00
relrelb
b59638935f
xml: Remove constant `process_entity` parameter
2022-03-12 16:11:39 +02:00
Aaron Hill
3bcb409bd8
Add more AVM2 'flash.' class stubs
...
This PR adds the following class stubs:
* 'flash.display.Loader'
* 'flash.net.URLRequest'
* 'flash.ui.Keyboard'
* 'flash.utils.Timer'
These are needed for 'This is the Only Level TOO' (though we'll need
actual implementations to get this game past the loading screen).
2022-03-12 15:09:41 +01:00
relrelb
b0a73d5638
avm1: Remove `TransformObject::construct`
...
`constructor` in `core/src/avm1/globals/transform.rs` should do
the same, as in other built-in classes.
2022-03-12 15:59:05 +02:00
relrelb
5a1e417526
avm1: Simplify `TDisplayObject::avm1_root()`
...
Make it infailable.
2022-03-10 01:22:52 +02:00
dependabot[bot]
71758be08b
build(deps): bump png from 0.17.4 to 0.17.5
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.4 to 0.17.5.
- [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.17.4...v0.17.5 )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 23:59:02 +02:00
Aaron Hill
f4bb6fc43c
Change property definition from `loaderUrl` to `loaderURL`
...
The actual property name is `loaderURL` - it looks like
a typo was made when this was originally defined in Ruffle.
2022-03-07 09:24:01 +02:00
relrelb
88f6856723
avm1: Fix `isFinite()` for SWF<7
...
Previously, `isFinite()` with no arguments on SWF<7 incorrectly
returned `true`, as `undefined` coerced to `f64` is `0.0`, which
is finite. Fix this by not defaulting to `undefined`, similarly to
the `isNaN()` implementation.
2022-03-06 23:15:18 +01:00
Aaron Hill
8d58c6974c
Display `Muliname` when trying to lookup a non-public property
...
This will make these errors easier to debug.
2022-03-06 22:56:23 +01:00
Aaron Hill
4a534086b8
Make `Date` class prototype methods non-enumerable
2022-03-06 22:48:15 +01:00
Aaron Hill
2d1b3a2834
Also declare Date methods on class prototype
2022-03-06 22:48:15 +01:00
Aaron Hill
59ef987210
Declare AVM2 'Date' class methods in the AS3 namespace
...
We now declare these methods in the 'http://adobe.com/AS3/2006/builtin '
namespace. This corresponds to the 'AS3' namespace modifier shown on the
docs page: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html
Previously, we would fail to lookup these methods, since the namespace
used by the SWF would not match the namespace defined by Ruffle.
2022-03-06 22:48:15 +01:00
relrelb
26f3d1e321
avm1: Fix typo
2022-03-06 23:10:09 +02:00
relrelb
d0edffaed3
avm1: Remove unneeded `pub`
2022-03-06 23:10:09 +02:00
relrelb
6504dc8ffc
avm1: Simplify `MovieClip::get_bounds`
...
The String and Object cases are already handled by `resolve_target_display_object`.
2022-03-06 23:10:09 +02:00
relrelb
2faabfb58e
xml: Remove `Error`
...
Directly use `quick_xml::Error` instead.
2022-03-02 08:56:23 +02:00
relrelb
e901999b4c
xml: Silently fail in `insert_child`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors. This
removes the last 3 remaining `Error` enum members besides `InvalidXml`.
2022-03-01 19:56:36 +02:00
relrelb
48d0737cd9
xml: Inline `adopt_child` into `insert_child`
...
There's no point in calling `adopt_child` alone. This makes 2 `Error`
enum members redundant.
2022-03-01 19:56:36 +02:00
Toad06
dcca61073b
core: Display the appropriate mouse cursor after interacting with a button
2022-02-28 15:28:18 -07:00
dependabot[bot]
b5f65463b6
build(deps): bump png from 0.17.3 to 0.17.4
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.3 to 0.17.4.
- [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 )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-28 22:31:11 +02:00
relrelb
7313913127
xml: Turn `remove_child` into `remove_node`
...
The 2 existing usages of `remove_node` always operated on a child and
its parent: One iterates over all of its children and removes each one,
and the other explicitly grabs the parent of a given node.
As a simplification, `remove_node` operates only on a child node,
without the need for the parent node in addition; it grabs the parent
from the child by itself. As such, it's non-failable.
2022-02-28 08:34:16 +02:00
relrelb
73c1be8dcc
xml: Remove `Error::TextNodeCantHaveChildren`
...
Text nodes are guaranteed to not be parents, as `adopt_child`
refuses to adopt children into them. So instead of returning an
`Err(Error::TextNodeCantHaveChildren)` in case of a text node parent,
mark those code paths as `unreachable!()`. This makes `orphan_child`
non-failable.
2022-02-28 08:34:16 +02:00
Toad06
66c132017f
avm1: Allow strings in `new Sound(target)`
2022-02-28 08:30:38 +02:00
relrelb
0401b3c447
avm2: Replace `json` with `serde_json`
...
The `json` crate seems unmaintained, and recently also causes compile
errors with stable Rust 1.59.0. On the other hand, `serde_json` is
very maintained and more popular.
However, from some reason a cyclic package dependency has introduced
by this change. For now use a workaround from: https://github.com/tkaitchuck/aHash/issues/95#issuecomment-903560879
2022-02-27 23:19:46 +02:00
relrelb
fa459f7547
core: Require `serde` feature
...
Enable it unconditionally as a preparation for depending on `serde_json`,
which will need `serde::Serialize`.
2022-02-27 23:19:46 +02:00
relrelb
841d0f7efd
avm1: Remove legacy JSON SharedObject deserialization
...
This is basically a revert of 61298b2be3
.
`SharedObject`s used to be saved as JSON in Ruffle, but since #4238
they're saved in AMF to match Flash's behavior. The legacy JSON
deserialization remained for backwards-compatibility, but from what it
seems, it has never worked; cd1cde1708
changed `LocalStorageBackend` to store base64-encoded strings instead
of plain ones. Therefore, Ruffle attempts to base64-decode old JSON
data, and unsurprisingly fails.
In addition, this removes 1 out of 2 usages of the unmaintained `json`
crate, which recently also causes compile errors with stable Rust 1.59.0.
2022-02-27 23:19:46 +02:00
relrelb
b645c01ce7
xml: Silently fail in `disown_parent`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of error.
2022-02-24 18:02:52 +02:00
relrelb
f7117824df
xml: Silently fail in `set_{prev,next}_sibling`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors.
2022-02-23 22:45:07 +02:00
relrelb
ce6e90c027
avm1: Store `status` in `XmlObject`, instead of `ParseError`
...
The only use of `last_parse_error` was in the `XML.prototype.status`
property, where it was converted into a number. Avoid storing it by
storing just the number.
2022-02-21 23:21:14 +02:00
dependabot[bot]
40f356a385
build(deps): bump rand from 0.8.4 to 0.8.5
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/rust-random/rand/releases )
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-random/rand/compare/0.8.4...0.8.5 )
---
updated-dependencies:
- dependency-name: rand
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 22:34:09 +02:00
Toad06
5e8d8cc4d1
avm1: Add `trace` to globals
2022-02-14 14:50:33 +02:00
relrelb
faa1f3d6b4
avm1: Refactor `XmlNodeObject::from_xml_node`
...
Revert some of e50aea864b
for an even
better approach - Remove `XmlNodeObject::empty_node` entirely by
making `XmlNodeObject::from_xml_node` a suitable alternative. That is,
being able to accept a custom `proto` like before.
Also, make it return an `XmlNodeObject` instead of an `Object`, and
add a few `.into()` where needed.
2022-02-14 12:15:39 +02:00
dependabot[bot]
db888ad739
build(deps): bump png from 0.17.2 to 0.17.3
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.2 to 0.17.3.
- [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 )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:43:46 +02:00
relrelb
dbddefb44d
xml: Refactor `XmlNode::into_string`
...
* Don't use `quick_xml::Writer` for formatting the XML, being much
more simple.
* Return `WString` instead of `String`, reducing `to_utf8_lossy()`
calls except when the string needs to be escaped (attribute values
and text contents).
2022-02-13 18:11:50 +02:00
dependabot[bot]
a3288fa20c
build(deps): bump serde from 1.0.133 to 1.0.136
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.133 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.133...v1.0.136 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:10:43 +02:00
dependabot[bot]
cc2df3e23c
build(deps): bump syn from 1.0.85 to 1.0.86
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.85...1.0.86 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:55:17 +01:00
dependabot[bot]
036218ed01
build(deps): bump jpeg-decoder from 0.2.1 to 0.2.2
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.1 to 0.2.2.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.1...v0.2.2 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:47:13 +02:00
dependabot[bot]
5f630217c6
build(deps): bump smallvec from 1.7.0 to 1.8.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:46:59 +02:00
dependabot[bot]
281c080295
build(deps): bump symphonia from 0.4.0 to 0.5.0
...
Bumps [symphonia](https://github.com/pdeljanov/Symphonia ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases )
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.4.0...v0.5.0 )
---
updated-dependencies:
- dependency-name: symphonia
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:13:44 +02:00
dependabot[bot]
3bef5cadf6
build(deps): bump quote from 1.0.14 to 1.0.15
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.14 to 1.0.15.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.14...1.0.15 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 15:45:11 +02:00
Jean Marchand
9969e0ce5a
avm2: Fix invalid option
2022-02-12 23:35:32 +02:00
relrelb
ad2b8ea007
avm1: Merge `XmlDocument` into `XmlObject`
...
As `XmlDocument` and `XmlObject` had 1-to-1 relation, and `XmlDocument`
is already tightly coupled with AVM1, there's no good reason for them
being separate objects.
This brings us one step closer towards an XML implementation hosted
completely in AVM1.
A future PR will merge `XmlNode` into `XmlNodeObject` in a similar
manner.
2022-02-11 19:08:02 +02:00
relrelb
aee98d81c8
avm1: Fix nightly build error
2022-02-11 18:45:32 +02:00
relrelb
360ad90a85
avm1: Call sort function with a primitive `this`
...
This is now possible thanks to #6108 .
2022-02-11 18:45:32 +02:00
Toad06
b15806d9c2
avm1: Remove `random` from globals
2022-02-11 00:55:13 +02:00
relrelb
44fd13c654
avm1: Fix builtins' attributes
...
Fixes #5827 .
2022-02-10 19:42:05 +02:00
relrelb
b6c7cc1ca3
core: Cleanup `Avm1ConstructorRegistry`
...
Instead of storing shared pointers to `Avm1ConstructorRegistry` in
`MovieLibrary`, access the `PropertyMap` directly, without an extra
abstraction.
Also, move the constructor registries to `Avm1`, for better
encapsulation.
2022-02-10 07:58:30 +02:00
Toad06
fff9cd1d63
avm1: Change cursor to arrow when the `enabled` property is set to false
2022-02-09 16:26:50 -08:00
TÖRÖK Attila
ed0aa3758c
core: Extend the embedded fake device font with more characters
...
By also embedding the "Basic Latin", "Latin I", and "Latin Extended A" sections.
2022-02-09 20:09:52 +01:00
relrelb
6c4a10792d
avm1: Remove `XmlIdMapObject`
...
Use a bare `ScriptObject` instead.
2022-02-07 22:24:42 +02:00
relrelb
e50aea864b
xml: Simplify `XmlNodeObject::from_xml_node`
...
Since it's always called with the same prototype (`XMLNode.prototype`),
this can be pulled into the function itself, greatly simplifying it.
2022-02-07 22:24:42 +02:00
relrelb
79d5a0e326
avm1: Avoid some calls to `XmlNode::introduce_script_object`
...
Instead call `XmlNode::script_object`, which internally calls
`XmlNode::introduce_script_object`. This is a preparation for changing
the signature of `XmlNodeObject::from_xml_node`.
2022-02-07 22:24:42 +02:00
relrelb
7e32f7b85d
xml: Remove `tests.rs`
...
These are already covered by the SWF tests.
2022-02-07 22:24:42 +02:00
Adrian Wielgosik
562a205f3d
chore: clippy
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
2c4b260a8c
chore: cargo fmt
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
c67579e236
avm2: Implement Object()
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
0004b9e58e
avm2: Implement RegExp()
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
c8fe2fcfb2
avm2: Implement Namespace() stub
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
8402f6637b
avm2: Implement Vector.<T>(array_like)
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
db8aa42db9
avm2: Support custom Class() implementations
2022-02-07 00:49:00 +01:00
Fernando Karchiloff
0c853082dd
core: Fix bullet append with box_count check
2022-02-06 20:52:04 +02:00
Fernando Karchiloff
b7273e038c
core: fix bullet append from html
2022-02-06 20:52:04 +02:00
relrelb
48c43b731e
avm1: Remove unused `is_defined`
2022-02-05 13:43:19 +02:00
Toad06
83cc9dc308
avm1: Fire `onReleaseOutside` event even when the button is invisible
2022-01-30 14:08:47 -08:00
Mike Welsh
601918a998
core: Fix drawing API stroke rendering order ( fix #3186 )
2022-01-29 20:05:04 -08:00
Mike Welsh
705588a2ec
core: Fix incorrect fill and stroke rendering order ( fix #6129 )
2022-01-29 20:05:04 -08:00
Mike Welsh
55da3cd7d0
chore: Add .cargo/config.toml for workspace-level lint config
...
Currently it is not directly possible to configure lints for the
entire workspace via TOML, which forced us to repeat `#![allow]`
blocks in each crate.
embark pointed out this workaround to configure lints at the
workspace level via RUSTFLAGS:
https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395
Remove the common `#![allow]` blocks and switch to this method for
global lint config.
Temporarily allow `needless_borrow` lint, buggy pending this fix:
https://github.com/rust-lang/rust-clippy/pull/8355
2022-01-29 14:22:44 -08:00
relrelb
99b22b24dd
avm1: Remove unused `FunctionObjectData::primitive`
2022-01-29 12:12:39 -08:00
Daniel Jacobs
1e5956c02a
core: Fix get_text_format bullet return value
2022-01-27 22:35:18 -08:00
TÖRÖK Attila
43b21e5d4d
chore: Bump approx to 0.5.1, remove clippy lint suppressions
2022-01-25 18:34:35 -08:00
Toad06
da50d44460
core: Fix detection of button events
2022-01-24 11:48:37 -08:00
Mike Welsh
354d7f0ce6
avm1: Remove unused `this` from `Scope::resolve` and `set`
2022-01-24 02:04:57 -08:00
Mike Welsh
c35edaae82
avm1: Allow `this` to be `undefined`
...
Change `Activation::this` to be `Value` instead of `Object`.
2022-01-24 02:04:57 -08:00
Mike Welsh
9ccb3ac3e7
avm1: Fix coercion in string-object concatenation
...
Previously we called `toString` when concatenating a string to an
Object. However, Flash actually has more complex behavior, usually
calling both `valueOf` and `toString`. This is loosely based on
ToPrimitive/DefaultValue with no type hint in the ECMAScript spec.
* Call `valueOf`.
* If the result isn't a primitive, call `toString`.
* If the result still isn't primitive, return `"[type Object]"`.
* For Date objects in SWFv6 and higher, call `toString`.
* If the result isn't a primitive, call `toString` (AVM1 bug?)
* If it still isn't primitive, return `"[type Object]"`.
2022-01-23 17:19:09 -08:00
David Wendt
48f8515c03
core: `mouseEnabled` controls whether or not display objects are mouse-pickable
2022-01-22 19:58:32 -08:00
David Wendt
35cbed01fa
docs: Better document the `ClipEvent` dispatch patterns.
2022-01-22 19:58:32 -08:00
David Wendt
e5d9379740
core: Implement `mouseMove` event
2022-01-22 19:58:32 -08:00
David Wendt
6271d069d7
core: `Stage` should not include it's own transform in it's local/global matrix.
2022-01-22 19:58:32 -08:00
David Wendt
c42984a990
avm2: Implement `MouseEvent.toString`.
...
This also rearranges some things about how we construct events, because `MouseEvent` has different defaults from `Event`. When we finally support parameter metadata on methods we should remove that code.
We also remove the `value_of` code on `EventObject` as that was a mistake. Events don't do anything special in there and I misinterpreted the test results the first time around.
2022-01-22 19:58:32 -08:00
David Wendt
880211c238
core: Implement the `doubleClick` event on objects that request it.
2022-01-22 19:58:32 -08:00
David Wendt
eeea5ffea6
core: Issue `MouseWheel` events for AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
87a9a543ba
chore: Fix clippy lint on nightly
2022-01-22 19:58:32 -08:00
David Wendt
84d1d5aa76
core: Issue `mouseOver`, `mouseOut`, etc when dragging.
2022-01-22 19:58:32 -08:00
David Wendt
42b606d058
core: Issue `rollOver`, `rollOut`, `mouseOut`, and `mouseOver` events to AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
353a5a78d6
core: Move `mouse_pick` and `mouse_cursor` to `InteractiveObject` as no non-interactive object implements them.
...
This also cascades into other places, ultimately resulting in more things being marked as `InteractiveObject`.
2022-01-22 19:58:32 -08:00
David Wendt
d0ef15503c
avm2: Store the last-hovered or currently-hovered object on the event that notifies the clip that the hover state has changed.
2022-01-22 19:58:32 -08:00
David Wendt
f69206aaa2
core: Fire AVM2's `mouseUp` event on the correct object.
...
This requires adding another notion of mouse-release events to `ClipEvent`. We now have four:
* `MouseUp` - the mouse was released, any object on the render list can handle this event ("anycast" event)
* `MouseUpInside` - the mouse was released inside this display object, only the mouse-picked target of the event can handle it
* `Release` - the mouse was released inside the last clicked display object
* `ReleaseOutside` - the mouse was released outside the last clicked display object
For those keeping score at home, in AVM2, the valid progression of events is either...
* On the same object, `mouseDown`, `mouseUp`, and `click`
* On one object, `mouseDown`, then some mouse movement that takes the cursor out of the first object, then on another object `mouseUp`, and then finally the first object gets `releaseOutside`.
2022-01-22 19:58:32 -08:00
David Wendt
35f020f482
avm2: Allow `Stage` to receive button presses
2022-01-22 19:58:32 -08:00
David Wendt
9d4b222b29
core: AVM2 wants the same semantics as `Press`/`Release`, not `MouseDown`/`MouseUp`.
...
`MouseDown`/`MouseUp` are effectively broadcasts; they hit every movie clip that can accept them until one of them has a handler for it. AVM2 instead wants events that only apply to specific mouse-picked display objects, which means we need to use the Player-tracked events `Press`, `Release`, and `ReleaseOutside`. The only problem is that we also need to emit a `mouseUp` event on both `Release` and `ReleaseOutside`.
2022-01-22 19:58:32 -08:00
David Wendt
f0ab17c979
core: AVM2 `MovieClip`s can accept mouse events without being in button mode.
...
This technically changes the meaning of `require_button_mode` slightly to something more like "accepts input".
2022-01-22 19:58:32 -08:00
David Wendt
f56782c5c7
core: Movie clips do not have a hand cursor unless they are also in button mode.
2022-01-22 19:58:32 -08:00
David Wendt
cbeb24f3f8
core: Implement forced button mode flag for AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
7b6f8aef06
avm2: Implement `flash.events.EventPhase`.
2022-01-22 19:58:32 -08:00
David Wendt
6d02248ea5
core: Add a method to fire common `InteractiveObject` events into AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
18b8b227a1
avm2: Add utility method for pulling mouse event data from current context
2022-01-22 19:58:32 -08:00
David Wendt
c53130e940
avm2: Automatically select a given event's class based on it's data.
2022-01-22 19:58:32 -08:00
David Wendt
ada093938e
avm2: Expose `MouseEvent` as a system class.
2022-01-22 19:58:32 -08:00
David Wendt
ac0f62d475
avm2: Implement `MouseEvent.stageX`/`stageY`
2022-01-22 19:58:32 -08:00
David Wendt
9ee263160a
avm2: Implement `MouseEvent.relatedObject`
2022-01-22 19:58:32 -08:00
David Wendt
477b8fb87f
avm2: Implement `MouseEvent.movementX`/`movementY`
2022-01-22 19:58:32 -08:00
David Wendt
b612980ace
avm2: Impl `MouseEvent.localX`/`localY`
2022-01-22 19:58:32 -08:00
David Wendt
948b591378
avm2: Stub `MouseEvent.isRelatedObjectInaccessible`
2022-01-22 19:58:32 -08:00
David Wendt
a3c48c5e29
avm2: Implement `MouseEvent.delta`
2022-01-22 19:58:32 -08:00
David Wendt
22638f4aae
avm2: Impl `MouseEvent.buttonDown`
2022-01-22 19:58:32 -08:00
David Wendt
d790b138b0
avm2: Implement accessor methods for `altKey`, `commandKey`, `controlKey`/`ctrlKey`, and `shiftKey`.
2022-01-22 19:58:32 -08:00
David Wendt
d9bbafb0bb
avm2: Make `MouseEvent`'s constructor set event data based on it's parameters.
2022-01-22 19:58:32 -08:00
David Wendt
016cd6ccc0
avm2: Make event construction take an `EventData` parameter.
...
This also necessitated the introduction of a `FullScreenEvent` data type.
2022-01-22 19:58:32 -08:00
David Wendt
43161976c7
avm2: Add a new field to store mouse event data on dispatched events.
2022-01-22 19:58:32 -08:00
relrelb
164e1a38c0
core: Remove unnecessary parameter from `post_instantiation`
...
`display_object` was always equivalent to `self`, there's no need to
pass both.
2022-01-22 11:37:33 -08:00
Mike Welsh
e11e1e870f
avm1: Improve Object comparisons in SWFv5
...
SWFv5 always calls `Object.valueOf` at least once and sometimes
twice in the Equals2 op, even when comparing two Objects.
For example, `Object(1) == Object(1)` is true in SWFv5 but false
in SWFv6.
2022-01-21 16:40:19 -08:00
Mike Welsh
bf599d9107
avm1: Clean up Value::abstract_eq
...
Consolidate several cases and fix some issues:
* Object-to-primitive comparison always goes through `valueOf`.
* `Object(undefined) == undefined` is true; this will coerce
to a bare object with no `valueOf`, resulting in
`undefined==undefined`.
* `{valueOf:function() { return NaN; }} == NaN` is true.
2022-01-21 16:40:19 -08:00
Mike Welsh
4d8db1e64d
avm1: Fix function closures inside `with`
...
When creating a scope for a closure, any `with` scopes were being
filtered out, but this was incorrect; `with` scopes are still on
the scope chain when the function is called.
2022-01-19 20:29:26 -08:00
relrelb
1de284dc5b
html: Fix handling of end tag mismatch
...
Flash ignores mismatched end tags (i.e. end tags with a missing/different
corresponding start tag). `quick-xml` checks end tag mismatches by
default, but it cannot recover after encountering one.
Commit 7e20543578
already disabled
`quick-xml`'s check, but that caused mismatched `Event::End` to be
handled, which may empty `format_stack` and later panic on
`format_stack.last().unwrap()`.
Thus, check for mismatched end tags ourselves, in a similar manner
of `quick-xml`, but in a recoverable way.
2022-01-18 13:50:26 -08:00
David Wendt
57acf47a10
avm2: Allow access to stage properties without a valid root movie clip.
2022-01-18 11:06:23 -08:00
David Wendt
df25d1ca8b
avm2: Children of the root inherit their parent's `loaderInfo`
2022-01-18 11:06:23 -08:00
David Wendt
f041cced72
avm2: The stage's loader info object allows access to `url`, `bytes`, and `parameters`.
2022-01-18 11:06:23 -08:00
Mike Welsh
b181debff6
swf: Use bitflags for `avm1::GetUrl2`
2022-01-17 21:35:57 -08:00
Mike Welsh
4c3e14eae5
core: Clean up `DefineFunction` action
...
* Have `DefineFunction` and `DefineFunction2` go through the same
code path by implementing `From<DefineFunction>` for
`DefineFunction2`.
* Change `register` to a `Option<NonZeroU8>` for size optimization.
* Add `function::Param` to store param info instead of a tuple.
2022-01-17 21:35:57 -08:00
Mike Welsh
c618a12d14
core: Remove _ pattern in `avm1::Activation::do_action`
...
The match is exhaustive, so replace `_` with `Action::Unknown`.
2022-01-17 21:35:57 -08:00
Mike Welsh
2b2346b65e
swf: Add `avm1::Action::End`
...
Returning an `Action::End` instead of `None` when reading the end
of an action.
2022-01-17 21:35:57 -08:00
Mike Welsh
9141451ca1
swf: Use structs for avm1 `Action` variants
...
Use a struct for all variants of `avm1::Action`.
This makes the style more consistent instead of using a mix of
struct and tuple variants, and allows the data to be easily passed
around.
2022-01-17 21:35:57 -08:00
Adrian Wielgosik
5358940774
avm2: Support basic string.replace
...
Supports:
- string.replace(string, string)
- string.replace(regex, simple_string)
Does not support:
- string.replace(regex, string_with_replacement_codes)
- string.replace(any, function)
2022-01-17 20:10:20 -08:00
relrelb
3b25a3b901
avm1: Correct `MovieClipLoader.getProgress`
...
Handle strings, numbers and DisplayObject targets.
Return compressed length rather than uncompressed length.
2022-01-15 13:08:01 -08:00
relrelb
eb23f19fad
avm1: Correct `MovieClipLoader.unloadClip`
...
Handle strings, numbers and DisplayObject targets.
2022-01-15 13:08:01 -08:00
relrelb
0da8e504ab
avm1: Correct `MovieClipLoader.loadClip`
...
Handle strings, numbers and DisplayObject targets (not just MovieClips).
To support non-MovieClip targets, turn `clip.as_movie_clip().unwrap()`
to `if let Some(mc) = clip.as_movie_clip()` in `Loader`.
2022-01-15 13:08:01 -08:00
relrelb
e9607cfcbb
chore: Appease clippy
2022-01-15 11:16:24 -08:00
relrelb
25722e7abe
avm1: Fix `onLoadInit` event order
...
`onLoadInit` is queued after all `DoAction`s of the loaded clips.
That is, if clip1, clip2, clip3 are loaded in the same frame
(in this order), then actions will be executed as follows:
* `DoAction` of clip3
* `DoAction` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip3
* `onLoadInit` of clip2
* `onLoadInit` of clip1
Previously, those were incorrectly executed as follows:
* `DoAction` of clip3
* `onLoadInit` of clip3
* `DoAction` of clip2
* `onLoadInit` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip1
2022-01-14 17:27:14 -08:00
TÖRÖK Attila
12f9bec194
chore: Bump h263-rs git reference
...
To make use of https://github.com/ruffle-rs/h263-rs/pull/17
2022-01-14 17:09:39 -08:00
Mike Welsh
232f1dd120
chore: Appease clippy
2022-01-10 23:37:11 -08:00
dependabot[bot]
8f53449762
build(deps): bump indexmap from 1.7.0 to 1.8.0
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.rst )
- [Commits](https://github.com/bluss/indexmap/compare/1.7.0...1.8.0 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:08:19 -08:00
dependabot[bot]
491cc05a79
build(deps): bump syn from 1.0.84 to 1.0.85
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.84...1.0.85 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:07:29 -08:00
relrelb
b39ab9034c
core: Remove `Player::is_mouse_down`
...
Now that `InputManager` tracks the mouse button, it can be used
instead.
2022-01-10 01:18:49 -08:00
relrelb
573aa89c9a
core: Handle mouse events in `InputManager::handle_event`
2022-01-10 01:18:49 -08:00
relrelb
82b4c6ef27
core: Support mouse buttons in `KeyCode`
...
Add `MouseLeft`, `MouseRight` and `MouseMiddle` to `KeyCode` for
AVM1's `Key.isDown()` function.
2022-01-10 01:18:49 -08:00
relrelb
6396c21bc0
core: Rename `PlayerEvent::MouseLeft` to `MouseLeave`
...
So it's not consfusing with `KeyCode::MouseLeft`.
2022-01-10 01:18:49 -08:00
relrelb
c00532aed2
core: Cleanup mouse update logic
...
Move code that is exclusive to mouse events from
`Player::update_mouse_state` to `Player::handle_event`.
2022-01-10 01:18:49 -08:00
Adrian Wielgosik
86210363f0
avm2: Remove Object::derive() machinery for AS3 prototypes
2022-01-09 18:23:10 -08:00
relrelb
b79144c122
avm1: Remove `TextFormatObject::set_text_format`
...
Use `text_format_mut` instead.
2022-01-10 00:26:33 +02:00
Mike Welsh
2653c5f5c3
audio: Handle gaps in MP3 SoundStreamBlock tags ( fix #3817 )
...
An MP3 "stream" sound can sometimes have frames without a
SoundStreamBlock tag, despite the SWF spec saying there should
at least be a tag with 0 samples on each frame. Ruffle would
stop the sound in this case, but the Flash Player may or may not
stop thje sound in the audio depending on the number of "empty"
frames. This could cause the audio to stutter as it continuously
stopped and restarted.
Handle this by keeping track of how many samples we've encountered
in MP3 blocks, and deducting the amount of samples consumed by each
timeline frame. Stop the sound if we run out of samples, as opposed
to when we hit a frame without a SoundStreamBlock.
Fixes #3817 .
2022-01-07 13:23:53 -08:00
Mike Welsh
b2f7c98f88
audio: Sync animation with embedded audio streams
...
This is a first pass at syncing animation and audio playback when
and embedded audio stream is playing.
Fixes #3020 , #3663 , #3958 .
2022-01-07 13:23:53 -08:00
relrelb
8c736b9756
avm1: Fix `MovieClipLoader` event arguments
...
The first argument of all events is the target MovieClip. It was
incorrect.
Also, `onLoadComplete` accepts an additional `httpStatus` argument.
Stub it to 0.
2022-01-07 10:39:16 -08:00
relrelb
e045a9502b
core: Small cleanup in `Loader`
...
Remove unnecessary calls to `introduce_loader_handle`, which are
dominated by `add_loader` that already calls it. As a result, `add_loader`
remained the only function to call `introduce_loader_handle`, so inline
it there.
2022-01-07 10:39:16 -08:00
relrelb
c05ff4cbc8
core: Unify `Loader::Xml` into `Loader::LoadVars`
...
Since they are identical (they both load the URL as a string, then
fire the `onHTTPStatus` and `onData` events). In fact, AVM1's
`XML.prototype.load` and `LoadVars.prototype.load` functions are
both defined as `ASnative(301, 0)`, so they invoke the same native
code under the hood.
2022-01-07 09:51:27 -08:00
dependabot[bot]
a9e86a73cf
build(deps): bump serde from 1.0.132 to 1.0.133
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.132 to 1.0.133.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.132...v1.0.133 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 23:28:57 +02:00
dependabot[bot]
6533511994
build(deps): bump quote from 1.0.10 to 1.0.14
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.10 to 1.0.14.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.10...1.0.14 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 22:50:58 +02:00
Mike Welsh
34ed9cbbaa
core: Fix incorrect closing of paths in drawing API ( fix #5598 )
...
The path starting position was not being set correctly after a
moveTo command, which could cause stray strokes to appear in the
drawing.
Fixes #5598 , #5768 , #5957 .
2022-01-01 22:24:08 -08:00
relrelb
655adedc1c
xml: Remove `XmlNode::is_as2_compatible`
...
Now all `XmlNodeData` types are AS2-compatible, so `is_as2_compatible`
always returns `true`.
2022-01-02 07:36:49 +02:00
relrelb
30cd2aa4f1
xml: Remove `XmlNodeData::DocType`
...
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::DocType`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.
So don't create those when parsing an XML from string, but still
store the `DOCTYPE` declaration string on the `XmlDocument`, which
is accissible through the `.docTypeDecl` property.
2022-01-02 07:36:49 +02:00
relrelb
827bb6e48e
xml: Remove `XmlNodeData::Comment`
...
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::Comment`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.
So simply don't create those when parsing an XML from string.
2022-01-02 07:36:49 +02:00
relrelb
e477fca9e4
xml: Use OR patterns
...
This results in a slightly shorter code, and avoids some duplication.
2021-12-31 19:00:12 +02:00
relrelb
8bd144ec88
xml: Make `XmlDocumentData::root` non-`Option`
...
Since `XmlNode::document` doesn't exist anymore, so as the circular-
reference between `XmlDocument` and `XmlNode`.
2021-12-31 19:00:12 +02:00
relrelb
3676db47a3
xml: Remove unused `XmlNode::document`
2021-12-31 19:00:12 +02:00
relrelb
f7e80e3fb9
xml: Inline `XmlDocument::add_child_to_tree`
...
Include the XML root node itself as part of the stack, so appending
children to it is no longer considered a special case.
2021-12-31 09:35:09 +02:00
relrelb
e1198bd30c
xml: Inline `XmlDocument::process_event`
...
Now that `replace_with_str` is defined in `XmlDocument`, there is
no need anymore for a separate function that handles nodes which have
document-wide implications.
2021-12-31 09:35:09 +02:00
relrelb
7d148fb61d
xml: Move `XmlNode::replace_with_str` to `XmlDocument`
...
It only makes sense to call this method on document roots.
2021-12-31 09:35:09 +02:00
Adrian Wielgosik
fcab60de7e
core: register non-ascii fonts lazily
2021-12-31 01:10:48 +01:00
relrelb
0bab5f6d91
avm1: Use `XmlObject`
...
Previously Ruffle's AVM1 runtime incorrectly permitted calling `XML`
functions on `XMLNode` objects. For example:
```as
var xml = new XML("<a><b></b></a>");
trace(XML.prototype.createElement.call(xml.firstChild, "aaa")); // traces "undefined" in Flash, but "<aaa />" in Ruffle before this commit.
```
Disallow this by using the newly-reintroduced `XmlObject` for `XML` objects
(rather than `XmlNodeObject` that represents also `XMLNode` object), and check
for it in all `XML` builtins.
2021-12-30 22:13:14 +02:00
relrelb
b501b4697a
avm1: Re-introduce `XmlObject`
...
The newly-reintroduced `XmlObject` will represent `XML` document objects.
Currently it's unused, but the following commit will make use of it.
2021-12-30 22:13:14 +02:00
TÖRÖK Attila
09ca48e389
chore: Bump h263-rs git reference
2021-12-30 16:22:27 +01:00
TÖRÖK Attila
6f68938591
video/vp6: Fix keyframe detection on Vp6WithAlpha videos
2021-12-29 11:28:05 +01:00
dependabot[bot]
56b340ebf5
build(deps): bump syn from 1.0.82 to 1.0.84
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.82 to 1.0.84.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.82...1.0.84 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-27 22:32:21 +02:00
relrelb
e547fd710d
xml: Remove `XmlName`
...
Instead use a much simpler approach using `XmlNode::local_name` and
`XmlNode::prefix`.
2021-12-27 20:53:34 +02:00
relrelb
6ca1ac05da
avm1: Rename `XmlObject` to `XmlNodeObject`
...
The name `XmlObject` will be re-used in a future PR for `XML`
document objects.
2021-12-27 20:53:34 +02:00
Moulins
74ab24c0c3
core: fix wide string handling in html::text_format
...
Closes #5839
2021-12-21 22:19:13 +02:00
Adrian Wielgosik
4230d1f19f
avm2: Add Mouse.hide(), Mouse.show()
2021-12-21 17:32:57 +01:00
dependabot[bot]
fd816f3a0a
build(deps): bump serde from 1.0.131 to 1.0.132
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.131 to 1.0.132.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.131...v1.0.132 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-21 08:35:54 +02:00
relrelb
b1151b2ab2
html: Rewrite `FormatSpans::to_html`
...
The new implementation doesn't use the `xml` crate, nor `quick-xml`,
but rather just iterates the `TextSpan`s and builds the formatted HTML
string.
2021-12-20 08:31:59 +02:00
relrelb
2ad5c644b0
avm1: Make `ArrayObject` proto non-`Option`
...
It was always passed as `Some`, so there's no reason for allowing
`None`.
2021-12-18 13:39:22 +02:00
relrelb
9d87a34f25
html: Ignore tag errors
...
Flash stops parsing the XML in such cases, but still returns the
partially-processed text.
2021-12-18 11:34:31 +02:00
relrelb
c1404f6a3e
html: Expand empty elements
...
`quick-xml` has a feature to split empty elements into an `Open` and
a `Close` event. Use it to avoid duplicated code.
2021-12-18 11:34:31 +02:00
relrelb
7e20543578
html: Don't check end names
...
Flash permits mismatched closing tags (e.g. `<mytag></different_tag>`),
so turn-off this check.
2021-12-18 11:34:31 +02:00
Adrian Wielgosik
5d81a0ce64
avm2: Remove .clone() calls now that Index is Copy
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
a8fb1c2b16
avm2: pass Multiname to resolve_type() by reference
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
22a0711d85
avm2: Use TU's method cache for callstatic, newfunction opcodes
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
4b23f4dfb7
avm2: Set correct value type in op_convert_u/i
2021-12-17 21:06:33 -07:00
TÖRÖK Attila
0a2767fcb4
video: Wire up DefineVideoStream smoothing flag to the renderer
...
With all the weird logic for when it actually takes effect
2021-12-17 21:03:57 -07:00
David Wendt
2aee3555ab
chore: Fix all new clippy lints added in latest Rust nightly
2021-12-17 20:53:26 -07:00
relrelb
07c5330456
core: Introduce `InputManager`
...
`InputManager` encapsulates the common logic that previously the
`UiBackend`s used to implement.
2021-12-15 14:20:30 -08:00
Adrian Wielgosik
726ec47f19
avm2: Support inheritance of protected traits
2021-12-15 22:26:41 +01:00
Adrian Wielgosik
11534a4b34
avm2: Implement parseInt, parseFloat
2021-12-15 22:16:49 +01:00
Adrian Wielgosik
49feb23649
avm2: Move toplevel functions to separate file
2021-12-15 22:16:49 +01:00
TÖRÖK Attila
95665bdc47
video: Extract software decoders (or glue) into their own modules, add screenvideo feature
2021-12-14 19:41:17 -07:00
TÖRÖK Attila
fdc448533d
video: Add Flash Screen Video (V1 only) decoder
...
Thanks a lot for the code and the help, Kostya!
2021-12-14 19:41:17 -07:00
Toad06
db98f0b42f
avm1: Use inner SWFs version number
2021-12-14 19:39:30 -07:00
dependabot[bot]
c6dfcb4e37
build(deps): bump serde from 1.0.130 to 1.0.131
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.130 to 1.0.131.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.130...v1.0.131 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:23:13 +02:00
dependabot[bot]
b8ff8bb185
build(deps): bump jpeg-decoder from 0.2.0 to 0.2.1
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.0...v0.2.1 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:23:01 +02:00
dependabot[bot]
ef679d25c7
build(deps): bump encoding_rs from 0.8.29 to 0.8.30
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.29 to 0.8.30.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.29...v0.8.30 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:22:28 +02:00
EmperorBale
30f2e0f8b1
avm2: Implement JSON ( #5172 )
...
* avm2: Implement JSON.parse
* avm2: Add AvmSerializer for serializing AVM values to JSON
* avm2: Add support for replacer objects
* avm2: use *const ObjectPtr for object stack
* avm2: Add support for space parameter is JSON.stringify
* avm2: Refactor AvmSerializer design
* avm2: Restrict spaces to a maximum of 10
* avm2: Refactor map_value
* tests: Add JSON.parse test
* chore: Appease clippy
* avm2: Check if value is undefined before inserting
* tests: Add test for JSON.stringify
* tests: Improve JSON.stringify test
* chore: Replace map_or with explicit match statements
* chore: Use QName::dynamic_name
* avm2: Use Object<'gc> instead of ObjectPtr
* chore: Use explicit match in deserialize_value
* Rebase fixes
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-12-13 18:32:04 +01:00
Adrian Wielgosik
ad1442dbaa
avm2: Add a basic ContextMenu stub
2021-12-13 18:31:03 +01:00
Adrian Wielgosik
1f5979f168
chore: clippy
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
1311b0a3d0
avm2: refactor Domain::get_defining_script
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
0fb075a309
chore: cargo fmt
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
3d8f611651
avm2: Update comments.
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
b747541709
avm2: Panic upon encountering CallMethod opcode
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
1d8c556944
avm2: Handle TODOs, throw errors where applicable
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
24247dff0b
avm2: install_const_late always appends slots
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
4bd12ae4b3
avm2: Get prototypes from classes without get_property()
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
49d16dea8b
avm2: Rip out `receiver` from get/set/call_property
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
ee0798b258
avm2: Cleanup slots/global initialization some more
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
21865edf9b
avm2: Support const slots, fill some TODOs
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
b272d8722e
avm2: Reword slot/disp_id assignment, remove Slot.
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
4d8999c012
avm2: Make all prototypes ScriptObjects; also cleanup vector enumeration, Proxy
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
3706db86d2
avm2: move properties from instances to vtable
2021-12-11 20:48:09 +01:00
relrelb
d3fe4ea59a
avm1: Split `XML` and `XMLNode` definitions
...
This reduces the file size of the previous `xml.rs` file, and makes
the code a bit more organized.
2021-12-11 20:28:37 +02:00
Adrian Wielgosik
6594d4159d
avm2: Use Vec instead of HashMap for loaded constants
2021-12-11 10:03:29 +01:00
relrelb
ca3b215561
chore: Appease clippy
2021-12-10 21:06:38 +02:00
relrelb
7966d850dd
core: Normalize `\r` to `\n` in `avm_trace`
...
Fixes #3120 .
2021-12-10 19:54:35 +02:00
relrelb
eacf34d80a
avm1: Remove `Function.prototype.toString`
...
`Function.prototype` doesn't have its own `toString` method, but
rather inherts it from `Object.prototype`. So remove `Function.prototype.toString`
and move its logic to `Object.prototype.toString`.
2021-12-10 11:36:39 +02:00
relrelb
ce2eff8b25
render: Stub L16 JPEG pixel format
...
16-bit luminance (grayscale) images are very rare, so it's hard to
tell what the expected behavior should be.
2021-12-10 00:28:45 +02:00
dependabot[bot]
8007f21ffe
build(deps): bump jpeg-decoder from 0.1.22 to 0.2.0
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.1.22 to 0.2.0.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.1.22...v0.2.0 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-10 00:28:45 +02:00
Adrian Wielgosik
d28dd3bd05
avm1: Fix up attributes of some builtins' protos
2021-12-10 00:28:21 +02:00
EmperorBale
0a25ebbc32
chore: Remove more explicit clones
2021-12-08 22:14:45 +01:00
EmperorBale
d6b7d0c915
chore: Fix formatting
2021-12-08 22:14:45 +01:00
EmperorBale
a192fbb113
chore: Remove explicit clones in avm2
2021-12-08 22:14:45 +01:00
EmperorBale
847a4fb61a
chore: Remove explicit clones in value
2021-12-08 22:14:45 +01:00
EmperorBale
1709ea94e7
chore: Remove explicit clones in object
2021-12-08 22:14:45 +01:00
EmperorBale
8ea41bc151
chore: Remove explicit clones in slot
2021-12-08 22:14:45 +01:00
EmperorBale
15378bcfde
chore: Remove explicit clones from vector
2021-12-08 22:14:45 +01:00
EmperorBale
2f71360c3b
chore: Remove explicit clones from primitive_object
2021-12-08 22:14:45 +01:00
EmperorBale
a7f86e679c
chore: Remove explicit clones from uint
2021-12-08 22:14:45 +01:00
EmperorBale
0a8b964754
chore: Remove explicit clones from number
2021-12-08 22:14:45 +01:00
EmperorBale
8f27196356
chore: Remove explicit clones in int
2021-12-08 22:14:45 +01:00
EmperorBale
a0bbc96b4a
chore: Remove explicit clones in function
2021-12-08 22:14:45 +01:00
EmperorBale
7027046588
chore: Remove explicit clones in shape
2021-12-08 22:14:45 +01:00
EmperorBale
51f909691f
chore: Remove explicit clones in movieclip
2021-12-08 22:14:45 +01:00
EmperorBale
96eb14fdab
chore: Remove explicit clones in boolean
2021-12-08 22:14:45 +01:00
EmperorBale
60fc4cd0c0
chore: Remove explicit clones in activation
2021-12-08 22:14:45 +01:00
EmperorBale
002158a1b0
chore: Remove explicit clones in array
2021-12-08 22:14:45 +01:00
EmperorBale
7fce022293
avm2: Derive Copy for Value
2021-12-08 22:14:45 +01:00
Adrian Wielgosik
685911a77c
swf: Box ShapeRecord::StyleChange variant
2021-12-08 22:14:17 +01:00
Moulins
3ff0c3d737
string: Correctly return None in `WStr::offset_in` for overlapping WStrs
2021-12-08 22:12:11 +01:00
relrelb
da4b5986b1
chore: Appease clippy
2021-12-08 22:36:55 +02:00
relrelb
5de81d4729
html: Handle attribute errors gracefully
...
`quick-xml` returns an `Err` for invalid attributes (e.g. unquoted).
Handle such errors by ignoring the HTML completely and return an
empty string instead, as Flash does.
Fix #5789 .
2021-12-05 08:40:04 +02:00
relrelb
7f7ecda8a9
core: Unify `define_bits_jpeg_3` and `define_bits_jpeg_4`
...
The only difference is the deblocking field, which is now read only
for DefineBitsJpeg4.
2021-12-04 21:32:16 +02:00
relrelb
00accf3e2a
render: Rename `register_bitmap_jpeg_3` to `register_bitmap_jpeg_3_or_4`
...
It's actually used by both DefineBitsJpeg3 and DefineBitsJpeg4 tags.
2021-12-04 21:32:16 +02:00
dependabot[bot]
963fa78f29
build(deps): bump weak-table from 0.3.0 to 0.3.2
...
Bumps [weak-table](https://github.com/tov/weak-table-rs ) from 0.3.0 to 0.3.2.
- [Release notes](https://github.com/tov/weak-table-rs/releases )
- [Changelog](https://github.com/tov/weak-table-rs/blob/main/CHANGELOG.md )
- [Commits](https://github.com/tov/weak-table-rs/compare/0.3.0...v0.3.2 )
---
updated-dependencies:
- dependency-name: weak-table
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-04 16:50:42 +02:00
relrelb
03aa31ec68
core: Fix a bug in `MorphShapeStatic::register_ratio`
...
The comparsion `start_change.move_to != end_change.move_to` doesn't
make sense, because even if they are identical, the positions need
to be updated.
Fix #2886 .
2021-12-04 13:46:02 +02:00
relrelb
fab4103932
chore: Appease clippy
2021-12-04 13:45:37 +02:00
David Wendt
54fcfde1cc
core: String equality should short-circuit on pointer equality
2021-12-02 16:33:56 -07:00
David Wendt
29d2df5f07
core: Hash the whole (byte-oriented) WStr without iterating it.
2021-12-02 16:33:56 -07:00
David Wendt
dbecd03110
core: When hashing `WString`, optimize for the common case (bytestrings)
2021-12-02 16:33:56 -07:00
David Wendt
9f30a9d4a6
avm2: When passing namespaces around, use a `SmallVec` of one element for memory savings.
2021-12-02 16:30:21 -07:00
David Wendt
1302ea9986
avm2: Pass everything around as `SmallVec`s.
2021-12-02 16:30:21 -07:00
David Wendt
5e03382f5d
avm2: Smallvec the property maps.
2021-12-02 16:30:21 -07:00
David Wendt
a18faeb047
avm2: Also put definition scripts in a `PropertyMap` and query them the same way we do objects
2021-12-02 16:30:21 -07:00
David Wendt
92697c9f1e
avm2: Use FNV hashing for all other parts of the VM.
2021-12-02 16:30:21 -07:00
David Wendt
3329e2a965
avm2: Use FNV hashes for property lookup.
2021-12-02 16:30:21 -07:00
David Wendt
769c45add5
avm2: Make `QName` a copy type.
2021-12-02 16:30:21 -07:00
David Wendt
d53abfebf4
avm2: Also preresolve all class traits, too.
2021-12-02 16:30:21 -07:00
David Wendt
44162ae698
avm2: Don't clone the multiname set on each lookup
2021-12-02 16:30:21 -07:00
David Wendt
3a7dd48c81
avm2: Build a flattened traits list per class and use that in lieu of a full trait lookup.
2021-12-02 16:30:21 -07:00
David Wendt
722dd6aabf
avm2: Refactor multiname resolution to take advantage of the new value storage structure.
2021-12-02 16:30:21 -07:00
David Wendt
c99231b610
avm2: Index the property map by local name and bucket all namespaces together into a single list.
2021-12-02 16:30:21 -07:00
David Wendt
0bc2ddfc7b
avm2: Remove prototype lookups from `resolve_any`
2021-12-02 16:30:21 -07:00
David Wendt
d83a7c909c
avm2: Don't scan the prototype for each multiname check.
2021-12-02 16:30:21 -07:00
Moulins
6bd3c62195
avm1: Remove unnecessary clones in shared_object::recursive_deserialize_json
2021-12-02 07:12:22 +02:00
dependabot[bot]
7d1ac9d26b
build(deps): bump syn from 1.0.81 to 1.0.82
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.81...1.0.82 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-11-29 23:04:42 +02:00
David Wendt
fa179dc63f
avm2: Unpublish a bunch of primclass methods
2021-11-28 18:40:21 -07:00
David Wendt
6d48126124
avm2: And, finally, `uint`.
2021-11-28 18:40:21 -07:00
David Wendt
640763bfda
avm2: Also do the same for `int`
2021-11-28 18:40:21 -07:00
David Wendt
593158cb04
avm2: Also allow calling `Number` methods on the prototype in the `public` namespace.
2021-11-28 18:40:21 -07:00
David Wendt
6bfca1af5f
avm2: Expose `Boolean` methods in the `public` namespace via prototypes.
2021-11-28 18:40:21 -07:00
David Wendt
3e8f13b70a
avm2: `Number.MIN_VALUE` is the machine epsilon, not the lowest possible finite value.
2021-11-28 18:40:21 -07:00
David Wendt
7569994f1f
avm2: Impl `Boolean.toString` and `Boolean.valueOf`.
2021-11-28 18:40:21 -07:00
David Wendt
aa01a682e1
avm2: Implement `uint`'s various formatting methods, too.
2021-11-28 18:40:21 -07:00
David Wendt
e43d18f7b0
avm2: Impl `int` versions of `toFixed`, `toString`, `toExponential`, and `toPrecision`
2021-11-28 18:40:21 -07:00
David Wendt
cabfe5e20c
avm2: All documented primitive class methods are in the AS3 namespace.
2021-11-28 18:40:21 -07:00
David Wendt
9e62b05157
avm2: Implement `Number.AS3::toString` and `Number.AS3::valueOf`.
...
This method has an odd flaw that we don't emulate yet. Actually, two:
1. Precision limits that are specific to the chosen radix
2. Occasional and intermittent corruption in the resulting 0 padding; usually manifesting as `x`, `W`, or `°` characters
The first could be emulated, but I've chosen not to... because the second thing listed not only isn't really possible to emulate, but actively prohibits approx-testing the results. So I'm marking the test as ignored and hoping no movies actually rely on the precision limits in `toString`.
2021-11-28 18:40:21 -07:00
David Wendt
4a09dfa3d0
avm2: Implement `Number.toFixed` and `Number.toPrecision`
2021-11-28 18:40:21 -07:00
David Wendt
55a7a1882d
avm2: Implement `Number.toExponential`
2021-11-28 18:40:21 -07:00
David Wendt
16597e0d7b
avm2: Fill out class constants for `uint`, `int`, and `Number`.
2021-11-28 18:40:21 -07:00
relrelb
2117ad8a4c
html: Ignore <p>, <li> and <br> tags in non-multiline mode
2021-11-28 22:57:48 +02:00
relrelb
9cad582e8b
html: Do not trim text in `FormatSpans::from_html`
...
Flash preserves spaces before and after text.
But since now `quick-xml` might emit empty `Text` events, those need
to be explicitly ignored in order to retain the same text format across
tags.
2021-11-28 22:57:48 +02:00
relrelb
a027d932e4
html: Use `as_ref()` instead of `clone()`
...
This should improve performance a bit.
2021-11-28 22:57:48 +02:00
Varun Ramesh
7c87f35d8d
avm2: Implement `flash.display.PixelSnapping` ( #5718 )
...
* Add flash.display.PixelSnapping enum class
* Run 'cargo format --all'
* Add 'final' class attribute
2021-11-28 07:31:39 +02:00
Moulins
9701b817f5
core: Replace WStr<'_> and WStrMut<'_> by a single DST type WStr
2021-11-27 11:20:47 -07:00
Moulins
fd8bdeb1a8
core: improve f64's FromWStr impl
...
This avoids converting the string to UTF8 if it can't possibly
be a float
2021-11-27 11:20:47 -07:00
Moulins
ee326e31b7
core: Reduce allocations in AvmString::new_utf8
...
Also remove some useless back-and-forth conversions between
AvmString and String
2021-11-27 11:20:47 -07:00
Moulins
fa30e1bc43
chore: rename AvmString::{new -> new_utf8, new_ucs2 -> new}
2021-11-27 11:20:47 -07:00
Moulins
45fe1e86ae
core: remove AvmString::as_str, and the extra UTF8 String inside
2021-11-27 11:20:47 -07:00
Moulins
e24af59197
core: remove last instances of AvmString::as_str
2021-11-27 11:20:47 -07:00
Moulins
824263d2bc
core: adapt TextField, Font & Html handling code to use WStr
2021-11-27 11:20:47 -07:00
Moulins
f149c9efce
core: remove some AvmString::as_str calls
2021-11-27 11:20:47 -07:00
Moulins
053758d77c
avm2: use WString in QName methods
2021-11-27 11:20:47 -07:00
Moulins
5ca911209b
core: implement WStr::join
2021-11-27 11:20:47 -07:00
Moulins
c496f81f13
avm1: remove AvmString::as_str usage in activation.rs and movie_clip.rs
2021-11-27 11:20:47 -07:00
Moulins
87400b829d
core: use WStrings for display object's frame and scene labels
2021-11-27 11:20:47 -07:00
Moulins
84b4e33036
core: implement FromWStr for various enum types
2021-11-27 11:20:47 -07:00
Moulins
b894d0c97f
avm1: adapt parseInt, escape & unescape to use WStr API
2021-11-27 11:20:47 -07:00
Moulins
c2349ae012
xml: use AvmString in xml code
...
This has the nice side-effect of reducing string cloning, because we can
just pass AvmStrings around instead.
2021-11-27 11:20:47 -07:00
Moulins
5db23ddbf3
avm2: use WStr in date parsing logic
2021-11-27 11:20:47 -07:00
Moulins
f49ce49d28
core: add FromWStr trait and WStr::parse
2021-11-27 11:20:47 -07:00
Moulins
8863b54db0
avm1: don't use &str for activation's path & variable logic
2021-11-27 11:20:47 -07:00
Moulins
1d9d7e6942
avm1: don't use &str methods when parsing enum parameters in MovieClip
2021-11-27 11:20:47 -07:00
Moulins
d850085d2b
avm1: partially rewrite Value::primitive_as_number
2021-11-27 11:20:47 -07:00
Moulins
4a09088d42
avm2: rewrite regexp module to not rely on AvmString::as_str
...
This is a little tricky, because we have to map the utf8 indices
returned by the regex engine to utf16 indices usable by Ruffle.
To limit the impact on performance, the regex, the string we're
currently matching on, and the last known (utf8, utf16) positions
are cached, avoiding extra utf8 conversions in common use cases
where a single string is repeatedly searched with increasing
`lastIndex`.
2021-11-27 11:20:47 -07:00
Moulins
23cbe4c2fd
core: Add `string::Pattern` trait, based on `std::str::Pattern`
...
This allows `Str::{find, rfind, split}` to accept multiple types
2021-11-27 11:20:47 -07:00
Moulins
110f568aa4
core: Remove some useless utf8<->utf16 conv. in {avm1,avm2}/activation.rs
2021-11-27 11:20:47 -07:00
Moulins
8885175550
core: Replace string::utils *_ignore_case functions by methods on WStr
2021-11-27 11:20:47 -07:00
Moulins
79d47a9863
avm1: Requires a WStr<'_> to access PropertyMap
2021-11-27 11:20:47 -07:00
Moulins
7f4af210b8
core: Reimplement AVM string methods using our UCS2 API
...
This generally means that methods are more efficient, as we
don't need to encode to UTF16 on-the-fly to have correct indices.
This also fix some bugs:
- charCode now properly handle surrogate pairs
- calling lastIndexOf with the empty pattern and an OoB index now
properly returns the string length
Still missing is AVM2's String.match
2021-11-27 11:20:47 -07:00
Moulins
32fa20b857
core: Make AvmString "two-headed" by storing a UTF8 and an UCS2 string
...
This is only temporary; once all code paths use the ruffle `WString` API
instead of dereferencing to a string, the UTF8 `String` will be removed.
2021-11-27 11:20:47 -07:00
Moulins
3d20c4acc7
core: Add owned string::WString type
2021-11-27 11:20:47 -07:00
Moulins
c1ccd3a3ac
core: Introduce `WStr` and `WStrMut` types, for representing Flash strings
...
These types represent an UCS2 string (UTF-16 with unpaired surrogates).
The string is stored either as a sequence of u8s (Bytes) or u16s (Wide);
the type of string is tracked by setting the high bit of the length of
its fat pointer.
2021-11-27 11:20:47 -07:00
relrelb
b32ec3cf6c
audio: Calculate sound transform values using 30-bit integers
...
The fix in #5218 wasn't sufficient; 30-bit arithmetic should be used
along all the way when calculating an effective sound transform.
For example, a sound transform composited by volumes `-0x80000000` and
`25` should end up as effectively 0, whereas previously it would have
been calculated as `-0x80000000 * 25 / 100 = -0x20000000`, which is a
30-bit integer that hasn't been truncated.
Fixes #5655 .
2021-11-27 12:09:33 +02:00
relrelb
e2b821e92f
chore: Replace `min` + `max` with `clamp`
...
`clamp` is a bit more efficient, in both runtime and size terms.
2021-11-26 20:54:48 +02:00
relrelb
41eb215b02
chore: Avoid using `std::char`
...
Use the `char` primitive type instead.
2021-11-26 10:45:30 +02:00
relrelb
dc6d4804ff
core: Avoid odd import
2021-11-26 10:45:30 +02:00
relrelb
0a3ede31dc
core: Remove unused `Downcast`
2021-11-26 10:45:30 +02:00
relrelb
79a0ba31ae
avm1: Use `.unwrap_or(&Value::Undefined)` in more places
2021-11-26 10:45:30 +02:00
Adrian Wielgosik
f35b2666a3
build: Use the 'union' SmallVec feature for minor memory savings
2021-11-26 00:45:09 +01:00
relrelb
79deba87f3
avm1: Small cleanup in `start_drag`
2021-11-25 07:35:33 +02:00
relrelb
a2aeadf9e1
core: Small cleanups in `Player::handle_event`
...
* Use `match` for AVM debug key combos.
* Remove redundant `if let Some(button_event)` inside an `if button_event.is_some()`.
2021-11-25 07:35:33 +02:00
relrelb
cbce91365c
desktop: Track `keys_down` by `KeyCode`
...
This makes `DesktopUiBackend::is_key_down` a simple one-line check.
Also unify the handling code of `ElementState::Pressed` and `ElementState::Released`,
which had a lot of common code.
2021-11-25 07:35:33 +02:00
Adrian Wielgosik
da4ed75bc8
avm2: Compare QNames by local name first
2021-11-22 17:59:00 -07:00
Adrian Wielgosik
c2d521df41
avm2: refactor: Merge has-setter-and-no-getter into one lookup
2021-11-22 17:59:00 -07:00
Adrian Wielgosik
370186dc3c
avm2: refactor: Make trait lookups return a single item
2021-11-22 17:59:00 -07:00
TÖRÖK Attila
0e4d2d48f5
video/vp6: Don't throw an error on skip frames, reuse the last frame instead
2021-11-22 17:08:31 +01:00
relrelb
56b5183262
avm1: Refactor and fix `BitmapData::compare`
2021-11-20 14:11:14 +02:00
bbb651
687069ba7d
avm1: Added BitmapData::compare
2021-11-20 14:11:14 +02:00
relrelb
3760e0e275
core: De-duplicate `round_to_even` function
...
Put a single implementation in `ecma_conversions.rs`.
Need to consider what to do with the similar implementation in `matrix.rs`.
2021-11-20 13:36:06 +02:00
relrelb
7c6d006862
avm2: Correct `TextFormat` properties coercion
2021-11-20 13:36:06 +02:00
relrelb
10b7c69719
avm1: Correct `TextFormat` properties coercion
2021-11-20 13:36:06 +02:00
David Wendt
068e7acc6f
avm2: Remove the need for `lazy_static`
2021-11-19 20:43:53 -07:00
David Wendt
dda8a73899
avm2: Refactor so we don't need to rebox and unbox the numbers into values.
...
Also, use an actual constant table for the ellipsises.
2021-11-19 20:43:53 -07:00
David Wendt
4665a6c210
avm2: None of `Graphics`' methods need to be `pub`.
2021-11-19 20:43:53 -07:00
David Wendt
c719e69693
avm2: Also implement `drawEllipse` using `drawRoundRect`.
2021-11-19 20:43:53 -07:00
David Wendt
ef46d780ba
avm2: Implement `Graphics.drawCircle` using `drawRoundRect`
2021-11-19 20:43:53 -07:00
David Wendt
b318eb9969
avm2: Implement `Graphics.drawRoundRect`
2021-11-19 20:43:53 -07:00
relrelb
24db13ae1e
html: Handle self-closing tags
...
"br" and "sbr" tags can appear in a self-closing form (i.e. `<br />`).
Commit 3cab464026
forgot to handle this.
2021-11-15 23:28:51 +02:00
relrelb
855bc721a8
html: Restore handling of "br" tags
...
This fully reverts commit 2119ce9
.
Seems like Flash does handle "br" tags, but ignores them under some
unknown circumstances (e.g. setting `htmlText` in AVM1).
For now handle "br" tags unconditionally.
2021-11-15 23:28:51 +02:00
relrelb
73f5982cad
avm1: Fix `Sound.setVolume()` and `Sound.setPan()` with no arguments
...
Instead of coercing `undefined` into `f64` (which results `NaN` in SWF7+),
treat the missing value argument as `0`.
2021-11-14 20:25:45 +02:00
relrelb
df514f319a
html: Restore handling of "sbr" tags
...
This partially reverts commit 2119ce9821
,
only restoring "sbr" tags handling because Flash seems to ignore only
"br" tags.
2021-11-13 12:11:48 +02:00
relrelb
2119ce9821
html: Remove handling of "br" and "sbr" tags
...
Seems like Flash just ignores them.
2021-11-13 10:21:41 +02:00
relrelb
12e8d3a82f
html: Fix typo
2021-11-13 10:21:41 +02:00
David Wendt
c0874f445d
avm2: Functions are functions.
2021-11-11 17:12:49 -07:00
David Wendt
7dd9776d40
avm2: Implement `uint`, `Number`, and `Boolean`'s constructors, too.
2021-11-11 16:34:11 -07:00
David Wendt
7cc7f0fe7f
avm2: Impl `int`'s instance initializer.
2021-11-11 16:34:11 -07:00
David Wendt
be3e126ebb
avm2: Stub the `Sprite` constructor as just creating a `MovieClip`.
2021-11-11 16:33:33 -07:00
Tal Hayon
7ed38850fd
core: implement displayState for Stage in avm1/2
2021-11-11 16:20:05 -07:00
relrelb
7b95441874
core: Re-use `EditText::html_text` in `EditText::propagate_text_binding`
2021-11-11 08:05:33 +02:00
relrelb
cf05137c1f
core: `EditText::html_text` cannot fail
2021-11-11 08:05:33 +02:00
relrelb
848b721165
xml: Remove `XmlNode::walk`
2021-11-11 08:05:33 +02:00
relrelb
c4729d733c
core: Avoid one usage of `FormatSpans::replace_text`
...
Use `FormatSpans::from_text` instead.
2021-11-11 08:05:33 +02:00