Skip to content

avm2: Store content of ContentElement subclasses as native data - #24338

Merged
Lord-McSweeney merged 5 commits into
ruffle-rs:masterfrom
Lord-McSweeney:avm2-content-native
Aug 1, 2026
Merged

avm2: Store content of ContentElement subclasses as native data#24338
Lord-McSweeney merged 5 commits into
ruffle-rs:masterfrom
Lord-McSweeney:avm2-content-native

Conversation

@Lord-McSweeney

@Lord-McSweeney Lord-McSweeney commented Aug 1, 2026

Copy link
Copy Markdown
Member

Description

This PR changes TextElement and GroupElement to store their data in a new enum, ElementData. This will make it easier to access in the future for use in improved FTE support.

Additionally, this PR fixes a couple minor issues with the ContentElement.text getter, and GroupElement child validation.

Unfortunately, this PR is a bit large, as everything depends on each other.

Testing

I've added a test, avm2/groupelement_text.

Checklist

  • I, a human, have self-reviewed this PR and fully understand the changes within.
  • I have made or updated tests where possible.
  • All of my commits are properly scoped, compile successfully, and pass all tests.
  • This PR does not make sense to split up into smaller PRs.
  • An LLM was involved in the authoring of this code.

@Lord-McSweeney Lord-McSweeney added A-avm2 Area: AVM2 (ActionScript 3) fte/tlf Issues relating to the FTE (Flash Text Engine) AVM2 API or the TLF (Text Layout Framework) library T-refactor Type: Refactor / Cleanup needs-tests This PR needs regression tests to be added before it can be merged labels Aug 1, 2026
Comment thread core/src/avm2/object/content_element_object.rs
Move `TextElement`'s text to a new enum, `ElementData`.
Fix behavior when dealing with `GraphicElement` and `GroupElement`
Comment thread core/src/avm2/globals/flash/text/engine/group_element.rs Outdated

@evilpie evilpie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I imagine we could use text directly in get_text_from_content now instead of GET_TEXT.

@Lord-McSweeney
Lord-McSweeney merged commit cb2f219 into ruffle-rs:master Aug 1, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) fte/tlf Issues relating to the FTE (Flash Text Engine) AVM2 API or the TLF (Text Layout Framework) library needs-tests This PR needs regression tests to be added before it can be merged T-refactor Type: Refactor / Cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants