Commit Graph

12774 Commits

Author SHA1 Message Date
Kamil Jarosz 53d2d16162 core: Add UiBackend::close_virtual_keyboard
This method may be used by backends that require explicit virtual
keyboard closing.
2024-07-27 21:32:35 +02:00
Kamil Jarosz e18ae830c1 web: Use browser focus events for focus management
This patch changes how the player focus is managed.

Before this patch, `instance.has_focus` was unrelated
to the current focus managed by the browser.
When the user clicked anywhere on the window, it was set to `false`,
and when the user clicked on the player, it was set to `true`.
This had two major issues.
1. When the user clicked on the player, `has_focus` was set to `false`,
   and then again to `true`. That was problematic when listening
   to focus change events.
2. Not using browser's focus makes it harder to integrate with Ruffle,
   i.e. tab out of Ruffle.

This patch uses browser's focus management to detect focus
and listen to focus events:
1. on `focusin` – FocusGained event is fired,
2. on `focusout` – FocusLost event is fired, and
3. on `pointerdown` – focus is manually set to the canvas.
The container has `tabindex` set to -1 in order to be focusable.

Virtual keyboard on web is represented as an input inside the container.
In order to preserve player focus when virtual keyboard is open,
this patch ensures that the container is focused and not the canvas.
This way, when the input is focused, the container does not lose its focus.
2024-07-27 21:32:35 +02:00
Lord-McSweeney ad4a65eee8 tests: Add test for linking root movie to non-zero id 2024-07-27 16:12:44 +03:00
Lord-McSweeney 6f0e641748 core: Link root movie to first invalid character ID registered, instead of always using character ID #0 2024-07-27 16:12:44 +03:00
Tom Schuster 93e86d977c avm2: Add flash.sensors.Geolocation stub 2024-07-27 14:13:04 +02:00
Tom Schuster 840128d81a avm2: flash.sensors.Accelerometer extends EventDispatcher 2024-07-27 14:13:04 +02:00
Tom Schuster 64c6782249 tests: Test Proxy hasProperty override is called for hasOwnProperty 2024-07-27 12:33:58 +02:00
Tom Schuster 1687739093 avm2: Call the Proxy hasProperty override for Object.hasOwnProperty 2024-07-27 12:33:58 +02:00
sleepycatcoding 61997e2cfb desktop: Do not resize the window while it is maximized 2024-07-27 11:06:37 +02:00
Kamil Jarosz 3f85265bc7 tests: Increase tolerance of image tests failing locally 2024-07-26 18:15:09 -04:00
Lord-McSweeney a4c6c3592b avm2: `StyleSheet` should extend `EventDispatcher` 2024-07-25 22:29:56 +03:00
Kamil Jarosz 8bfb50f3c1 tests: Add avm2/focus_events_mouse_focusable test
This test verifies the behavior of focus-related events when
trying to focus various interactive objects using mouse.
2024-07-25 16:38:06 +02:00
Kamil Jarosz b6ce6523de tests: Add avm2/focus_events_mixed_key_mouse test
This test verifies the behavior of focus-related events when
changing focus using keyboard and mouse interchangeably.
2024-07-25 16:38:06 +02:00
Kamil Jarosz be903d2cd5 tests: Add avm2/focus_events_mouse_same_object test
This test verifies the behavior of focus-related events when
changing focus to the same object using mouse.
2024-07-25 16:38:06 +02:00
Kamil Jarosz dd4b859268 tests: Add avm2/focus_events_mouse_basic test
This test verifies the behavior of focus-related events when
changing focus using mouse.
2024-07-25 16:38:06 +02:00
Kamil Jarosz c63a014efd tests: Add avm2/focus_events_key_navigation test
This test verifies the behavior of focus-related events
when using keyboard navigation.
2024-07-25 16:38:06 +02:00
Kamil Jarosz e3d013ebf8 tests: Add avm2/focus_events_key_same_object test
This test verifies the behavior of focus-related events when
changing focus to the same object using keyboard.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 2bf3a61a4d tests: Add avm2/focus_events_key_basic test
This test verifies the behavior of focus-related events when
changing focus using keyboard.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 8f4668e5bb tests: Add avm2/focus_events_code test
This test verifies the behavior of focus-related events when
changing focus programmatically.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 594d3d5d2f tests: Add avm2/focusrect_focuslost
This test verifies the behavior of focus-related events when
the window focus is lost.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 266efaf887 tests: Add avm1/focus_mouse_focusable test
This test checks which objects are focusable by mouse in AVM1.
2024-07-25 16:38:06 +02:00
Kamil Jarosz f8309bc548 avm2: Update focus before dispatching mouse events
The order of events seen during testing suggests that the focus
is updated before dispatching any mouse-related events.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 84e291dc37 core: Make AVM2 objects focusable by mouse
When clicking a focusable by mouse object in AVM2,
the focus should be updated.
2024-07-25 16:38:06 +02:00
Kamil Jarosz c30b229408 avm2: Add support for mouseFocusChange/keyFocusChange events 2024-07-25 16:38:06 +02:00
Kamil Jarosz 409f01e42c avm2: Add support for focusOut events 2024-07-25 16:38:06 +02:00
Kamil Jarosz f79ab195be avm2: Add EventObject::focus_event
This method allows constructing FocusEvents.
2024-07-25 16:38:06 +02:00
Kamil Jarosz 021de2bf91 core: Fix grammar in docs 2024-07-25 16:38:06 +02:00
Kamil Jarosz b850c9b0d2 tests: Make renderer optional for focusrect_focuslost 2024-07-25 16:38:06 +02:00
Lord-McSweeney e814692aaf tests: Add a test for gotoing to a frame with a frame label when the frame is the last frame 2024-07-25 15:59:16 +03:00
Lord-McSweeney cd9cfa6b26 core: Fix off-by-one in `MovieClip.frame_exists_within_scene` 2024-07-25 15:59:16 +03:00
Crowdin Bot 9065ce3a03 chore: Update translations from Crowdin 2024-07-24 21:57:36 +02:00
Aaron Hill f6737b68f4 avm2: Add 'avm_caught' trace target to log caught exceptions
When the `avm_debug` feature is enabled, we log all caught exceptions
under the `avm_caught` target at INFO level. This is useful for
debugging SWFs that catch and suppress exceptions, which can end up
hiding errors from unimplemented flash APIs.
2024-07-24 21:03:29 +02:00
dependabot[bot] b6c9e25cf4 build(deps-dev): bump typescript-eslint in /web
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.0.0-alpha.51 to 8.0.0-alpha.54.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/HEAD/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-24 19:14:42 +02:00
dependabot[bot] 0c321b3073 build(deps): bump chromedriver from 126.0.5 to 127.0.0 in /web
Bumps [chromedriver](https://github.com/giggio/node-chromedriver) from 126.0.5 to 127.0.0.
- [Commits](https://github.com/giggio/node-chromedriver/compare/126.0.5...127.0.0)

---
updated-dependencies:
- dependency-name: chromedriver
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-24 19:01:33 +02:00
dependabot[bot] eb2c98b8e6 build(deps-dev): bump the npm-minor group in /web with 2 updates
Bumps the npm-minor group in /web with 2 updates: [typescript](https://github.com/Microsoft/TypeScript) and [@types/chrome](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/chrome).


Updates `typescript` from 5.5.3 to 5.5.4
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.5.3...v5.5.4)

Updates `@types/chrome` from 0.0.268 to 0.0.269
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/chrome)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: "@types/chrome"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-24 18:50:44 +02:00
Daniel Jacobs d8da4ffaa5 extension: Don't redefine the window.close() method 2024-07-24 17:49:10 +02:00
Daniel Jacobs 141eab4292 extension: Unregister event listeners before adding new ones 2024-07-24 17:49:10 +02:00
Daniel Jacobs 830b5df3dc extension: Request permission for SWF origins loaded in player as needed 2024-07-24 17:49:10 +02:00
Moulins cb10589758 core: Don't make dependant AvmStrings pointing to static buffers 2024-07-24 17:30:04 +02:00
Moulins aa956a286f core: Rename `avm_string::Source::Owned` to `Managed`
This avoids confusion with the owned/dependant distinction
2024-07-24 17:30:04 +02:00
Kamil Jarosz d832476ae6 tests: Add avm2/edittext_paragraph_methods test 2024-07-24 17:12:54 +02:00
Kamil Jarosz fe82a23b61 avm2: Implement TextField.getParagraphLength 2024-07-24 17:12:54 +02:00
Kamil Jarosz 670e5f9ac2 avm2: Implement TextField.getFirstCharInParagraph 2024-07-24 17:12:54 +02:00
Kamil Jarosz e9b8cfae1a wstr: Add swf_is_newline util method 2024-07-24 17:12:54 +02:00
Kamil Jarosz 9912141114 core: Use swf_is_whitespace where possible 2024-07-24 17:12:54 +02:00
Daniel Jacobs 1cab534246 ci: Don't test on Edge as the latest release is missing for Linux 2024-07-24 10:57:29 -04:00
Daniel Jacobs a7ee776750 web: Fix globals.d.ts file type declarations 2024-07-23 20:06:15 +02:00
TÖRÖK Attila 9e3035a8bb chore: Fix new beta lint `clippy::manual_inspect` 2024-07-23 18:54:04 +02:00
Daniel Jacobs 07033d3087 web: Use CSS scale attribute instead of non-existent scale property 2024-07-23 11:14:52 -04:00
dependabot[bot] 9337dfc359 build(deps-dev): bump typescript-eslint in /web
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.0.0-alpha.49 to 8.0.0-alpha.51.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/HEAD/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-23 05:25:58 +02:00