mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Stop using associated types for the concrete ElementSnapshot implementation.
MozReview-Commit-ID: LS23s2RbMBg
This commit is contained in:
parent
9588065120
commit
b69fdad8e4
9 changed files with 28 additions and 30 deletions
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -66,7 +66,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, ServoSelectorImpl, Snapshot};
|
||||
use style::selector_matching::ApplicableDeclarationBlock;
|
||||
use style::sink::Push;
|
||||
use style::str::is_whitespace;
|
||||
|
@ -382,7 +382,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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue