Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text: Dispatch events on pasting text #19665

Merged
merged 9 commits into from
Mar 2, 2025

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Mar 1, 2025

This PR includes refactors and fixes that make our implementation closer to FP:

  • restrict filtering is done after dispatching textInput,
  • text pasting fires textInput.

Tests are included.

This refactor brings us closer to supporting IME, as IME works similarly to pasting.

@kjarosh kjarosh added text Issues relating to text rendering/input A-core Area: Core player, where no other category fits T-fix Type: Bug fix (in something that's supposed to work already) ime Issues related to Input Method Editor waiting-on-review Waiting on review from a Ruffle team member labels Mar 1, 2025
kjarosh added 9 commits March 2, 2025 19:18
This aligns with how restrict behaves in Flash Player, as textInput
events are fired before restrict.
This condition doesn't seem right, control characters should be filtered
out by the frontend (and ideally the OS).
This refactor makes it possible to input text with more than one
characters, which aligns with how pasting and IME works in Flash Player.
Flash Player dispatches textInput events with the original value, and
only then filters using the restrict mechanism.
In FP, pasting text behaves the same way as inputting all the characters
at once, it fires textInput events the same way, resticts works the same
way, etc.
This test verifies events fired when pasting text.
This test verifies how pasting works when maxChars is present.
This test verifies how pasting works with restrict.
This test verifies various events fired when restrict on a field is
active.
@kjarosh kjarosh force-pushed the edittext-paste-events branch from 46a81ef to 61d4334 Compare March 2, 2025 18:18
@kjarosh kjarosh enabled auto-merge (rebase) March 2, 2025 18:18
@kjarosh kjarosh removed the waiting-on-review Waiting on review from a Ruffle team member label Mar 2, 2025
@kjarosh kjarosh merged commit 072c5dc into ruffle-rs:master Mar 2, 2025
22 checks passed
@kjarosh kjarosh deleted the edittext-paste-events branch March 2, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core player, where no other category fits ime Issues related to Input Method Editor T-fix Type: Bug fix (in something that's supposed to work already) text Issues relating to text rendering/input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants