Commit Graph

11424 Commits

Author SHA1 Message Date
sleepycatcoding 36fc30e283 debug_ui: Do not render container as collapsible if it has no children 2024-01-26 20:34:49 +01:00
Nathan Adams f678d13ca8 tests: Throw an Err, not panic, in Approximations::compare 2024-01-26 18:59:06 +01:00
Nathan Adams aee051fa45 tests: Split test running into tick/test phases. This is enough to make it work on web. 2024-01-26 18:59:06 +01:00
Nathan Adams b6614d9705 tests: Turn Test::run() into Test::create_test_runner() - handle running externally 2024-01-26 18:59:06 +01:00
Nathan Adams 1b8d3f7392 tests: Output comparison is part of the TestRunner 2024-01-26 18:59:06 +01:00
Nathan Adams 7c4e345905 tests: Make Environment::create_renderer only make one renderer, not N amount 2024-01-26 18:59:06 +01:00
Nathan Adams bd64ee2942 tests: Extract out Test::movie() 2024-01-26 18:59:06 +01:00
Nathan Adams 5040bf3aff tests: Extract out a TestRunner struct 2024-01-26 18:59:06 +01:00
Moulins ac7086528f avm1: Implement proper behavior for Gradient***Filter array setters
Among other things:
- resizing `colors` should also resize `alphas` and `ratios`
- shrinking `ratios` should also shrink `colors` and `alphas`, but
  growing it doesn't change the size
2024-01-26 18:40:06 +01:00
Moulins 19ff294e60 avm1: Follow FP 32 (not FP 11) behavior for ColorMatrix/ConvolutionFilter 2024-01-26 18:40:06 +01:00
Moulins bd2165bd0f swf: Properly read/write ConvolutionFilters; these contain f32s, not Fixed16s 2024-01-26 18:40:06 +01:00
Moulins 659917bff2 avm1: Fix inaccuracies in DisplacementMapFilter
- `mode` should reject non-lowercased values
- `mapPoint` should reset to `(0, 0)` when set to an invalid value
2024-01-26 18:40:06 +01:00
Moulins 5ef911abc9 avm1: Don't overwrite alpha when setting the color field on BitmapFilters 2024-01-26 18:40:06 +01:00
Moulins 31e69c51b5 test: Rewrite AVM filter tests and regroup them in a single file
This uncovers some bugs in our implementation, so mark the test as a
known failure for now.
2024-01-26 18:40:06 +01:00
Kamil Jarosz 225f42db2a tests: Test EditText's HTML behavior for SWF version 6 2024-01-26 18:20:06 +01:00
Kamil Jarosz ed59195ad1 tests: Test EditText's HTML behavior for SWF version 7 2024-01-26 18:20:06 +01:00
Kamil Jarosz 03b88259ca tests: Test EditText's HTML behavior for SWF version 8 2024-01-26 18:20:06 +01:00
Kamil Jarosz ec345d20a5 core: Improve HTML handling for EditText and add support for SWF 6,7
This patch improves the logic of parsing and formatting HTML
for EditText, and adds support for SWF versions 6 and 7.

Examples of bugs fixed:
* invalid HTML: When generating HTML, Ruffle sometimes generated
  mismatched tags, e.g. tried to close a tag which was never opened.
* text outside of tags: sometimes, especially in case of multiline
  fields with multiple paragraphs, Ruffle generated proper tags,
  but the text was placed outside of them.
* BR/SBR closing issues: When opened, Ruffle waited for a close tag
  and ignored every other closing tag. BR/SBR do not need to be closed,
  so Ruffle often waited indefinitely.
* P/LI behavior: P and LI have a very peculiar behavior, but a very
  important one, because it influences the number of paragraphs/bullets
  and thus newlines for multiline fields.

Support for SWF 6,7:
* whitespace in SWF 6,7: SWF versions 6,7 ignore witespace-only text.
  This significantly influences the behavior of newlines and paragraphs.
* kerning in SWF 6,7: Enabling kerning in `<font>` works only for SWF 8+.
* multiline in SWF 6: FP 6 defines the `multiline` property, but it
  completely ignores it, and the field behaves as if it's always multiline.
2024-01-26 18:20:06 +01:00
Kamil Jarosz 5422792eb7 core: Add font and style structures for TextSpan
They make operating on text spans more natural, e.g. easy comparison.
2024-01-26 18:20:06 +01:00
Daniel Jacobs 119a093c27
web: Add allowFullscreen embed/object option (part of #4258) 2024-01-26 10:06:29 +00:00
Kamil Jarosz 62a46c7b60 core: Ignore font style in default TextFormat for HTML fields
It seems that font styles in the default text format
are ignored when dealing with an HTML field.

This patch revisits the fix from feacbdc1 (#13615),
which assumed that `<font>` resets font style.
That does not seem to be the case, but rather the bug
was caused by the invalid default text format,
which forced the text to be bold, due to the bold
variant of the font being linked to the text field.

This patch reverts 2f84d468 (#1201), which assumed that
the default color for a text span has 100% alpha.
The test added here contradicts it and it seems that
the default color is in fact rgba(0,0,0,0).
Testing the original SWF suggests that the underlying problem
has been fixed since that time.
2024-01-26 08:37:24 +01:00
David Wendt 4031659c9e core: Use the last processed tag time for stream time in case of buffer underruns. 2024-01-25 23:24:09 -07:00
David Wendt 56c14be708 core: Buffer overruns should not pause the stream unless we are actually at the end of the video. 2024-01-25 23:24:09 -07:00
David Wendt 14dec5dcce avm1: `bytesTotal` should actually get `bytesTotal` 2024-01-25 23:24:09 -07:00
David Wendt 092e20a1be core: Adding data to the buffer should reactivate the stream. 2024-01-25 23:24:09 -07:00
David Wendt 9f70fab5b5 web: Use single-threaded shared ownership for body stream 2024-01-25 23:24:09 -07:00
David Wendt 899e02fd82 core: Inform `NetStream` of the expected stream length.
`NetStream` uses this information to reserve stream buffer capacity. It also exposes this information to AVM via `bytesTotal`.
2024-01-25 23:24:09 -07:00
David Wendt 006c3af4b8 core: Add backend method for getting the expected length of a response. 2024-01-25 23:24:09 -07:00
David Wendt 08ee3ea638 core: Load all `NetStream` data in chunks. 2024-01-25 23:24:09 -07:00
David Wendt 91dd9563bb core: Add method to read downloads in chunks instead of all-at-once. 2024-01-25 23:24:09 -07:00
David Wendt 06eb2e1ee8 core: `Request` is now a trait. Body download is deferred to a second async method. 2024-01-25 23:24:09 -07:00
TÖRÖK Attila 36210c9f20 avm2: Add AIR-only constant `flash.ui.KeyLocation.D_PAD` 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 67674ba089 avm2: Add constant `flash.ui.GameInputDevice.MAX_BUFFER_SIZE` 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 8b9e490d2d avm2: Add remaining `StageVideoEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 6f5cf27d55 avm2: Add undocumented `IOErrorEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila c7b7f24a19 avm2: Add remaining, AIR-only `IOErrorEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila bb0c30a686 avm2: Add `flash.events.ActivityEvent.ACTIVITY` constant 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 97c5394600 avm2: Add remaining `ClipboardFormats` constants 2024-01-25 22:44:41 +01:00
Crowdin Bot e6ea51005d chore: Update translations from Crowdin 2024-01-25 22:26:19 +01:00
moulins 727a9a8334
avm2: Don't forget to set the state in `Avm2Button::set_state`
Fixes #14922. Also removes a redundant line. These regressed in #14820.
2024-01-25 21:20:25 +00:00
Tom Schuster 70b6f62eab tests: Add tests for FileReferenceList browse 2024-01-25 19:10:56 +01:00
Tom Schuster 499dfc8990 avm2: Partially implement FileReferenceList with a single FileReference 2024-01-25 19:10:56 +01:00
Aaron Hill bb9e7c04f7 avm2: Fix handling of Loader.loadBytes for images
I've switched back to the original code for creating
the bitmap/bitmapdata, rather than relying on custom
initialization logic that we only used in loader.

To make sure that the Bitmap/BitmapData are only exposed
to ActionScript at the correct time, I've added a new flag
to control when 'LoaderInfo.content' becomes non-null
2024-01-25 10:35:28 -05:00
Lord-McSweeney 38d58552f2 nit: Fix some minor capitalization mistakes 2024-01-25 08:05:48 +01:00
Crowdin Bot 917c1c08f7 chore: Update translations from Crowdin 2024-01-25 00:49:31 +01:00
Aaron Hill 820e7e828a wgpu: Allow Stage3D texture upload where source is smaller than dest
Fancy Pants World 4 relies on this behavior.
2024-01-25 00:30:10 +01:00
Daniel Jacobs dd158c6193 web: Remove swfUrl from RufflePlayer for files loaded by data 2024-01-24 12:11:44 -05:00
Aaron Hill 1cb24b41b0 render: Support PixelBender ByteArray/Vector.<Number> input/output
When ActionScript uses a ByteArray/Vector.<Number> as a shader input
or target, we create a temporary Rgba32Float texture, and copy the
input float32 bytes to/from the texture.

Unfortunately, wgpu doesn't seem to support an Rgb32Float (3-channel)
texture. When the shader uses 3 channels, we use a Rgba32Float
(4-channel) texture, and manually insert/remove padding for the
alpha channels. This isn't very efficient, but it's the simplest
solution.

The temporary textures themselves aren't cached anywhere - if this
becomes a performance issue, we could look into using some of our
existing wgpu texture/buffer pooling code.
2024-01-24 08:31:52 -05:00
Crowdin Bot a916f6e7a2 chore: Update translations from Crowdin 2024-01-23 23:01:01 +01:00
Moulins 5f83b45692 avm2: Add `Avm2Button::all_state_children` to centralize button child ordering 2024-01-23 22:43:13 +01:00