Commit Graph

12480 Commits

Author SHA1 Message Date
Kamil Jarosz b55d4d1021 avm2: Fix TextField.getLineText()
This patch makes the implementation more performant, simpler, and
fixes its behavior related to returning the line delimiter and tabs.
2024-06-27 22:02:41 +02:00
Kamil Jarosz 4f457da07b tests: Remove avm2/textfield_getlinetext test
The output.txt of this test was invalid,
because it skipped a carriage return after one of the lines.
This has of course something to do with the whole CR/LF/CRLF newline
madness, as the trailing CR formed a CRLF with the "real" newline
character LF, and (I suspect) git replaced it with LF ignoring
CR completely, which badly influenced the current implementation.

This test will be replaced with a proper test when
the implementation is fixed.
2024-06-27 22:02:41 +02:00
Kamil Jarosz 9a6708f4b1 avm2: Implement TextField.getLineOffset() 2024-06-27 22:02:41 +02:00
Kamil Jarosz 57b371900b avm2: Implement TextField.getLineLength() 2024-06-27 22:02:41 +02:00
Kamil Jarosz 8569df9503 text: Add start and end text positions to LayoutLine
By adding start and end positions to LayoutLine, it's now easy to
calculate the line length, get its text, or search through lines.
2024-06-27 22:02:41 +02:00
Kamil Jarosz dcafb3d291 text: Assume at least one span is present during layout
After some past refactors, it's true now that during layout there's
at least one text span, which is ensured by the span normalization.
This refactor simplifies code.
2024-06-27 22:02:41 +02:00
Kamil Jarosz a606fcc8ed text: Implement Debug for LayoutContent 2024-06-27 22:02:41 +02:00
Kamil Jarosz 47ea369047 text: Add text positions to all layout boxes
This refactor adds positions to all layout boxes, not only texts.
Positions for bullets and drawings are used only for obtaining
information about their location relative to other layout boxes,
so that searching and other various operations on boxes are easier.
2024-06-27 22:02:41 +02:00
Aaron Hill 8bea6d4ef9 avm2: Parse and load DoAbc/DoAbc2 tags during frame execution
Parsing and loading the definitions from an DoAbc/DoAbc2 tag
is visible to ActionScript - any definitions will become accessible,
and the script initializer will be run when accessing any of those
definitions.

We now delay the actual parsing/loading traits from DoAbc2 tags.
This is run before we process any SymbolClass tags, and only runs
the first time that we execute a frame.

This also fixes an issue where we would incorrectly produce a
`VerifyError` during preloading when trying to load a superclass
for a `Class` for a tag in a future frame. That frame might require
other class definitions to be populated first (e.g. by a `Loader`
in the first frame).
2024-06-27 21:44:40 +02:00
TÖRÖK Attila e75299702b chore: Bump bitstream-io to 2.4.2 2024-06-27 21:19:36 +02:00
TÖRÖK Attila b68583e2ee Revert "ci: Release and test with Rust 1.78 instead of stable"
This reverts commit 4448e37d98.
2024-06-27 21:19:36 +02:00
TÖRÖK Attila c02c6d2d44 chore: Update `wgpu-core` and `wgpu-hal` to 0.21.1 2024-06-27 21:19:36 +02:00
Crowdin Bot c470adfe71 chore: Update translations from Crowdin 2024-06-27 10:06:38 +02:00
Crowdin Bot c6ed64cced chore: Update translations from Crowdin 2024-06-26 03:16:13 +02:00
Kornelius Rohrschneider 76d3cd95a4 tests: Add form loader encoding tests
Several form loader encoding tests have been added. They test whether
the form loader uses the correct encoding to decode text files with
different SWF versions and settings.
One test has been marked as known failure as it tests how Flash decodes
invalid UTF-8 characters (when decoding as UTF-8), which is not yet
implemented in Ruffle.
2024-06-26 02:37:44 +02:00
Kornelius Rohrschneider 4d6dd38616 core: Make the form loader use Windows-1252 if SWF version <= 5
The form loader now loads files using Windows-1252 if the SWF version is
smaller than 6. This roughly matches Flash's behaviour (Flash uses
Windows-1252 on Windows, on macOS a slightly different custom encoding
is used).
Previously, UTF-8 has been (wrongly) used for all SWF files if
System#useCodepage hasn't been set to true, leading to incorrectly
displayed characters.
2024-06-26 02:37:44 +02:00
Kornelius Rohrschneider 0b30b7fdda core: Use HTTP response encoding if existing
If System#useCodepage has been set to true, the form loader now uses the
encoding specified in the HTTP response content type field, if existing,
to decode remote text files. chardetng is now (only) used if the HTTP
response doesn't specify any encoding or if the file is local.
2024-06-26 02:37:44 +02:00
Kornelius Rohrschneider 870bdae6fd core: Add support of non-UTF-8 encodings to the form loader
Flash's form loader loads text files in the local system codepage if
System#useCodepage has been set to true. Previously, Ruffle always
(wrongly) used UTF-8, leading to incorrectly displayed characters.
This has been fixed. Ruffle now supports loading files with an encoding
other than UTF-8.
As Ruffle doesn't always have access to the system codepage and as it's
not reliably the correct encoding, the crate chardetng has been added.
It's used instead of the system codepage to detect the encoding, and the
data is converted into UTF-8.
2024-06-26 02:37:44 +02:00
TÖRÖK Attila 837c922b55 chore: web: Regenerate `package-lock.json`
Like this:
  $ rm -rf package-lock.json node_modules/
  $ npm update
  $ npm install --save --save-dev --save-peer
2024-06-25 19:39:11 +02:00
Daniel Jacobs 38e48099d0 chore: Fix formatting 2024-06-24 20:17:34 -04:00
Daniel Jacobs 3b6cc37324 extension: On Chrome, adding permissions for a specific site adds many 2024-06-24 20:17:34 -04:00
Daniel Jacobs 11d73474b2 extension: If popup ping fails, re-send after 0.2 seconds 2024-06-24 20:17:34 -04:00
Daniel Jacobs 20d6e1d4cc extension: Separate permission button from other buttons 2024-06-24 20:17:34 -04:00
Daniel Jacobs 8af4454012 extension: Reload the tab when non-<all_urls> host permission added 2024-06-24 20:17:34 -04:00
Daniel Jacobs 23d8e5617c extension: Revert non-working check 2024-06-24 20:17:34 -04:00
Daniel Jacobs cee3046216 extension: Address review comments 2024-06-24 20:17:34 -04:00
Daniel Jacobs eb64cd530d extension: Make onboarding page look nicer 2024-06-24 20:17:34 -04:00
Daniel Jacobs 9aa027311d extension: Upgrade Firefox to Manifest V3 2024-06-24 20:17:34 -04:00
Crowdin Bot e83e39ad27 chore: Update translations from Crowdin 2024-06-25 00:26:30 +02:00
dependabot[bot] 8877eebdb2 build(deps): bump the cargo-minor group across 1 directory with 4 updates
Bumps the cargo-minor group with 4 updates in the / directory: [bytemuck](https://github.com/Lokathor/bytemuck), [syn](https://github.com/dtolnay/syn), [proc-macro2](https://github.com/dtolnay/proc-macro2) and [libloading](https://github.com/nagisa/rust_libloading).


Updates `bytemuck` from 1.16.0 to 1.16.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.0...v1.16.1)

Updates `syn` from 2.0.66 to 2.0.68
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.68)

Updates `proc-macro2` from 1.0.85 to 1.0.86
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86)

Updates `libloading` from 0.8.3 to 0.8.4
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-minor
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-minor
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-minor
- dependency-name: libloading
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-25 00:08:16 +02:00
dependabot[bot] 2f7fa169a9 build(deps-dev): bump the npm-minor group in /web with 3 updates
Bumps the npm-minor group in /web with 3 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [mocha](https://github.com/mochajs/mocha).


Updates `@typescript-eslint/eslint-plugin` from 7.13.1 to 7.14.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.14.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 7.13.1 to 7.14.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.14.1/packages/parser)

