diff --git a/components/style/binding_tools/regen.py b/components/style/binding_tools/regen.py index 62302733fac..c037bd5cc65 100755 --- a/components/style/binding_tools/regen.py +++ b/components/style/binding_tools/regen.py @@ -309,7 +309,7 @@ COMPILATION_TARGETS = { ], "servo_nullable_arc_types": [ "ServoComputedValues", "RawServoStyleSheet", - "ServoDeclarationBlock" + "RawServoDeclarationBlock" ], "servo_owned_types": [ "RawServoStyleSet", diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index c5588ca4b97..32740556d28 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -81,7 +81,7 @@ impl PartialEq for GeckoDeclarationBlock { } unsafe impl HasFFI for GeckoDeclarationBlock { - type FFIType = bindings::ServoDeclarationBlock; + type FFIType = bindings::RawServoDeclarationBlock; } unsafe impl HasArcFFI for GeckoDeclarationBlock {} diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 7c219fceeb3..26288268ace 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -10,11 +10,11 @@ pub type RawServoStyleSheetBorrowedOrNull<'a> = Option<&'a RawServoStyleSheet>; pub type RawServoStyleSheetBorrowed<'a> = &'a RawServoStyleSheet; enum RawServoStyleSheetVoid{ } pub struct RawServoStyleSheet(RawServoStyleSheetVoid); -pub type ServoDeclarationBlockStrong = ::gecko_bindings::sugar::ownership::Strong; -pub type ServoDeclarationBlockBorrowedOrNull<'a> = Option<&'a ServoDeclarationBlock>; -pub type ServoDeclarationBlockBorrowed<'a> = &'a ServoDeclarationBlock; -enum ServoDeclarationBlockVoid{ } -pub struct ServoDeclarationBlock(ServoDeclarationBlockVoid); +pub type RawServoDeclarationBlockStrong = ::gecko_bindings::sugar::ownership::Strong; +pub type RawServoDeclarationBlockBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlock>; +pub type RawServoDeclarationBlockBorrowed<'a> = &'a RawServoDeclarationBlock; +enum RawServoDeclarationBlockVoid{ } +pub struct RawServoDeclarationBlock(RawServoDeclarationBlockVoid); pub type RawGeckoNodeBorrowed<'a> = &'a RawGeckoNode; pub type RawGeckoNodeBorrowedOrNull<'a> = Option<&'a RawGeckoNode>; pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement; @@ -370,7 +370,7 @@ extern "C" { } extern "C" { pub fn Gecko_GetServoDeclarationBlock(element: RawGeckoElementBorrowed) - -> ServoDeclarationBlockBorrowedOrNull; + -> RawServoDeclarationBlockBorrowedOrNull; } extern "C" { pub fn Gecko_Atomize(aString: *const ::std::os::raw::c_char, aLength: u32) @@ -865,11 +865,11 @@ extern "C" { base: *mut ThreadSafeURIHolder, referrer: *mut ThreadSafeURIHolder, principal: *mut ThreadSafePrincipalHolder) - -> ServoDeclarationBlockStrong; + -> RawServoDeclarationBlockStrong; } extern "C" { pub fn Servo_RestyleWithAddedDeclaration(declarations: - ServoDeclarationBlockBorrowed, + RawServoDeclarationBlockBorrowed, previous_style: ServoComputedValuesBorrowed) -> ServoComputedValuesStrong; @@ -877,37 +877,37 @@ extern "C" { extern "C" { pub fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32, cache: *mut nsHTMLCSSStyleSheet) - -> ServoDeclarationBlockStrong; + -> RawServoDeclarationBlockStrong; } extern "C" { pub fn Servo_DeclarationBlock_AddRef(declarations: - ServoDeclarationBlockBorrowed); + RawServoDeclarationBlockBorrowed); } extern "C" { pub fn Servo_DeclarationBlock_Release(declarations: - ServoDeclarationBlockBorrowed); + RawServoDeclarationBlockBorrowed); } extern "C" { - pub fn Servo_DeclarationBlock_Equals(a: ServoDeclarationBlockBorrowed, - b: ServoDeclarationBlockBorrowed) + pub fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed, + b: RawServoDeclarationBlockBorrowed) -> bool; } extern "C" { pub fn Servo_DeclarationBlock_GetCache(declarations: - ServoDeclarationBlockBorrowed) + RawServoDeclarationBlockBorrowed) -> *mut nsHTMLCSSStyleSheet; } extern "C" { pub fn Servo_DeclarationBlock_SetImmutable(declarations: - ServoDeclarationBlockBorrowed); + RawServoDeclarationBlockBorrowed); } extern "C" { pub fn Servo_DeclarationBlock_ClearCachePointer(declarations: - ServoDeclarationBlockBorrowed); + RawServoDeclarationBlockBorrowed); } extern "C" { pub fn Servo_DeclarationBlock_SerializeOneValue(declarations: - ServoDeclarationBlockBorrowed, + RawServoDeclarationBlockBorrowed, buffer: *mut nsString); } extern "C" { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 124e75072cd..bdc9a4d15d0 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -24,10 +24,10 @@ use style::gecko::traversal::RecalcStyleOnly; use style::gecko::wrapper::{DUMMY_BASE_URL, GeckoDeclarationBlock}; use style::gecko::wrapper::{GeckoElement, GeckoNode}; use style::gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoNodeBorrowed}; +use style::gecko_bindings::bindings::{RawServoDeclarationBlockBorrowed, RawServoDeclarationBlockStrong}; use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetOwned}; use style::gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedValuesBorrowed}; use style::gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong}; -use style::gecko_bindings::bindings::{ServoDeclarationBlockBorrowed, ServoDeclarationBlockStrong}; use style::gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder}; use style::gecko_bindings::bindings::{nsHTMLCSSStyleSheet, ServoComputedValuesBorrowedOrNull}; use style::gecko_bindings::bindings::Gecko_Utf8SliceToString; @@ -127,7 +127,7 @@ pub extern "C" fn Servo_RestyleSubtree(node: RawGeckoNodeBorrowed, } #[no_mangle] -pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: ServoDeclarationBlockBorrowed, +pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: RawServoDeclarationBlockBorrowed, previous_style: ServoComputedValuesBorrowed) -> ServoComputedValuesStrong { @@ -381,7 +381,7 @@ pub extern "C" fn Servo_ParseProperty(property_bytes: *const u8, base: *mut ThreadSafeURIHolder, referrer: *mut ThreadSafeURIHolder, principal: *mut ThreadSafePrincipalHolder) - -> ServoDeclarationBlockStrong { + -> RawServoDeclarationBlockStrong { // All this string wrangling is temporary until the Gecko string bindings land (bug 1294742). let name = unsafe { from_utf8_unchecked(slice::from_raw_parts(property_bytes, property_length as usize)) }; @@ -404,7 +404,7 @@ pub extern "C" fn Servo_ParseProperty(property_bytes: *const u8, match PropertyDeclaration::parse(name, &context, &mut Parser::new(value_str), &mut results, false) { PropertyDeclarationParseResult::ValidOrIgnoredDeclaration => {}, - _ => return ServoDeclarationBlockStrong::null(), + _ => return RawServoDeclarationBlockStrong::null(), } let results = results.into_iter().map(|r| (r, Importance::Normal)).collect(); @@ -421,7 +421,7 @@ pub extern "C" fn Servo_ParseProperty(property_bytes: *const u8, #[no_mangle] pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32, cache: *mut nsHTMLCSSStyleSheet) - -> ServoDeclarationBlockStrong { + -> RawServoDeclarationBlockStrong { let value = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) }; Arc::new(GeckoDeclarationBlock { declarations: GeckoElement::parse_style_attribute(value).map(|block| { @@ -433,41 +433,41 @@ pub extern "C" fn Servo_ParseStyleAttribute(bytes: *const u8, length: u32, } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: ServoDeclarationBlockBorrowed) { +pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: RawServoDeclarationBlockBorrowed) { unsafe { GeckoDeclarationBlock::addref(declarations) }; } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_Release(declarations: ServoDeclarationBlockBorrowed) { +pub extern "C" fn Servo_DeclarationBlock_Release(declarations: RawServoDeclarationBlockBorrowed) { unsafe { GeckoDeclarationBlock::release(declarations) }; } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_Equals(a: ServoDeclarationBlockBorrowed, - b: ServoDeclarationBlockBorrowed) +pub extern "C" fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed, + b: RawServoDeclarationBlockBorrowed) -> bool { GeckoDeclarationBlock::as_arc(&a) == GeckoDeclarationBlock::as_arc(&b) } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_GetCache(declarations: ServoDeclarationBlockBorrowed) +pub extern "C" fn Servo_DeclarationBlock_GetCache(declarations: RawServoDeclarationBlockBorrowed) -> *mut nsHTMLCSSStyleSheet { GeckoDeclarationBlock::as_arc(&declarations).cache.load(Ordering::Relaxed) } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_SetImmutable(declarations: ServoDeclarationBlockBorrowed) { +pub extern "C" fn Servo_DeclarationBlock_SetImmutable(declarations: RawServoDeclarationBlockBorrowed) { GeckoDeclarationBlock::as_arc(&declarations).immutable.store(true, Ordering::Relaxed) } #[no_mangle] -pub extern "C" fn Servo_DeclarationBlock_ClearCachePointer(declarations: ServoDeclarationBlockBorrowed) { +pub extern "C" fn Servo_DeclarationBlock_ClearCachePointer(declarations: RawServoDeclarationBlockBorrowed) { GeckoDeclarationBlock::as_arc(&declarations).cache.store(ptr::null_mut(), Ordering::Relaxed) } #[no_mangle] pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue( - declarations: ServoDeclarationBlockBorrowed, + declarations: RawServoDeclarationBlockBorrowed, buffer: *mut nsString) { let mut string = String::new();