layout: Stop doing unsafe transmutes between refcell references.

This commit splits the style and layout data in two separate refcells.

These transmutes have been a source of trouble (for example on Android), and
they feel like a hack anyway.

Fixes #16982
This commit is contained in:
Emilio Cobos Álvarez 2017-05-24 19:15:12 +02:00
parent bb310efbb9
commit deaa935f5b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 79 additions and 94 deletions

View file

@ -1173,7 +1173,7 @@ impl LayoutThread {
// If we haven't styled this node yet, we don't need to track a
// restyle.
let mut data = match el.mutate_layout_data() {
let style_data = match el.get_data() {
Some(d) => d,
None => {
unsafe { el.unset_snapshot_flags() };
@ -1186,7 +1186,7 @@ impl LayoutThread {
map.insert(el.as_node().opaque(), s);
}
let mut style_data = &mut data.base.style_data;
let mut style_data = style_data.borrow_mut();
let mut restyle_data = style_data.ensure_restyle();
// Stash the data on the element for processing by the style system.