mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
style: Allow disabling invalidation-based querySelector from C++
Rust compile times are hard. MozReview-Commit-ID: 9Xhtf7f3Vzv
This commit is contained in:
parent
931aae9760
commit
bfabd9f855
2 changed files with 32 additions and 2 deletions
|
@ -1693,17 +1693,27 @@ pub unsafe extern "C" fn Servo_SelectorList_Matches(
|
|||
pub unsafe extern "C" fn Servo_SelectorList_QueryFirst(
|
||||
node: RawGeckoNodeBorrowed,
|
||||
selectors: RawServoSelectorListBorrowed,
|
||||
may_use_invalidation: bool,
|
||||
) -> *const structs::RawGeckoElement {
|
||||
use std::borrow::Borrow;
|
||||
use style::dom_apis::{self, QueryFirst};
|
||||
use style::dom_apis::{self, MayUseInvalidation, QueryFirst};
|
||||
|
||||
let node = GeckoNode(node);
|
||||
let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
|
||||
let mut result = None;
|
||||
|
||||
let may_use_invalidation =
|
||||
if may_use_invalidation {
|
||||
MayUseInvalidation::Yes
|
||||
} else {
|
||||
MayUseInvalidation::No
|
||||
};
|
||||
|
||||
dom_apis::query_selector::<GeckoElement, QueryFirst>(
|
||||
node,
|
||||
&selectors,
|
||||
&mut result,
|
||||
may_use_invalidation,
|
||||
);
|
||||
|
||||
result.map_or(ptr::null(), |e| e.0)
|
||||
|
@ -1714,19 +1724,28 @@ pub unsafe extern "C" fn Servo_SelectorList_QueryAll(
|
|||
node: RawGeckoNodeBorrowed,
|
||||
selectors: RawServoSelectorListBorrowed,
|
||||
content_list: *mut structs::nsSimpleContentList,
|
||||
may_use_invalidation: bool,
|
||||
) {
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Borrow;
|
||||
use style::dom_apis::{self, QueryAll};
|
||||
use style::dom_apis::{self, MayUseInvalidation, QueryAll};
|
||||
|
||||
let node = GeckoNode(node);
|
||||
let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
|
||||
let mut result = SmallVec::new();
|
||||
|
||||
let may_use_invalidation =
|
||||
if may_use_invalidation {
|
||||
MayUseInvalidation::Yes
|
||||
} else {
|
||||
MayUseInvalidation::No
|
||||
};
|
||||
|
||||
dom_apis::query_selector::<GeckoElement, QueryAll>(
|
||||
node,
|
||||
&selectors,
|
||||
&mut result,
|
||||
may_use_invalidation,
|
||||
);
|
||||
|
||||
if !result.is_empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue