Bug 1325734 - Remove Servo Layout's dependency on the initial-ness of the style. r=emilio

This commit is contained in:
Bobby Holley 2017-01-06 18:51:24 -08:00
parent 9482467add
commit 962a4a79bb
6 changed files with 59 additions and 13 deletions

View file

@ -151,6 +151,7 @@ impl<ConcreteNode> Iterator for TreeIterator<ConcreteNode>
/// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout
/// node does not allow any parents or siblings of nodes to be accessed, to avoid races.
pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo + PartialEq + Sized {
type ConcreteNode: LayoutNode<ConcreteThreadSafeLayoutNode = Self>;
type ConcreteThreadSafeLayoutElement:
ThreadSafeLayoutElement<ConcreteThreadSafeLayoutNode = Self>
+ ::selectors::Element<Impl=SelectorImpl>;
@ -237,14 +238,20 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
fn is_ignorable_whitespace(&self, context: &SharedStyleContext) -> bool;
fn restyle_damage(self) -> RestyleDamage;
/// Returns true if this node contributes content. This is used in the implementation of
/// `empty_cells` per CSS 2.1 § 17.6.1.1.
fn is_content(&self) -> bool {
self.type_id().is_some()
}
/// Returns access to the underlying LayoutNode. This is breaks the abstraction
/// barrier of ThreadSafeLayout wrapper layer, and can lead to races if not used
/// carefully.
///
/// We need this because the implementation of some methods need to access the layout
/// data flags, and we have this annoying trait separation between script and layout :-(
unsafe fn unsafe_get(self) -> Self::ConcreteNode;
fn can_be_fragmented(&self) -> bool;
fn node_text_content(&self) -> String;