mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Make Arc helpers into methods
This commit is contained in:
parent
92c3961743
commit
9f6b772bbb
5 changed files with 110 additions and 120 deletions
|
@ -25,7 +25,7 @@ use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsEle
|
|||
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
||||
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
|
||||
use gecko_bindings::structs::{nsIAtom, nsChangeHint, nsStyleContext};
|
||||
use gecko_bindings::sugar::refptr::HasArcFFI;
|
||||
use gecko_bindings::sugar::refptr::FFIArcHelpers;
|
||||
use gecko_string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use glue::GeckoDeclarationBlock;
|
||||
use libc::uintptr_t;
|
||||
|
@ -109,7 +109,7 @@ impl TRestyleDamage for GeckoRestyleDamage {
|
|||
fn compute(source: &nsStyleContext,
|
||||
new_style: &Arc<ComputedValues>) -> Self {
|
||||
let context = source as *const nsStyleContext as *mut nsStyleContext;
|
||||
let hint = unsafe { Gecko_CalcStyleDifference(context, ComputedValues::to_borrowed(new_style)) };
|
||||
let hint = unsafe { Gecko_CalcStyleDifference(context, new_style.as_borrowed()) };
|
||||
GeckoRestyleDamage(hint)
|
||||
}
|
||||
|
||||
|
@ -474,11 +474,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
if declarations.is_null() {
|
||||
None
|
||||
} else {
|
||||
let opt_ptr = GeckoDeclarationBlock::with(declarations, |declarations| {
|
||||
// Use a raw pointer to extend the lifetime
|
||||
declarations.declarations.as_ref().map(|r| r as *const Arc<_>)
|
||||
});
|
||||
opt_ptr.map(|ptr| unsafe { &*ptr })
|
||||
let declarations = declarations.as_arc::<GeckoDeclarationBlock>();
|
||||
declarations.declarations.as_ref().map(|r| r as *const Arc<_>).map(|ptr| unsafe { &*ptr })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue