Look at nsIAtom.mHash directly rather than call Gecko_HashAtom.

This commit is contained in:
Cameron McCormack 2016-06-07 17:37:35 +10:00
parent ca26e95e44
commit 0bf1f2793b
7 changed files with 9 additions and 10 deletions

View file

@ -35,6 +35,7 @@ use structs::nscolor;
use structs::nsFont;
use structs::FontFamilyList;
use structs::FontFamilyType;
use structs::nsIAtom;
use heapsize::HeapSizeOf;
unsafe impl Send for nsStyleFont {}
unsafe impl Sync for nsStyleFont {}
@ -121,7 +122,6 @@ unsafe impl Send for nsStyleGradientStop {}
unsafe impl Sync for nsStyleGradientStop {}
impl HeapSizeOf for nsStyleGradientStop { fn heap_size_of_children(&self) -> usize { 0 } }
pub enum nsIAtom { }
pub enum nsINode { }
pub type RawGeckoNode = nsINode;
pub enum nsIPrincipal { }

View file

@ -52,7 +52,7 @@ done
# Other mapped types.
for TYPE in SheetParsingMode nsMainThreadPtrHandle nsMainThreadPtrHolder nscolor nsFont \
FontFamilyList FontFamilyType
FontFamilyList FontFamilyType nsIAtom
do
MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-blacklist-type $TYPE "
MAP_GECKO_TYPES=$MAP_GECKO_TYPES"-raw-line 'use structs::$TYPE;' "

View file

@ -10,9 +10,9 @@ use env_logger;
use euclid::Size2D;
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use gecko_bindings::bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoNodeData};
use gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder, nsIAtom};
use gecko_bindings::bindings::{ThreadSafePrincipalHolder, ThreadSafeURIHolder};
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
use gecko_bindings::structs::SheetParsingMode;
use gecko_bindings::structs::{SheetParsingMode, nsIAtom};
use properties::GeckoComputedValues;
use selector_impl::{GeckoSelectorImpl, PseudoElement, SharedStyleContext, Stylesheet};
use std::marker::PhantomData;

View file

@ -1,4 +1,4 @@
use gecko_bindings::bindings::nsIAtom;
use gecko_bindings::structs::nsIAtom;
use Atom;

View file

@ -10,9 +10,8 @@ use gecko_bindings::bindings::Gecko_AddRefAtom;
use gecko_bindings::bindings::Gecko_AtomEqualsUTF8IgnoreCase;
use gecko_bindings::bindings::Gecko_Atomize;
use gecko_bindings::bindings::Gecko_GetAtomAsUTF16;
use gecko_bindings::bindings::Gecko_HashAtom;
use gecko_bindings::bindings::Gecko_ReleaseAtom;
use gecko_bindings::bindings::nsIAtom;
use gecko_bindings::structs::nsIAtom;
use heapsize::HeapSizeOf;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::borrow::Cow;
@ -100,7 +99,7 @@ unsafe impl Sync for Atom {}
impl Atom {
pub fn get_hash(&self) -> u32 {
unsafe {
Gecko_HashAtom(self.0)
(*self.0).mHash
}
}

View file

@ -24,7 +24,7 @@ with open(objdir_path + "/dist/include/nsGkAtomList.h") as f:
atoms = [line_to_atom(line) for line in lines]
with open("atom_macro.rs", "w") as f:
f.write("use gecko_bindings::bindings::nsIAtom;\n\n")
f.write("use gecko_bindings::structs::nsIAtom;\n\n")
f.write("use Atom;\n\n")
f.write("pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom { unsafe { Atom::from_static(ptr) } }\n\n")
for atom in atoms:

View file

@ -9,7 +9,6 @@ use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_GetElementId;
use gecko_bindings::bindings::Gecko_GetNodeData;
use gecko_bindings::bindings::ServoNodeData;
use gecko_bindings::bindings::nsIAtom;
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetAttrAsUTF8, Gecko_GetDocumentElement};
use gecko_bindings::bindings::{Gecko_GetFirstChild, Gecko_GetFirstChildElement};
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetLastChildElement};
@ -21,6 +20,7 @@ use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
#[allow(unused_imports)] // Used in commented-out code.
use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement, Gecko_SetNodeData};
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
use gecko_bindings::structs::nsIAtom;
use libc::uintptr_t;
use properties::GeckoComputedValues;
use selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PrivateStyleData};