aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_wrapper.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-25 19:58:47 -0500
committerGitHub <noreply@github.com>2017-05-25 19:58:47 -0500
commit764da7ba39c0ccbaf807c6131418761f70584322 (patch)
treeb3b72f562092d62790206cf05d0d849696c87013 /components/script/layout_wrapper.rs
parenta961f6a1eb0c2375e1dae245eeaea849e093f224 (diff)
parentdeaa935f5b776c6ca04ed37c8b5ae4c8311b0efb (diff)
downloadservo-764da7ba39c0ccbaf807c6131418761f70584322.tar.gz
servo-764da7ba39c0ccbaf807c6131418761f70584322.zip
Auto merge of #17025 - emilio:layout-data, r=jdm
script/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 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17025) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r--components/script/layout_wrapper.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index eab6f2fd9c9..0b230e6081f 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -47,7 +47,7 @@ use html5ever::{LocalName, Namespace};
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use range::Range;
use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress};
-use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
+use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData};
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint};
@@ -452,12 +452,12 @@ impl<'le> TElement for ServoLayoutElement<'le> {
}
fn store_children_to_process(&self, n: isize) {
- let data = self.get_partial_layout_data().unwrap().borrow();
+ let data = self.get_style_data().unwrap();
data.parallel.children_to_process.store(n, Ordering::Relaxed);
}
fn did_process_child(&self) -> isize {
- let data = self.get_partial_layout_data().unwrap().borrow();
+ let data = self.get_style_data().unwrap();
let old_value = data.parallel.children_to_process.fetch_sub(1, Ordering::Relaxed);
debug_assert!(old_value >= 1);
old_value - 1
@@ -466,9 +466,7 @@ impl<'le> TElement for ServoLayoutElement<'le> {
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>> {
unsafe {
self.get_style_and_layout_data().map(|d| {
- let ppld: &AtomicRefCell<PartialPersistentLayoutData> = &*d.ptr.get();
- let psd: &AtomicRefCell<ElementData> = transmute(ppld);
- psd
+ &(*d.ptr.get()).element_data
})
}
}
@@ -537,7 +535,7 @@ impl<'le> ServoLayoutElement<'le> {
}
}
- fn get_partial_layout_data(&self) -> Option<&AtomicRefCell<PartialPersistentLayoutData>> {
+ fn get_style_data(&self) -> Option<&StyleData> {
unsafe {
self.get_style_and_layout_data().map(|d| &*d.ptr.get())
}