Don't re-resolve already-resolved generated content

This fixes #7846, a failure in the "quotes-036.htm" test. Servo lays out this
test correctly in its initial layout, but then messes it up in any relayout
(whether it's an incremental or full layout).

The problem is that the ResolveGeneratedContent traversal is not safe to run
more than once on the same flow. It mutates some GeneratedContent fragments
into ScannedText fragments, but leaves others unmodified (in particular,
those that generate empty content). The next time layout runs, these remaining
GeneratedContent fragments are processed *again* but with an incorrect correct
quote nesting level (because some of the surrounding GeneratedContent
fragments are gone).

This patch ensures that each GeneratedContent fragment is resolved only once.
This commit is contained in:
Matt Brubeck 2016-03-11 08:34:30 -08:00
parent 53aca4b80e
commit 5104d8244f
5 changed files with 16 additions and 11 deletions

View file

@ -846,10 +846,8 @@ impl InlineFlow {
first_line_indentation: Au(0),
};
for fragment in &flow.fragments.fragments {
if fragment.is_generated_content() {
flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT)
}
if flow.fragments.fragments.iter().any(Fragment::is_unscanned_generated_content) {
flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT);
}
flow