Skip to content

Commit

Permalink
avm2: Simplify string comparison in stylesheet a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed May 14, 2024
1 parent 4691d0c commit b5948a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/src/avm2/globals/flash/text/style_sheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ pub fn inner_parse_font_family<'gc>(
}

// Transform some names
if value == WStr::from_units(b"mono") {
if value == b"mono" {
value = WStr::from_units(b"_typewriter");
} else if value == WStr::from_units(b"sans-serif") {
} else if value == b"sans-serif" {
value = WStr::from_units(b"_sans");
} else if value == WStr::from_units(b"serif") {
} else if value == b"serif" {
value = WStr::from_units(b"_serif");
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/avm2/globals/flash/text/text_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ pub fn set_display<'gc>(
value => value.coerce_to_string(activation)?,
};

text_format.display = if value == WStr::from_units(b"block") {
text_format.display = if &value == b"block" {
Some(TextDisplay::Block)
} else if value == WStr::from_units(b"inline") {
} else if &value == b"inline" {
Some(TextDisplay::Inline)
} else if value == WStr::from_units(b"none") {
} else if &value == b"none" {
Some(TextDisplay::None)
} else {
// No error message for this, silently set it to None/null
Expand Down

0 comments on commit b5948a8

Please sign in to comment.