Skip to content
Permalink
Browse files

Devirtualize nsIAtom.

  • Loading branch information
nnethercote committed Sep 27, 2017
1 parent 0160aae commit 7019d425230326fe6a1398b3c4639249e3d2afba
@@ -18,7 +18,6 @@ use gecko_bindings::structs::{nsCSSKeyword, nsCSSProps_KTableEntry, nsCSSValue,
use gecko_bindings::structs::{nsMediaExpression_Range, nsMediaFeature};
use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType, nsMediaFeature_RequirementFlags};
use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextOwned};
use gecko_bindings::structs::nsIAtom;
use media_queries::MediaType;
use parser::ParserContext;
use properties::{ComputedValues, StyleBuilder};
@@ -165,7 +164,7 @@ impl Device {
// mMediaEmulated.
let context = self.pres_context();
let medium_to_use = if context.mIsEmulatingMedia() != 0 {
context.mMediaEmulated.raw::<nsIAtom>()
context.mMediaEmulated.mRawPtr
} else {
context.mMedium
};
@@ -124,7 +124,7 @@ impl ComputedValues {
pub fn pseudo(&self) -> Option<PseudoElement> {
use string_cache::Atom;

let atom = (self.0)._base.mPseudoTag.raw::<structs::nsIAtom>();
let atom = (self.0)._base.mPseudoTag.mRawPtr;
if atom.is_null() {
return None;
}
@@ -3235,11 +3235,10 @@ fn static_assert() {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_no_properties;
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable;
use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN;
use gecko_bindings::structs::nsIAtom;

let property = self.gecko.mTransitions[index].mProperty;
if property == eCSSProperty_UNKNOWN || property == eCSSPropertyExtra_variable {
let atom = self.gecko.mTransitions[index].mUnknownProperty.raw::<nsIAtom>();
let atom = self.gecko.mTransitions[index].mUnknownProperty.mRawPtr;
debug_assert!(!atom.is_null());
TransitionProperty::Unsupported(CustomIdent(atom.into()))
} else if property == eCSSPropertyExtra_no_properties {
@@ -3258,7 +3257,6 @@ fn static_assert() {
pub fn copy_transition_property_from(&mut self, other: &Self) {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable;
use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN;
use gecko_bindings::structs::nsIAtom;
unsafe { self.gecko.mTransitions.ensure_len(other.gecko.mTransitions.len()) };

let count = other.gecko.mTransitionPropertyCount;
@@ -3268,7 +3266,7 @@ fn static_assert() {
transition.mProperty = other.gecko.mTransitions[index].mProperty;
if transition.mProperty == eCSSProperty_UNKNOWN ||
transition.mProperty == eCSSPropertyExtra_variable {
let atom = other.gecko.mTransitions[index].mUnknownProperty.raw::<nsIAtom>();
let atom = other.gecko.mTransitions[index].mUnknownProperty.mRawPtr;
debug_assert!(!atom.is_null());
unsafe { Gecko_StyleTransition_SetUnsupportedProperty(transition, atom) };
}
@@ -3533,12 +3531,12 @@ fn static_assert() {
use gecko_bindings::structs::nsIAtom;
use values::CustomIdent;

if self.gecko.mWillChange.mBuffer.len() == 0 {
if self.gecko.mWillChange.len() == 0 {
T::Auto
} else {
T::AnimateableFeatures(
self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| {
CustomIdent((*gecko_atom as *mut nsIAtom).into())
self.gecko.mWillChange.iter().map(|gecko_atom| {
CustomIdent((gecko_atom.mRawPtr as *mut nsIAtom).into())
}).collect()
)
}
@@ -5161,7 +5159,7 @@ clip-path
} else if servo.0 == atom!("stroke-opacity") {
self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_STROKE_OPACITY as u8;
}
unsafe { gecko.set_raw_from_addrefed::<structs::nsIAtom>(servo.0.into_addrefed()) }
unsafe { gecko.mRawPtr = servo.0.into_addrefed() }
}
}

@@ -660,11 +660,10 @@ ${helpers.single_keyword_system("font-variant-caps",
// we could use clone_language and clone_font_family() here but that's
// expensive. Do it only in gecko mode for now.
% if product == "gecko":
use gecko_bindings::structs::nsIAtom;
// if the language or generic changed, we need to recalculate
// the font size from the stored font-size origin information.
if context.builder.get_font().gecko().mLanguage.raw::<nsIAtom>() !=
context.builder.get_parent_font().gecko().mLanguage.raw::<nsIAtom>() ||
if context.builder.get_font().gecko().mLanguage.mRawPtr !=
context.builder.get_parent_font().gecko().mLanguage.mRawPtr ||
context.builder.get_font().gecko().mGenericID !=
context.builder.get_parent_font().gecko().mGenericID {
if let Some(info) = computed.keyword_info {
@@ -11,7 +11,7 @@ use dom::TElement;
use element_state::ElementState;
use font_metrics::FontMetricsProvider;
#[cfg(feature = "gecko")]
use gecko_bindings::structs::{nsIAtom, ServoStyleSetSizes, StyleRuleInclusion};
use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
use hashglobe::FailedAllocationError;
use invalidation::element::invalidation_map::InvalidationMap;
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
@@ -1588,7 +1588,7 @@ impl ExtraStyleData {
guard: &SharedRwLockReadGuard,
rule: &Arc<Locked<CounterStyleRule>>,
) {
let name = rule.read_with(guard).mName.raw::<nsIAtom>().into();
let name = rule.read_with(guard).mName.mRawPtr.into();
self.counter_styles.insert(name, rule.clone());
}

@@ -168,7 +168,6 @@ impl ToComputedValue for KeywordSize {
type ComputedValue = NonNegativeLength;
#[inline]
fn to_computed_value(&self, cx: &Context) -> NonNegativeLength {
use gecko_bindings::structs::nsIAtom;
use values::specified::length::au_to_int_px;
// Data from nsRuleNode.cpp in Gecko
// Mapping from base size and HTML size to pixels
@@ -194,7 +193,7 @@ impl ToComputedValue for KeywordSize {
// XXXManishearth handle quirks mode (bug 1401322)

let ref gecko_font = cx.style().get_font().gecko();
let base_size = unsafe { Atom::with(gecko_font.mLanguage.raw::<nsIAtom>(), |atom| {
let base_size = unsafe { Atom::with(gecko_font.mLanguage.mRawPtr, |atom| {
cx.font_metrics_provider.get_size(atom, gecko_font.mGenericID).0
}) };

0 comments on commit 7019d42

Please sign in to comment.
You can’t perform that action at this time.