Replace begin_styling with a centralized mechanism to set a node up for either styling or restyling.

We also make sure that an element never has an ElementData with ElementDataStyles::Uninitialized,
and eagerly call prepare_for_styling whenever an ElementData is instantiated.

MozReview-Commit-ID: 9YP6eSmdMt0
This commit is contained in:
Bobby Holley 2016-10-30 20:45:29 -07:00
parent b98bb241dc
commit 71b9004d86
10 changed files with 129 additions and 104 deletions

View file

@ -73,7 +73,6 @@ impl<T> PseudoElementType<T> {
/// Trait to abstract access to layout data across various data structures.
pub trait GetLayoutData {
fn get_style_and_layout_data(&self) -> Option<OpaqueStyleAndLayoutData>;
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
}
/// A wrapper so that layout can access only the methods that it should have access to. Layout must
@ -85,6 +84,8 @@ pub trait LayoutNode: GetLayoutData + TNode {
/// Returns the type ID of this node.
fn type_id(&self) -> LayoutNodeType;
unsafe fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
fn has_changed(&self) -> bool;
unsafe fn clear_dirty_bits(&self);
@ -274,7 +275,6 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode {
}
pub trait LayoutElement: Clone + Copy + Sized + Debug + GetLayoutData + TElement {
fn get_style_data(&self) -> Option<&AtomicRefCell<ElementData>>;
}
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +