Flash Player *traces* any errors that occur during setting properties
on the newly-constructed object durting AMf deserialization, and
continues deserializing.
This patch makes the caret be drawn using lines.
This ensures that the width of the caret is always 1px.
Additionally, it improves caret positioning, so that it's closer to FP.
This patch removes the drawing used for rendering the border and
the background and renders them using primitives instead.
It provides two methods for drawing the border and the background:
* draw_device_text_box -- when device fonts are used,
* draw_text_box -- when fonts are embedded.
Updated expected images in tests as they are closer to FP now:
* text/auto_size/height,
* text/auto_size/return,
* text/auto_size/width,
* visual/shumway_acid_tests/acid_color_0.
For the test avm2/stage3d_texture it's hard to say whether the current
output is closer to FP or not, as FP renders it with a different scale.
However, I have confirmed that there exists a scale at which FP renders
the text fields exactly as Ruffle after this patch.
This patch splits the current method of create_box into
1. create_box -- without rotation, and
2. create_box_with_rotation -- with rotation.
The reason for that refactor is that create_box was often used without
rotation, and always passing 0.0 as rotation and having
a dedicated condition for 0.0 was superfluous.
Both implementations currently use `screen_position_to_index`, which
is inaccurate, and that's why these methods still produce a stub warning.
However, this implementation makes some games work, is a lot better than
a perfect implementation which would require a lot of work and time,
and infinitely better than no implementation at all.
Before this patch, it was possible that some objects did not have a
debug rect despite existing on the stage and interacting with the user.
That was the case for instance for buttons with hit bounds and no up state.
This patch ensures that debug rect is at least as big as highlight bounds,
which are used to highlight focused objects on the stage.
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.
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.
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).
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.
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.
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.
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).
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.