mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Log element during selector matching
MozReview-Commit-ID: D8eFyRCy5BR
This commit is contained in:
parent
eaefcbe551
commit
6b1b8bbee8
8 changed files with 35 additions and 2 deletions
|
@ -25,6 +25,7 @@ gecko_like_types = []
|
|||
bitflags = "0.7"
|
||||
matches = "0.1"
|
||||
cssparser = "0.13.7"
|
||||
log = "0.3"
|
||||
fnv = "1.0"
|
||||
phf = "0.7.18"
|
||||
precomputed-hash = "0.1"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#[macro_use] extern crate bitflags;
|
||||
#[macro_use] extern crate cssparser;
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate matches;
|
||||
extern crate fnv;
|
||||
extern crate phf;
|
||||
|
|
|
@ -198,7 +198,7 @@ fn may_match<E>(hashes: &AncestorHashes,
|
|||
/// and `is_unvisited` are based on relevant link state of only the current
|
||||
/// complex selector being matched (not the global relevant link status for all
|
||||
/// selectors in `MatchingContext`).
|
||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub enum RelevantLinkStatus {
|
||||
/// Looking for a possible relevant link. This is the initial mode when
|
||||
/// matching a selector.
|
||||
|
@ -429,6 +429,9 @@ fn matches_complex_selector_internal<E, F>(mut selector_iter: SelectorIter<E::Im
|
|||
matches_simple_selector(simple, element, context, &relevant_link, flags_setter)
|
||||
});
|
||||
|
||||
debug!("Matching for {:?}, simple selector {:?}, relevant link {:?}",
|
||||
element, selector_iter, relevant_link);
|
||||
|
||||
let combinator = selector_iter.next_sequence();
|
||||
let siblings = combinator.map_or(false, |c| c.is_sibling());
|
||||
if siblings {
|
||||
|
|
|
@ -453,6 +453,16 @@ impl<'a, Impl: SelectorImpl> Iterator for SelectorIter<'a, Impl> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, Impl: SelectorImpl> fmt::Debug for SelectorIter<'a, Impl> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let iter = self.iter.clone().rev();
|
||||
for component in iter {
|
||||
component.to_css(f)?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator over all simple selectors belonging to ancestors.
|
||||
pub struct AncestorIter<'a, Impl: 'a + SelectorImpl>(SelectorIter<'a, Impl>);
|
||||
impl<'a, Impl: 'a + SelectorImpl> AncestorIter<'a, Impl> {
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
use attr::{AttrSelectorOperation, NamespaceConstraint};
|
||||
use matching::{ElementSelectorFlags, MatchingContext, RelevantLinkStatus};
|
||||
use parser::SelectorImpl;
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub trait Element: Sized {
|
||||
pub trait Element: Sized + Debug {
|
||||
type Impl: SelectorImpl;
|
||||
|
||||
fn parent_element(&self) -> Option<Self>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue