mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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:
parent
53aca4b80e
commit
5104d8244f
5 changed files with 16 additions and 11 deletions
|
@ -180,6 +180,7 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> {
|
|||
list_style_type,
|
||||
RenderingMode::Suffix(".\u{00a0}"))
|
||||
}
|
||||
GeneratedContentInfo::Empty |
|
||||
GeneratedContentInfo::ContentItem(ContentItem::String(_)) => {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
@ -242,9 +243,14 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> {
|
|||
}
|
||||
};
|
||||
|
||||
if let Some(new_info) = new_info {
|
||||
fragment.specific = new_info
|
||||
}
|
||||
fragment.specific = match new_info {
|
||||
Some(new_info) => new_info,
|
||||
// If the fragment did not generate any content, replace it with a no-op placeholder
|
||||
// so that it isn't processed again on the next layout. FIXME (mbrubeck): When
|
||||
// processing an inline flow, this traversal should be allowed to insert or remove
|
||||
// fragments. Then we can just remove these fragments rather than adding placeholders.
|
||||
None => SpecificFragmentInfo::GeneratedContent(box GeneratedContentInfo::Empty)
|
||||
};
|
||||
}
|
||||
|
||||
fn reset_and_increment_counters_as_necessary(&mut self, fragment: &mut Fragment) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue