Stop using associated types for the concrete ElementSnapshot implementation.

MozReview-Commit-ID: LS23s2RbMBg
This commit is contained in:
Bobby Holley 2016-11-02 13:17:34 -07:00
parent 9588065120
commit b69fdad8e4
9 changed files with 28 additions and 30 deletions

View file

@ -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()