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
59d735a034
tests: Add a test for `MouseEvent.stageX`/`stageY`
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
David Wendt
69c66fe720
tests: Add a test of `MouseEvent`'s constructor
2022-01-22 19:58:32 -08:00
Mike Welsh
cad76ad4fa
ci: Fix publishing of Firefox extension
...
Supply FIREFOX_EXTENSION_ID var to the web build step to ensure
this gets correctly populated in the manifest.json.
2022-01-22 18:38:18 -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
95ddc06e71
ci: Use macos-11 runner
2022-01-21 18:21: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
6bffef2550
ci: Publish Chrome and Firefox extensions nightly
2022-01-21 16:19:49 -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
Mike Welsh
1e28e1da11
chore: Bump to wgpu 0.12
2022-01-19 13:20:27 -08:00
Fernando Karchiloff
7d3113a2d5
doc: Fix path to tests folder
2022-01-18 18:33:18 -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
d5862809c7
swf: Remove extraneous ? in avm1::Writer
2022-01-17 21:35:57 -08:00
Mike Welsh
265bcc278a
swf: Add avm1::Writer::write_small_action
...
Convenience method for writing zero-length actions.
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
059c1a3417
web: Add a comment about `ignorePatterns`
2022-01-16 11:07:00 -08:00
relrelb
2f1cb9f655
web: Disallow non-const TypeScript enums
...
They generate unnecessary code.
2022-01-16 11:07:00 -08:00
relrelb
479719f425
web: De-duplicate TypeScript ESLint rules
...
Pull them to the root config, using the `overrides` feature:
https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns
2022-01-16 11:07:00 -08:00
relrelb
5bf8b46ab5
web: Integrate Prettier into Stylelint
2022-01-16 11:07:00 -08:00
relrelb
94d82aa060
web: Convert more files from JSON to YAML
2022-01-16 11:07:00 -08:00
relrelb
d0eb6adbc0
web: Fix `publicPath` when loaded from a CDN
...
CDNs allow omitting the filename:
* https://unpkg.com/@ruffle-rs/ruffle
* https://cdn.jsdelivr.net/npm/@ruffle-rs/ruffle
That caused `currentScriptURL` to be determined incorrectly:
```js
new URL(".", "https://unpkg.com/@ruffle-rs/ruffle ").href
// "https://unpkg.com/@ruffle-rs/ "
```
If the filename is omitted, append a slash to prevent the last
component from being dropped:
```js
new URL(".", "https://unpkg.com/@ruffle-rs/ruffle/ ").href
// "https://unpkg.com/@ruffle-rs/ruffle/ "
```
2022-01-15 14:49:19 -08:00