servo: Merge #18649 - Devirtualize nsIAtom (from nnethercote:bug-1400459); r=froydnj

<!-- Please describe your changes on the following line: -->

https://bugzilla.mozilla.org/show_bug.cgi?id=1400459
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1400459

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because tested on the Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 54f8a131ea50fe8b0480d9f146acc97e13bc45d6

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 490a18d56715a458cad9f0ee341ca798a1b1dc2d
This commit is contained in:
Nicholas Nethercote 2017-09-27 00:52:31 -05:00
Родитель ab8f04191a
Коммит f5c40383ca
7 изменённых файлов: 1009 добавлений и 1929 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -18,7 +18,6 @@ use gecko_bindings::structs::{nsCSSKeyword, nsCSSProps_KTableEntry, nsCSSValue,
use gecko_bindings::structs::{nsMediaExpression_Range, nsMediaFeature}; use gecko_bindings::structs::{nsMediaExpression_Range, nsMediaFeature};
use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType, nsMediaFeature_RequirementFlags}; use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType, nsMediaFeature_RequirementFlags};
use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextOwned}; use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextOwned};
use gecko_bindings::structs::nsIAtom;
use media_queries::MediaType; use media_queries::MediaType;
use parser::ParserContext; use parser::ParserContext;
use properties::{ComputedValues, StyleBuilder}; use properties::{ComputedValues, StyleBuilder};
@ -165,7 +164,7 @@ impl Device {
// mMediaEmulated. // mMediaEmulated.
let context = self.pres_context(); let context = self.pres_context();
let medium_to_use = if context.mIsEmulatingMedia() != 0 { let medium_to_use = if context.mIsEmulatingMedia() != 0 {
context.mMediaEmulated.raw::<nsIAtom>() context.mMediaEmulated.mRawPtr
} else { } else {
context.mMedium context.mMedium
}; };

Просмотреть файл

@ -124,7 +124,7 @@ impl ComputedValues {
pub fn pseudo(&self) -> Option<PseudoElement> { pub fn pseudo(&self) -> Option<PseudoElement> {
use string_cache::Atom; use string_cache::Atom;
let atom = (self.0)._base.mPseudoTag.raw::<structs::nsIAtom>(); let atom = (self.0)._base.mPseudoTag.mRawPtr;
if atom.is_null() { if atom.is_null() {
return None; return None;
} }
@ -3235,11 +3235,10 @@ fn static_assert() {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_no_properties; use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_no_properties;
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable; use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable;
use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN; use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN;
use gecko_bindings::structs::nsIAtom;
let property = self.gecko.mTransitions[index].mProperty; let property = self.gecko.mTransitions[index].mProperty;
if property == eCSSProperty_UNKNOWN || property == eCSSPropertyExtra_variable { 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()); debug_assert!(!atom.is_null());
TransitionProperty::Unsupported(CustomIdent(atom.into())) TransitionProperty::Unsupported(CustomIdent(atom.into()))
} else if property == eCSSPropertyExtra_no_properties { } else if property == eCSSPropertyExtra_no_properties {
@ -3258,7 +3257,6 @@ fn static_assert() {
pub fn copy_transition_property_from(&mut self, other: &Self) { pub fn copy_transition_property_from(&mut self, other: &Self) {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable; use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable;
use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN; use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN;
use gecko_bindings::structs::nsIAtom;
unsafe { self.gecko.mTransitions.ensure_len(other.gecko.mTransitions.len()) }; unsafe { self.gecko.mTransitions.ensure_len(other.gecko.mTransitions.len()) };
let count = other.gecko.mTransitionPropertyCount; let count = other.gecko.mTransitionPropertyCount;
@ -3268,7 +3266,7 @@ fn static_assert() {
transition.mProperty = other.gecko.mTransitions[index].mProperty; transition.mProperty = other.gecko.mTransitions[index].mProperty;
if transition.mProperty == eCSSProperty_UNKNOWN || if transition.mProperty == eCSSProperty_UNKNOWN ||
transition.mProperty == eCSSPropertyExtra_variable { 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()); debug_assert!(!atom.is_null());
unsafe { Gecko_StyleTransition_SetUnsupportedProperty(transition, atom) }; unsafe { Gecko_StyleTransition_SetUnsupportedProperty(transition, atom) };
} }
@ -3533,12 +3531,12 @@ fn static_assert() {
use gecko_bindings::structs::nsIAtom; use gecko_bindings::structs::nsIAtom;
use values::CustomIdent; use values::CustomIdent;
if self.gecko.mWillChange.mBuffer.len() == 0 { if self.gecko.mWillChange.len() == 0 {
T::Auto T::Auto
} else { } else {
T::AnimateableFeatures( T::AnimateableFeatures(
self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| { self.gecko.mWillChange.iter().map(|gecko_atom| {
CustomIdent((*gecko_atom as *mut nsIAtom).into()) CustomIdent((gecko_atom.mRawPtr as *mut nsIAtom).into())
}).collect() }).collect()
) )
} }
@ -5161,7 +5159,7 @@ clip-path
} else if servo.0 == atom!("stroke-opacity") { } else if servo.0 == atom!("stroke-opacity") {
self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_STROKE_OPACITY as u8; 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 // we could use clone_language and clone_font_family() here but that's
// expensive. Do it only in gecko mode for now. // expensive. Do it only in gecko mode for now.
% if product == "gecko": % if product == "gecko":
use gecko_bindings::structs::nsIAtom;
// if the language or generic changed, we need to recalculate // if the language or generic changed, we need to recalculate
// the font size from the stored font-size origin information. // the font size from the stored font-size origin information.
if context.builder.get_font().gecko().mLanguage.raw::<nsIAtom>() != if context.builder.get_font().gecko().mLanguage.mRawPtr !=
context.builder.get_parent_font().gecko().mLanguage.raw::<nsIAtom>() || context.builder.get_parent_font().gecko().mLanguage.mRawPtr ||
context.builder.get_font().gecko().mGenericID != context.builder.get_font().gecko().mGenericID !=
context.builder.get_parent_font().gecko().mGenericID { context.builder.get_parent_font().gecko().mGenericID {
if let Some(info) = computed.keyword_info { if let Some(info) = computed.keyword_info {

Просмотреть файл

@ -11,7 +11,7 @@ use dom::TElement;
use element_state::ElementState; use element_state::ElementState;
use font_metrics::FontMetricsProvider; use font_metrics::FontMetricsProvider;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs::{nsIAtom, ServoStyleSetSizes, StyleRuleInclusion}; use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
use hashglobe::FailedAllocationError; use hashglobe::FailedAllocationError;
use invalidation::element::invalidation_map::InvalidationMap; use invalidation::element::invalidation_map::InvalidationMap;
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey}; use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
@ -1588,7 +1588,7 @@ impl ExtraStyleData {
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
rule: &Arc<Locked<CounterStyleRule>>, 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()); self.counter_styles.insert(name, rule.clone());
} }

Просмотреть файл

@ -168,7 +168,6 @@ impl ToComputedValue for KeywordSize {
type ComputedValue = NonNegativeLength; type ComputedValue = NonNegativeLength;
#[inline] #[inline]
fn to_computed_value(&self, cx: &Context) -> NonNegativeLength { fn to_computed_value(&self, cx: &Context) -> NonNegativeLength {
use gecko_bindings::structs::nsIAtom;
use values::specified::length::au_to_int_px; use values::specified::length::au_to_int_px;
// Data from nsRuleNode.cpp in Gecko // Data from nsRuleNode.cpp in Gecko
// Mapping from base size and HTML size to pixels // Mapping from base size and HTML size to pixels
@ -194,7 +193,7 @@ impl ToComputedValue for KeywordSize {
// XXXManishearth handle quirks mode (bug 1401322) // XXXManishearth handle quirks mode (bug 1401322)
let ref gecko_font = cx.style().get_font().gecko(); 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 cx.font_metrics_provider.get_size(atom, gecko_font.mGenericID).0
}) }; }) };