mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
stylo: Implement Element.matches using stylo.
Bug: 1404897 Reviewed-by: heycam MozReview-Commit-ID: 7nxYVcweu0W Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
c65e7d607a
commit
6fc967f3f9
1 changed files with 20 additions and 2 deletions
|
@ -6,7 +6,7 @@ use cssparser::{Parser, ParserInput};
|
|||
use cssparser::ToCss as ParserToCss;
|
||||
use env_logger::LogBuilder;
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
use selectors::Element;
|
||||
use selectors::{self, Element};
|
||||
use selectors::matching::{MatchingContext, MatchingMode, matches_selector};
|
||||
use servo_arc::{Arc, ArcBorrow, RawOffsetArc};
|
||||
use std::cell::RefCell;
|
||||
|
@ -1522,6 +1522,22 @@ pub extern "C" fn Servo_StyleRule_SelectorMatchesElement(rule: RawServoStyleRule
|
|||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_SelectorList_Matches(
|
||||
element: RawGeckoElementBorrowed,
|
||||
selectors: &::selectors::SelectorList<SelectorImpl>,
|
||||
) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
let mut context = MatchingContext::new(
|
||||
MatchingMode::Normal,
|
||||
None,
|
||||
None,
|
||||
element.owner_document_quirks_mode(),
|
||||
);
|
||||
|
||||
selectors::matching::matches_selector_list(selectors, &element, &mut context)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed, result: *mut nsAString) {
|
||||
read_locked_arc(rule, |rule: &ImportRule| {
|
||||
|
@ -4104,7 +4120,9 @@ pub extern "C" fn Servo_CorruptRuleHashAndCrash(set: RawServoStyleSetBorrowed, i
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_SelectorList_Parse(selector_list: *const nsACString) -> *mut ::selectors::SelectorList<SelectorImpl> {
|
||||
pub unsafe extern "C" fn Servo_SelectorList_Parse(
|
||||
selector_list: *const nsACString,
|
||||
) -> *mut ::selectors::SelectorList<SelectorImpl> {
|
||||
use style::selector_parser::SelectorParser;
|
||||
|
||||
debug_assert!(!selector_list.is_null());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue