Auto merge of #20339 - emilio:atom-from-dead-beef, r=nox

style: Remove unsound Atom From implementations.

Fixes #20158

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20339)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-03-19 06:11:14 -04:00 committed by GitHub
commit b47224dbcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 85 additions and 100 deletions

View file

@ -413,7 +413,7 @@ impl nsStyleImage {
nsStyleImageType::eStyleImageType_Element => {
use gecko_string_cache::Atom;
let atom = Gecko_GetImageElement(self);
Some(GenericImage::Element(Atom::from(atom)))
Some(GenericImage::Element(Atom::from_raw(atom)))
},
_ => panic!("Unexpected image type")
}

View file

@ -176,7 +176,7 @@ impl Device {
context.mMedium
};
MediaType(CustomIdent(Atom::from(medium_to_use)))
MediaType(CustomIdent(unsafe { Atom::from_raw(medium_to_use) }))
}
/// Returns the current viewport size in app units.
@ -262,7 +262,7 @@ impl ToCss for Expression {
}
// NB: CssStringWriter not needed, feature names are under control.
write!(dest, "{}", Atom::from(unsafe { *self.feature.mName }))?;
write!(dest, "{}", unsafe { Atom::from_static(*self.feature.mName) })?;
if let Some(ref val) = self.value {
dest.write_str(": ")?;
@ -394,9 +394,9 @@ impl MediaExpressionValue {
}
nsMediaFeature_ValueType::eIdent => {
debug_assert_eq!(css_value.mUnit, nsCSSUnit::eCSSUnit_AtomIdent);
Some(MediaExpressionValue::Ident(Atom::from(unsafe {
*css_value.mValue.mAtom.as_ref()
})))
Some(MediaExpressionValue::Ident(unsafe {
Atom::from_raw(*css_value.mValue.mAtom.as_ref())
}))
}
nsMediaFeature_ValueType::eIntRatio => {
let array = unsafe { css_value.array_unchecked() };

View file

@ -507,7 +507,7 @@ impl CounterStyleOrNone {
let name = unsafe { bindings::Gecko_CounterStyle_GetName(gecko_value) };
if !name.is_null() {
let name = Atom::from(name);
let name = unsafe { Atom::from_raw(name) };
if name == atom!("none") {
Either::First(CounterStyleOrNone::None)
} else {