mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Simplify rust-selectors API for attribute selectors
This commit is contained in:
parent
2ca2c2d2be
commit
83c7824fda
15 changed files with 447 additions and 480 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue