-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
avm2: Implement line-related methods of TextField
#16904
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kjarosh
added
text
Issues relating to text rendering/input
A-avm2
Area: AVM2 (ActionScript 3)
labels
Jun 27, 2024
kjarosh
force-pushed
the
textfield-line-methods
branch
2 times, most recently
from
June 27, 2024 14:48
323f472
to
cb4b489
Compare
kjarosh
force-pushed
the
textfield-line-methods
branch
from
June 27, 2024 18:58
cb4b489
to
16d8f45
Compare
Dinnerbone
approved these changes
Jun 27, 2024
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.
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.
By adding start and end positions to LayoutLine, it's now easy to calculate the line length, get its text, or search through lines.
The output.txt of this test was invalid, because it skipped a carriage return after one of the lines. This has of course something to do with the whole CR/LF/CRLF newline madness, as the trailing CR formed a CRLF with the "real" newline character LF, and (I suspect) git replaced it with LF ignoring CR completely, which badly influenced the current implementation. This test will be replaced with a proper test when the implementation is fixed.
This patch makes the implementation more performant, simpler, and fixes its behavior related to returning the line delimiter and tabs.
This test verifies the behavior of line-related methods of TextField: * getLineLength(), * getLineOffset(), and * getLineText().
Dinnerbone
force-pushed
the
textfield-line-methods
branch
from
June 27, 2024 19:50
16d8f45
to
bc89545
Compare
kjarosh
removed
the
waiting-on-review
Waiting on review from a Ruffle team member
label
Jun 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to #16784, this PR (except bringing some more refactors) implements
TextField.getLineLength()
,TextField.getLineOffset()
, and fixesTextField.getLineText()
.A test is added which covers all three methods, and
avm2/textfield_getlinetext
is removed, because it had a funny mistake that badly influenced the implementation.