Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare stylo crates for switching to the 2018 edition #22083

Merged
merged 5 commits into from Nov 10, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

`cargo fix --edition --features gecko`

  • Loading branch information
SimonSapin committed Nov 10, 2018
commit b1822a39fa8931f5c51302f6b282e5c54c447dfb
@@ -7,14 +7,14 @@

use crate::context::QuirksMode;
use crate::dom::TElement;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::media_queries::ToMediaListKey;
use crate::media_queries::Device;
use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheet_set::AuthorStylesheetSet;
use crate::stylesheets::StylesheetInDocument;
use crate::stylist::CascadeData;
#[cfg(feature = "gecko")]
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};

/// A set of author stylesheets and their computed representation, such as the
/// ones used for ShadowRoot and XBL.
@@ -76,10 +76,10 @@ where
}

#[cfg(feature = "gecko")]
unsafe impl HasFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {
type FFIType = ::gecko_bindings::bindings::RawServoAuthorStyles;
unsafe impl HasFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {
type FFIType = crate::gecko_bindings::bindings::RawServoAuthorStyles;
}
#[cfg(feature = "gecko")]
unsafe impl HasSimpleFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {}
unsafe impl HasSimpleFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
#[cfg(feature = "gecko")]
unsafe impl HasBoxFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {}
unsafe impl HasBoxFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
@@ -13,6 +13,8 @@ use crate::data::{EagerPseudoStyles, ElementData};
use crate::dom::OpaqueNode;
use crate::dom::{SendElement, TElement};
use crate::font_metrics::FontMetricsProvider;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs;
use crate::parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
use crate::properties::ComputedValues;
#[cfg(feature = "servo")]
@@ -30,8 +32,6 @@ use crate::traversal_flags::TraversalFlags;
use euclid::Size2D;
use euclid::TypedScale;
use fxhash::FxHashMap;
#[cfg(feature = "gecko")]
use gecko_bindings::structs;
#[cfg(feature = "servo")]
use parking_lot::RwLock;
use selectors::matching::ElementSelectorFlags;
@@ -8,11 +8,11 @@
#![deny(missing_docs)]

use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::applicable_declarations::ApplicableDeclarationBlock;
#[cfg(feature = "gecko")]
use context::PostAnimationTasks;
use crate::context::PostAnimationTasks;
#[cfg(feature = "gecko")]
use context::UpdateAnimationsTasks;
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::context::UpdateAnimationsTasks;
use crate::data::ElementData;
use crate::element_state::ElementState;
use crate::font_metrics::FontMetricsProvider;
@@ -26,7 +26,7 @@ fn should_report_statistics() -> bool {

#[cfg(feature = "gecko")]
fn should_report_statistics() -> bool {
unsafe { ::gecko_bindings::structs::ServoTraversalStatistics_sActive }
unsafe { crate::gecko_bindings::structs::ServoTraversalStatistics_sActive }
}

#[cfg(feature = "servo")]
@@ -38,9 +38,9 @@ fn report_statistics(_stats: &PerThreadTraversalStatistics) {
fn report_statistics(stats: &PerThreadTraversalStatistics) {
// This should only be called in the main thread, or it may be racy
// to update the statistics in a global variable.
debug_assert!(unsafe { ::gecko_bindings::bindings::Gecko_IsMainThread() });
debug_assert!(unsafe { crate::gecko_bindings::bindings::Gecko_IsMainThread() });
let gecko_stats =
unsafe { &mut ::gecko_bindings::structs::ServoTraversalStatistics_sSingleton };
unsafe { &mut crate::gecko_bindings::structs::ServoTraversalStatistics_sSingleton };
gecko_stats.mElementsTraversed += stats.elements_traversed;
gecko_stats.mElementsStyled += stats.elements_styled;
gecko_stats.mElementsMatched += stats.elements_matched;
@@ -8,27 +8,29 @@

use crate::error_reporting::ContextualParseError;
use crate::parser::{Parse, ParserContext};
#[cfg(feature = "gecko")]
use crate::properties::longhands::font_language_override;
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::values::computed::font::FamilyName;
use crate::values::generics::font::FontStyle as GenericFontStyle;
use crate::values::specified::font::SpecifiedFontStyle;
use crate::values::specified::font::{AbsoluteFontWeight, FontStretch};
#[cfg(feature = "gecko")]
use crate::values::specified::font::{
SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings,
};
use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::Angle;
#[cfg(feature = "gecko")]
use cssparser::UnicodeRange;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use cssparser::{CowRcStr, SourceLocation};
#[cfg(feature = "gecko")]
use properties::longhands::font_language_override;
use selectors::parser::SelectorParseErrorKind;
use std::fmt::{self, Write};
use style_traits::values::SequenceWriter;
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
use style_traits::{StyleParseErrorKind, ToCss};
#[cfg(feature = "gecko")]
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};

/// A source for a font-face rule.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
@@ -53,8 +55,8 @@ impl OneOrMoreSeparated for Source {
#[repr(u8)]
#[allow(missing_docs)]
pub enum FontFaceSourceListComponent {
Url(*const ::gecko_bindings::structs::mozilla::css::URLValue),
Local(*mut ::gecko_bindings::structs::nsAtom),
Url(*const crate::gecko_bindings::structs::mozilla::css::URLValue),
Local(*mut crate::gecko_bindings::structs::nsAtom),
FormatHint {
length: usize,
utf8_bytes: *const u8,
@@ -410,13 +412,13 @@ impl Parse for Source {
macro_rules! is_descriptor_enabled {
("font-display") => {
unsafe {
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled
}
};
("font-variation-settings") => {
unsafe {
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled != 0
}
};
@@ -86,8 +86,8 @@ impl FontMetricsProvider for ServoMetricsProvider {

#[cfg(feature = "gecko")]
/// Construct a font metrics provider for the current product
pub fn get_metrics_provider_for_product() -> ::gecko::wrapper::GeckoFontMetricsProvider {
::gecko::wrapper::GeckoFontMetricsProvider::new()
pub fn get_metrics_provider_for_product() -> crate::gecko::wrapper::GeckoFontMetricsProvider {
crate::gecko::wrapper::GeckoFontMetricsProvider::new()
}

#[cfg(feature = "servo")]
@@ -8,40 +8,42 @@

#![allow(non_snake_case, missing_docs)]

use gecko::url::CssUrlData;
use gecko_bindings::bindings::RawServoCounterStyleRule;
use gecko_bindings::bindings::RawServoFontFeatureValuesRule;
use gecko_bindings::bindings::RawServoImportRule;
use gecko_bindings::bindings::RawServoKeyframe;
use gecko_bindings::bindings::RawServoKeyframesRule;
use gecko_bindings::bindings::RawServoMediaRule;
use gecko_bindings::bindings::RawServoMozDocumentRule;
use gecko_bindings::bindings::RawServoNamespaceRule;
use gecko_bindings::bindings::RawServoPageRule;
use gecko_bindings::bindings::RawServoRuleNode;
use gecko_bindings::bindings::RawServoRuleNodeStrong;
use gecko_bindings::bindings::RawServoSupportsRule;
use gecko_bindings::bindings::ServoCssRules;
use gecko_bindings::structs::RawServoAnimationValue;
use gecko_bindings::structs::RawServoCssUrlData;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawServoFontFaceRule;
use gecko_bindings::structs::RawServoMediaList;
use gecko_bindings::structs::RawServoQuotes;
use gecko_bindings::structs::RawServoStyleRule;
use gecko_bindings::structs::RawServoStyleSheetContents;
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
use media_queries::MediaList;
use properties::animated_properties::AnimationValue;
use properties::{ComputedValues, PropertyDeclarationBlock};
use rule_tree::StrongRuleNode;
use crate::gecko::url::CssUrlData;
use crate::gecko_bindings::bindings::RawServoCounterStyleRule;
use crate::gecko_bindings::bindings::RawServoFontFeatureValuesRule;
use crate::gecko_bindings::bindings::RawServoImportRule;
use crate::gecko_bindings::bindings::RawServoKeyframe;
use crate::gecko_bindings::bindings::RawServoKeyframesRule;
use crate::gecko_bindings::bindings::RawServoMediaRule;
use crate::gecko_bindings::bindings::RawServoMozDocumentRule;
use crate::gecko_bindings::bindings::RawServoNamespaceRule;
use crate::gecko_bindings::bindings::RawServoPageRule;
use crate::gecko_bindings::bindings::RawServoRuleNode;
use crate::gecko_bindings::bindings::RawServoRuleNodeStrong;
use crate::gecko_bindings::bindings::RawServoSupportsRule;
use crate::gecko_bindings::bindings::ServoCssRules;
use crate::gecko_bindings::structs::RawServoAnimationValue;
use crate::gecko_bindings::structs::RawServoCssUrlData;
use crate::gecko_bindings::structs::RawServoDeclarationBlock;
use crate::gecko_bindings::structs::RawServoFontFaceRule;
use crate::gecko_bindings::structs::RawServoMediaList;
use crate::gecko_bindings::structs::RawServoQuotes;
use crate::gecko_bindings::structs::RawServoStyleRule;
use crate::gecko_bindings::structs::RawServoStyleSheetContents;
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
use crate::media_queries::MediaList;
use crate::properties::animated_properties::AnimationValue;
use crate::properties::{ComputedValues, PropertyDeclarationBlock};
use crate::rule_tree::StrongRuleNode;
use crate::shared_lock::Locked;
use crate::stylesheets::keyframes_rule::Keyframe;
use crate::stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
use crate::stylesheets::{
DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule,
};
use crate::stylesheets::{StyleRule, StylesheetContents, SupportsRule};
use servo_arc::{Arc, ArcBorrow};
use shared_lock::Locked;
use std::{mem, ptr};
use stylesheets::keyframes_rule::Keyframe;
use stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule};
use stylesheets::{StyleRule, StylesheetContents, SupportsRule};
use values::computed::QuotePair;

macro_rules! impl_arc_ffi {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.