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

avm1: Introduce TextFormatObject #5569

Merged
merged 2 commits into from
Oct 30, 2021
Merged

Conversation

relrelb
Copy link
Contributor

@relrelb relrelb commented Oct 30, 2021

TextFormat objects differ from regular objects in that
TextField.setTextFormat and TextField.setNewTextFormat accept
only the former, and ignore the latter.

Also, TextFormat.prototype has native accessors that coerce the
values on get/set.

@relrelb relrelb force-pushed the avm1_text_format branch 2 times, most recently from c51934d to aae94da Compare October 30, 2021 08:58
`TextFormat` objects differ from regular objects in that
`TextField.setTextFormat` and `TextField.setNewTextFormat` accept
only the former, and ignore the latter.

Also, `TextFormat.prototype` has native accessors that coerce the
values on get/set.
Since `TextFormat.color` should preserve the alpha value, and the AVM1
getter/setter no longer reset it, we need to reset it in other places:

* `TextField.textColor` setter.
* `EditText` SWF tag handling.
* HTML parsing.

And to set it explicitly to 255 in `LayoutBox::as_renderable_text`.
Copy link
Member

@kmeisthax kmeisthax left a comment

Choose a reason for hiding this comment

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

LGTM.

I'm going to assume the extra type checks in AS3 make an AVM2 version of this object type unnecessary? Or should we be doing that, too?

Copy link
Member

@Herschel Herschel left a comment

Choose a reason for hiding this comment

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

Thank you!

@Herschel Herschel merged commit 9aed0e7 into ruffle-rs:master Oct 30, 2021
@relrelb relrelb deleted the avm1_text_format branch October 30, 2021 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants