style: Add infrastructure for non-eagerly-cascaded pseudo-elements

This commit also removes StylistWrapper and uses Arc::get_mut instead.
This commit is contained in:
Emilio Cobos Álvarez 2016-04-22 16:05:41 +02:00
parent 2dacbc6fb3
commit b6402a81d0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 188 additions and 78 deletions

View file

@ -72,7 +72,7 @@ use style::properties::{ComputedValues, ServoComputedValues};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
use style::restyle_hints::ElementSnapshot;
use style::selector_impl::{NonTSPseudoClass, PseudoElement, ServoSelectorImpl};
use style::servo::PrivateStyleData;
use style::servo::{PrecomputedStyleData, PrivateStyleData};
use url::Url;
use util::str::is_whitespace;
@ -168,11 +168,11 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
OpaqueNodeMethods::from_jsmanaged(unsafe { self.get_jsmanaged() })
}
fn initialize_data(self) {
fn initialize_data(self, precomputed: &Arc<PrecomputedStyleData>) {
let has_data = unsafe { self.borrow_data_unchecked().is_some() };
if !has_data {
let ptr: NonOpaqueStyleAndLayoutData =
Box::into_raw(box RefCell::new(PrivateLayoutData::new()));
Box::into_raw(box RefCell::new(PrivateLayoutData::new(precomputed.clone())));
let opaque = OpaqueStyleAndLayoutData {
ptr: unsafe { NonZero::new(ptr as *mut ()) }
};
@ -707,9 +707,10 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
})
}
// TODO(emilio): Since the ::-details-* pseudos are internal, just affecting one element, and
// only changing `display` property when the element `open` attribute changes, this should be
// eligible for not being cascaded eagerly, reading the display property from layout instead.
// TODO(emilio): Since the ::-details-* pseudos are internal, just affecting
// one element, and only changing `display` property when the element `open`
// attribute changes, this should be eligible for not being cascaded
// eagerly, reading the display property from layout instead.
#[inline]
fn get_details_summary_pseudo(&self) -> Option<Self> {
if self.is_element() &&