Skip to content

Commit

Permalink
Auto merge of #17844 - emilio:is-visited, r=bholley
Browse files Browse the repository at this point in the history
stylo: Read mName as a raw nsIAtom* from NodeInfoInner.

Changes for bug 1383756.
  • Loading branch information
bors-servo committed Jul 24, 2017
2 parents 3629efb + 0e80710 commit 897f5d8
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 22 deletions.
39 changes: 29 additions & 10 deletions components/style/gecko/generated/structs_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4206,19 +4206,21 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug)]
#[derive(Debug, Copy)]
pub struct NodeInfo_NodeInfoInner {
pub mName: root::nsCOMPtr<root::nsIAtom>,
pub mPrefix: root::nsCOMPtr<root::nsIAtom>,
pub mName: *const root::nsIAtom,
pub mPrefix: *mut root::nsIAtom,
pub mNamespaceID: i32,
pub mNodeType: u16,
pub mNameString: *const root::nsAString,
pub mExtraName: root::nsCOMPtr<root::nsIAtom>,
pub mExtraName: *mut root::nsIAtom,
pub mHash: root::PLHashNumber,
pub mHashInitialized: bool,
}
#[test]
fn bindgen_test_layout_NodeInfo_NodeInfoInner() {
assert_eq!(::std::mem::size_of::<NodeInfo_NodeInfoInner>() ,
40usize , concat ! (
48usize , concat ! (
"Size of: " , stringify ! ( NodeInfo_NodeInfoInner
) ));
assert_eq! (::std::mem::align_of::<NodeInfo_NodeInfoInner>() ,
Expand Down Expand Up @@ -4267,6 +4269,23 @@ pub mod root {
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mExtraName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo_NodeInfoInner ) ) .
mHash as * const _ as usize } , 40usize , concat !
(
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mHash ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo_NodeInfoInner ) ) .
mHashInitialized as * const _ as usize } , 44usize
, concat ! (
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mHashInitialized ) ));
}
impl Clone for NodeInfo_NodeInfoInner {
fn clone(&self) -> Self { *self }
}
extern "C" {
#[link_name =
Expand All @@ -4276,7 +4295,7 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_NodeInfo() {
assert_eq!(::std::mem::size_of::<NodeInfo>() , 120usize ,
assert_eq!(::std::mem::size_of::<NodeInfo>() , 128usize ,
concat ! ( "Size of: " , stringify ! ( NodeInfo )
));
assert_eq! (::std::mem::align_of::<NodeInfo>() , 8usize ,
Expand Down Expand Up @@ -4304,22 +4323,22 @@ pub mod root {
, "::" , stringify ! ( mInner ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mOwnerManager
as * const _ as usize } , 64usize , concat ! (
as * const _ as usize } , 72usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mOwnerManager ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mQualifiedName
as * const _ as usize } , 72usize , concat ! (
as * const _ as usize } , 80usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mQualifiedName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mNodeName as *
const _ as usize } , 88usize , concat ! (
const _ as usize } , 96usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mNodeName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mLocalName as
* const _ as usize } , 104usize , concat ! (
* const _ as usize } , 112usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mLocalName ) ));
}
Expand Down
39 changes: 29 additions & 10 deletions components/style/gecko/generated/structs_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4097,19 +4097,21 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug)]
#[derive(Debug, Copy)]
pub struct NodeInfo_NodeInfoInner {
pub mName: root::nsCOMPtr,
pub mPrefix: root::nsCOMPtr,
pub mName: *const root::nsIAtom,
pub mPrefix: *mut root::nsIAtom,
pub mNamespaceID: i32,
pub mNodeType: u16,
pub mNameString: *const root::nsAString,
pub mExtraName: root::nsCOMPtr,
pub mExtraName: *mut root::nsIAtom,
pub mHash: root::PLHashNumber,
pub mHashInitialized: bool,
}
#[test]
fn bindgen_test_layout_NodeInfo_NodeInfoInner() {
assert_eq!(::std::mem::size_of::<NodeInfo_NodeInfoInner>() ,
40usize , concat ! (
48usize , concat ! (
"Size of: " , stringify ! ( NodeInfo_NodeInfoInner
) ));
assert_eq! (::std::mem::align_of::<NodeInfo_NodeInfoInner>() ,
Expand Down Expand Up @@ -4158,6 +4160,23 @@ pub mod root {
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mExtraName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo_NodeInfoInner ) ) .
mHash as * const _ as usize } , 40usize , concat !
(
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mHash ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo_NodeInfoInner ) ) .
mHashInitialized as * const _ as usize } , 44usize
, concat ! (
"Alignment of field: " , stringify ! (
NodeInfo_NodeInfoInner ) , "::" , stringify ! (
mHashInitialized ) ));
}
impl Clone for NodeInfo_NodeInfoInner {
fn clone(&self) -> Self { *self }
}
extern "C" {
#[link_name =
Expand All @@ -4167,7 +4186,7 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_NodeInfo() {
assert_eq!(::std::mem::size_of::<NodeInfo>() , 112usize ,
assert_eq!(::std::mem::size_of::<NodeInfo>() , 120usize ,
concat ! ( "Size of: " , stringify ! ( NodeInfo )
));
assert_eq! (::std::mem::align_of::<NodeInfo>() , 8usize ,
Expand All @@ -4190,22 +4209,22 @@ pub mod root {
, "::" , stringify ! ( mInner ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mOwnerManager
as * const _ as usize } , 56usize , concat ! (
as * const _ as usize } , 64usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mOwnerManager ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mQualifiedName
as * const _ as usize } , 64usize , concat ! (
as * const _ as usize } , 72usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mQualifiedName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mNodeName as *
const _ as usize } , 80usize , concat ! (
const _ as usize } , 88usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mNodeName ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const NodeInfo ) ) . mLocalName as
* const _ as usize } , 96usize , concat ! (
* const _ as usize } , 104usize , concat ! (
"Alignment of field: " , stringify ! ( NodeInfo )
, "::" , stringify ! ( mLocalName ) ));
}
Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {

fn get_local_name(&self) -> &WeakAtom {
unsafe {
WeakAtom::new(self.as_node().node_info().mInner.mName.raw::<nsIAtom>())
WeakAtom::new(self.as_node().node_info().mInner.mName)
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko_string_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ unsafe impl Sync for WeakAtom {}
impl WeakAtom {
/// Construct a `WeakAtom` from a raw `nsIAtom`.
#[inline]
pub unsafe fn new<'a>(atom: *mut nsIAtom) -> &'a mut Self {
pub unsafe fn new<'a>(atom: *const nsIAtom) -> &'a mut Self {
&mut *(atom as *mut WeakAtom)
}

Expand Down

0 comments on commit 897f5d8

Please sign in to comment.