mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Remove Borrowed<T>/BorrowedMut<T>, use Option<&T> instead.
This commit is contained in:
parent
fc251384a7
commit
b416ccfcae
6 changed files with 41 additions and 171 deletions
|
@ -155,7 +155,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, new_style.as_borrowed()) };
|
||||
let hint = unsafe { Gecko_CalcStyleDifference(context, new_style.as_borrowed_opt().unwrap()) };
|
||||
GeckoRestyleDamage(hint)
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
}
|
||||
|
||||
fn last_child(&self) -> Option<GeckoNode<'ln>> {
|
||||
unsafe { Gecko_GetLastChild(self.0).borrow_opt().map(GeckoNode) }
|
||||
unsafe { Gecko_GetLastChild(self.0).map(GeckoNode) }
|
||||
}
|
||||
|
||||
fn prev_sibling(&self) -> Option<GeckoNode<'ln>> {
|
||||
|
@ -397,7 +397,7 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
|||
curr
|
||||
},
|
||||
GeckoChildrenIterator::GeckoIterator(ref it) => unsafe {
|
||||
Gecko_GetNextStyleChild(&it).borrow_opt().map(GeckoNode)
|
||||
Gecko_GetNextStyleChild(&it).map(GeckoNode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ impl<'ld> TDocument for GeckoDocument<'ld> {
|
|||
|
||||
fn root_node(&self) -> Option<GeckoNode<'ld>> {
|
||||
unsafe {
|
||||
Gecko_GetDocumentElement(self.0).borrow_opt().map(|el| GeckoElement(el).as_node())
|
||||
Gecko_GetDocumentElement(self.0).map(|el| GeckoElement(el).as_node())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,10 +470,10 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
fn style_attribute(&self) -> Option<&Arc<PropertyDeclarationBlock>> {
|
||||
let declarations = unsafe { Gecko_GetServoDeclarationBlock(self.0) };
|
||||
if declarations.is_null() {
|
||||
if declarations.is_none() {
|
||||
None
|
||||
} else {
|
||||
let declarations = declarations.as_arc::<GeckoDeclarationBlock>();
|
||||
let declarations = GeckoDeclarationBlock::arc_from_borrowed(&declarations).unwrap();
|
||||
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