diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-07 16:31:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-07 16:31:10 -0600 |
commit | d8ac5100e81ccbad4b5131688b96bedb9b5e279d (patch) | |
tree | 50e4518ec7459d74feeb6b4ea15f453238af31f1 /components/script | |
parent | f1c3e97fb47b6fbe1d82ebb30a38ab7afd4fe0b8 (diff) | |
parent | a2c7a9d0fb7174f9188640ba2fb5a3df7821c1a8 (diff) | |
download | servo-d8ac5100e81ccbad4b5131688b96bedb9b5e279d.tar.gz servo-d8ac5100e81ccbad4b5131688b96bedb9b5e279d.zip |
Auto merge of #14034 - bholley:more_concrete_types, r=emilio
incremental restyle: Use more concrete types in the style system
We need to hang both snapshots and restyle damage off of ElementData, and so we need them to be concrete to avoid infecting ElementData with the trait hierarchy.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14034)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 4 | ||||
-rw-r--r-- | components/script/dom/document.rs | 12 | ||||
-rw-r--r-- | components/script/layout_wrapper.rs | 6 |
3 files changed, 10 insertions, 12 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 59a6178e462..67c2721f973 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -94,7 +94,7 @@ use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto}; use style::element_state::*; use style::media_queries::MediaQueryList; use style::properties::PropertyDeclarationBlock; -use style::selector_impl::{ElementSnapshot, PseudoElement}; +use style::selector_impl::{PseudoElement, Snapshot}; use style::values::specified::Length; use time::Duration; use url::Origin as UrlOrigin; @@ -346,7 +346,7 @@ no_jsmanaged_fields!(DOMString); no_jsmanaged_fields!(Mime); no_jsmanaged_fields!(AttrIdentifier); no_jsmanaged_fields!(AttrValue); -no_jsmanaged_fields!(ElementSnapshot); +no_jsmanaged_fields!(Snapshot); no_jsmanaged_fields!(HttpsState); no_jsmanaged_fields!(Request); no_jsmanaged_fields!(SharedRt); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index cb8a2d37cf9..5b1f4cfe404 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -125,7 +125,7 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use style::attr::AttrValue; use style::context::ReflowGoal; -use style::selector_impl::ElementSnapshot; +use style::selector_impl::Snapshot; use style::str::{split_html_space_chars, str_join}; use style::stylesheets::Stylesheet; use time; @@ -236,7 +236,7 @@ pub struct Document { appropriate_template_contents_owner_document: MutNullableHeap<JS<Document>>, /// For each element that has had a state or attribute change since the last restyle, /// track the original condition of the element. - modified_elements: DOMRefCell<HashMap<JS<Element>, ElementSnapshot>>, + modified_elements: DOMRefCell<HashMap<JS<Element>, Snapshot>>, /// This flag will be true if layout suppressed a reflow attempt that was /// needed in order for the page to be painted. needs_paint: Cell<bool>, @@ -1708,7 +1708,7 @@ pub enum DocumentSource { #[allow(unsafe_code)] pub trait LayoutDocumentHelpers { unsafe fn is_html_document_for_layout(&self) -> bool; - unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, ElementSnapshot)>; + unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, Snapshot)>; unsafe fn needs_paint_from_layout(&self); unsafe fn will_paint(&self); } @@ -1722,7 +1722,7 @@ impl LayoutDocumentHelpers for LayoutJS<Document> { #[inline] #[allow(unrooted_must_root)] - unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, ElementSnapshot)> { + unsafe fn drain_modified_elements(&self) -> Vec<(LayoutJS<Element>, Snapshot)> { let mut elements = (*self.unsafe_get()).modified_elements.borrow_mut_for_layout(); let result = elements.drain().map(|(k, v)| (k.to_layout(), v)).collect(); result @@ -1970,7 +1970,7 @@ impl Document { let mut map = self.modified_elements.borrow_mut(); let snapshot = map.entry(JS::from_ref(el)) .or_insert_with(|| { - ElementSnapshot::new(el.html_element_in_html_document()) + Snapshot::new(el.html_element_in_html_document()) }); if snapshot.state.is_none() { snapshot.state = Some(el.state()); @@ -1981,7 +1981,7 @@ impl Document { let mut map = self.modified_elements.borrow_mut(); let mut snapshot = map.entry(JS::from_ref(el)) .or_insert_with(|| { - ElementSnapshot::new(el.html_element_in_html_document()) + Snapshot::new(el.html_element_in_html_document()) }); if snapshot.attrs.is_none() { let attrs = el.attrs() diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index c83e8232a40..00c7ce1413c 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -46,7 +46,6 @@ use parking_lot::RwLock; use range::Range; use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress}; use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData}; -use script_layout_interface::restyle_damage::RestyleDamage; use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutElement, LayoutNode}; use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode}; use selectors::matching::ElementFlags; @@ -66,7 +65,7 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthe use style::dom::{TRestyleDamage, UnsafeNode}; use style::element_state::*; use style::properties::{ComputedValues, PropertyDeclarationBlock}; -use style::selector_impl::{ElementSnapshot, NonTSPseudoClass, PseudoElement, ServoSelectorImpl}; +use style::selector_impl::{NonTSPseudoClass, PseudoElement, RestyleDamage, ServoSelectorImpl, Snapshot}; use style::selector_matching::ApplicableDeclarationBlock; use style::sink::Push; use style::str::is_whitespace; @@ -382,7 +381,7 @@ impl<'ld> TDocument for ServoLayoutDocument<'ld> { self.as_node().children().find(ServoLayoutNode::is_element) } - fn drain_modified_elements(&self) -> Vec<(ServoLayoutElement<'ld>, ElementSnapshot)> { + fn drain_modified_elements(&self) -> Vec<(ServoLayoutElement<'ld>, Snapshot)> { let elements = unsafe { self.document.drain_modified_elements() }; elements.into_iter().map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot)).collect() } @@ -435,7 +434,6 @@ impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> { impl<'le> TElement for ServoLayoutElement<'le> { type ConcreteNode = ServoLayoutNode<'le>; type ConcreteDocument = ServoLayoutDocument<'le>; - type ConcreteRestyleDamage = RestyleDamage; fn as_node(&self) -> ServoLayoutNode<'le> { ServoLayoutNode::from_layout_js(self.element.upcast()) |