Simplify rust-selectors API for attribute selectors

This commit is contained in:
Simon Sapin 2017-05-17 19:41:21 +02:00
parent 2ca2c2d2be
commit 83c7824fda
15 changed files with 447 additions and 480 deletions

View file

@ -12,6 +12,8 @@ use cssparser::{self, Color, RGBA};
use euclid::num::Zero;
use num_traits::ToPrimitive;
use properties::PropertyDeclarationBlock;
use selector_parser::SelectorImpl;
use selectors::attr::AttrSelectorOperation;
use servo_url::ServoUrl;
use shared_lock::Locked;
use std::ascii::AsciiExt;
@ -349,6 +351,12 @@ impl AttrValue {
panic!("Uint not found");
}
}
pub fn eval_selector(&self, selector: &AttrSelectorOperation<SelectorImpl>) -> bool {
// FIXME(SimonSapin) this can be more efficient by matching on `(self, selector)` variants
// and doing Atom comparisons instead of string comparisons where possible.
selector.eval_str(self)
}
}
impl ::std::ops::Deref for AttrValue {