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
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.
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.
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
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.