Auto merge of #18877 - emilio:closest-why, r=nox

stylo: Dumb down the return value of SelectorList_Closest.

So it builds with rust 1.21.

See: https://bugzilla.mozilla.org/show_bug.cgi?id=1408622

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18877)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-14 08:13:59 -05:00 committed by GitHub
commit 8b6207c0d6
2 changed files with 31 additions and 20 deletions

View file

@ -1921,6 +1921,11 @@ extern "C" {
pub fn Gecko_AddBufferToCrashReport(addr: *const ::std::os::raw::c_void, pub fn Gecko_AddBufferToCrashReport(addr: *const ::std::os::raw::c_void,
len: usize); len: usize);
} }
extern "C" {
pub fn Gecko_AnnotateCrashReport(key_str: *const ::std::os::raw::c_char,
value_str:
*const ::std::os::raw::c_char);
}
extern "C" { extern "C" {
pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed); pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed);
} }
@ -2118,6 +2123,11 @@ extern "C" {
arg2: RawServoSelectorListBorrowed) arg2: RawServoSelectorListBorrowed)
-> bool; -> bool;
} }
extern "C" {
pub fn Servo_SelectorList_Closest(arg1: RawGeckoElementBorrowed,
arg2: RawServoSelectorListBorrowed)
-> *const RawGeckoElement;
}
extern "C" { extern "C" {
pub fn Servo_StyleSet_AddSizeOfExcludingThis(malloc_size_of: MallocSizeOf, pub fn Servo_StyleSet_AddSizeOfExcludingThis(malloc_size_of: MallocSizeOf,
malloc_enclosing_size_of: malloc_enclosing_size_of:

View file

@ -332,11 +332,11 @@ pub extern "C" fn Servo_MaybeGCRuleTree(raw_data: RawServoStyleSetBorrowed) {
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValues_Interpolate(from: RawServoAnimationValueBorrowed, pub extern "C" fn Servo_AnimationValues_Interpolate(
to: RawServoAnimationValueBorrowed, from: RawServoAnimationValueBorrowed,
progress: f64) to: RawServoAnimationValueBorrowed,
-> RawServoAnimationValueStrong progress: f64,
{ ) -> RawServoAnimationValueStrong {
let from_value = AnimationValue::as_arc(&from); let from_value = AnimationValue::as_arc(&from);
let to_value = AnimationValue::as_arc(&to); let to_value = AnimationValue::as_arc(&to);
if let Ok(value) = from_value.animate(to_value, Procedure::Interpolate { progress }) { if let Ok(value) = from_value.animate(to_value, Procedure::Interpolate { progress }) {
@ -356,10 +356,10 @@ pub extern "C" fn Servo_AnimationValues_IsInterpolable(from: RawServoAnimationVa
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValues_Add(a: RawServoAnimationValueBorrowed, pub extern "C" fn Servo_AnimationValues_Add(
b: RawServoAnimationValueBorrowed) a: RawServoAnimationValueBorrowed,
-> RawServoAnimationValueStrong b: RawServoAnimationValueBorrowed,
{ ) -> RawServoAnimationValueStrong {
let a_value = AnimationValue::as_arc(&a); let a_value = AnimationValue::as_arc(&a);
let b_value = AnimationValue::as_arc(&b); let b_value = AnimationValue::as_arc(&b);
if let Ok(value) = a_value.animate(b_value, Procedure::Add) { if let Ok(value) = a_value.animate(b_value, Procedure::Add) {
@ -370,11 +370,11 @@ pub extern "C" fn Servo_AnimationValues_Add(a: RawServoAnimationValueBorrowed,
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValues_Accumulate(a: RawServoAnimationValueBorrowed, pub extern "C" fn Servo_AnimationValues_Accumulate(
b: RawServoAnimationValueBorrowed, a: RawServoAnimationValueBorrowed,
count: u64) b: RawServoAnimationValueBorrowed,
-> RawServoAnimationValueStrong count: u64,
{ ) -> RawServoAnimationValueStrong {
let a_value = AnimationValue::as_arc(&a); let a_value = AnimationValue::as_arc(&a);
let b_value = AnimationValue::as_arc(&b); let b_value = AnimationValue::as_arc(&b);
if let Ok(value) = a_value.animate(b_value, Procedure::Accumulate { count }) { if let Ok(value) = a_value.animate(b_value, Procedure::Accumulate { count }) {
@ -673,8 +673,9 @@ pub extern "C" fn Servo_AnimationValue_DeepEqual(this: RawServoAnimationValueBor
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AnimationValue_Uncompute(value: RawServoAnimationValueBorrowed) pub extern "C" fn Servo_AnimationValue_Uncompute(
-> RawServoDeclarationBlockStrong { value: RawServoAnimationValueBorrowed,
) -> RawServoDeclarationBlockStrong {
let value = AnimationValue::as_arc(&value); let value = AnimationValue::as_arc(&value);
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
Arc::new(global_style_data.shared_lock.wrap( Arc::new(global_style_data.shared_lock.wrap(
@ -1521,10 +1522,10 @@ pub extern "C" fn Servo_StyleRule_SelectorMatchesElement(rule: RawServoStyleRule
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_SelectorList_Closest<'a>( pub unsafe extern "C" fn Servo_SelectorList_Closest(
element: RawGeckoElementBorrowed<'a>, element: RawGeckoElementBorrowed,
selectors: RawServoSelectorListBorrowed, selectors: RawServoSelectorListBorrowed,
) -> RawGeckoElementBorrowedOrNull<'a> { ) -> *const structs::RawGeckoElement {
use std::borrow::Borrow; use std::borrow::Borrow;
use style::dom_apis; use style::dom_apis;
@ -1532,7 +1533,7 @@ pub unsafe extern "C" fn Servo_SelectorList_Closest<'a>(
let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow(); let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
dom_apis::element_closest(element, &selectors, element.owner_document_quirks_mode()) dom_apis::element_closest(element, &selectors, element.owner_document_quirks_mode())
.map(|e| e.0) .map_or(ptr::null(), |e| e.0)
} }
#[no_mangle] #[no_mangle]