Updates `mocha` from 10.4.0 to 10.5.0
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.4.0...v10.5.0)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 23:19:22 +02:00
Tom Schuster fe754d7fed avm2: Change map().unwrap_or() to map_or() 2024-06-24 16:36:25 +02:00
Tom Schuster 0a513f273e avm2: Cleanup some Value::Object matching 2024-06-24 16:36:25 +02:00
dependabot[bot] c4f478c30a build(deps-dev): bump replace-in-file from 7.2.0 to 8.0.0 in /web
Bumps [replace-in-file](https://github.com/adamreisnz/replace-in-file) from 7.2.0 to 8.0.0.
- [Release notes](https://github.com/adamreisnz/replace-in-file/releases)
- [Changelog](https://github.com/adamreisnz/replace-in-file/blob/main/CHANGELOG.md)
- [Commits](https://github.com/adamreisnz/replace-in-file/commits)

---
updated-dependencies:
- dependency-name: replace-in-file
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 15:43:04 +02:00
dependabot[bot] f455037d34 build(deps): bump the npm-minor group in /web with 7 updates
Bumps the npm-minor group in /web with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) | `36.0.0` | `36.0.1` |
| [typescript](https://github.com/Microsoft/TypeScript) | `5.4.5` | `5.5.2` |
| [tsx](https://github.com/privatenumber/tsx) | `4.15.6` | `4.15.7` |
| [chromedriver](https://github.com/giggio/node-chromedriver) | `126.0.2` | `126.0.3` |
| [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) | `10.0.6` | `10.0.7` |
| [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | `48.2.12` | `48.4.0` |
| [typedoc](https://github.com/TypeStrong/TypeDoc) | `0.25.13` | `0.26.2` |


Updates `stylelint-config-standard` from 36.0.0 to 36.0.1
- [Release notes](https://github.com/stylelint/stylelint-config-standard/releases)
- [Changelog](https://github.com/stylelint/stylelint-config-standard/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint-config-standard/compare/36.0.0...36.0.1)

Updates `typescript` from 5.4.5 to 5.5.2
- [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.4.5...v5.5.2)

Updates `tsx` from 4.15.6 to 4.15.7
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.15.6...v4.15.7)

Updates `chromedriver` from 126.0.2 to 126.0.3
- [Commits](https://github.com/giggio/node-chromedriver/compare/126.0.2...126.0.3)

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

Updates `eslint-plugin-jsdoc` from 48.2.12 to 48.4.0
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v48.2.12...v48.4.0)

Updates `typedoc` from 0.25.13 to 0.26.2
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.25.13...v0.26.2)

---
updated-dependencies:
- dependency-name: stylelint-config-standard
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
- dependency-name: tsx
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: chromedriver
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
- dependency-name: typedoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 15:12:48 +02:00
Kamil Jarosz 04dfd1f22f avm2: Do not fire roll over events on focus change (yet)
This patch bypasses AVM2 conditionally when firing roll over events
triggered by a focus change until a proper support for AVM2 events
is implemented.
2024-06-23 13:30:27 +02:00
Kamil Jarosz 83ed478beb wgpu: Do not use 'packed' as variable name in WGSL shaders
Turns out that 'packed' is a keyword in some GLSL shaders,
and naga currently preserves it, producing a syntax error.

As a workaround, this patch renames the variable to something else.
2024-06-23 09:51:04 +02:00
Nathan Adams 575481f9cc web: Don't use direct eval, use indirect new Function(...) instead 2024-06-23 00:26:55 +02:00
sleepycatcoding 9979631f8c frontend-utils: Replace async-net's `TcpStream` with tokio's 2024-06-23 00:40:24 +03:00
Lord-McSweeney 9271618185 avm2: Properly import stub_getter and stub_setter in Shader 2024-06-22 13:28:01 -07:00
riku 036839fb1f
extension: Fix 4399 CORS and Flash detection issue (close #13943) (#16750)
Co-authored-by: Zhentao Lu <zhentaolu@microsoft.com>
2024-06-21 15:05:53 +00:00
Aaron Hill dc03f541db avm2: Match Flash behavior for DoAbc/SymbolClass script initializers
Flash Player handles SymbolClass tags and eager (non-lazy) DoAbc2 tags in an unusual way:
During the first time that a given frame is executed:
1. All SymbolClass tags are processed in order, triggering ClassObject loading (and the associated
   script initializer execution, if it hasn't already been run)
2. All eager (non-lazy) DoAbc/DoAbc2 tags have their *final* script initializer executed.

To implement this, we now cache the needed `Script` and symbol class
data during preloading. The first time we execute a frame, we run
the symbolclass class lookup and assignment, followed by the final
script initializer for each DoAbc2 tag in the frame.

This fixes 'minidash' (and probably other crossbridge games as well).
2024-06-21 16:57:06 +02:00
Kamil Jarosz adea7ae743 text: Refactor EditText.line_text
This refactor takes advantage of the
new layout structure to simplify code.
2024-06-21 16:41:56 +02:00
Kamil Jarosz bfbd2dbd19 text: Refactor EditText.layout_metrics
This refactor takes advantage of the
new layout structure to simplify code.
2024-06-21 16:41:56 +02:00
Kamil Jarosz 50ade23779 text: Implement Layout.bounds 2024-06-21 16:41:56 +02:00
Kamil Jarosz ba13386788 text: Restructure layout to include text lines
This patch removes `LineData` & `get_line_data` and incorporates
their logic into layout calculation adding `Layout` and `LayoutLine`.
The goal is to simplify operations on the layout, as now
line data is always present and integrated with the layout.
Specialized methods may be added to `Layout` and `LayoutLine`
in the future.
2024-06-21 16:41:56 +02:00
Kamil Jarosz d2f5b78503 text: Move lower_from_text_spans to module level 2024-06-21 16:41:56 +02:00
Crowdin Bot 43b2cced0a chore: Update translations from Crowdin 2024-06-21 10:17:03 +02:00
Lord-McSweeney 1164dd747a avm2: Merge locals better 2024-06-20 17:02:13 -07:00
Lord-McSweeney 1389f5fa67 avm2: Record all jump sources in verifier 2024-06-20 17:02:13 -07:00