ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.8k stars 823 forks source link

Text based visual tests are failing #1167

Open Dinnerbone opened 4 years ago

Dinnerbone commented 4 years ago

Mega issue for now because I don't know which are the same cause or not.

I've copied over the edittext avm1 tests to the visual-test repo, and these are the results:

Name Expected Actual
edittext_align
edittext_bullet
edittext_default_format
edittext_font_size
edittext_html_entity
edittext_html_roundtrip
edittext_letter_spacing
edittext_margins
edittext_newlines
edittext_tab_stops
edittext_underline

The only test that passes is edittext_leading, so I've not included it here.

hatal175 commented 3 years ago

Regarding edittext_bullet, there's an issue in the html transformation. The last \</li> is translated into a line break even though there's no more text after it. The layout then creates a bullet for the last empty textspan, even though flash doesn't.

I'm not sure how to fix this elegantly in lower_from_html.

danielhjacobs commented 3 years ago

That's not the only html transformation issue with edittext_bullet hatal. If you have newlines or spaces (I'm not sure which is the culprit or if both are) between the end of a line of text inside an li and the \</li>, extra bullets are added, even though \</li> is respected in Flash. Plus, the bullet that's expected to be there first is just not there.

For example, this ends up with a ton of extra bullets:

<h2>Heading Here</h2>
<ul>
  <li><a href="example.com?type=1" target="_blank">Example 1</a> is here.
  </li>
  <li><a href="example.com?type=2" target="_blank">Example 2</a> is here.
  </li>
  <li><a href="example.com?type=3" target="_blank">Example 3</a> is here.
  </li>
  <li><a href="example.com?type=4" target="_blank">Example 4</a> is here.
  </li>
</ul>

From what I saw, this ended up formatted as if it was:

<h2>Heading Here</h2><a href="example.com?type=1" target="_blank">Example 1</a> is here.
<ul>
  <li><a href="example.com?type=2" target="_blank">Example 2</a> is here.</li>
  <li></li>
  <li></li>
  <li><a href="example.com?type=3" target="_blank">Example 3</a> is here.</li>
  <li></li>
  <li></li>
  <li><a href="example.com?type=4" target="_blank">Example 4</a> is here.</li>
  <li></li>
  <li></li>
</ul>

On the other hand, this only ends up with the one extra bullet already mentioned, and only if it's the last line of loaded text:

<h2>Heading Here</h2>
<ul>
  <li><a href="example.com?type=1" target="_blank">Example 1</a> is here.</li>
  <li><a href="example.com?type=2" target="_blank">Example 2</a> is here.</li>
  <li><a href="example.com?type=3" target="_blank">Example 3</a> is here.</li>
  <li><a href="example.com?type=4" target="_blank">Example 4</a> is here.</li>
</ul>

With this example, keep in mind that I am aware h2 tags are treated as if they don't exist and a tags are not clickable, but I wanted to keep the example as close to what I had as possible.

See issue in action by clicking 3D Brain on http://www.g2conline.org/ with the extension and scrolling down. The XML file is at http://www.g2conline.org/elements/3dbrain/xml/brainData_02.xml and you can see it's actual formatting at view-source:http://www.g2conline.org/elements/3dbrain/xml/brainData_02.xml An example is lines 61 to 71.

kjarosh commented 1 week ago

Remaining issues:

Comments: