Commit Graph

6476 Commits

Author SHA1 Message Date
Mike Welsh b7ebe0bbec ci: Temporarily disable Windows Node 14 test
Test is currently broken because of this issue:
https://github.com/actions/setup-node/issues/411
2022-01-29 15:29:49 -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 1fd1a1e68e ci: Use `runner.os` over `matrix.os`
`runner.os` is a little more descriptive. But unfortunately, it cannot
be used in `job.name`.
2022-01-29 14:19:51 -08:00
relrelb 99b22b24dd avm1: Remove unused `FunctionObjectData::primitive` 2022-01-29 12:12:39 -08:00
relrelb a320e3b1d0 chore: Update badges in `README.md`
* Improve build status and Discord badges.
* Add npm and AUR badges.
2022-01-28 10:00:27 -08:00
Daniel Jacobs 1e5956c02a core: Fix get_text_format bullet return value 2022-01-27 22:35:18 -08:00
Toad06 c14569e3d4 web: Add `refresh` method to `navigator.plugins` 2022-01-26 18:53:33 -08:00
Daniel Jacobs c0880225ff selfhosted: Use absolute URLs for links in README 2022-01-26 18:51:06 -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
Mike Welsh d5986a7294 desktop: Don't swallow Escape key (fix #6135) 2022-01-25 00:22:28 -08:00
nosamu f23c03129a
extension: URL-encode the SWF URL for the player page
When the user clicks the "Open in a new tab" button, the extension's internal `player.html` page opens, with a URL parameter `?url=[the SWF URL]`. Right now, this URL parameter is not properly encoded. This causes a problem when we get to https://github.com/ruffle-rs/ruffle/blob/master/web/packages/extension/src/player.ts#L14:
> `const swfUrl = url.searchParams.get("url");` 
Because the value "url" parameter was not properly encoded, any `&` character in the SWF URL would be interpreted as the start of a *new* parameter, instead of being part of the actual SWF URL. So anything after the first `&` symbol in the SWF URL would be chopped off.
On Itch.io Flash pages such as https://rarykos.itch.io/hug-me-im-cold, the SWF URL contains several important parameters - if they are not included, the server returns 403 Forbidden (it's a type of hotlinking protection). So when the user clicked the "Open in a new tab" button on Itch.io pages, the SWF would refuse to load in the player.
This PR fixes the problem - Itch.io SWFs load when opened in a new tab after my change is applied.
2022-01-24 19:01:11 -08:00
relrelb 809e91d029 demo: Serve on default port
The switch to 8081 seems like a leftover from #5250.
Return to the default 8080.
2022-01-24 13:29:42 -08:00
relrelb 2132f3c9cd ci: Skip `publish-aur-package` job on forks
Move the `if` condition that tests for the Ruffle official repository
to the job-level, so all steps of that job are skipped, rather than
only the publish step itself. This should have a very little effect,
but I just randomly noticed it.
2022-01-24 12:30:03 -08:00
Toad06 da50d44460 core: Fix detection of button events 2022-01-24 11:48:37 -08:00
Mike Welsh 3e9f9741ea tests: Edit funky_function_calls to test undefined this
Test `this` instead of `this == other_this` to verify when it is
indeed an unboxed undefined.
2022-01-24 02:04:57 -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 d9bedffb9f tests: Add tests for Object-to-String coercion 2022-01-23 17:19:09 -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
Mike Welsh bfe0ee2563 wgpu: Fix gradient shader on vulkan backend
A regression in naga caused a mistranslation of the gradient shader
on the vulkan backend. This caused radial gradients to be rendered
as linear gradients on the vulkan backend. dx12 seems unaffected.

This seems to be cased by a switch statement starting with a default
case Re-order the case statements to avoid this. Looks like it's been
fixed in naga master.
2022-01-22 20:54:18 -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 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