mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Bindgenup
Major pain point is that I had to write the bitfield stuff manually, but that should be resolved soon again. Now we generate proper layout for _every_ struct, including field offsets \o/.
This commit is contained in:
parent
ab197de04f
commit
91e0ae2fe7
8 changed files with 21925 additions and 7876 deletions
|
@ -135,16 +135,22 @@ impl WeakAtom {
|
|||
/// Returns whether this atom is static.
|
||||
#[inline]
|
||||
pub fn is_static(&self) -> bool {
|
||||
// FIXME(emilio): re-introduce bitfield accessors:
|
||||
//
|
||||
// https://github.com/servo/rust-bindgen/issues/519
|
||||
unsafe {
|
||||
(*self.as_ptr()).mIsStatic() != 0
|
||||
((*self.as_ptr())._bitfield_1 & (0x80000000 as u32)) != 0
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the length of the atom string.
|
||||
#[inline]
|
||||
pub fn len(&self) -> u32 {
|
||||
// FIXME(emilio): re-introduce bitfield accessors:
|
||||
//
|
||||
// https://github.com/servo/rust-bindgen/issues/519
|
||||
unsafe {
|
||||
(*self.as_ptr()).mLength()
|
||||
(*self.as_ptr())._bitfield_1 & 0x7FFFFFFF
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,10 +288,11 @@ impl From<*mut nsIAtom> for Atom {
|
|||
fn from(ptr: *mut nsIAtom) -> Atom {
|
||||
debug_assert!(!ptr.is_null());
|
||||
unsafe {
|
||||
if (*ptr).mIsStatic() == 0 {
|
||||
let ret = Atom(WeakAtom::new(ptr));
|
||||
if !ret.is_static() {
|
||||
Gecko_AddRefAtom(ptr);
|
||||
}
|
||||
Atom(WeakAtom::new(ptr))
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue