ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.67k stars 814 forks source link

Regression: Versions 2023-11-10+ Have Broken Input Textfields #14988

Open astroUNL opened 9 months ago

astroUNL commented 9 months ago

Describe the bug

Starting with 2023-11-10 and up to present (2023-01-29) some input textfields are broken:

  1. The fields do not display text.
  2. The user is unable to enter text.

The particular fields with the problem are created with the createTextField method. However, other text fields created with that method work (such as the degree symbol fields). I have been unable to determine what it is about these fields that cause them to not appear.

ruffle-text-bug

Expected behavior

The textfields should display text and allow input, as shown in the picture.

Content Location

Source SWF: https://astro.unl.edu/classaction/animations/coordsmotion/altazimuth.swf

Working (2023-11-09, self-hosted): https://astro.unl.edu/classaction/animations/coordsmotion/altazimuth.html

Broken (2023-11-10, unpkg): https://astro.unl.edu/classaction/animations/coordsmotion/altazimuth.html?ruffleVer=0.1.0-nightly.2023.11.10

(The URL query string can be used to specify specific versions hosted at unpkg.com/@ruffle-rs, otherwise a locally hosted copy of the 2024-11-09 version of Ruffle is used. Sometimes using unpkg is slow.)

There are other Flash sims with the same problem on this page: https://astro.unl.edu/animationsLinks.html

Affected platform

Self-hosted version (also desktop version)

Operating system

Windows, macOS

Browser

Chrome

Additional information

I am the author of this SWF and I still have the FLA.

britt-j commented 2 months ago

The regression seems to have happened in https://github.com/ruffle-rs/ruffle/commit/924e5ef632253c711f36d37ebad9758eafd4d24d, which was a part of https://github.com/ruffle-rs/ruffle/pull/13923

britt-j commented 1 month ago

The code responsible for the regression is: https://github.com/ruffle-rs/ruffle/blob/6059031d71d4480c5f861b6b7c44adbb74bb9684/core/src/display_object/edit_text.rs#L814-L815 The SWF sets the height of the textfield to 0 on initialization and never explicitly sets it to something else, meaning it'll be reset to zero when the autosize mode is none, which it does set it to. It seems from my testing that the height should be set to the exterior bounds' height like above: https://github.com/ruffle-rs/ruffle/blob/6059031d71d4480c5f861b6b7c44adbb74bb9684/core/src/display_object/edit_text.rs#L809-L810 But just replacing it with that breaks a test that was matching Flash, so the fix is more complicated than that.

The code in the SWF responsible for these textfields is in Standard Slider V6, and the code updating the field is in the function assigned to updateField