mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #9976 - bholley:remove_trait_lifetimes, r=SimonSapin
Remove lifetimes from Style/Layout traits Right now, there's a huge amount of complexity in T{Node,Element,Document} and friends because of the lifetime parameter. Before I started generalizing this code for use by Gecko, these wrappers were plain structs. They had (and still have) a phantom lifetime associated with them to prevent references to DOM nodes from leaking past the end of restyle, when they might be invalidated by a GC. When I generalized them, I decided to put the lifetime on the trait as well, since there are some situations where the lifetime is, in fact, necessary. Specifically, they are necessary for the compiler to understand that all the things borrowed from all the nodes and elements and so on have the same lifetime (the lifetime of the restyle), rather than the lifetime of whichever particular element or node pointer the value was borrowed from. This come up in situations where we do |let el = node.as_element()| or |let n = el.as_node()| and then borrow something from the result. The compiler thinks the borrow lifetime is that of |el| or |n|, when it's actually longer. In practice though, I think the style and layout algorithms we use don't run into this issue much, and we can hack around it where it comes up. So I think we should remove the lifetimes from the traits, which will let us aggregate the embedding-provided traits together onto a single meta-trait and significantly simplify the code. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9976) <!-- Reviewable:end -->
This commit is contained in:
commit
aea8d8959d
16 changed files with 143 additions and 162 deletions
|
@ -209,8 +209,8 @@ impl InlineFragmentsAccumulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_inline_node<'ln, N>(node: &N) -> InlineFragmentsAccumulator
|
fn from_inline_node<N>(node: &N) -> InlineFragmentsAccumulator
|
||||||
where N: ThreadSafeLayoutNode<'ln> {
|
where N: ThreadSafeLayoutNode {
|
||||||
InlineFragmentsAccumulator {
|
InlineFragmentsAccumulator {
|
||||||
fragments: IntermediateInlineFragments::new(),
|
fragments: IntermediateInlineFragments::new(),
|
||||||
enclosing_node: Some(InlineFragmentNodeInfo {
|
enclosing_node: Some(InlineFragmentNodeInfo {
|
||||||
|
@ -267,22 +267,20 @@ impl InlineFragmentsAccumulator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An object that knows how to create flows.
|
/// An object that knows how to create flows.
|
||||||
pub struct FlowConstructor<'a, 'ln, N: ThreadSafeLayoutNode<'ln>> {
|
pub struct FlowConstructor<'a, N: ThreadSafeLayoutNode> {
|
||||||
/// The layout context.
|
/// The layout context.
|
||||||
pub layout_context: &'a LayoutContext<'a>,
|
pub layout_context: &'a LayoutContext<'a>,
|
||||||
/// Satisfy the compiler about the unused parameters, which we use to improve the ergonomics of
|
/// Satisfy the compiler about the unused parameters, which we use to improve the ergonomics of
|
||||||
/// the ensuing impl {} by removing the need to parameterize all the methods individually.
|
/// the ensuing impl {} by removing the need to parameterize all the methods individually.
|
||||||
phantom1: PhantomData<&'ln ()>,
|
|
||||||
phantom2: PhantomData<N>,
|
phantom2: PhantomData<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'ln, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>>
|
impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
FlowConstructor<'a, 'ln, ConcreteThreadSafeLayoutNode> {
|
FlowConstructor<'a, ConcreteThreadSafeLayoutNode> {
|
||||||
/// Creates a new flow constructor.
|
/// Creates a new flow constructor.
|
||||||
pub fn new(layout_context: &'a LayoutContext<'a>) -> Self {
|
pub fn new(layout_context: &'a LayoutContext<'a>) -> Self {
|
||||||
FlowConstructor {
|
FlowConstructor {
|
||||||
layout_context: layout_context,
|
layout_context: layout_context,
|
||||||
phantom1: PhantomData,
|
|
||||||
phantom2: PhantomData,
|
phantom2: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1444,9 +1442,9 @@ impl<'a, 'ln, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'ln, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<'ln, ConcreteThreadSafeLayoutNode>
|
impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode>
|
||||||
for FlowConstructor<'a, 'ln, ConcreteThreadSafeLayoutNode>
|
for FlowConstructor<'a, ConcreteThreadSafeLayoutNode>
|
||||||
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln> {
|
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
||||||
// Construct Flow based on 'display', 'position', and 'float' values.
|
// Construct Flow based on 'display', 'position', and 'float' values.
|
||||||
//
|
//
|
||||||
// CSS 2.1 Section 9.7
|
// CSS 2.1 Section 9.7
|
||||||
|
@ -1623,8 +1621,8 @@ trait NodeUtils {
|
||||||
fn swap_out_construction_result(self) -> ConstructionResult;
|
fn swap_out_construction_result(self) -> ConstructionResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
||||||
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln> {
|
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
||||||
fn is_replaced_content(&self) -> bool {
|
fn is_replaced_content(&self) -> bool {
|
||||||
match self.type_id() {
|
match self.type_id() {
|
||||||
None |
|
None |
|
||||||
|
@ -1674,10 +1672,7 @@ impl<'ln, ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNo
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Methods for interacting with HTMLObjectElement nodes
|
/// Methods for interacting with HTMLObjectElement nodes
|
||||||
trait ObjectElement<'a> {
|
trait ObjectElement {
|
||||||
/// Returns None if this node is not matching attributes.
|
|
||||||
fn get_type_and_data(&self) -> (Option<&'a str>, Option<&'a str>);
|
|
||||||
|
|
||||||
/// Returns true if this node has object data that is correct uri.
|
/// Returns true if this node has object data that is correct uri.
|
||||||
fn has_object_data(&self) -> bool;
|
fn has_object_data(&self) -> bool;
|
||||||
|
|
||||||
|
@ -1685,21 +1680,20 @@ trait ObjectElement<'a> {
|
||||||
fn object_data(&self) -> Option<Url>;
|
fn object_data(&self) -> Option<Url>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, N> ObjectElement<'ln> for N where N: ThreadSafeLayoutNode<'ln> {
|
impl<N> ObjectElement for N where N: ThreadSafeLayoutNode {
|
||||||
fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) {
|
|
||||||
let elem = self.as_element();
|
|
||||||
(elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_object_data(&self) -> bool {
|
fn has_object_data(&self) -> bool {
|
||||||
match self.get_type_and_data() {
|
let elem = self.as_element();
|
||||||
|
let type_and_data = (elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")));
|
||||||
|
match type_and_data {
|
||||||
(None, Some(uri)) => is_image_data(uri),
|
(None, Some(uri)) => is_image_data(uri),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn object_data(&self) -> Option<Url> {
|
fn object_data(&self) -> Option<Url> {
|
||||||
match self.get_type_and_data() {
|
let elem = self.as_element();
|
||||||
|
let type_and_data = (elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")));
|
||||||
|
match type_and_data {
|
||||||
(None, Some(uri)) if is_image_data(uri) => Url::parse(uri).ok(),
|
(None, Some(uri)) if is_image_data(uri) => Url::parse(uri).ok(),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,7 +483,7 @@ pub trait ImmutableFlowUtils {
|
||||||
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
fn need_anonymous_flow(self, child: &Flow) -> bool;
|
||||||
|
|
||||||
/// Generates missing child flow of this flow.
|
/// Generates missing child flow of this flow.
|
||||||
fn generate_missing_child_flow<'ln, N: ThreadSafeLayoutNode<'ln>>(self, node: &N) -> FlowRef;
|
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N) -> FlowRef;
|
||||||
|
|
||||||
/// Returns true if this flow contains fragments that are roots of an absolute flow tree.
|
/// Returns true if this flow contains fragments that are roots of an absolute flow tree.
|
||||||
fn contains_roots_of_absolute_flow_tree(&self) -> bool;
|
fn contains_roots_of_absolute_flow_tree(&self) -> bool;
|
||||||
|
@ -1272,7 +1272,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
/// FIXME(pcwalton): This duplicates some logic in
|
/// FIXME(pcwalton): This duplicates some logic in
|
||||||
/// `generate_anonymous_table_flows_if_necessary()`. We should remove this function eventually,
|
/// `generate_anonymous_table_flows_if_necessary()`. We should remove this function eventually,
|
||||||
/// as it's harder to understand.
|
/// as it's harder to understand.
|
||||||
fn generate_missing_child_flow<'ln, N: ThreadSafeLayoutNode<'ln>>(self, node: &N) -> FlowRef {
|
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N) -> FlowRef {
|
||||||
let mut style = node.style().clone();
|
let mut style = node.style().clone();
|
||||||
match self.class() {
|
match self.class() {
|
||||||
FlowClass::Table | FlowClass::TableRowGroup => {
|
FlowClass::Table | FlowClass::TableRowGroup => {
|
||||||
|
|
|
@ -323,7 +323,7 @@ pub struct CanvasFragmentInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CanvasFragmentInfo {
|
impl CanvasFragmentInfo {
|
||||||
pub fn new<'ln, N: ThreadSafeLayoutNode<'ln>>(node: &N, data: HTMLCanvasData) -> CanvasFragmentInfo {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N, data: HTMLCanvasData) -> CanvasFragmentInfo {
|
||||||
CanvasFragmentInfo {
|
CanvasFragmentInfo {
|
||||||
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node),
|
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node),
|
||||||
renderer_id: data.renderer_id,
|
renderer_id: data.renderer_id,
|
||||||
|
@ -368,8 +368,8 @@ impl ImageFragmentInfo {
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): The fact that image fragments store the cache in the fragment makes little
|
/// FIXME(pcwalton): The fact that image fragments store the cache in the fragment makes little
|
||||||
/// sense to me.
|
/// sense to me.
|
||||||
pub fn new<'ln, N: ThreadSafeLayoutNode<'ln>>(node: &N, url: Option<Url>,
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N, url: Option<Url>,
|
||||||
layout_context: &LayoutContext) -> ImageFragmentInfo {
|
layout_context: &LayoutContext) -> ImageFragmentInfo {
|
||||||
let image_or_metadata = url.and_then(|url| {
|
let image_or_metadata = url.and_then(|url| {
|
||||||
layout_context.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
|
layout_context.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
|
||||||
});
|
});
|
||||||
|
@ -446,8 +446,8 @@ pub struct ReplacedImageFragmentInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReplacedImageFragmentInfo {
|
impl ReplacedImageFragmentInfo {
|
||||||
pub fn new<'ln, N>(node: &N) -> ReplacedImageFragmentInfo
|
pub fn new<N>(node: &N) -> ReplacedImageFragmentInfo
|
||||||
where N: ThreadSafeLayoutNode<'ln> {
|
where N: ThreadSafeLayoutNode {
|
||||||
let is_vertical = node.style().writing_mode.is_vertical();
|
let is_vertical = node.style().writing_mode.is_vertical();
|
||||||
ReplacedImageFragmentInfo {
|
ReplacedImageFragmentInfo {
|
||||||
computed_inline_size: None,
|
computed_inline_size: None,
|
||||||
|
@ -590,7 +590,7 @@ pub struct IframeFragmentInfo {
|
||||||
|
|
||||||
impl IframeFragmentInfo {
|
impl IframeFragmentInfo {
|
||||||
/// Creates the information specific to an iframe fragment.
|
/// Creates the information specific to an iframe fragment.
|
||||||
pub fn new<'ln, N: ThreadSafeLayoutNode<'ln>>(node: &N) -> IframeFragmentInfo {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N) -> IframeFragmentInfo {
|
||||||
let pipeline_id = node.iframe_pipeline_id();
|
let pipeline_id = node.iframe_pipeline_id();
|
||||||
IframeFragmentInfo {
|
IframeFragmentInfo {
|
||||||
pipeline_id: pipeline_id,
|
pipeline_id: pipeline_id,
|
||||||
|
@ -765,7 +765,7 @@ pub struct TableColumnFragmentInfo {
|
||||||
|
|
||||||
impl TableColumnFragmentInfo {
|
impl TableColumnFragmentInfo {
|
||||||
/// Create the information specific to an table column fragment.
|
/// Create the information specific to an table column fragment.
|
||||||
pub fn new<'ln, N: ThreadSafeLayoutNode<'ln>>(node: &N) -> TableColumnFragmentInfo {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N) -> TableColumnFragmentInfo {
|
||||||
let element = node.as_element();
|
let element = node.as_element();
|
||||||
let span = element.get_attr(&ns!(), &atom!("span"))
|
let span = element.get_attr(&ns!(), &atom!("span"))
|
||||||
.and_then(|string| string.parse().ok())
|
.and_then(|string| string.parse().ok())
|
||||||
|
@ -778,7 +778,7 @@ impl TableColumnFragmentInfo {
|
||||||
|
|
||||||
impl Fragment {
|
impl Fragment {
|
||||||
/// Constructs a new `Fragment` instance.
|
/// Constructs a new `Fragment` instance.
|
||||||
pub fn new<'ln, N: ThreadSafeLayoutNode<'ln>>(node: &N, specific: SpecificFragmentInfo) -> Fragment {
|
pub fn new<N: ThreadSafeLayoutNode>(node: &N, specific: SpecificFragmentInfo) -> Fragment {
|
||||||
let style = node.style().clone();
|
let style = node.style().clone();
|
||||||
let writing_mode = style.writing_mode;
|
let writing_mode = style.writing_mode;
|
||||||
|
|
||||||
|
|
|
@ -794,7 +794,7 @@ impl LayoutThread {
|
||||||
possibly_locked_rw_data.block(rw_data);
|
possibly_locked_rw_data.block(rw_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_get_layout_root<'ln, N: LayoutNode<'ln>>(&self, node: N) -> Option<FlowRef> {
|
fn try_get_layout_root<N: LayoutNode>(&self, node: N) -> Option<FlowRef> {
|
||||||
let mut data = match node.mutate_layout_data() {
|
let mut data = match node.mutate_layout_data() {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
None => return None,
|
None => return None,
|
||||||
|
@ -1372,7 +1372,7 @@ impl LayoutThread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn dirty_all_nodes<'ln, N: LayoutNode<'ln>>(node: N) {
|
unsafe fn dirty_all_nodes<N: LayoutNode>(node: N) {
|
||||||
for node in node.traverse_preorder() {
|
for node in node.traverse_preorder() {
|
||||||
// TODO(cgaebel): mark nodes which are sensitive to media queries as
|
// TODO(cgaebel): mark nodes which are sensitive to media queries as
|
||||||
// "changed":
|
// "changed":
|
||||||
|
|
|
@ -284,7 +284,7 @@ impl FragmentBorderBoxIterator for MarginRetrievingFragmentBorderBoxIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_content_box_request<'ln, N: LayoutNode<'ln>>(
|
pub fn process_content_box_request<N: LayoutNode>(
|
||||||
requested_node: N, layout_root: &mut FlowRef) -> Rect<Au> {
|
requested_node: N, layout_root: &mut FlowRef) -> Rect<Au> {
|
||||||
// FIXME(pcwalton): This has not been updated to handle the stacking context relative
|
// FIXME(pcwalton): This has not been updated to handle the stacking context relative
|
||||||
// stuff. So the position is wrong in most cases.
|
// stuff. So the position is wrong in most cases.
|
||||||
|
@ -296,7 +296,7 @@ pub fn process_content_box_request<'ln, N: LayoutNode<'ln>>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_content_boxes_request<'ln, N: LayoutNode<'ln>>(requested_node: N, layout_root: &mut FlowRef)
|
pub fn process_content_boxes_request<N: LayoutNode>(requested_node: N, layout_root: &mut FlowRef)
|
||||||
-> Vec<Rect<Au>> {
|
-> Vec<Rect<Au>> {
|
||||||
// FIXME(pcwalton): This has not been updated to handle the stacking context relative
|
// FIXME(pcwalton): This has not been updated to handle the stacking context relative
|
||||||
// stuff. So the position is wrong in most cases.
|
// stuff. So the position is wrong in most cases.
|
||||||
|
@ -490,14 +490,14 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_node_geometry_request<'ln, N: LayoutNode<'ln>>(requested_node: N, layout_root: &mut FlowRef)
|
pub fn process_node_geometry_request<N: LayoutNode>(requested_node: N, layout_root: &mut FlowRef)
|
||||||
-> Rect<i32> {
|
-> Rect<i32> {
|
||||||
let mut iterator = FragmentLocatingFragmentIterator::new(requested_node.opaque());
|
let mut iterator = FragmentLocatingFragmentIterator::new(requested_node.opaque());
|
||||||
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
||||||
iterator.client_rect
|
iterator.client_rect
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_node_scroll_area_request<'ln, N: LayoutNode<'ln>>(requested_node: N, layout_root: &mut FlowRef)
|
pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layout_root: &mut FlowRef)
|
||||||
-> Rect<i32> {
|
-> Rect<i32> {
|
||||||
let mut iterator = UnioningFragmentScrollAreaIterator::new(requested_node.opaque());
|
let mut iterator = UnioningFragmentScrollAreaIterator::new(requested_node.opaque());
|
||||||
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
||||||
|
@ -529,7 +529,7 @@ pub fn process_node_scroll_area_request<'ln, N: LayoutNode<'ln>>(requested_node:
|
||||||
|
|
||||||
/// Return the resolved value of property for a given (pseudo)element.
|
/// Return the resolved value of property for a given (pseudo)element.
|
||||||
/// https://drafts.csswg.org/cssom/#resolved-value
|
/// https://drafts.csswg.org/cssom/#resolved-value
|
||||||
pub fn process_resolved_style_request<'ln, N: LayoutNode<'ln>>(
|
pub fn process_resolved_style_request<N: LayoutNode>(
|
||||||
requested_node: N, pseudo: &Option<PseudoElement>,
|
requested_node: N, pseudo: &Option<PseudoElement>,
|
||||||
property: &Atom, layout_root: &mut FlowRef) -> Option<String> {
|
property: &Atom, layout_root: &mut FlowRef) -> Option<String> {
|
||||||
let layout_node = requested_node.to_threadsafe();
|
let layout_node = requested_node.to_threadsafe();
|
||||||
|
@ -566,7 +566,7 @@ pub fn process_resolved_style_request<'ln, N: LayoutNode<'ln>>(
|
||||||
// There are probably other quirks.
|
// There are probably other quirks.
|
||||||
let applies = true;
|
let applies = true;
|
||||||
|
|
||||||
fn used_value_for_position_property<'ln, N: LayoutNode<'ln>>(
|
fn used_value_for_position_property<N: LayoutNode>(
|
||||||
layout_node: N::ConcreteThreadSafeLayoutNode,
|
layout_node: N::ConcreteThreadSafeLayoutNode,
|
||||||
layout_root: &mut FlowRef,
|
layout_root: &mut FlowRef,
|
||||||
requested_node: N,
|
requested_node: N,
|
||||||
|
@ -647,7 +647,7 @@ pub fn process_resolved_style_request<'ln, N: LayoutNode<'ln>>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_offset_parent_query<'ln, N: LayoutNode<'ln>>(requested_node: N, layout_root: &mut FlowRef)
|
pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root: &mut FlowRef)
|
||||||
-> OffsetParentResponse {
|
-> OffsetParentResponse {
|
||||||
let mut iterator = ParentOffsetBorderBoxIterator::new(requested_node.opaque());
|
let mut iterator = ParentOffsetBorderBoxIterator::new(requested_node.opaque());
|
||||||
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
||||||
|
@ -668,7 +668,7 @@ pub fn process_offset_parent_query<'ln, N: LayoutNode<'ln>>(requested_node: N, l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_margin_style_query<'ln, N: LayoutNode<'ln>>(requested_node: N)
|
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
|
||||||
-> MarginStyleResponse {
|
-> MarginStyleResponse {
|
||||||
let layout_node = requested_node.to_threadsafe();
|
let layout_node = requested_node.to_threadsafe();
|
||||||
let style = &*layout_node.style();
|
let style = &*layout_node.style();
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub struct TableCellFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TableCellFlow {
|
impl TableCellFlow {
|
||||||
pub fn from_node_fragment_and_visibility_flag<'ln, N: ThreadSafeLayoutNode<'ln>>(
|
pub fn from_node_fragment_and_visibility_flag<N: ThreadSafeLayoutNode>(
|
||||||
node: &N, fragment: Fragment, visible: bool) -> TableCellFlow {
|
node: &N, fragment: Fragment, visible: bool) -> TableCellFlow {
|
||||||
TableCellFlow {
|
TableCellFlow {
|
||||||
block_flow: BlockFlow::from_fragment(fragment, None),
|
block_flow: BlockFlow::from_fragment(fragment, None),
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub struct RecalcStyleAndConstructFlows<'lc> {
|
||||||
root: OpaqueNode,
|
root: OpaqueNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'lc, 'ln> DomTraversalContext<'ln, ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> {
|
impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> {
|
||||||
type SharedContext = SharedLayoutContext;
|
type SharedContext = SharedLayoutContext;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self {
|
fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self {
|
||||||
|
@ -73,7 +73,7 @@ impl<'lc, 'ln> DomTraversalContext<'ln, ServoLayoutNode<'ln>> for RecalcStyleAnd
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A bottom-up, parallelizable traversal.
|
/// A bottom-up, parallelizable traversal.
|
||||||
pub trait PostorderNodeMutTraversal<'ln, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>> {
|
pub trait PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> {
|
||||||
/// The operation to perform. Return true to continue or false to stop.
|
/// The operation to perform. Return true to continue or false to stop.
|
||||||
fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) -> bool;
|
fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ pub trait PostorderNodeMutTraversal<'ln, ConcreteThreadSafeLayoutNode: ThreadSaf
|
||||||
/// The flow construction traversal, which builds flows for styled nodes.
|
/// The flow construction traversal, which builds flows for styled nodes.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn construct_flows_at<'a, 'ln, N: LayoutNode<'ln>>(context: &'a LayoutContext<'a>, root: OpaqueNode, node: N) {
|
fn construct_flows_at<'a, N: LayoutNode>(context: &'a LayoutContext<'a>, root: OpaqueNode, node: N) {
|
||||||
// Construct flows for this node.
|
// Construct flows for this node.
|
||||||
{
|
{
|
||||||
let tnode = node.to_threadsafe();
|
let tnode = node.to_threadsafe();
|
||||||
|
|
|
@ -79,8 +79,8 @@ pub type NonOpaqueStyleAndLayoutData = *mut RefCell<PrivateLayoutData>;
|
||||||
/// A wrapper so that layout can access only the methods that it should have access to. Layout must
|
/// A wrapper so that layout can access only the methods that it should have access to. Layout must
|
||||||
/// only ever see these and must never see instances of `LayoutJS`.
|
/// only ever see these and must never see instances of `LayoutJS`.
|
||||||
|
|
||||||
pub trait LayoutNode<'ln> : TNode<'ln> {
|
pub trait LayoutNode : TNode {
|
||||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>;
|
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode;
|
||||||
fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
||||||
|
|
||||||
/// Returns the type ID of this node.
|
/// Returns the type ID of this node.
|
||||||
|
@ -130,7 +130,7 @@ impl<'ln> ServoLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
impl<'ln> TNode for ServoLayoutNode<'ln> {
|
||||||
type ConcreteElement = ServoLayoutElement<'ln>;
|
type ConcreteElement = ServoLayoutElement<'ln>;
|
||||||
type ConcreteDocument = ServoLayoutDocument<'ln>;
|
type ConcreteDocument = ServoLayoutDocument<'ln>;
|
||||||
type ConcreteRestyleDamage = RestyleDamage;
|
type ConcreteRestyleDamage = RestyleDamage;
|
||||||
|
@ -286,7 +286,7 @@ impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
|
||||||
type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'ln>;
|
type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'ln>;
|
||||||
|
|
||||||
fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode {
|
fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode {
|
||||||
|
@ -364,7 +364,7 @@ pub struct ServoLayoutDocument<'ld> {
|
||||||
chain: PhantomData<&'ld ()>,
|
chain: PhantomData<&'ld ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ld> TDocument<'ld> for ServoLayoutDocument<'ld> {
|
impl<'ld> TDocument for ServoLayoutDocument<'ld> {
|
||||||
type ConcreteNode = ServoLayoutNode<'ld>;
|
type ConcreteNode = ServoLayoutNode<'ld>;
|
||||||
type ConcreteElement = ServoLayoutElement<'ld>;
|
type ConcreteElement = ServoLayoutElement<'ld>;
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ pub struct ServoLayoutElement<'le> {
|
||||||
chain: PhantomData<&'le ()>,
|
chain: PhantomData<&'le ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> TElement<'le> for ServoLayoutElement<'le> {
|
impl<'le> TElement for ServoLayoutElement<'le> {
|
||||||
type ConcreteNode = ServoLayoutNode<'le>;
|
type ConcreteNode = ServoLayoutNode<'le>;
|
||||||
type ConcreteDocument = ServoLayoutDocument<'le>;
|
type ConcreteDocument = ServoLayoutDocument<'le>;
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ impl<'le> TElement<'le> for ServoLayoutElement<'le> {
|
||||||
ServoLayoutNode::from_layout_js(self.element.upcast())
|
ServoLayoutNode::from_layout_js(self.element.upcast())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock> {
|
||||||
unsafe {
|
unsafe {
|
||||||
&*self.element.style_attribute()
|
&*self.element.style_attribute()
|
||||||
}
|
}
|
||||||
|
@ -637,8 +637,8 @@ impl<T> PseudoElementType<T> {
|
||||||
/// A thread-safe version of `LayoutNode`, used during flow construction. This type of layout
|
/// 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.
|
/// node does not allow any parents or siblings of nodes to be accessed, to avoid races.
|
||||||
|
|
||||||
pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
|
pub trait ThreadSafeLayoutNode : Clone + Copy + Sized {
|
||||||
type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<'ln, ConcreteThreadSafeLayoutNode = Self>;
|
type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<ConcreteThreadSafeLayoutNode = Self>;
|
||||||
type ChildrenIterator: Iterator<Item = Self> + Sized;
|
type ChildrenIterator: Iterator<Item = Self> + Sized;
|
||||||
|
|
||||||
/// Creates a new `ThreadSafeLayoutNode` for the same `LayoutNode`
|
/// Creates a new `ThreadSafeLayoutNode` for the same `LayoutNode`
|
||||||
|
@ -788,16 +788,16 @@ pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
|
||||||
|
|
||||||
// This trait is only public so that it can be implemented by the gecko wrapper.
|
// This trait is only public so that it can be implemented by the gecko wrapper.
|
||||||
// It can be used to violate thread-safety, so don't use it elsewhere in layout!
|
// It can be used to violate thread-safety, so don't use it elsewhere in layout!
|
||||||
pub trait DangerousThreadSafeLayoutNode<'ln> : ThreadSafeLayoutNode<'ln> {
|
pub trait DangerousThreadSafeLayoutNode : ThreadSafeLayoutNode {
|
||||||
unsafe fn dangerous_first_child(&self) -> Option<Self>;
|
unsafe fn dangerous_first_child(&self) -> Option<Self>;
|
||||||
unsafe fn dangerous_next_sibling(&self) -> Option<Self>;
|
unsafe fn dangerous_next_sibling(&self) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ThreadSafeLayoutElement<'le>: Clone + Copy + Sized {
|
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized {
|
||||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'le, ConcreteThreadSafeLayoutElement = Self>;
|
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&'le str>;
|
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
@ -808,7 +808,7 @@ pub struct ServoThreadSafeLayoutNode<'ln> {
|
||||||
pseudo: PseudoElementType<display::T>,
|
pseudo: PseudoElementType<display::T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> DangerousThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
|
impl<'ln> DangerousThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
unsafe fn dangerous_first_child(&self) -> Option<Self> {
|
unsafe fn dangerous_first_child(&self) -> Option<Self> {
|
||||||
self.get_jsmanaged().first_child_ref()
|
self.get_jsmanaged().first_child_ref()
|
||||||
.map(|node| self.new_with_this_lifetime(&node))
|
.map(|node| self.new_with_this_lifetime(&node))
|
||||||
|
@ -843,9 +843,9 @@ impl<'ln> ServoThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
|
impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||||
type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>;
|
type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>;
|
||||||
type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator<'ln, Self>;
|
type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator<Self>;
|
||||||
|
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<display::T>) -> ServoThreadSafeLayoutNode<'ln> {
|
fn with_pseudo(&self, pseudo: PseudoElementType<display::T>) -> ServoThreadSafeLayoutNode<'ln> {
|
||||||
ServoThreadSafeLayoutNode {
|
ServoThreadSafeLayoutNode {
|
||||||
|
@ -1031,15 +1031,13 @@ impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ThreadSafeLayoutNodeChildrenIterator<'ln, ConcreteNode: ThreadSafeLayoutNode<'ln>> {
|
pub struct ThreadSafeLayoutNodeChildrenIterator<ConcreteNode: ThreadSafeLayoutNode> {
|
||||||
current_node: Option<ConcreteNode>,
|
current_node: Option<ConcreteNode>,
|
||||||
parent_node: ConcreteNode,
|
parent_node: ConcreteNode,
|
||||||
// Satisfy the compiler about the unused lifetime.
|
|
||||||
phantom: PhantomData<&'ln ()>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, ConcreteNode> ThreadSafeLayoutNodeChildrenIterator<'ln, ConcreteNode>
|
impl<ConcreteNode> ThreadSafeLayoutNodeChildrenIterator<ConcreteNode>
|
||||||
where ConcreteNode: DangerousThreadSafeLayoutNode<'ln> {
|
where ConcreteNode: DangerousThreadSafeLayoutNode {
|
||||||
pub fn new(parent: ConcreteNode) -> Self {
|
pub fn new(parent: ConcreteNode) -> Self {
|
||||||
let first_child: Option<ConcreteNode> = match parent.get_pseudo_element_type() {
|
let first_child: Option<ConcreteNode> = match parent.get_pseudo_element_type() {
|
||||||
PseudoElementType::Normal => {
|
PseudoElementType::Normal => {
|
||||||
|
@ -1052,13 +1050,12 @@ impl<'ln, ConcreteNode> ThreadSafeLayoutNodeChildrenIterator<'ln, ConcreteNode>
|
||||||
ThreadSafeLayoutNodeChildrenIterator {
|
ThreadSafeLayoutNodeChildrenIterator {
|
||||||
current_node: first_child,
|
current_node: first_child,
|
||||||
parent_node: parent,
|
parent_node: parent,
|
||||||
phantom: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<'ln, ConcreteNode>
|
impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNode>
|
||||||
where ConcreteNode: DangerousThreadSafeLayoutNode<'ln> {
|
where ConcreteNode: DangerousThreadSafeLayoutNode {
|
||||||
type Item = ConcreteNode;
|
type Item = ConcreteNode;
|
||||||
fn next(&mut self) -> Option<ConcreteNode> {
|
fn next(&mut self) -> Option<ConcreteNode> {
|
||||||
let node = self.current_node.clone();
|
let node = self.current_node.clone();
|
||||||
|
@ -1094,10 +1091,10 @@ pub struct ServoThreadSafeLayoutElement<'le> {
|
||||||
element: &'le Element,
|
element: &'le Element,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> ThreadSafeLayoutElement<'le> for ServoThreadSafeLayoutElement<'le> {
|
impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
||||||
type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'le>;
|
type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'le>;
|
||||||
|
|
||||||
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&'le str> {
|
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.element.get_attr_val_for_layout(namespace, name)
|
self.element.get_attr_val_for_layout(namespace, name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use selectors::Element;
|
||||||
use selectors::matching::DeclarationBlock;
|
use selectors::matching::DeclarationBlock;
|
||||||
use smallvec::VecLike;
|
use smallvec::VecLike;
|
||||||
use std::cell::{Ref, RefMut};
|
use std::cell::{Ref, RefMut};
|
||||||
use std::marker::PhantomData;
|
|
||||||
use std::ops::BitOr;
|
use std::ops::BitOr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use string_cache::{Atom, Namespace};
|
use string_cache::{Atom, Namespace};
|
||||||
|
@ -48,9 +47,9 @@ pub trait TRestyleDamage : BitOr<Output=Self> + Copy {
|
||||||
fn rebuild_and_reflow() -> Self;
|
fn rebuild_and_reflow() -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TNode<'ln> : Sized + Copy + Clone {
|
pub trait TNode : Sized + Copy + Clone {
|
||||||
type ConcreteElement: TElement<'ln, ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
type ConcreteElement: TElement<ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||||
type ConcreteDocument: TDocument<'ln, ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
type ConcreteDocument: TDocument<ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
||||||
type ConcreteRestyleDamage: TRestyleDamage;
|
type ConcreteRestyleDamage: TRestyleDamage;
|
||||||
|
|
||||||
fn to_unsafe(&self) -> UnsafeNode;
|
fn to_unsafe(&self) -> UnsafeNode;
|
||||||
|
@ -65,22 +64,20 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||||
|
|
||||||
fn dump(self);
|
fn dump(self);
|
||||||
|
|
||||||
fn traverse_preorder(self) -> TreeIterator<'ln, Self> {
|
fn traverse_preorder(self) -> TreeIterator<Self> {
|
||||||
TreeIterator::new(self)
|
TreeIterator::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator over this node's children.
|
/// Returns an iterator over this node's children.
|
||||||
fn children(self) -> ChildrenIterator<'ln, Self> {
|
fn children(self) -> ChildrenIterator<Self> {
|
||||||
ChildrenIterator {
|
ChildrenIterator {
|
||||||
current: self.first_child(),
|
current: self.first_child(),
|
||||||
phantom: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rev_children(self) -> ReverseChildrenIterator<'ln, Self> {
|
fn rev_children(self) -> ReverseChildrenIterator<Self> {
|
||||||
ReverseChildrenIterator {
|
ReverseChildrenIterator {
|
||||||
current: self.last_child(),
|
current: self.last_child(),
|
||||||
phantom: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +166,7 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||||
|
|
||||||
/// Returns the style results for the given node. If CSS selector matching
|
/// Returns the style results for the given node. If CSS selector matching
|
||||||
/// has not yet been performed, fails.
|
/// has not yet been performed, fails.
|
||||||
fn style(&'ln self) -> Ref<Arc<ComputedValues>> {
|
fn style(&self) -> Ref<Arc<ComputedValues>> {
|
||||||
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,9 +176,9 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TDocument<'ld> : Sized + Copy + Clone {
|
pub trait TDocument : Sized + Copy + Clone {
|
||||||
type ConcreteNode: TNode<'ld, ConcreteElement = Self::ConcreteElement, ConcreteDocument = Self>;
|
type ConcreteNode: TNode<ConcreteElement = Self::ConcreteElement, ConcreteDocument = Self>;
|
||||||
type ConcreteElement: TElement<'ld, ConcreteNode = Self::ConcreteNode, ConcreteDocument = Self>;
|
type ConcreteElement: TElement<ConcreteNode = Self::ConcreteNode, ConcreteDocument = Self>;
|
||||||
|
|
||||||
fn as_node(&self) -> Self::ConcreteNode;
|
fn as_node(&self) -> Self::ConcreteNode;
|
||||||
|
|
||||||
|
@ -190,13 +187,13 @@ pub trait TDocument<'ld> : Sized + Copy + Clone {
|
||||||
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, ElementSnapshot)>;
|
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, ElementSnapshot)>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TElement<'le> : Sized + Copy + Clone + ElementExt {
|
pub trait TElement : Sized + Copy + Clone + ElementExt {
|
||||||
type ConcreteNode: TNode<'le, ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||||
type ConcreteDocument: TDocument<'le, ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
||||||
|
|
||||||
fn as_node(&self) -> Self::ConcreteNode;
|
fn as_node(&self) -> Self::ConcreteNode;
|
||||||
|
|
||||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock>;
|
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock>;
|
||||||
|
|
||||||
fn get_state(&self) -> ElementState;
|
fn get_state(&self) -> ElementState;
|
||||||
|
|
||||||
|
@ -248,25 +245,22 @@ pub trait TElement<'le> : Sized + Copy + Clone + ElementExt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
pub struct TreeIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||||
stack: Vec<ConcreteNode>,
|
stack: Vec<ConcreteNode>,
|
||||||
// Satisfy the compiler about the unused lifetime.
|
|
||||||
phantom: PhantomData<&'a ()>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, ConcreteNode> TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
impl<ConcreteNode> TreeIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||||
fn new(root: ConcreteNode) -> TreeIterator<'a, ConcreteNode> {
|
fn new(root: ConcreteNode) -> TreeIterator<ConcreteNode> {
|
||||||
let mut stack = vec!();
|
let mut stack = vec!();
|
||||||
stack.push(root);
|
stack.push(root);
|
||||||
TreeIterator {
|
TreeIterator {
|
||||||
stack: stack,
|
stack: stack,
|
||||||
phantom: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, ConcreteNode> Iterator for TreeIterator<'a, ConcreteNode>
|
impl<ConcreteNode> Iterator for TreeIterator<ConcreteNode>
|
||||||
where ConcreteNode: TNode<'a> {
|
where ConcreteNode: TNode {
|
||||||
type Item = ConcreteNode;
|
type Item = ConcreteNode;
|
||||||
fn next(&mut self) -> Option<ConcreteNode> {
|
fn next(&mut self) -> Option<ConcreteNode> {
|
||||||
let ret = self.stack.pop();
|
let ret = self.stack.pop();
|
||||||
|
@ -275,14 +269,12 @@ impl<'a, ConcreteNode> Iterator for TreeIterator<'a, ConcreteNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ChildrenIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
pub struct ChildrenIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||||
current: Option<ConcreteNode>,
|
current: Option<ConcreteNode>,
|
||||||
// Satisfy the compiler about the unused lifetime.
|
|
||||||
phantom: PhantomData<&'a ()>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, ConcreteNode> Iterator for ChildrenIterator<'a, ConcreteNode>
|
impl<ConcreteNode> Iterator for ChildrenIterator<ConcreteNode>
|
||||||
where ConcreteNode: TNode<'a> {
|
where ConcreteNode: TNode {
|
||||||
type Item = ConcreteNode;
|
type Item = ConcreteNode;
|
||||||
fn next(&mut self) -> Option<ConcreteNode> {
|
fn next(&mut self) -> Option<ConcreteNode> {
|
||||||
let node = self.current;
|
let node = self.current;
|
||||||
|
@ -291,14 +283,12 @@ impl<'a, ConcreteNode> Iterator for ChildrenIterator<'a, ConcreteNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ReverseChildrenIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
pub struct ReverseChildrenIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||||
current: Option<ConcreteNode>,
|
current: Option<ConcreteNode>,
|
||||||
// Satisfy the compiler about the unused lifetime.
|
|
||||||
phantom: PhantomData<&'a ()>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, ConcreteNode> Iterator for ReverseChildrenIterator<'a, ConcreteNode>
|
impl<ConcreteNode> Iterator for ReverseChildrenIterator<ConcreteNode>
|
||||||
where ConcreteNode: TNode<'a> {
|
where ConcreteNode: TNode {
|
||||||
type Item = ConcreteNode;
|
type Item = ConcreteNode;
|
||||||
fn next(&mut self) -> Option<ConcreteNode> {
|
fn next(&mut self) -> Option<ConcreteNode> {
|
||||||
let node = self.current;
|
let node = self.current;
|
||||||
|
|
|
@ -29,7 +29,7 @@ use util::vec::ForgetfulSink;
|
||||||
|
|
||||||
/// High-level interface to CSS selector matching.
|
/// High-level interface to CSS selector matching.
|
||||||
|
|
||||||
fn create_common_style_affecting_attributes_from_element<'le, E: TElement<'le>>(element: &E)
|
fn create_common_style_affecting_attributes_from_element<E: TElement>(element: &E)
|
||||||
-> CommonStyleAffectingAttributes {
|
-> CommonStyleAffectingAttributes {
|
||||||
let mut flags = CommonStyleAffectingAttributes::empty();
|
let mut flags = CommonStyleAffectingAttributes::empty();
|
||||||
for attribute_info in &common_style_affecting_attributes() {
|
for attribute_info in &common_style_affecting_attributes() {
|
||||||
|
@ -212,7 +212,7 @@ impl StyleSharingCandidate {
|
||||||
/// the style sharing candidate or `None` if this node is ineligible for
|
/// the style sharing candidate or `None` if this node is ineligible for
|
||||||
/// style sharing.
|
/// style sharing.
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn new<'le, E: TElement<'le>>(element: &E) -> Option<StyleSharingCandidate> {
|
fn new<E: TElement>(element: &E) -> Option<StyleSharingCandidate> {
|
||||||
let parent_element = match element.parent_element() {
|
let parent_element = match element.parent_element() {
|
||||||
None => return None,
|
None => return None,
|
||||||
Some(parent_element) => parent_element,
|
Some(parent_element) => parent_element,
|
||||||
|
@ -254,11 +254,11 @@ impl StyleSharingCandidate {
|
||||||
link: element.is_link(),
|
link: element.is_link(),
|
||||||
namespace: (*element.get_namespace()).clone(),
|
namespace: (*element.get_namespace()).clone(),
|
||||||
common_style_affecting_attributes:
|
common_style_affecting_attributes:
|
||||||
create_common_style_affecting_attributes_from_element::<'le, E>(&element)
|
create_common_style_affecting_attributes_from_element::<E>(&element)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn can_share_style_with<'a, E: TElement<'a>>(&self, element: &E) -> bool {
|
pub fn can_share_style_with<E: TElement>(&self, element: &E) -> bool {
|
||||||
if *element.get_local_name() != self.local_name {
|
if *element.get_local_name() != self.local_name {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ impl StyleSharingCandidateCache {
|
||||||
self.cache.iter()
|
self.cache.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_if_possible<'le, E: TElement<'le>>(&mut self, element: &E) {
|
pub fn insert_if_possible<E: TElement>(&mut self, element: &E) {
|
||||||
match StyleSharingCandidate::new(element) {
|
match StyleSharingCandidate::new(element) {
|
||||||
None => {}
|
None => {}
|
||||||
Some(candidate) => self.cache.insert(candidate, ())
|
Some(candidate) => self.cache.insert(candidate, ())
|
||||||
|
@ -364,7 +364,7 @@ pub enum StyleSharingResult<ConcreteRestyleDamage: TRestyleDamage> {
|
||||||
StyleWasShared(usize, ConcreteRestyleDamage),
|
StyleWasShared(usize, ConcreteRestyleDamage),
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PrivateMatchMethods<'ln>: TNode<'ln>
|
trait PrivateMatchMethods: TNode
|
||||||
where <Self::ConcreteElement as Element>::Impl: SelectorImplExt {
|
where <Self::ConcreteElement as Element>::Impl: SelectorImplExt {
|
||||||
fn cascade_node_pseudo_element(&self,
|
fn cascade_node_pseudo_element(&self,
|
||||||
context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>,
|
context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>,
|
||||||
|
@ -483,10 +483,10 @@ trait PrivateMatchMethods<'ln>: TNode<'ln>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, N: TNode<'ln>> PrivateMatchMethods<'ln> for N
|
impl<N: TNode> PrivateMatchMethods for N
|
||||||
where <N::ConcreteElement as Element>::Impl: SelectorImplExt {}
|
where <N::ConcreteElement as Element>::Impl: SelectorImplExt {}
|
||||||
|
|
||||||
trait PrivateElementMatchMethods<'le>: TElement<'le> {
|
trait PrivateElementMatchMethods: TElement {
|
||||||
fn share_style_with_candidate_if_possible(&self,
|
fn share_style_with_candidate_if_possible(&self,
|
||||||
parent_node: Option<Self::ConcreteNode>,
|
parent_node: Option<Self::ConcreteNode>,
|
||||||
candidate: &StyleSharingCandidate)
|
candidate: &StyleSharingCandidate)
|
||||||
|
@ -516,9 +516,9 @@ trait PrivateElementMatchMethods<'le>: TElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le, E: TElement<'le>> PrivateElementMatchMethods<'le> for E {}
|
impl<E: TElement> PrivateElementMatchMethods for E {}
|
||||||
|
|
||||||
pub trait ElementMatchMethods<'le> : TElement<'le>
|
pub trait ElementMatchMethods : TElement
|
||||||
where Self::Impl: SelectorImplExt {
|
where Self::Impl: SelectorImplExt {
|
||||||
fn match_element(&self,
|
fn match_element(&self,
|
||||||
stylist: &Stylist<Self::Impl>,
|
stylist: &Stylist<Self::Impl>,
|
||||||
|
@ -552,7 +552,7 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
||||||
style_sharing_candidate_cache:
|
style_sharing_candidate_cache:
|
||||||
&mut StyleSharingCandidateCache,
|
&mut StyleSharingCandidateCache,
|
||||||
parent: Option<Self::ConcreteNode>)
|
parent: Option<Self::ConcreteNode>)
|
||||||
-> StyleSharingResult<<Self::ConcreteNode as TNode<'le>>::ConcreteRestyleDamage> {
|
-> StyleSharingResult<<Self::ConcreteNode as TNode>::ConcreteRestyleDamage> {
|
||||||
if opts::get().disable_share_style_cache {
|
if opts::get().disable_share_style_cache {
|
||||||
return StyleSharingResult::CannotShare
|
return StyleSharingResult::CannotShare
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
||||||
// Yay, cache hit. Share the style.
|
// Yay, cache hit. Share the style.
|
||||||
let node = self.as_node();
|
let node = self.as_node();
|
||||||
let style = &mut node.mutate_data().unwrap().style;
|
let style = &mut node.mutate_data().unwrap().style;
|
||||||
let damage = <<Self as TElement<'le>>::ConcreteNode as TNode<'le>>
|
let damage = <<Self as TElement>::ConcreteNode as TNode>
|
||||||
::ConcreteRestyleDamage::compute((*style).as_ref(), &*shared_style);
|
::ConcreteRestyleDamage::compute((*style).as_ref(), &*shared_style);
|
||||||
*style = Some(shared_style);
|
*style = Some(shared_style);
|
||||||
return StyleSharingResult::StyleWasShared(i, damage)
|
return StyleSharingResult::StyleWasShared(i, damage)
|
||||||
|
@ -583,10 +583,10 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le, E: TElement<'le>> ElementMatchMethods<'le> for E
|
impl<E: TElement> ElementMatchMethods for E
|
||||||
where E::Impl: SelectorImplExt {}
|
where E::Impl: SelectorImplExt {}
|
||||||
|
|
||||||
pub trait MatchMethods<'ln> : TNode<'ln> {
|
pub trait MatchMethods : TNode {
|
||||||
// The below two functions are copy+paste because I can't figure out how to
|
// The below two functions are copy+paste because I can't figure out how to
|
||||||
// write a function which takes a generic function. I don't think it can
|
// write a function which takes a generic function. I don't think it can
|
||||||
// be done.
|
// be done.
|
||||||
|
@ -716,4 +716,4 @@ pub trait MatchMethods<'ln> : TNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln, N: TNode<'ln>> MatchMethods<'ln> for N {}
|
impl<N: TNode> MatchMethods for N {}
|
||||||
|
|
|
@ -39,10 +39,10 @@ pub fn run_queue_with_custom_work_data_type<To, F, SharedContext: Sync>(
|
||||||
queue.run(shared);
|
queue.run(shared);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_dom<'ln, N, C>(root: N,
|
pub fn traverse_dom<N, C>(root: N,
|
||||||
queue_data: &C::SharedContext,
|
queue_data: &C::SharedContext,
|
||||||
queue: &mut WorkQueue<C::SharedContext, WorkQueueData>)
|
queue: &mut WorkQueue<C::SharedContext, WorkQueueData>)
|
||||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
where N: TNode, C: DomTraversalContext<N> {
|
||||||
run_queue_with_custom_work_data_type(queue, |queue| {
|
run_queue_with_custom_work_data_type(queue, |queue| {
|
||||||
queue.push(WorkUnit {
|
queue.push(WorkUnit {
|
||||||
fun: top_down_dom::<N, C>,
|
fun: top_down_dom::<N, C>,
|
||||||
|
@ -53,9 +53,9 @@ pub fn traverse_dom<'ln, N, C>(root: N,
|
||||||
|
|
||||||
/// A parallel top-down DOM traversal.
|
/// A parallel top-down DOM traversal.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn top_down_dom<'ln, N, C>(unsafe_nodes: UnsafeNodeList,
|
fn top_down_dom<N, C>(unsafe_nodes: UnsafeNodeList,
|
||||||
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
||||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
where N: TNode, C: DomTraversalContext<N> {
|
||||||
let context = C::new(proxy.user_data(), unsafe_nodes.1);
|
let context = C::new(proxy.user_data(), unsafe_nodes.1);
|
||||||
|
|
||||||
let mut discovered_child_nodes = Vec::new();
|
let mut discovered_child_nodes = Vec::new();
|
||||||
|
@ -105,10 +105,10 @@ fn top_down_dom<'ln, N, C>(unsafe_nodes: UnsafeNodeList,
|
||||||
///
|
///
|
||||||
/// The only communication between siblings is that they both
|
/// The only communication between siblings is that they both
|
||||||
/// fetch-and-subtract the parent's children count.
|
/// fetch-and-subtract the parent's children count.
|
||||||
fn bottom_up_dom<'ln, N, C>(root: OpaqueNode,
|
fn bottom_up_dom<N, C>(root: OpaqueNode,
|
||||||
unsafe_node: UnsafeNode,
|
unsafe_node: UnsafeNode,
|
||||||
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
||||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
where N: TNode, C: DomTraversalContext<N> {
|
||||||
let context = C::new(proxy.user_data(), root);
|
let context = C::new(proxy.user_data(), root);
|
||||||
|
|
||||||
// Get a real layout node.
|
// Get a real layout node.
|
||||||
|
|
|
@ -248,7 +248,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
/// The returned boolean indicates whether the style is *shareable*; that is, whether the
|
/// The returned boolean indicates whether the style is *shareable*; that is, whether the
|
||||||
/// matched selectors are simple enough to allow the matching logic to be reduced to the logic
|
/// matched selectors are simple enough to allow the matching logic to be reduced to the logic
|
||||||
/// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`.
|
/// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`.
|
||||||
pub fn push_applicable_declarations<'le, E, V>(
|
pub fn push_applicable_declarations<E, V>(
|
||||||
&self,
|
&self,
|
||||||
element: &E,
|
element: &E,
|
||||||
parent_bf: Option<&BloomFilter>,
|
parent_bf: Option<&BloomFilter>,
|
||||||
|
@ -256,7 +256,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
||||||
pseudo_element: Option<Impl::PseudoElement>,
|
pseudo_element: Option<Impl::PseudoElement>,
|
||||||
applicable_declarations: &mut V)
|
applicable_declarations: &mut V)
|
||||||
-> bool
|
-> bool
|
||||||
where E: Element<Impl=Impl> + TElement<'le>,
|
where E: Element<Impl=Impl> + TElement,
|
||||||
V: VecLike<DeclarationBlock> {
|
V: VecLike<DeclarationBlock> {
|
||||||
assert!(!self.is_device_dirty);
|
assert!(!self.is_device_dirty);
|
||||||
assert!(style_attribute.is_none() || pseudo_element.is_none(),
|
assert!(style_attribute.is_none() || pseudo_element.is_none(),
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
use dom::TNode;
|
use dom::TNode;
|
||||||
use traversal::DomTraversalContext;
|
use traversal::DomTraversalContext;
|
||||||
|
|
||||||
pub fn traverse_dom<'ln, N, C>(root: N,
|
pub fn traverse_dom<N, C>(root: N,
|
||||||
shared: &C::SharedContext)
|
shared: &C::SharedContext)
|
||||||
where N: TNode<'ln>,
|
where N: TNode,
|
||||||
C: DomTraversalContext<'ln, N> {
|
C: DomTraversalContext<N> {
|
||||||
fn doit<'a, 'ln, N, C>(context: &'a C, node: N)
|
fn doit<'a, N, C>(context: &'a C, node: N)
|
||||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
where N: TNode, C: DomTraversalContext<N> {
|
||||||
context.process_preorder(node);
|
context.process_preorder(node);
|
||||||
|
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
|
|
|
@ -43,11 +43,11 @@ thread_local!(
|
||||||
///
|
///
|
||||||
/// If one does not exist, a new one will be made for you. If it is out of date,
|
/// If one does not exist, a new one will be made for you. If it is out of date,
|
||||||
/// it will be cleared and reused.
|
/// it will be cleared and reused.
|
||||||
fn take_thread_local_bloom_filter<'ln, N, Impl: SelectorImplExt>(parent_node: Option<N>,
|
fn take_thread_local_bloom_filter<N, Impl: SelectorImplExt>(parent_node: Option<N>,
|
||||||
root: OpaqueNode,
|
root: OpaqueNode,
|
||||||
context: &SharedStyleContext<Impl>)
|
context: &SharedStyleContext<Impl>)
|
||||||
-> Box<BloomFilter>
|
-> Box<BloomFilter>
|
||||||
where N: TNode<'ln> {
|
where N: TNode {
|
||||||
STYLE_BLOOM.with(|style_bloom| {
|
STYLE_BLOOM.with(|style_bloom| {
|
||||||
match (parent_node, style_bloom.borrow_mut().take()) {
|
match (parent_node, style_bloom.borrow_mut().take()) {
|
||||||
// Root node. Needs new bloom filter.
|
// Root node. Needs new bloom filter.
|
||||||
|
@ -90,10 +90,10 @@ pub fn put_thread_local_bloom_filter<Impl: SelectorImplExt>(bf: Box<BloomFilter>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "Ancestors" in this context is inclusive of ourselves.
|
/// "Ancestors" in this context is inclusive of ourselves.
|
||||||
fn insert_ancestors_into_bloom_filter<'ln, N>(bf: &mut Box<BloomFilter>,
|
fn insert_ancestors_into_bloom_filter<N>(bf: &mut Box<BloomFilter>,
|
||||||
mut n: N,
|
mut n: N,
|
||||||
root: OpaqueNode)
|
root: OpaqueNode)
|
||||||
where N: TNode<'ln> {
|
where N: TNode {
|
||||||
debug!("[{}] Inserting ancestors.", tid());
|
debug!("[{}] Inserting ancestors.", tid());
|
||||||
let mut ancestors = 0;
|
let mut ancestors = 0;
|
||||||
loop {
|
loop {
|
||||||
|
@ -108,7 +108,7 @@ fn insert_ancestors_into_bloom_filter<'ln, N>(bf: &mut Box<BloomFilter>,
|
||||||
debug!("[{}] Inserted {} ancestors.", tid(), ancestors);
|
debug!("[{}] Inserted {} ancestors.", tid(), ancestors);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait DomTraversalContext<'ln, N: TNode<'ln>> {
|
pub trait DomTraversalContext<N: TNode> {
|
||||||
type SharedContext: Sync + 'static;
|
type SharedContext: Sync + 'static;
|
||||||
fn new<'a>(&'a Self::SharedContext, OpaqueNode) -> Self;
|
fn new<'a>(&'a Self::SharedContext, OpaqueNode) -> Self;
|
||||||
fn process_preorder(&self, node: N);
|
fn process_preorder(&self, node: N);
|
||||||
|
@ -119,10 +119,10 @@ pub trait DomTraversalContext<'ln, N: TNode<'ln>> {
|
||||||
/// layout computation. This computes the styles applied to each node.
|
/// layout computation. This computes the styles applied to each node.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn recalc_style_at<'a, 'ln, N, C>(context: &'a C,
|
pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
||||||
root: OpaqueNode,
|
root: OpaqueNode,
|
||||||
node: N)
|
node: N)
|
||||||
where N: TNode<'ln>,
|
where N: TNode,
|
||||||
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>,
|
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>,
|
||||||
<N::ConcreteElement as Element>::Impl: SelectorImplExt + 'a {
|
<N::ConcreteElement as Element>::Impl: SelectorImplExt + 'a {
|
||||||
// Initialize layout data.
|
// Initialize layout data.
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub struct RecalcStyleOnly<'lc> {
|
||||||
root: OpaqueNode,
|
root: OpaqueNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'lc, 'ln, N: TNode<'ln>> DomTraversalContext<'ln, N> for RecalcStyleOnly<'lc>
|
impl<'lc, N: TNode> DomTraversalContext<N> for RecalcStyleOnly<'lc>
|
||||||
where N::ConcreteElement: ::selectors::Element<Impl=GeckoSelectorImpl> {
|
where N::ConcreteElement: ::selectors::Element<Impl=GeckoSelectorImpl> {
|
||||||
type SharedContext = SharedStyleContext;
|
type SharedContext = SharedStyleContext;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl BitOr for DummyRestyleDamage {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl<'ln> TNode<'ln> for GeckoNode<'ln> {
|
impl<'ln> TNode for GeckoNode<'ln> {
|
||||||
type ConcreteDocument = GeckoDocument<'ln>;
|
type ConcreteDocument = GeckoDocument<'ln>;
|
||||||
type ConcreteElement = GeckoElement<'ln>;
|
type ConcreteElement = GeckoElement<'ln>;
|
||||||
type ConcreteRestyleDamage = DummyRestyleDamage;
|
type ConcreteRestyleDamage = DummyRestyleDamage;
|
||||||
|
@ -268,7 +268,7 @@ impl<'ld> GeckoDocument<'ld> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ld> TDocument<'ld> for GeckoDocument<'ld> {
|
impl<'ld> TDocument for GeckoDocument<'ld> {
|
||||||
type ConcreteNode = GeckoNode<'ld>;
|
type ConcreteNode = GeckoNode<'ld>;
|
||||||
type ConcreteElement = GeckoElement<'ld>;
|
type ConcreteElement = GeckoElement<'ld>;
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ impl<'le> GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> TElement<'le> for GeckoElement<'le> {
|
impl<'le> TElement for GeckoElement<'le> {
|
||||||
type ConcreteNode = GeckoNode<'le>;
|
type ConcreteNode = GeckoNode<'le>;
|
||||||
type ConcreteDocument = GeckoDocument<'le>;
|
type ConcreteDocument = GeckoDocument<'le>;
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ impl<'le> TElement<'le> for GeckoElement<'le> {
|
||||||
unsafe { GeckoNode::from_raw(self.element as *mut RawGeckoNode) }
|
unsafe { GeckoNode::from_raw(self.element as *mut RawGeckoNode) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock> {
|
||||||
panic!("Requires signature modification - only implemented in stylo branch");
|
panic!("Requires signature modification - only implemented in stylo branch");
|
||||||
/*
|
/*
|
||||||
// FIXME(bholley): We should do what Servo does here. Gecko needs to
|
// FIXME(bholley): We should do what Servo does here. Gecko needs to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue