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

avm2: Do not disable HTML when setting TextField.text #19014

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/src/avm2/globals/flash/text/text_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ pub fn set_text<'gc>(
{
let text = args.get_string_non_null(activation, 0, "text")?;

this.set_is_html(activation.context, false);
this.set_text(&text, activation.context);
}

Expand Down
32 changes: 32 additions & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;

public class Test extends MovieClip {
public function Test() {
var tf = new TextField();
tf.defaultTextFormat = new TextFormat("Default Font");
tf.defaultTextFormat = new TextFormat("Default Font");

tf.htmlText = "<font face='NonDefault Font'><b>bold</b></font>";

trace("After setting HTML:");
trace(" " + tf.text);
trace(" " + tf.htmlText);

tf.text = "text";

trace("After setting text:");
trace(" " + tf.text);
trace(" " + tf.htmlText);

tf.text = "<b>text</b>";

trace("After setting text with HTML entities:");
trace(" " + tf.text);
trace(" " + tf.htmlText);
}
}
}
9 changes: 9 additions & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
After setting HTML:
bold
<P ALIGN="LEFT"><FONT FACE="NonDefault Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>bold</B></FONT></P>
After setting text:
text
<P ALIGN="LEFT"><FONT FACE="Default Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">text</FONT></P>
After setting text with HTML entities:
<b>text</b>
<P ALIGN="LEFT"><FONT FACE="Default Font" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">&lt;b&gt;text&lt;/b&gt;</FONT></P>
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/edittext_set_text_vs_html/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1