Revert "Auto merge of #16976 - upsuper:bug1366247, r=nox"

This reverts commit 3d40b516c8, reversing
changes made to 255387a915.
This commit is contained in:
Emilio Cobos Álvarez 2017-05-21 21:29:50 +02:00
parent cdf52773a1
commit 1f7d48f564
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 28 additions and 79 deletions

View file

@ -10,7 +10,7 @@ use gecko_bindings::bindings::Gecko_AddRefAtom;
use gecko_bindings::bindings::Gecko_Atomize;
use gecko_bindings::bindings::Gecko_Atomize16;
use gecko_bindings::bindings::Gecko_ReleaseAtom;
use gecko_bindings::structs::{already_AddRefed, nsIAtom};
use gecko_bindings::structs::nsIAtom;
use nsstring::nsAString;
use precomputed_hash::PrecomputedHash;
use std::ascii::AsciiExt;
@ -219,6 +219,24 @@ impl Atom {
atom
}
/// Creates an atom from a dynamic atom pointer that has already had AddRef
/// called on it.
#[inline]
pub unsafe fn from_addrefed(ptr: *mut nsIAtom) -> Self {
debug_assert!(!ptr.is_null());
unsafe {
Atom(WeakAtom::new(ptr))
}
}
/// Convert this atom into an addrefed nsIAtom pointer.
#[inline]
pub fn into_addrefed(self) -> *mut nsIAtom {
let ptr = self.as_ptr();
mem::forget(self);
ptr
}
/// Return whether two atoms are ASCII-case-insensitive matches
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
let a = self.as_slice();
@ -340,19 +358,3 @@ impl From<*mut nsIAtom> for Atom {
}
}
}
impl From<already_AddRefed<nsIAtom>> for Atom {
#[inline]
fn from(ptr: already_AddRefed<nsIAtom>) -> Atom {
unsafe { Atom(WeakAtom::new(ptr.take())) }
}
}
impl From<Atom> for already_AddRefed<nsIAtom> {
#[inline]
fn from(atom: Atom) -> already_AddRefed<nsIAtom> {
let ptr = atom.as_ptr();
mem::forget(atom);
unsafe { already_AddRefed::new_unchecked(ptr) }
}
}