aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_wrapper.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-07-29 14:17:56 -0700
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-08-03 13:31:11 -0700
commit6d67525172811f203220f02defa7b4635e6414c8 (patch)
treef74270fd8193800fd8c10b74d211ebfe162a2a2c /components/script/layout_wrapper.rs
parent1470d5b17443a74ebcb1f9be42f7daa124f7b01a (diff)
downloadservo-6d67525172811f203220f02defa7b4635e6414c8.tar.gz
servo-6d67525172811f203220f02defa7b4635e6414c8.zip
style: Refactor TRestyleDamage and TNode to accept/provide a "style source"
In the Gecko case, this style source would be the style context. In the servo case, it will be always the computed values. We could optimise this further in the case of stylo (from three FFI calls to one) if we use an API of the form CalcAndStore(node, new_cv). But that would imply borrowing the data twice from Servo (we also have borrow_data_unchecked fwiw, but...).
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r--components/script/layout_wrapper.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index bfd7a8273d9..6dcfc06884f 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -51,6 +51,7 @@ use selectors::matching::{DeclarationBlock, ElementFlags};
use selectors::parser::{AttrSelector, NamespaceConstraint};
use std::marker::PhantomData;
use std::mem::{transmute, transmute_copy};
+use std::sync::Arc;
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
use style::attr::AttrValue;
use style::computed_values::display;
@@ -58,7 +59,7 @@ use style::context::SharedStyleContext;
use style::data::PrivateStyleData;
use style::dom::{PresentationalHintsSynthetizer, OpaqueNode, TDocument, TElement, TNode, UnsafeNode};
use style::element_state::*;
-use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
+use style::properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
use style::refcell::{Ref, RefCell, RefMut};
use style::selector_impl::{ElementSnapshot, NonTSPseudoClass, ServoSelectorImpl};
use style::sink::Push;
@@ -262,6 +263,13 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
}
}
+
+ #[inline]
+ fn existing_style_for_restyle_damage<'a>(&'a self,
+ current_cv: Option<&'a Arc<ComputedValues>>)
+ -> Option<&'a Arc<ComputedValues>> {
+ current_cv
+ }
}
impl<'ln> LayoutNode for ServoLayoutNode<'ln> {