mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
stylo: Integrate QuerySelectorAll in Gecko.
Bug: 1410624 Reviewed-by: heycam MozReview-Commit-ID: 2Jf3Z6ikjXB
This commit is contained in:
parent
d73af807b7
commit
6b3821ae27
1 changed files with 32 additions and 0 deletions
|
@ -1635,6 +1635,38 @@ pub unsafe extern "C" fn Servo_SelectorList_QueryFirst(
|
||||||
result.map_or(ptr::null(), |e| e.0)
|
result.map_or(ptr::null(), |e| e.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn Servo_SelectorList_QueryAll(
|
||||||
|
node: RawGeckoNodeBorrowed,
|
||||||
|
selectors: RawServoSelectorListBorrowed,
|
||||||
|
content_list: *mut structs::nsSimpleContentList,
|
||||||
|
) {
|
||||||
|
use smallvec::SmallVec;
|
||||||
|
use std::borrow::Borrow;
|
||||||
|
use style::dom_apis::{self, QueryAll};
|
||||||
|
|
||||||
|
let node = GeckoNode(node);
|
||||||
|
let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
|
||||||
|
let mut result = SmallVec::new();
|
||||||
|
|
||||||
|
dom_apis::query_selector::<GeckoElement, QueryAll>(
|
||||||
|
node,
|
||||||
|
&selectors,
|
||||||
|
&mut result,
|
||||||
|
node.owner_document_quirks_mode(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if !result.is_empty() {
|
||||||
|
// NOTE(emilio): This relies on a slice of GeckoElement having the same
|
||||||
|
// memory representation than a slice of element pointers.
|
||||||
|
bindings::Gecko_ContentList_AppendAll(
|
||||||
|
content_list,
|
||||||
|
result.as_ptr() as *mut *const _,
|
||||||
|
result.len(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed, result: *mut nsAString) {
|
pub extern "C" fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed, result: *mut nsAString) {
|
||||||
read_locked_arc(rule, |rule: &ImportRule| {
|
read_locked_arc(rule, |rule: &ImportRule| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue