style: Share code for Element::Matches.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-13 12:50:38 +02:00
parent 085a0db056
commit 9e6c49d479
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 47 additions and 21 deletions

View file

@ -1556,18 +1556,15 @@ pub unsafe extern "C" fn Servo_SelectorList_Matches(
selectors: RawServoSelectorListBorrowed,
) -> bool {
use std::borrow::Borrow;
use style::dom_apis;
let element = GeckoElement(element);
let mut context = MatchingContext::new(
MatchingMode::Normal,
None,
None,
element.owner_document_quirks_mode(),
);
context.scope_element = Some(element.opaque());
let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
selectors::matching::matches_selector_list(&selectors, &element, &mut context)
dom_apis::element_matches(
&element,
&selectors,
element.owner_document_quirks_mode(),
)
}
#[no_mangle]