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

@ -14,7 +14,7 @@ use parking_lot::RwLock;
use properties::{ComputedValues, PropertyDeclarationBlock};
use properties::longhands::display::computed_value as display;
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
use selector_impl::{ElementExt, PseudoElement};
use selector_impl::{ElementExt, PseudoElement, Snapshot};
use selector_matching::ApplicableDeclarationBlock;
use sink::Push;
use std::fmt::Debug;
@ -159,8 +159,7 @@ pub trait TDocument : Sized + Copy + Clone {
fn root_node(&self) -> Option<Self::ConcreteNode>;
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement,
<Self::ConcreteElement as ElementExt>::Snapshot)>;
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, Snapshot)>;
fn needs_paint_from_layout(&self);
fn will_paint(&self);

View file

@ -691,8 +691,6 @@ impl<'le> ::selectors::MatchAttr for GeckoElement<'le> {
}
impl<'le> ElementExt for GeckoElement<'le> {
type Snapshot = GeckoElementSnapshot;
#[inline]
fn is_link(&self) -> bool {
self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink)

View file

@ -8,7 +8,7 @@ use Atom;
use element_state::*;
#[cfg(feature = "servo")]
use heapsize::HeapSizeOf;
use selector_impl::{AttrValue, ElementExt, NonTSPseudoClass, TheSelectorImpl};
use selector_impl::{AttrValue, ElementExt, NonTSPseudoClass, Snapshot, TheSelectorImpl};
use selectors::{Element, MatchAttr};
use selectors::matching::{MatchingReason, StyleRelations};
use selectors::matching::matches_complex_selector;
@ -85,7 +85,7 @@ struct ElementWrapper<'a, E>
where E: ElementExt
{
element: E,
snapshot: Option<&'a E::Snapshot>,
snapshot: Option<&'a Snapshot>,
}
impl<'a, E> ElementWrapper<'a, E>
@ -95,7 +95,7 @@ impl<'a, E> ElementWrapper<'a, E>
ElementWrapper { element: el, snapshot: None }
}
pub fn new_with_snapshot(el: E, snapshot: &'a E::Snapshot) -> ElementWrapper<'a, E> {
pub fn new_with_snapshot(el: E, snapshot: &'a Snapshot) -> ElementWrapper<'a, E> {
ElementWrapper { element: el, snapshot: Some(snapshot) }
}
}
@ -424,7 +424,7 @@ impl DependencySet {
}
pub fn compute_hint<E>(&self, el: &E,
snapshot: &E::Snapshot,
snapshot: &Snapshot,
current_state: ElementState)
-> RestyleHint
where E: ElementExt + Clone

View file

@ -5,7 +5,6 @@
//! The pseudo-classes and pseudo-elements supported by the style system.
use matching::{common_style_affecting_attributes, CommonStyleAffectingAttributeMode};
use restyle_hints;
use selectors::Element;
use selectors::parser::{AttrSelector, SelectorImpl};
@ -14,14 +13,20 @@ pub type AttrValue = <TheSelectorImpl as SelectorImpl>::AttrValue;
#[cfg(feature = "servo")]
pub use servo_selector_impl::*;
#[cfg(feature = "servo")]
pub use servo_selector_impl::{ServoSelectorImpl as TheSelectorImpl, ServoElementSnapshot as ElementSnapshot};
#[cfg(feature = "gecko")]
pub use gecko::selector_impl::*;
#[cfg(feature = "servo")]
pub use servo_selector_impl::ServoSelectorImpl as TheSelectorImpl;
#[cfg(feature = "gecko")]
pub use gecko::selector_impl::{GeckoSelectorImpl as TheSelectorImpl};
pub use gecko::selector_impl::GeckoSelectorImpl as TheSelectorImpl;
#[cfg(feature = "servo")]
pub use servo_selector_impl::ServoElementSnapshot as Snapshot;
#[cfg(feature = "gecko")]
pub use gecko::snapshot::GeckoElementSnapshot as Snapshot;
/// This function determines if a pseudo-element is eagerly cascaded or not.
///
@ -71,8 +76,6 @@ impl PseudoElementCascadeType {
}
pub trait ElementExt: Element<Impl=TheSelectorImpl> {
type Snapshot: restyle_hints::ElementSnapshot + 'static;
fn is_link(&self) -> bool;
}

View file

@ -16,7 +16,7 @@ use properties::{PropertyDeclaration, PropertyDeclarationBlock};
use quickersort::sort_by;
use restyle_hints::{RestyleHint, DependencySet};
use rule_tree::{RuleTree, StrongRuleNode, StyleSource};
use selector_impl::{ElementExt, TheSelectorImpl, PseudoElement};
use selector_impl::{ElementExt, TheSelectorImpl, PseudoElement, Snapshot};
use selectors::Element;
use selectors::bloom::BloomFilter;
use selectors::matching::{AFFECTED_BY_STYLE_ATTRIBUTE, AFFECTED_BY_PRESENTATIONAL_HINTS};
@ -611,7 +611,7 @@ impl Stylist {
}
pub fn compute_restyle_hint<E>(&self, element: &E,
snapshot: &E::Snapshot,
snapshot: &Snapshot,
// NB: We need to pass current_state as an argument because
// selectors::Element doesn't provide access to ElementState
// directly, and computing it from the ElementState would be

View file

@ -384,8 +384,6 @@ impl MatchAttrGeneric for ServoElementSnapshot {
}
impl<E: Element<Impl=TheSelectorImpl>> ElementExt for E {
type Snapshot = ServoElementSnapshot;
fn is_link(&self) -> bool {
self.match_non_ts_pseudo_class(NonTSPseudoClass::AnyLink)
}