mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Hoist most styling functionality from TNode to TElement.
MozReview-Commit-ID: DZ8ZrsZIiAU
This commit is contained in:
parent
47d29fd056
commit
5442fbec3f
17 changed files with 399 additions and 363 deletions
|
@ -19,7 +19,7 @@ use style::atomic_refcell::AtomicRefCell;
|
|||
use style::computed_values::display;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::data::NodeData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
|
||||
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TElement, TNode};
|
||||
use style::dom::OpaqueNode;
|
||||
use style::properties::ServoComputedValues;
|
||||
use style::selector_impl::{PseudoElement, PseudoElementCascadeType, ServoSelectorImpl};
|
||||
|
@ -73,6 +73,7 @@ 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
|
||||
|
@ -88,10 +89,6 @@ pub trait LayoutNode: GetLayoutData + TNode {
|
|||
|
||||
unsafe fn clear_dirty_bits(&self);
|
||||
|
||||
fn get_style_data(&self) -> Option<&AtomicRefCell<NodeData>>;
|
||||
|
||||
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
|
||||
|
||||
fn rev_children(self) -> LayoutIterator<ReverseChildrenIterator<Self>> {
|
||||
LayoutIterator(ReverseChildrenIterator {
|
||||
current: self.last_child(),
|
||||
|
@ -276,6 +273,10 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
|||
unsafe fn dangerous_next_sibling(&self) -> Option<Self>;
|
||||
}
|
||||
|
||||
pub trait LayoutElement: Clone + Copy + Sized + Debug + GetLayoutData + TElement {
|
||||
fn get_style_data(&self) -> Option<&AtomicRefCell<NodeData>>;
|
||||
}
|
||||
|
||||
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
||||
::selectors::Element<Impl=ServoSelectorImpl> +
|
||||
GetLayoutData +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue