Bug 1506391 - `cargo fix --edition --features gecko`. r=emilio

This commit is contained in:
Simon Sapin 2018-11-06 22:33:52 +01:00 коммит произвёл Emilio Cobos Álvarez
Родитель 4f9e2bcf36
Коммит f7c7465ccb
87 изменённых файлов: 614 добавлений и 585 удалений

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

@ -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};
#[cfg(feature = "gecko")]
use context::PostAnimationTasks;
#[cfg(feature = "gecko")]
use context::UpdateAnimationsTasks;
use crate::applicable_declarations::ApplicableDeclarationBlock;
#[cfg(feature = "gecko")]
use crate::context::PostAnimationTasks;
#[cfg(feature = "gecko")]
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 {

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

@ -9,24 +9,24 @@
#![allow(unsafe_code)]
use app_units::Au;
use gecko::values::GeckoStyleCoordConvertible;
use gecko_bindings::bindings;
use gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
use gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
use std::f32::consts::PI;
use stylesheets::{Origin, RulesMutateError};
use values::computed::image::LineDirection;
use values::computed::url::ComputedImageUrl;
use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
use values::computed::{
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
use crate::gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
use crate::stylesheets::{Origin, RulesMutateError};
use crate::values::computed::image::LineDirection;
use crate::values::computed::url::ComputedImageUrl;
use crate::values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
use crate::values::computed::{
Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto,
};
use values::computed::{Percentage, TextAlign};
use values::generics::box_::VerticalAlign;
use values::generics::grid::{TrackListValue, TrackSize};
use values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
use values::generics::rect::Rect;
use crate::values::computed::{Percentage, TextAlign};
use crate::values::generics::box_::VerticalAlign;
use crate::values::generics::grid::{TrackListValue, TrackSize};
use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
use crate::values::generics::rect::Rect;
use std::f32::consts::PI;
impl From<CalcLengthOrPercentage> for nsStyleCoord_CalcValue {
fn from(other: CalcLengthOrPercentage) -> nsStyleCoord_CalcValue {
@ -112,8 +112,8 @@ impl From<nsStyleCoord_CalcValue> for LengthOrPercentageOrAuto {
// disappear as we move more stuff to cbindgen.
impl From<nsStyleCoord_CalcValue> for NonNegativeLengthOrPercentageOrAuto {
fn from(other: nsStyleCoord_CalcValue) -> Self {
use crate::values::generics::NonNegative;
use style_traits::values::specified::AllowedNumericType;
use values::generics::NonNegative;
NonNegative(if other.mLength < 0 || other.mPercent < 0. {
LengthOrPercentageOrAuto::Calc(CalcLengthOrPercentage::with_clamping_mode(
Au(other.mLength).into(),
@ -137,8 +137,8 @@ impl From<Angle> for CoordDataValue {
}
fn line_direction(horizontal: LengthOrPercentage, vertical: LengthOrPercentage) -> LineDirection {
use values::computed::position::Position;
use values::specified::position::{X, Y};
use crate::values::computed::position::Position;
use crate::values::specified::position::{X, Y};
let horizontal_percentage = match horizontal {
LengthOrPercentage::Percentage(percentage) => Some(percentage.0),
@ -240,8 +240,10 @@ impl nsStyleImage {
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
use values::generics::image::{Circle, Ellipse, EndingShape, GradientKind, ShapeExtent};
use values::specified::position::{X, Y};
use crate::values::generics::image::{
Circle, Ellipse, EndingShape, GradientKind, ShapeExtent,
};
use crate::values::specified::position::{X, Y};
let stop_count = gradient.items.len();
if stop_count >= ::std::u32::MAX as usize {
@ -437,8 +439,8 @@ impl nsStyleImage {
/// Converts into Image.
pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> {
use gecko_bindings::structs::nsStyleImageType;
use values::computed::{MozImageRect, NumberOrPercentage};
use crate::gecko_bindings::structs::nsStyleImageType;
use crate::values::computed::{MozImageRect, NumberOrPercentage};
match self.mType {
nsStyleImageType::eStyleImageType_Null => None,
@ -477,7 +479,7 @@ impl nsStyleImage {
Some(GenericImage::Gradient(self.get_gradient()))
},
nsStyleImageType::eStyleImageType_Element => {
use gecko_string_cache::Atom;
use crate::gecko_string_cache::Atom;
let atom = bindings::Gecko_GetImageElement(self);
Some(GenericImage::Element(Atom::from_raw(atom)))
},
@ -497,11 +499,11 @@ impl nsStyleImage {
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
use values::computed::image::LineDirection;
use values::computed::position::Position;
use values::computed::Length;
use values::generics::image::{Circle, ColorStop, CompatMode, Ellipse};
use values::generics::image::{EndingShape, GradientKind, ShapeExtent};
use crate::values::computed::image::LineDirection;
use crate::values::computed::position::Position;
use crate::values::computed::Length;
use crate::values::generics::image::{Circle, ColorStop, CompatMode, Ellipse};
use crate::values::generics::image::{EndingShape, GradientKind, ShapeExtent};
let gecko_gradient = bindings::Gecko_GetGradientImageValue(self)
.as_ref()
@ -652,26 +654,32 @@ impl nsStyleImage {
pub mod basic_shape {
//! Conversions from and to CSS shape representations.
use gecko::values::GeckoStyleCoordConvertible;
use gecko_bindings::structs;
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType};
use gecko_bindings::structs::{StyleGeometryBox, StyleShapeSource, StyleShapeSourceType};
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use gecko_bindings::sugar::refptr::RefPtr;
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
use crate::gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType};
use crate::gecko_bindings::structs::{
StyleGeometryBox, StyleShapeSource, StyleShapeSourceType,
};
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use crate::gecko_bindings::sugar::refptr::RefPtr;
use crate::values::computed::basic_shape::{
BasicShape, ClippingShape, FloatAreaShape, ShapeRadius,
};
use crate::values::computed::border::{BorderCornerRadius, BorderRadius};
use crate::values::computed::length::LengthOrPercentage;
use crate::values::computed::motion::OffsetPath;
use crate::values::computed::position;
use crate::values::computed::url::ComputedUrl;
use crate::values::generics::basic_shape::{
BasicShape as GenericBasicShape, InsetRect, Polygon,
};
use crate::values::generics::basic_shape::{Circle, Ellipse, Path, PolygonCoord};
use crate::values::generics::basic_shape::{GeometryBox, ShapeBox, ShapeSource};
use crate::values::generics::border::BorderRadius as GenericBorderRadius;
use crate::values::generics::rect::Rect;
use crate::values::specified::SVGPathData;
use std::borrow::Borrow;
use values::computed::basic_shape::{BasicShape, ClippingShape, FloatAreaShape, ShapeRadius};
use values::computed::border::{BorderCornerRadius, BorderRadius};
use values::computed::length::LengthOrPercentage;
use values::computed::motion::OffsetPath;
use values::computed::position;
use values::computed::url::ComputedUrl;
use values::generics::basic_shape::{BasicShape as GenericBasicShape, InsetRect, Polygon};
use values::generics::basic_shape::{Circle, Ellipse, Path, PolygonCoord};
use values::generics::basic_shape::{GeometryBox, ShapeBox, ShapeSource};
use values::generics::border::BorderRadius as GenericBorderRadius;
use values::generics::rect::Rect;
use values::specified::SVGPathData;
impl StyleShapeSource {
/// Convert StyleShapeSource to ShapeSource except URL and Image
@ -706,7 +714,7 @@ pub mod basic_shape {
/// Generate a SVGPathData from StyleShapeSource if possible.
fn to_svg_path(&self) -> Option<SVGPathData> {
use values::specified::svg_path::PathCommand;
use crate::values::specified::svg_path::PathCommand;
match self.mType {
StyleShapeSourceType::Path => {
let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr };
@ -908,7 +916,7 @@ pub mod basic_shape {
impl From<ShapeBox> for StyleGeometryBox {
fn from(reference: ShapeBox) -> Self {
use gecko_bindings::structs::StyleGeometryBox::*;
use crate::gecko_bindings::structs::StyleGeometryBox::*;
match reference {
ShapeBox::ContentBox => ContentBox,
ShapeBox::PaddingBox => PaddingBox,
@ -920,7 +928,7 @@ pub mod basic_shape {
impl From<GeometryBox> for StyleGeometryBox {
fn from(reference: GeometryBox) -> Self {
use gecko_bindings::structs::StyleGeometryBox::*;
use crate::gecko_bindings::structs::StyleGeometryBox::*;
match reference {
GeometryBox::ShapeBox(shape_box) => From::from(shape_box),
GeometryBox::FillBox => FillBox,
@ -935,7 +943,7 @@ pub mod basic_shape {
// but coherence doesn't like that and TryFrom isn't stable
impl From<StyleGeometryBox> for GeometryBox {
fn from(reference: StyleGeometryBox) -> Self {
use gecko_bindings::structs::StyleGeometryBox::*;
use crate::gecko_bindings::structs::StyleGeometryBox::*;
match reference {
ContentBox => GeometryBox::ShapeBox(ShapeBox::ContentBox),
PaddingBox => GeometryBox::ShapeBox(ShapeBox::PaddingBox),
@ -951,7 +959,7 @@ pub mod basic_shape {
impl From<StyleGeometryBox> for ShapeBox {
fn from(reference: StyleGeometryBox) -> Self {
use gecko_bindings::structs::StyleGeometryBox::*;
use crate::gecko_bindings::structs::StyleGeometryBox::*;
match reference {
ContentBox => ShapeBox::ContentBox,
PaddingBox => ShapeBox::PaddingBox,
@ -987,9 +995,9 @@ impl From<Origin> for SheetType {
impl TrackSize<LengthOrPercentage> {
/// Return TrackSize from given two nsStyleCoord
pub fn from_gecko_style_coords<T: CoordData>(gecko_min: &T, gecko_max: &T) -> Self {
use gecko_bindings::structs::root::nsStyleUnit;
use values::computed::length::LengthOrPercentage;
use values::generics::grid::{TrackBreadth, TrackSize};
use crate::gecko_bindings::structs::root::nsStyleUnit;
use crate::values::computed::length::LengthOrPercentage;
use crate::values::generics::grid::{TrackBreadth, TrackSize};
if gecko_min.unit() == nsStyleUnit::eStyleUnit_None {
debug_assert!(
@ -1016,7 +1024,7 @@ impl TrackSize<LengthOrPercentage> {
/// Save TrackSize to given gecko fields.
pub fn to_gecko_style_coords<T: CoordDataMut>(&self, gecko_min: &mut T, gecko_max: &mut T) {
use values::generics::grid::TrackSize;
use crate::values::generics::grid::TrackSize;
match *self {
TrackSize::FitContent(ref lop) => {
@ -1047,7 +1055,7 @@ impl TrackListValue<LengthOrPercentage, Integer> {
/// Save TrackSize to given gecko fields.
pub fn to_gecko_style_coords<T: CoordDataMut>(&self, gecko_min: &mut T, gecko_max: &mut T) {
use values::generics::grid::TrackListValue;
use crate::values::generics::grid::TrackListValue;
match *self {
TrackListValue::TrackSize(ref size) => size.to_gecko_style_coords(gecko_min, gecko_max),
@ -1061,7 +1069,7 @@ where
T: GeckoStyleCoordConvertible,
{
/// Convert this generic Rect to given Gecko fields.
pub fn to_gecko_rect(&self, sides: &mut ::gecko_bindings::structs::nsStyleSides) {
pub fn to_gecko_rect(&self, sides: &mut crate::gecko_bindings::structs::nsStyleSides) {
self.0.to_gecko_style_coord(&mut sides.data_at_mut(0));
self.1.to_gecko_style_coord(&mut sides.data_at_mut(1));
self.2.to_gecko_style_coord(&mut sides.data_at_mut(2));
@ -1070,9 +1078,9 @@ where
/// Convert from given Gecko data to generic Rect.
pub fn from_gecko_rect(
sides: &::gecko_bindings::structs::nsStyleSides,
) -> Option<::values::generics::rect::Rect<T>> {
use values::generics::rect::Rect;
sides: &crate::gecko_bindings::structs::nsStyleSides,
) -> Option<crate::values::generics::rect::Rect<T>> {
use crate::values::generics::rect::Rect;
Some(Rect::new(
T::from_gecko_style_coord(&sides.data_at(0)).expect("coord[0] cound not convert"),

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

@ -5,23 +5,23 @@
//! Data needed to style a Gecko document.
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use context::QuirksMode;
use dom::TElement;
use gecko_bindings::bindings::{self, RawServoStyleSet};
use gecko_bindings::structs::StyleSheet as DomStyleSheet;
use gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes};
use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
use crate::context::QuirksMode;
use crate::dom::TElement;
use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
use crate::gecko_bindings::structs::StyleSheet as DomStyleSheet;
use crate::gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
use crate::gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes};
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use crate::media_queries::{Device, MediaList};
use crate::properties::ComputedValues;
use crate::selector_parser::SnapshotMap;
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
use crate::stylist::Stylist;
use malloc_size_of::MallocSizeOfOps;
use media_queries::{Device, MediaList};
use properties::ComputedValues;
use selector_parser::SnapshotMap;
use servo_arc::Arc;
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use std::fmt;
use stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
use stylist::Stylist;
/// Little wrapper to a Gecko style sheet.
#[derive(Eq, PartialEq)]
@ -38,7 +38,7 @@ impl fmt::Debug for GeckoStyleSheet {
}
}
impl ToMediaListKey for ::gecko::data::GeckoStyleSheet {
impl ToMediaListKey for crate::gecko::data::GeckoStyleSheet {
fn to_media_list_key(&self) -> MediaListKey {
use std::mem;
unsafe { MediaListKey::from_raw(mem::transmute(self.0)) }
@ -105,7 +105,7 @@ impl StylesheetInDocument for GeckoStyleSheet {
}
fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
use gecko_bindings::structs::mozilla::dom::MediaList as DomMediaList;
use crate::gecko_bindings::structs::mozilla::dom::MediaList as DomMediaList;
use std::mem;
unsafe {

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

@ -4,17 +4,19 @@
//! Global style data
use context::StyleSystemOptions;
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
use crate::context::StyleSystemOptions;
use crate::gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
use crate::gecko_bindings::bindings::{
Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread,
};
use crate::parallel::STYLE_THREAD_STACK_SIZE_KB;
use crate::shared_lock::SharedRwLock;
use crate::thread_state;
use num_cpus;
use parallel::STYLE_THREAD_STACK_SIZE_KB;
use rayon;
use shared_lock::SharedRwLock;
use std::cmp;
use std::env;
use std::ffi::CString;
use thread_state;
/// Global style data
pub struct GlobalStyleData {

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

@ -5,16 +5,16 @@
//! Gecko's media feature list and evaluator.
use app_units::Au;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
use crate::media_queries::media_feature_expression::{AspectRatio, RangeOrOperator};
use crate::media_queries::Device;
use crate::values::computed::CSSPixelLength;
use crate::values::computed::Resolution;
use crate::Atom;
use euclid::Size2D;
use gecko_bindings::bindings;
use gecko_bindings::structs;
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use media_queries::media_feature::{Evaluator, MediaFeatureDescription};
use media_queries::media_feature_expression::{AspectRatio, RangeOrOperator};
use media_queries::Device;
use values::computed::CSSPixelLength;
use values::computed::Resolution;
use Atom;
fn viewport_size(device: &Device) -> Size2D<Au> {
let pc = device.pres_context();

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

@ -6,24 +6,24 @@
use app_units::Au;
use app_units::AU_PER_PX;
use crate::custom_properties::CssEnvironment;
use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::{nsPresContext, RawGeckoPresContextBorrowed};
use crate::media_queries::MediaType;
use crate::properties::ComputedValues;
use crate::string_cache::Atom;
use crate::values::computed::font::FontSize;
use crate::values::{CustomIdent, KeyframesName};
use cssparser::RGBA;
use custom_properties::CssEnvironment;
use euclid::Size2D;
use euclid::TypedScale;
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use gecko_bindings::bindings;
use gecko_bindings::structs;
use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextBorrowed};
use media_queries::MediaType;
use properties::ComputedValues;
use servo_arc::Arc;
use std::fmt;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
use string_cache::Atom;
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel};
use values::computed::font::FontSize;
use values::{CustomIdent, KeyframesName};
/// The `Device` in Gecko wraps a pres context, has a default values computed,
/// and contains all the viewport rule state.

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

@ -8,16 +8,16 @@
//! `pseudo_element_definition.mako.rs`. If you touch that file, you probably
//! need to update the checked-in files for Servo.
use crate::gecko_bindings::structs::{self, CSSPseudoElementType};
use crate::properties::longhands::display::computed_value::T as Display;
use crate::properties::{ComputedValues, PropertyFlags};
use crate::selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
use crate::str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use crate::string_cache::Atom;
use crate::values::serialize_atom_identifier;
use cssparser::ToCss;
use gecko_bindings::structs::{self, CSSPseudoElementType};
use properties::longhands::display::computed_value::T as Display;
use properties::{ComputedValues, PropertyFlags};
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
use std::fmt;
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use string_cache::Atom;
use thin_slice::ThinBoxedSlice;
use values::serialize_atom_identifier;
include!(concat!(
env!("OUT_DIR"),

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

@ -4,11 +4,11 @@
//! Gecko's restyle damage computation (aka change hints, aka `nsChangeHint`).
use gecko_bindings::bindings;
use gecko_bindings::structs;
use gecko_bindings::structs::nsChangeHint;
use matching::{StyleChange, StyleDifference};
use properties::ComputedValues;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::nsChangeHint;
use crate::matching::{StyleChange, StyleDifference};
use crate::properties::ComputedValues;
use std::ops::{BitAnd, BitOr, BitOrAssign, Not};
/// The representation of Gecko's restyle damage is just a wrapper over

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

@ -4,13 +4,13 @@
//! Bindings for CSS Rule objects
use counter_style::{self, CounterBound};
use gecko_bindings::structs::{self, nsCSSValue};
use gecko_bindings::sugar::ns_css_value::ToNsCssValue;
use crate::counter_style::{self, CounterBound};
use crate::gecko_bindings::structs::{self, nsCSSValue};
use crate::gecko_bindings::sugar::ns_css_value::ToNsCssValue;
impl<'a> ToNsCssValue for &'a counter_style::System {
fn convert(self, nscssvalue: &mut nsCSSValue) {
use counter_style::System::*;
use crate::counter_style::System::*;
match *self {
Cyclic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC as i32),
Numeric => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC as i32),
@ -123,7 +123,7 @@ impl<'a> ToNsCssValue for &'a counter_style::AdditiveSymbols {
impl<'a> ToNsCssValue for &'a counter_style::SpeakAs {
fn convert(self, nscssvalue: &mut nsCSSValue) {
use counter_style::SpeakAs::*;
use crate::counter_style::SpeakAs::*;
match *self {
Auto => nscssvalue.set_auto(),
Bullets => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_BULLETS as i32),

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

@ -4,27 +4,29 @@
//! Gecko-specific bits for selector-parsing.
use crate::element_state::{DocumentState, ElementState};
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::RawServoSelectorList;
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::element::document_state::InvalidationMatchingData;
use crate::selector_parser::{Direction, SelectorParser};
use crate::str::starts_with_ignore_ascii_case;
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use crate::values::serialize_atom_identifier;
use cssparser::{BasicParseError, BasicParseErrorKind, Parser};
use cssparser::{CowRcStr, SourceLocation, ToCss, Token};
use element_state::{DocumentState, ElementState};
use gecko_bindings::structs;
use gecko_bindings::structs::RawServoSelectorList;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use invalidation::element::document_state::InvalidationMatchingData;
use selector_parser::{Direction, SelectorParser};
use selectors::parser::{self as selector_parser, Selector};
use selectors::parser::{SelectorParseErrorKind, Visit};
use selectors::visitor::SelectorVisitor;
use selectors::SelectorList;
use std::fmt;
use str::starts_with_ignore_ascii_case;
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
use thin_slice::ThinBoxedSlice;
use values::serialize_atom_identifier;
pub use gecko::pseudo_element::{PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT};
pub use gecko::snapshot::SnapshotMap;
pub use crate::gecko::pseudo_element::{
PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT,
};
pub use crate::gecko::snapshot::SnapshotMap;
bitflags! {
// See NonTSPseudoClass::is_enabled_in()
@ -169,7 +171,7 @@ impl NonTSPseudoClass {
/// Returns whether the pseudo-class is enabled in content sheets.
fn is_enabled_in_content(&self) -> bool {
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
match *self {
// For pseudo-classes with pref, the availability in content
// depends on the pref.

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

@ -5,19 +5,19 @@
//! A gecko snapshot, that stores the element attributes and state before they
//! change in order to properly calculate restyle hints.
use dom::TElement;
use element_state::ElementState;
use gecko::snapshot_helpers;
use gecko::wrapper::{GeckoElement, NamespaceConstraintHelpers};
use gecko_bindings::bindings;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use gecko_bindings::structs::ServoElementSnapshotTable;
use invalidation::element::element_wrapper::ElementSnapshot;
use crate::dom::TElement;
use crate::element_state::ElementState;
use crate::gecko::snapshot_helpers;
use crate::gecko::wrapper::{GeckoElement, NamespaceConstraintHelpers};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::ServoElementSnapshot;
use crate::gecko_bindings::structs::ServoElementSnapshotFlags as Flags;
use crate::gecko_bindings::structs::ServoElementSnapshotTable;
use crate::invalidation::element::element_wrapper::ElementSnapshot;
use crate::string_cache::{Atom, Namespace};
use crate::WeakAtom;
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use string_cache::{Atom, Namespace};
use WeakAtom;
/// A snapshot of a Gecko element.
pub type GeckoElementSnapshot = ServoElementSnapshot;

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

@ -4,11 +4,11 @@
//! Element an snapshot common logic.
use gecko_bindings::bindings;
use gecko_bindings::structs::{self, nsAtom};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{self, nsAtom};
use crate::string_cache::{Atom, WeakAtom};
use crate::CaseSensitivityExt;
use selectors::attr::CaseSensitivity;
use string_cache::{Atom, WeakAtom};
use CaseSensitivityExt;
/// A function that, given an element of type `T`, allows you to get a single
/// class or a class list.

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

@ -4,10 +4,10 @@
//! Gecko-specific bits for the styling DOM traversal.
use context::{SharedStyleContext, StyleContext};
use dom::{TElement, TNode};
use gecko::wrapper::{GeckoElement, GeckoNode};
use traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData};
use crate::context::{SharedStyleContext, StyleContext};
use crate::dom::{TElement, TNode};
use crate::gecko::wrapper::{GeckoElement, GeckoNode};
use crate::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData};
/// This is the simple struct that Gecko uses to encapsulate a DOM traversal for
/// styling.

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

@ -4,21 +4,21 @@
//! Common handling for the specified value CSS url() values.
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::root::mozilla::css::URLValue;
use crate::gecko_bindings::structs::root::mozilla::CORSMode;
use crate::gecko_bindings::structs::root::nsStyleImageRequest;
use crate::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI};
use crate::gecko_bindings::sugar::refptr::RefPtr;
use crate::parser::{Parse, ParserContext};
use crate::stylesheets::UrlExtraData;
use crate::values::computed::{Context, ToComputedValue};
use cssparser::Parser;
use gecko_bindings::bindings;
use gecko_bindings::structs::root::mozilla::css::URLValue;
use gecko_bindings::structs::root::mozilla::CORSMode;
use gecko_bindings::structs::root::nsStyleImageRequest;
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI};
use gecko_bindings::sugar::refptr::RefPtr;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use nsstring::nsCString;
use parser::{Parse, ParserContext};
use servo_arc::Arc;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, ToCss};
use stylesheets::UrlExtraData;
use values::computed::{Context, ToComputedValue};
/// A CSS url() value for gecko.
#[css(function = "url")]
@ -132,12 +132,12 @@ impl SpecifiedUrl {
}
fn from_css_url(url: CssUrl) -> Self {
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_NONE;
use crate::gecko_bindings::structs::root::mozilla::CORSMode_CORS_NONE;
Self::from_css_url_with_cors(url, CORSMode_CORS_NONE)
}
fn from_css_url_with_cors_anonymous(url: CssUrl) -> Self {
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_ANONYMOUS;
use crate::gecko_bindings::structs::root::mozilla::CORSMode_CORS_ANONYMOUS;
Self::from_css_url_with_cors(url, CORSMode_CORS_ANONYMOUS)
}
}

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

@ -7,30 +7,32 @@
//! Different kind of helpers to interact with Gecko values.
use app_units::Au;
use counter_style::{Symbol, Symbols};
use crate::counter_style::{Symbol, Symbols};
use crate::gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
use crate::gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
use crate::media_queries::Device;
use crate::values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
use crate::values::computed::FlexBasis as ComputedFlexBasis;
use crate::values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage};
use crate::values::computed::{LengthOrPercentageOrAuto, Percentage};
use crate::values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
use crate::values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength};
use crate::values::computed::{
NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber,
};
use crate::values::generics::basic_shape::ShapeRadius;
use crate::values::generics::box_::Perspective;
use crate::values::generics::flex::FlexBasis;
use crate::values::generics::gecko::ScrollSnapPoint;
use crate::values::generics::grid::{TrackBreadth, TrackKeyword};
use crate::values::generics::length::{MaxLength, MozLength};
use crate::values::generics::{CounterStyleOrNone, NonNegative};
use crate::values::{Auto, Either, None_, Normal};
use crate::Atom;
use cssparser::RGBA;
use gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
use gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
use media_queries::Device;
use nsstring::{nsACString, nsCStr};
use std::cmp::max;
use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
use values::computed::FlexBasis as ComputedFlexBasis;
use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage};
use values::computed::{LengthOrPercentageOrAuto, Percentage};
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength};
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
use values::generics::basic_shape::ShapeRadius;
use values::generics::box_::Perspective;
use values::generics::flex::FlexBasis;
use values::generics::gecko::ScrollSnapPoint;
use values::generics::grid::{TrackBreadth, TrackKeyword};
use values::generics::length::{MaxLength, MozLength};
use values::generics::{CounterStyleOrNone, NonNegative};
use values::{Auto, Either, None_, Normal};
use Atom;
/// A trait that defines an interface to convert from and to `nsStyleCoord`s.
pub trait GeckoStyleCoordConvertible: Sized {
@ -377,8 +379,12 @@ impl GeckoStyleCoordConvertible for Normal {
impl GeckoStyleCoordConvertible for ExtremumLength {
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
use gecko_bindings::structs::{NS_STYLE_WIDTH_AVAILABLE, NS_STYLE_WIDTH_FIT_CONTENT};
use gecko_bindings::structs::{NS_STYLE_WIDTH_MAX_CONTENT, NS_STYLE_WIDTH_MIN_CONTENT};
use crate::gecko_bindings::structs::{
NS_STYLE_WIDTH_AVAILABLE, NS_STYLE_WIDTH_FIT_CONTENT,
};
use crate::gecko_bindings::structs::{
NS_STYLE_WIDTH_MAX_CONTENT, NS_STYLE_WIDTH_MIN_CONTENT,
};
coord.set_value(CoordDataValue::Enumerated(match *self {
ExtremumLength::MozMaxContent => NS_STYLE_WIDTH_MAX_CONTENT,
ExtremumLength::MozMinContent => NS_STYLE_WIDTH_MIN_CONTENT,
@ -388,8 +394,12 @@ impl GeckoStyleCoordConvertible for ExtremumLength {
}
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
use gecko_bindings::structs::{NS_STYLE_WIDTH_AVAILABLE, NS_STYLE_WIDTH_FIT_CONTENT};
use gecko_bindings::structs::{NS_STYLE_WIDTH_MAX_CONTENT, NS_STYLE_WIDTH_MIN_CONTENT};
use crate::gecko_bindings::structs::{
NS_STYLE_WIDTH_AVAILABLE, NS_STYLE_WIDTH_FIT_CONTENT,
};
use crate::gecko_bindings::structs::{
NS_STYLE_WIDTH_MAX_CONTENT, NS_STYLE_WIDTH_MIN_CONTENT,
};
match coord.as_value() {
CoordDataValue::Enumerated(NS_STYLE_WIDTH_MAX_CONTENT) => {
Some(ExtremumLength::MozMaxContent)
@ -451,8 +461,8 @@ impl GeckoStyleCoordConvertible for ScrollSnapPoint<LengthOrPercentage> {
}
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
use gecko_bindings::structs::root::nsStyleUnit;
use values::generics::gecko::ScrollSnapPoint;
use crate::gecko_bindings::structs::root::nsStyleUnit;
use crate::values::generics::gecko::ScrollSnapPoint;
Some(match coord.unit() {
nsStyleUnit::eStyleUnit_None => ScrollSnapPoint::None,
@ -476,7 +486,7 @@ where
}
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
use gecko_bindings::structs::root::nsStyleUnit;
use crate::gecko_bindings::structs::root::nsStyleUnit;
if coord.unit() == nsStyleUnit::eStyleUnit_None {
return Some(Perspective::None);
@ -521,8 +531,8 @@ pub fn round_border_to_device_pixels(width: Au, au_per_device_px: Au) -> Au {
impl CounterStyleOrNone {
/// Convert this counter style to a Gecko CounterStylePtr.
pub fn to_gecko_value(self, gecko_value: &mut CounterStylePtr, device: &Device) {
use gecko_bindings::bindings::Gecko_SetCounterStyleToName as set_name;
use gecko_bindings::bindings::Gecko_SetCounterStyleToSymbols as set_symbols;
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToName as set_name;
use crate::gecko_bindings::bindings::Gecko_SetCounterStyleToSymbols as set_symbols;
let pres_context = device.pres_context();
match self {
CounterStyleOrNone::None => unsafe {
@ -558,9 +568,9 @@ impl CounterStyleOrNone {
/// Convert Gecko CounterStylePtr to CounterStyleOrNone or String.
pub fn from_gecko_value(gecko_value: &CounterStylePtr) -> Either<Self, String> {
use gecko_bindings::bindings;
use values::generics::SymbolsType;
use values::CustomIdent;
use crate::gecko_bindings::bindings;
use crate::values::generics::SymbolsType;
use crate::values::CustomIdent;
let name = unsafe { bindings::Gecko_CounterStyle_GetName(gecko_value) };
if !name.is_null() {

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

@ -15,59 +15,63 @@
//! the separation between the style system implementation and everything else.
use app_units::Au;
use applicable_declarations::ApplicableDeclarationBlock;
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use author_styles::AuthorStyles;
use context::{PostAnimationTasks, QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
use data::ElementData;
use dom::{LayoutIterator, NodeInfo, OpaqueNode, TDocument, TElement, TNode, TShadowRoot};
use element_state::{DocumentState, ElementState};
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
use gecko::data::GeckoStyleSheet;
use gecko::global_style_data::GLOBAL_STYLE_DATA;
use gecko::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
use gecko::snapshot_helpers;
use gecko_bindings::bindings;
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
use gecko_bindings::bindings::Gecko_GetActiveLinkAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetAnimationEffectCount;
use gecko_bindings::bindings::Gecko_GetAnimationRule;
use gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations;
use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetUnvisitedLinkAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetVisitedLinkAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_IsSignificantChild;
use gecko_bindings::bindings::Gecko_MatchLang;
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
use gecko_bindings::bindings::Gecko_UpdateAnimations;
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::structs;
use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
use gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
use gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO;
use gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
use gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
use gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
use gecko_bindings::structs::NODE_NEEDS_FRAME;
use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
use hash::FxHashMap;
use logical_geometry::WritingMode;
use media_queries::Device;
use properties::animated_properties::{AnimationValue, AnimationValueMap};
use properties::style_structs::Font;
use properties::{ComputedValues, LonghandId};
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
use rule_tree::CascadeLevel as ServoCascadeLevel;
use selector_parser::{AttrValue, HorizontalDirection, Lang};
use crate::applicable_declarations::ApplicableDeclarationBlock;
use crate::author_styles::AuthorStyles;
use crate::context::{PostAnimationTasks, QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
use crate::data::ElementData;
use crate::dom::{LayoutIterator, NodeInfo, OpaqueNode, TDocument, TElement, TNode, TShadowRoot};
use crate::element_state::{DocumentState, ElementState};
use crate::font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
use crate::gecko::data::GeckoStyleSheet;
use crate::gecko::global_style_data::GLOBAL_STYLE_DATA;
use crate::gecko::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
use crate::gecko::snapshot_helpers;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::bindings::Gecko_ElementHasAnimations;
use crate::gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use crate::gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
use crate::gecko_bindings::bindings::Gecko_GetActiveLinkAttrDeclarationBlock;
use crate::gecko_bindings::bindings::Gecko_GetAnimationEffectCount;
use crate::gecko_bindings::bindings::Gecko_GetAnimationRule;
use crate::gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations;
use crate::gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock;
use crate::gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock;
use crate::gecko_bindings::bindings::Gecko_GetUnvisitedLinkAttrDeclarationBlock;
use crate::gecko_bindings::bindings::Gecko_GetVisitedLinkAttrDeclarationBlock;
use crate::gecko_bindings::bindings::Gecko_IsSignificantChild;
use crate::gecko_bindings::bindings::Gecko_MatchLang;
use crate::gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
use crate::gecko_bindings::bindings::Gecko_UpdateAnimations;
use crate::gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
use crate::gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::nsChangeHint;
use crate::gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
use crate::gecko_bindings::structs::nsRestyleHint;
use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
use crate::gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO;
use crate::gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
use crate::gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
use crate::gecko_bindings::structs::NODE_NEEDS_FRAME;
use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
use crate::gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
use crate::hash::FxHashMap;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::properties::animated_properties::{AnimationValue, AnimationValueMap};
use crate::properties::style_structs::Font;
use crate::properties::{ComputedValues, LonghandId};
use crate::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
use crate::rule_tree::CascadeLevel as ServoCascadeLevel;
use crate::selector_parser::{AttrValue, HorizontalDirection, Lang};
use crate::shared_lock::Locked;
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use crate::stylist::CascadeData;
use crate::CaseSensitivityExt;
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use selectors::matching::VisitedHandlingMode;
@ -75,15 +79,11 @@ use selectors::matching::{ElementSelectorFlags, MatchingContext};
use selectors::sink::Push;
use selectors::{Element, OpaqueElement};
use servo_arc::{Arc, ArcBorrow, RawOffsetArc};
use shared_lock::Locked;
use std::cell::RefCell;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::mem;
use std::ptr;
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use stylist::CascadeData;
use CaseSensitivityExt;
#[inline]
fn elements_with_id<'a, 'le>(
@ -287,7 +287,7 @@ impl<'ln> GeckoNode<'ln> {
/// This logic is duplicate in Gecko's nsINode::IsInShadowTree().
#[inline]
fn is_in_shadow_tree(&self) -> bool {
use gecko_bindings::structs::NODE_IS_IN_SHADOW_TREE;
use crate::gecko_bindings::structs::NODE_IS_IN_SHADOW_TREE;
self.flags() & (NODE_IS_IN_SHADOW_TREE as u32) != 0
}
@ -295,7 +295,7 @@ impl<'ln> GeckoNode<'ln> {
/// Make sure to mirror any modifications in both places.
#[inline]
fn flattened_tree_parent_is_parent(&self) -> bool {
use gecko_bindings::structs::*;
use crate::gecko_bindings::structs::*;
let flags = self.flags();
if flags & (NODE_MAY_BE_IN_BINDING_MNGR as u32 | NODE_IS_IN_SHADOW_TREE as u32) != 0 {
return false;
@ -767,7 +767,7 @@ impl<'le> GeckoElement<'le> {
#[inline]
fn has_properties(&self) -> bool {
use gecko_bindings::structs::NODE_HAS_PROPERTIES;
use crate::gecko_bindings::structs::NODE_HAS_PROPERTIES;
(self.flags() & NODE_HAS_PROPERTIES as u32) != 0
}
@ -805,8 +805,8 @@ impl<'le> GeckoElement<'le> {
restyle_hint: nsRestyleHint,
change_hint: nsChangeHint,
) {
use gecko::restyle_damage::GeckoRestyleDamage;
use invalidation::element::restyle_hints::RestyleHint;
use crate::gecko::restyle_damage::GeckoRestyleDamage;
use crate::invalidation::element::restyle_hints::RestyleHint;
let damage = GeckoRestyleDamage::new(change_hint);
debug!(
@ -844,14 +844,14 @@ impl<'le> GeckoElement<'le> {
/// This logic is duplicated in Gecko's nsIContent::IsRootOfAnonymousSubtree.
#[inline]
fn is_root_of_anonymous_subtree(&self) -> bool {
use gecko_bindings::structs::NODE_IS_ANONYMOUS_ROOT;
use crate::gecko_bindings::structs::NODE_IS_ANONYMOUS_ROOT;
self.flags() & (NODE_IS_ANONYMOUS_ROOT as u32) != 0
}
/// This logic is duplicated in Gecko's nsIContent::IsRootOfNativeAnonymousSubtree.
#[inline]
fn is_root_of_native_anonymous_subtree(&self) -> bool {
use gecko_bindings::structs::NODE_IS_NATIVE_ANONYMOUS_ROOT;
use crate::gecko_bindings::structs::NODE_IS_NATIVE_ANONYMOUS_ROOT;
return self.flags() & (NODE_IS_NATIVE_ANONYMOUS_ROOT as u32) != 0;
}
@ -883,8 +883,8 @@ impl<'le> GeckoElement<'le> {
}
fn css_transitions_info(&self) -> FxHashMap<LonghandId, Arc<AnimationValue>> {
use gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
use gecko_bindings::bindings::Gecko_ElementTransitions_Length;
use crate::gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
use crate::gecko_bindings::bindings::Gecko_ElementTransitions_Length;
let collection_length = unsafe { Gecko_ElementTransitions_Length(self.0) } as usize;
let mut map = FxHashMap::with_capacity_and_hasher(collection_length, Default::default());
@ -910,7 +910,7 @@ impl<'le> GeckoElement<'le> {
after_change_style: &ComputedValues,
existing_transitions: &FxHashMap<LonghandId, Arc<AnimationValue>>,
) -> bool {
use values::animated::{Animate, Procedure};
use crate::values::animated::{Animate, Procedure};
debug_assert!(!longhand_id.is_logical());
// If there is an existing transition, update only if the end value
@ -945,7 +945,7 @@ impl<'le> GeckoElement<'le> {
/// by Gecko. We could align these and then do this without conditionals, but
/// it's probably not worth the trouble.
fn selector_flags_to_node_flags(flags: ElementSelectorFlags) -> u32 {
use gecko_bindings::structs::*;
use crate::gecko_bindings::structs::*;
let mut gecko_flags = 0u32;
if flags.contains(ElementSelectorFlags::HAS_SLOW_SELECTOR) {
gecko_flags |= NODE_HAS_SLOW_SELECTOR as u32;
@ -967,8 +967,8 @@ fn get_animation_rule(
element: &GeckoElement,
cascade_level: CascadeLevel,
) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
use gecko_bindings::sugar::ownership::HasSimpleFFI;
use properties::longhands::ANIMATABLE_PROPERTY_COUNT;
use crate::gecko_bindings::sugar::ownership::HasSimpleFFI;
use crate::properties::longhands::ANIMATABLE_PROPERTY_COUNT;
// There's a very rough correlation between the number of effects
// (animations) on an element and the number of properties it is likely to
@ -1006,7 +1006,7 @@ pub struct GeckoFontMetricsProvider {
// This may be slow on pages using more languages, might be worth optimizing
// by caching lang->group mapping separately and/or using a hashmap on larger
// loads.
pub font_size_cache: RefCell<Vec<(Atom, ::gecko_bindings::structs::FontSizePrefs)>>,
pub font_size_cache: RefCell<Vec<(Atom, crate::gecko_bindings::structs::FontSizePrefs)>>,
}
impl GeckoFontMetricsProvider {
@ -1024,7 +1024,7 @@ impl FontMetricsProvider for GeckoFontMetricsProvider {
}
fn get_size(&self, font_name: &Atom, font_family: u8) -> Au {
use gecko_bindings::bindings::Gecko_GetBaseSize;
use crate::gecko_bindings::bindings::Gecko_GetBaseSize;
let mut cache = self.font_size_cache.borrow_mut();
if let Some(sizes) = cache.iter().find(|el| el.0 == *font_name) {
return sizes.1.size_for_generic(font_family);
@ -1042,7 +1042,7 @@ impl FontMetricsProvider for GeckoFontMetricsProvider {
in_media_query: bool,
device: &Device,
) -> FontMetricsQueryResult {
use gecko_bindings::bindings::Gecko_GetFontMetrics;
use crate::gecko_bindings::bindings::Gecko_GetFontMetrics;
let gecko_metrics = unsafe {
Gecko_GetFontMetrics(
device.pres_context(),
@ -1392,7 +1392,7 @@ impl<'le> TElement for GeckoElement<'le> {
/// This logic is duplicated in Gecko's nsINode::IsInNativeAnonymousSubtree.
#[inline]
fn is_in_native_anonymous_subtree(&self) -> bool {
use gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
use crate::gecko_bindings::structs::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
self.flags() & (NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE as u32) != 0
}
@ -1499,8 +1499,8 @@ impl<'le> TElement for GeckoElement<'le> {
/// Process various tasks that are a result of animation-only restyle.
fn process_post_animation(&self, tasks: PostAnimationTasks) {
use gecko_bindings::structs::nsChangeHint_nsChangeHint_Empty;
use gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree;
use crate::gecko_bindings::structs::nsChangeHint_nsChangeHint_Empty;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree;
debug_assert!(!tasks.is_empty(), "Should be involved a task");
@ -1638,9 +1638,9 @@ impl<'le> TElement for GeckoElement<'le> {
before_change_style: &ComputedValues,
after_change_style: &ComputedValues,
) -> bool {
use gecko_bindings::structs::nsCSSPropertyID;
use properties::LonghandIdSet;
use values::computed::TransitionProperty;
use crate::gecko_bindings::structs::nsCSSPropertyID;
use crate::properties::LonghandIdSet;
use crate::values::computed::TransitionProperty;
debug_assert!(
self.might_need_transitions_update(Some(before_change_style), after_change_style),
@ -1753,11 +1753,11 @@ impl<'le> TElement for GeckoElement<'le> {
) where
V: Push<ApplicableDeclarationBlock>,
{
use properties::longhands::_x_lang::SpecifiedValue as SpecifiedLang;
use properties::longhands::_x_text_zoom::SpecifiedValue as SpecifiedZoom;
use properties::longhands::color::SpecifiedValue as SpecifiedColor;
use properties::longhands::text_align::SpecifiedValue as SpecifiedTextAlign;
use values::specified::color::Color;
use crate::properties::longhands::_x_lang::SpecifiedValue as SpecifiedLang;
use crate::properties::longhands::_x_text_zoom::SpecifiedValue as SpecifiedZoom;
use crate::properties::longhands::color::SpecifiedValue as SpecifiedColor;
use crate::properties::longhands::text_align::SpecifiedValue as SpecifiedTextAlign;
use crate::values::specified::color::Color;
lazy_static! {
static ref TH_RULE: ApplicableDeclarationBlock = {
let global_style_data = &*GLOBAL_STYLE_DATA;

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

@ -4,7 +4,7 @@
//! Little helpers for `nsCOMPtr`.
use gecko_bindings::structs::nsCOMPtr;
use crate::gecko_bindings::structs::nsCOMPtr;
#[cfg(feature = "gecko_debug")]
impl<T> nsCOMPtr<T> {

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

@ -4,8 +4,8 @@
//! Little helper for `nsCompatibility`.
use context::QuirksMode;
use gecko_bindings::structs::nsCompatibility;
use crate::context::QuirksMode;
use crate::gecko_bindings::structs::nsCompatibility;
impl From<nsCompatibility> for QuirksMode {
#[inline]

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

@ -4,10 +4,10 @@
//! Rust helpers for Gecko's `nsCSSShadowArray`.
use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
use gecko_bindings::structs::{nsCSSShadowArray, nsCSSShadowItem, RefPtr};
use crate::gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
use crate::gecko_bindings::bindings::Gecko_NewCSSShadowArray;
use crate::gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
use crate::gecko_bindings::structs::{nsCSSShadowArray, nsCSSShadowItem, RefPtr};
use std::ops::{Deref, DerefMut};
use std::{ptr, slice};

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

@ -5,8 +5,8 @@
//! Rust helpers for Gecko's `nsCSSShadowItem`.
use app_units::Au;
use gecko_bindings::structs::nsCSSShadowItem;
use values::computed::effects::{BoxShadow, SimpleShadow};
use crate::gecko_bindings::structs::nsCSSShadowItem;
use crate::values::computed::effects::{BoxShadow, SimpleShadow};
impl nsCSSShadowItem {
/// Sets this item from the given box shadow.

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

@ -4,16 +4,16 @@
//! Little helpers for `nsCSSValue`.
use gecko_bindings::bindings;
use gecko_bindings::structs;
use gecko_bindings::structs::{nsCSSUnit, nsCSSValue};
use gecko_bindings::structs::{nsCSSValueList, nsCSSValue_Array};
use gecko_string_cache::Atom;
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::{nsCSSUnit, nsCSSValue};
use crate::gecko_bindings::structs::{nsCSSValueList, nsCSSValue_Array};
use crate::gecko_string_cache::Atom;
use crate::values::computed::{Angle, Length, LengthOrPercentage, Percentage};
use std::marker::PhantomData;
use std::mem;
use std::ops::{Index, IndexMut};
use std::slice;
use values::computed::{Angle, Length, LengthOrPercentage, Percentage};
impl nsCSSValue {
/// Create a CSSValue with null unit, useful to be used as a return value.

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

@ -4,10 +4,10 @@
//! Rust helpers for Gecko's `nsStyleAutoArray`.
use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
use gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
use gecko_bindings::structs::nsStyleAutoArray;
use gecko_bindings::structs::{StyleAnimation, StyleTransition};
use crate::gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
use crate::gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
use crate::gecko_bindings::structs::nsStyleAutoArray;
use crate::gecko_bindings::structs::{StyleAnimation, StyleTransition};
use std::iter::{once, Chain, IntoIterator, Once};
use std::ops::{Index, IndexMut};
use std::slice::{Iter, IterMut};

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

@ -4,9 +4,11 @@
//! Rust helpers for Gecko's `nsStyleCoord`.
use gecko_bindings::bindings;
use gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
use gecko_bindings::structs::{nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit, nscoord};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
use crate::gecko_bindings::structs::{
nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit, nscoord,
};
use std::mem;
impl nsStyleCoord {
@ -266,7 +268,7 @@ pub unsafe trait CoordDataMut: CoordData {
/// Useful for initializing uninits, given that `set_value` may segfault on
/// uninits.
fn leaky_set_null(&mut self) {
use gecko_bindings::structs::nsStyleUnit::*;
use crate::gecko_bindings::structs::nsStyleUnit::*;
unsafe {
let (unit, union) = self.values_mut();
*unit = eStyleUnit_Null;
@ -278,7 +280,7 @@ pub unsafe trait CoordDataMut: CoordData {
/// Sets the inner value.
fn set_value(&mut self, value: CoordDataValue) {
use self::CoordDataValue::*;
use gecko_bindings::structs::nsStyleUnit::*;
use crate::gecko_bindings::structs::nsStyleUnit::*;
self.reset();
unsafe {
let (unit, union) = self.values_mut();
@ -365,7 +367,7 @@ pub unsafe trait CoordData {
/// Get the appropriate value for this object.
fn as_value(&self) -> CoordDataValue {
use self::CoordDataValue::*;
use gecko_bindings::structs::nsStyleUnit::*;
use crate::gecko_bindings::structs::nsStyleUnit::*;
unsafe {
match self.unit() {
eStyleUnit_Null => Null,
@ -387,7 +389,7 @@ pub unsafe trait CoordData {
#[inline]
/// Pretend inner value is a float; obtain it.
unsafe fn get_float(&self) -> f32 {
use gecko_bindings::structs::nsStyleUnit::*;
use crate::gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(
self.unit() == eStyleUnit_Percent ||
self.unit() == eStyleUnit_Factor ||
@ -400,7 +402,7 @@ pub unsafe trait CoordData {
#[inline]
/// Pretend inner value is an int; obtain it.
unsafe fn get_integer(&self) -> i32 {
use gecko_bindings::structs::nsStyleUnit::*;
use crate::gecko_bindings::structs::nsStyleUnit::*;
debug_assert!(
self.unit() == eStyleUnit_Coord ||
self.unit() == eStyleUnit_Integer ||

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

@ -4,8 +4,8 @@
//! Rust helpers for Gecko's nsTArray.
use gecko_bindings::bindings;
use gecko_bindings::structs::{nsTArray, nsTArrayHeader};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader};
use std::mem;
use std::ops::{Deref, DerefMut};
use std::slice;

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

@ -4,15 +4,15 @@
//! Helper to iterate over `OriginFlags` bits.
use gecko_bindings::structs::OriginFlags;
use gecko_bindings::structs::OriginFlags_Author;
use gecko_bindings::structs::OriginFlags_User;
use gecko_bindings::structs::OriginFlags_UserAgent;
use stylesheets::OriginSet;
use crate::gecko_bindings::structs::OriginFlags;
use crate::gecko_bindings::structs::OriginFlags_Author;
use crate::gecko_bindings::structs::OriginFlags_User;
use crate::gecko_bindings::structs::OriginFlags_UserAgent;
use crate::stylesheets::OriginSet;
/// Checks that the values for OriginFlags are the ones we expect.
pub fn assert_flags_match() {
use stylesheets::origin::*;
use crate::stylesheets::origin::*;
debug_assert_eq!(OriginFlags_UserAgent.0, OriginSet::ORIGIN_USER_AGENT.bits());
debug_assert_eq!(OriginFlags_Author.0, OriginSet::ORIGIN_AUTHOR.bits());
debug_assert_eq!(OriginFlags_User.0, OriginSet::ORIGIN_USER.bits());

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

@ -4,13 +4,13 @@
//! A rust helper to ease the use of Gecko's refcounted types.
use gecko_bindings::sugar::ownership::HasArcFFI;
use gecko_bindings::{bindings, structs};
use crate::gecko_bindings::sugar::ownership::HasArcFFI;
use crate::gecko_bindings::{bindings, structs};
use crate::Atom;
use servo_arc::Arc;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::{fmt, mem, ptr};
use Atom;
/// Trait for all objects that have Addref() and Release
/// methods and can be placed inside RefPtr<T>

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

@ -4,13 +4,13 @@
//! Rust helpers to interact with Gecko's StyleComplexColor.
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use gecko_bindings::structs::StyleComplexColor;
use gecko_bindings::structs::StyleComplexColor_Tag as Tag;
use values::computed::ui::ColorOrAuto;
use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
use values::generics::color::{Color as GenericColor, ComplexColorRatios};
use values::{Auto, Either};
use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
use crate::gecko_bindings::structs::StyleComplexColor;
use crate::gecko_bindings::structs::StyleComplexColor_Tag as Tag;
use crate::values::computed::ui::ColorOrAuto;
use crate::values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
use crate::values::generics::color::{Color as GenericColor, ComplexColorRatios};
use crate::values::{Auto, Either};
impl StyleComplexColor {
/// Create a `StyleComplexColor` value that represents `currentColor`.

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

@ -10,11 +10,11 @@
//! A drop-in replacement for string_cache, but backed by Gecko `nsAtom`s.
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::{nsAtom, nsDynamicAtom, nsStaticAtom};
use crate::gecko_bindings::bindings::Gecko_AddRefAtom;
use crate::gecko_bindings::bindings::Gecko_Atomize;
use crate::gecko_bindings::bindings::Gecko_Atomize16;
use crate::gecko_bindings::bindings::Gecko_ReleaseAtom;
use crate::gecko_bindings::structs::{nsAtom, nsDynamicAtom, nsStaticAtom};
use nsstring::{nsAString, nsStr};
use precomputed_hash::PrecomputedHash;
use std::borrow::{Borrow, Cow};

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

@ -4,12 +4,12 @@
//! A type to represent a namespace.
use gecko_bindings::structs::nsAtom;
use crate::gecko_bindings::structs::nsAtom;
use crate::string_cache::{Atom, WeakAtom};
use precomputed_hash::PrecomputedHash;
use std::borrow::Borrow;
use std::fmt;
use std::ops::Deref;
use string_cache::{Atom, WeakAtom};
#[macro_export]
macro_rules! ns {

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

@ -358,7 +358,7 @@ impl<'a> SelectorVisitor for CompoundSelectorDependencyCollector<'a> {
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
#[cfg(feature = "gecko")]
use selector_parser::NonTSPseudoClass;
use crate::selector_parser::NonTSPseudoClass;
match *s {
Component::ID(ref id) => {

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

@ -4,9 +4,9 @@
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
use crate::traversal_flags::TraversalFlags;
#[cfg(feature = "gecko")]
use gecko_bindings::structs::nsRestyleHint;
use crate::gecko_bindings::structs::nsRestyleHint;
use crate::traversal_flags::TraversalFlags;
bitflags! {
/// The kind of restyle we need to do for a given element.
@ -193,12 +193,12 @@ impl Default for RestyleHint {
#[cfg(feature = "gecko")]
impl From<nsRestyleHint> for RestyleHint {
fn from(mut raw: nsRestyleHint) -> Self {
use gecko_bindings::structs::nsRestyleHint_eRestyle_Force as eRestyle_Force;
use gecko_bindings::structs::nsRestyleHint_eRestyle_ForceDescendants as eRestyle_ForceDescendants;
use gecko_bindings::structs::nsRestyleHint_eRestyle_LaterSiblings as eRestyle_LaterSiblings;
use gecko_bindings::structs::nsRestyleHint_eRestyle_Self as eRestyle_Self;
use gecko_bindings::structs::nsRestyleHint_eRestyle_SomeDescendants as eRestyle_SomeDescendants;
use gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree as eRestyle_Subtree;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Force as eRestyle_Force;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_ForceDescendants as eRestyle_ForceDescendants;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_LaterSiblings as eRestyle_LaterSiblings;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Self as eRestyle_Self;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_SomeDescendants as eRestyle_SomeDescendants;
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree as eRestyle_Subtree;
let mut hint = RestyleHint::empty();
@ -241,7 +241,7 @@ malloc_size_of_is_0!(RestyleHint);
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_restyle_hints_match() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
macro_rules! check_restyle_hints {
( $( $a:ident => $b:path),*, ) => {

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

@ -166,15 +166,15 @@ pub mod use_counters;
pub mod values;
#[cfg(feature = "gecko")]
pub use gecko_string_cache as string_cache;
pub use crate::gecko_string_cache as string_cache;
#[cfg(feature = "gecko")]
pub use gecko_string_cache::Atom;
pub use crate::gecko_string_cache::Atom;
#[cfg(feature = "gecko")]
pub use gecko_string_cache::Atom as Prefix;
pub use crate::gecko_string_cache::Atom as Prefix;
#[cfg(feature = "gecko")]
pub use gecko_string_cache::Atom as LocalName;
pub use crate::gecko_string_cache::Atom as LocalName;
#[cfg(feature = "gecko")]
pub use gecko_string_cache::Namespace;
pub use crate::gecko_string_cache::Namespace;
#[cfg(feature = "servo")]
pub use html5ever::LocalName;
@ -226,7 +226,7 @@ macro_rules! reexport_computed_values {
longhand_properties_idents!(reexport_computed_values);
#[cfg(feature = "gecko")]
use gecko_string_cache::WeakAtom;
use crate::gecko_string_cache::WeakAtom;
#[cfg(feature = "servo")]
use servo_atoms::Atom as WeakAtom;

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

@ -79,7 +79,7 @@ impl WritingMode {
#[cfg(feature = "gecko")]
{
use properties::longhands::text_orientation::computed_value::T as TextOrientation;
use crate::properties::longhands::text_orientation::computed_value::T as TextOrientation;
// If FLAG_SIDEWAYS is already set, this means writing-mode is
// either sideways-rl or sideways-lr, and for both of these values,

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

@ -195,9 +195,9 @@ trait PrivateMatchMethods: TElement {
context: &mut StyleContext<Self>,
primary_style: &Arc<ComputedValues>,
) -> Option<Arc<ComputedValues>> {
use context::CascadeInputs;
use style_resolver::{PseudoElementResolution, StyleResolverForElement};
use stylist::RuleInclusion;
use crate::context::CascadeInputs;
use crate::style_resolver::{PseudoElementResolution, StyleResolverForElement};
use crate::stylist::RuleInclusion;
let rule_node = primary_style.rules();
let without_transition_rules = context
@ -307,7 +307,7 @@ trait PrivateMatchMethods: TElement {
new_values: &ComputedValues,
restyle_hints: RestyleHint,
) {
use context::PostAnimationTasks;
use crate::context::PostAnimationTasks;
if !restyle_hints.intersects(RestyleHint::RESTYLE_SMIL) {
return;
@ -337,7 +337,7 @@ trait PrivateMatchMethods: TElement {
restyle_hint: RestyleHint,
important_rules_changed: bool,
) {
use context::UpdateAnimationsTasks;
use crate::context::UpdateAnimationsTasks;
if context.shared.traversal_flags.for_animation_only() {
self.handle_display_change_for_smil_if_needed(
@ -538,7 +538,7 @@ trait PrivateMatchMethods: TElement {
// seems not common enough to care about.
#[cfg(feature = "gecko")]
{
use values::specified::align::AlignFlags;
use crate::values::specified::align::AlignFlags;
let old_justify_items = old_values.get_position().clone_justify_items();
let new_justify_items = new_values.get_position().clone_justify_items();

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

@ -9,6 +9,8 @@ use super::media_feature::{Evaluator, MediaFeatureDescription};
use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
use super::Device;
use crate::context::QuirksMode;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs;
use crate::parser::{Parse, ParserContext};
use crate::str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use crate::stylesheets::Origin;
@ -17,8 +19,6 @@ use crate::values::specified::{Integer, Length, Number, Resolution};
use crate::values::{serialize_atom_identifier, CSSFloat};
use crate::Atom;
use cssparser::{Parser, Token};
#[cfg(feature = "gecko")]
use gecko_bindings::structs;
use num_traits::Zero;
use std::cmp::{Ordering, PartialOrd};
use std::fmt::{self, Write};
@ -270,10 +270,10 @@ impl MediaFeatureExpression {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
#[cfg(feature = "gecko")]
use crate::gecko::media_features::MEDIA_FEATURES;
#[cfg(feature = "servo")]
use crate::servo::media_queries::MEDIA_FEATURES;
#[cfg(feature = "gecko")]
use gecko::media_features::MEDIA_FEATURES;
// FIXME: remove extra indented block when lifetimes are non-lexical
let feature;

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

@ -18,7 +18,7 @@ pub use self::media_feature_expression::MediaFeatureExpression;
pub use self::media_list::MediaList;
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};
#[cfg(feature = "gecko")]
pub use crate::gecko::media_queries::Device;
#[cfg(feature = "servo")]
pub use crate::servo::media_queries::Device;
#[cfg(feature = "gecko")]
pub use gecko::media_queries::Device;

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

@ -15,7 +15,7 @@ use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_parsing_mode_match() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
macro_rules! check_parsing_modes {
( $( $a:ident => $b:path ),*, ) => {

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

@ -745,7 +745,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
let gecko_font = self.context.builder.mutate_font().gecko_mut();
gecko_font.mGenericID = generic;
unsafe {
::gecko_bindings::bindings::Gecko_nsStyleFont_PrefillDefaultForGeneric(
crate::gecko_bindings::bindings::Gecko_nsStyleFont_PrefillDefaultForGeneric(
gecko_font,
pres_context,
generic,
@ -796,7 +796,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
self.seen.contains(LonghandId::MozMinFontSizeRatio) ||
self.seen.contains(LonghandId::FontFamily)
{
use properties::{CSSWideKeyword, WideKeywordDeclaration};
use crate::properties::{CSSWideKeyword, WideKeywordDeclaration};
// font-size must be explicitly inherited to handle lang
// changes and scriptlevel changes.

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

@ -7,13 +7,13 @@
//! The rule tree.
use crate::applicable_declarations::ApplicableDeclarationList;
#[cfg(feature = "gecko")]
use crate::gecko::selector_parser::PseudoElement;
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::StyleRule;
use crate::thread_state;
#[cfg(feature = "gecko")]
use gecko::selector_parser::PseudoElement;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use servo_arc::{Arc, ArcBorrow, ArcUnion, ArcUnionBorrow};
use smallvec::SmallVec;
@ -1214,15 +1214,15 @@ impl StrongRuleNode {
author_colors_allowed: bool,
) -> bool
where
E: ::dom::TElement,
E: crate::dom::TElement,
{
use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BACKGROUND;
use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BORDER;
use gecko_bindings::structs::NS_AUTHOR_SPECIFIED_PADDING;
use properties::{CSSWideKeyword, LonghandId, LonghandIdSet};
use properties::{PropertyDeclaration, PropertyDeclarationId};
use crate::gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BACKGROUND;
use crate::gecko_bindings::structs::NS_AUTHOR_SPECIFIED_BORDER;
use crate::gecko_bindings::structs::NS_AUTHOR_SPECIFIED_PADDING;
use crate::properties::{CSSWideKeyword, LonghandId, LonghandIdSet};
use crate::properties::{PropertyDeclaration, PropertyDeclarationId};
use crate::values::specified::Color;
use std::borrow::Cow;
use values::specified::Color;
// Reset properties:
const BACKGROUND_PROPS: &'static [LonghandId] =

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

@ -23,19 +23,19 @@ pub type AttrValue = <SelectorImpl as ::selectors::SelectorImpl>::AttrValue;
pub use crate::servo::selector_parser::*;
#[cfg(feature = "gecko")]
pub use gecko::selector_parser::*;
pub use crate::gecko::selector_parser::*;
#[cfg(feature = "servo")]
pub use crate::servo::selector_parser::ServoElementSnapshot as Snapshot;
#[cfg(feature = "gecko")]
pub use gecko::snapshot::GeckoElementSnapshot as Snapshot;
pub use crate::gecko::snapshot::GeckoElementSnapshot as Snapshot;
#[cfg(feature = "servo")]
pub use crate::servo::restyle_damage::ServoRestyleDamage as RestyleDamage;
#[cfg(feature = "gecko")]
pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;
pub use crate::gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;
/// Servo's selector parser.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]

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

@ -239,7 +239,7 @@ pub trait ToCssWithGuard {
#[cfg(feature = "gecko")]
pub struct DeepCloneParams {
/// The new sheet we're cloning rules into.
pub reference_sheet: *const ::gecko_bindings::structs::StyleSheet,
pub reference_sheet: *const crate::gecko_bindings::structs::StyleSheet,
}
/// Parameters needed for deep clones.

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

@ -59,7 +59,7 @@ fn is_effective_display_none_for_display_contents<E>(element: E) -> bool
where
E: TElement,
{
use Atom;
use crate::Atom;
// FIXME(emilio): This should be an actual static.
lazy_static! {
@ -272,8 +272,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// mutating writing-mode change the potential physical sides chosen?
#[cfg(feature = "gecko")]
fn adjust_for_text_combine_upright(&mut self) {
use computed_values::text_combine_upright::T as TextCombineUpright;
use computed_values::writing_mode::T as WritingMode;
use crate::computed_values::text_combine_upright::T as TextCombineUpright;
use crate::computed_values::writing_mode::T as WritingMode;
let writing_mode = self.style.get_inherited_box().clone_writing_mode();
let text_combine_upright = self.style.get_inherited_text().clone_text_combine_upright();
@ -346,9 +346,9 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// both forced to "normal".
#[cfg(feature = "gecko")]
fn adjust_for_mathvariant(&mut self) {
use properties::longhands::_moz_math_variant::computed_value::T as MozMathVariant;
use properties::longhands::font_weight::computed_value::T as FontWeight;
use values::generics::font::FontStyle;
use crate::properties::longhands::_moz_math_variant::computed_value::T as MozMathVariant;
use crate::properties::longhands::font_weight::computed_value::T as FontWeight;
use crate::values::generics::font::FontStyle;
if self.style.get_font().clone__moz_math_variant() != MozMathVariant::None {
let font_style = self.style.mutate_font();
font_style.set_font_weight(FontWeight::normal());
@ -512,7 +512,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// table.
#[cfg(feature = "gecko")]
fn adjust_for_table_text_align(&mut self) {
use properties::longhands::text_align::computed_value::T as TextAlign;
use crate::properties::longhands::text_align::computed_value::T as TextAlign;
if self.style.get_box().clone_display() != Display::Table {
return;
}
@ -587,7 +587,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
where
E: TElement,
{
use properties::longhands::unicode_bidi::computed_value::T as UnicodeBidi;
use crate::properties::longhands::unicode_bidi::computed_value::T as UnicodeBidi;
let self_display = self.style.get_box().clone_display();
// Check whether line break should be suppressed for this element.
@ -669,7 +669,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// <https://drafts.csswg.org/css-align/#valdef-justify-items-legacy>
#[cfg(feature = "gecko")]
fn adjust_for_justify_items(&mut self) {
use values::specified::align;
use crate::values::specified::align;
let justify_items = self.style.get_position().clone_justify_items();
if justify_items.specified.0 != align::AlignFlags::LEGACY {
return;
@ -703,8 +703,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
where
E: TElement,
{
use properties::longhands::_moz_appearance::computed_value::T as Appearance;
use properties::longhands::line_height::computed_value::T as LineHeight;
use crate::properties::longhands::_moz_appearance::computed_value::T as Appearance;
use crate::properties::longhands::line_height::computed_value::T as LineHeight;
if self.style.get_box().clone__moz_appearance() == Appearance::Menulist {
if self.style.get_inherited_text().clone_line_height() == LineHeight::normal() {

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

@ -172,8 +172,8 @@ impl DocumentMatchingFunction {
#[cfg(feature = "gecko")]
/// Evaluate a URL matching function.
pub fn evaluate(&self, device: &Device) -> bool {
use gecko_bindings::bindings::Gecko_DocumentRule_UseForPresentation;
use gecko_bindings::structs::DocumentMatchingFunction as GeckoDocumentMatchingFunction;
use crate::gecko_bindings::bindings::Gecko_DocumentRule_UseForPresentation;
use crate::gecko_bindings::structs::DocumentMatchingFunction as GeckoDocumentMatchingFunction;
use nsstring::nsCStr;
let func = match *self {
@ -253,8 +253,8 @@ impl DocumentCondition {
#[cfg(feature = "gecko")]
fn allowed_in(&self, context: &ParserContext) -> bool {
use gecko_bindings::structs;
use stylesheets::Origin;
use crate::gecko_bindings::structs;
use crate::stylesheets::Origin;
if context.stylesheet_origin != Origin::Author {
return true;

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

@ -7,6 +7,10 @@
//! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule
use crate::error_reporting::ContextualParseError;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray};
use crate::parser::{Parse, ParserContext};
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
@ -17,10 +21,6 @@ use crate::Atom;
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
use cssparser::{DeclarationListParser, DeclarationParser, Parser};
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
#[cfg(feature = "gecko")]
use gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry;
#[cfg(feature = "gecko")]
use gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray};
use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};

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

@ -30,7 +30,7 @@ pub struct PendingSheet {
#[derive(Debug)]
pub enum ImportSheet {
/// A bonafide stylesheet.
Sheet(::gecko::data::GeckoStyleSheet),
Sheet(crate::gecko::data::GeckoStyleSheet),
/// An @import created while parsing off-main-thread, whose Gecko sheet has
/// yet to be created and attached.
Pending(PendingSheet),
@ -39,7 +39,7 @@ pub enum ImportSheet {
#[cfg(feature = "gecko")]
impl ImportSheet {
/// Creates a new ImportSheet from a GeckoStyleSheet.
pub fn new(sheet: ::gecko::data::GeckoStyleSheet) -> Self {
pub fn new(sheet: crate::gecko::data::GeckoStyleSheet) -> Self {
ImportSheet::Sheet(sheet)
}
@ -53,7 +53,7 @@ impl ImportSheet {
/// Returns a reference to the GeckoStyleSheet in this ImportSheet, if it
/// exists.
pub fn as_sheet(&self) -> Option<&::gecko::data::GeckoStyleSheet> {
pub fn as_sheet(&self) -> Option<&crate::gecko::data::GeckoStyleSheet> {
match *self {
ImportSheet::Sheet(ref s) => Some(s),
ImportSheet::Pending(_) => None,
@ -69,8 +69,8 @@ impl DeepCloneWithLock for ImportSheet {
_guard: &SharedRwLockReadGuard,
params: &DeepCloneParams,
) -> Self {
use gecko::data::GeckoStyleSheet;
use gecko_bindings::bindings;
use crate::gecko::data::GeckoStyleSheet;
use crate::gecko_bindings::bindings;
match *self {
ImportSheet::Sheet(ref s) => {
let clone = unsafe {

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

@ -63,7 +63,7 @@ pub type UrlExtraData = ::servo_url::ServoUrl;
#[cfg(feature = "gecko")]
#[derive(Clone, PartialEq)]
pub struct UrlExtraData(
pub ::gecko_bindings::sugar::refptr::RefPtr<::gecko_bindings::structs::URLExtraData>,
pub crate::gecko_bindings::sugar::refptr::RefPtr<crate::gecko_bindings::structs::URLExtraData>,
);
#[cfg(feature = "gecko")]
@ -80,7 +80,7 @@ impl UrlExtraData {
///
/// This method doesn't touch refcount.
#[inline]
pub unsafe fn from_ptr_ref(ptr: &*mut ::gecko_bindings::structs::URLExtraData) -> &Self {
pub unsafe fn from_ptr_ref(ptr: &*mut crate::gecko_bindings::structs::URLExtraData) -> &Self {
::std::mem::transmute(ptr)
}
}
@ -88,7 +88,7 @@ impl UrlExtraData {
#[cfg(feature = "gecko")]
impl fmt::Debug for UrlExtraData {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
use gecko_bindings::{bindings, structs};
use crate::gecko_bindings::{bindings, structs};
struct DebugURI(*mut structs::nsIURI);
impl fmt::Debug for DebugURI {

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

@ -222,8 +222,8 @@ impl SupportsCondition {
#[cfg(feature = "gecko")]
fn eval_moz_bool_pref(name: &CStr, cx: &ParserContext) -> bool {
use gecko_bindings::bindings;
use stylesheets::Origin;
use crate::gecko_bindings::bindings;
use crate::stylesheets::Origin;
if cx.stylesheet_origin != Origin::UserAgent && !cx.chrome_rules_enabled() {
return false;
}
@ -325,7 +325,7 @@ impl RawSelector {
#[cfg(feature = "gecko")]
{
if unsafe {
!::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled
!crate::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled
} {
return false;
}
@ -347,7 +347,7 @@ impl RawSelector {
#[cfg(feature = "gecko")]
{
use selector_parser::PseudoElement;
use crate::selector_parser::PseudoElement;
use selectors::parser::Component;
let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() && selector

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

@ -9,6 +9,8 @@ use crate::context::{CascadeInputs, QuirksMode};
use crate::dom::{TElement, TShadowRoot};
use crate::element_state::{DocumentState, ElementState};
use crate::font_metrics::FontMetricsProvider;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
use crate::invalidation::element::invalidation_map::InvalidationMap;
use crate::invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
use crate::media_queries::Device;
@ -26,11 +28,11 @@ use crate::stylesheets::keyframes_rule::KeyframesAnimation;
use crate::stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
use crate::stylesheets::StyleRule;
use crate::stylesheets::StylesheetInDocument;
#[cfg(feature = "gecko")]
use crate::stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
use crate::stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
use crate::thread_state::{self, ThreadState};
use crate::{Atom, LocalName, Namespace, WeakAtom};
#[cfg(feature = "gecko")]
use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
use hashglobe::FailedAllocationError;
#[cfg(feature = "gecko")]
use malloc_size_of::MallocUnconditionalShallowSizeOf;
@ -49,8 +51,6 @@ use smallbitvec::SmallBitVec;
use std::ops;
use std::sync::Mutex;
use style_traits::viewport::ViewportConstraints;
#[cfg(feature = "gecko")]
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
/// The type of the stylesheets that the stylist contains.
#[cfg(feature = "servo")]
@ -58,7 +58,7 @@ pub type StylistSheet = crate::stylesheets::DocumentStyleSheet;
/// The type of the stylesheets that the stylist contains.
#[cfg(feature = "gecko")]
pub type StylistSheet = ::gecko::data::GeckoStyleSheet;
pub type StylistSheet = crate::gecko::data::GeckoStyleSheet;
/// A cache of computed user-agent data, to be shared across documents.
lazy_static! {

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

@ -40,7 +40,7 @@ bitflags! {
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_traversal_flags_match() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
macro_rules! check_traversal_flags {
( $( $a:ident => $b:path ),*, ) => {

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

@ -4,9 +4,9 @@
//! Various stuff for CSS property use counters.
use crate::properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
#[cfg(feature = "gecko")]
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
use std::cell::Cell;
#[cfg(target_pointer_width = "64")]
@ -78,7 +78,7 @@ impl UseCounters {
#[cfg(feature = "gecko")]
unsafe impl HasFFI for UseCounters {
type FFIType = ::gecko_bindings::structs::StyleUseCounters;
type FFIType = crate::gecko_bindings::structs::StyleUseCounters;
}
#[cfg(feature = "gecko")]

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

@ -6,14 +6,14 @@
use crate::values::animated::color::Color;
use crate::values::computed::length::Length;
#[cfg(feature = "gecko")]
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::{Angle, Number};
use crate::values::generics::effects::BoxShadow as GenericBoxShadow;
use crate::values::generics::effects::Filter as GenericFilter;
use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow;
#[cfg(not(feature = "gecko"))]
use crate::values::Impossible;
#[cfg(feature = "gecko")]
use values::computed::url::ComputedUrl;
/// An animated value for a single `box-shadow`.
pub type BoxShadow = GenericBoxShadow<Color, Length, Length, Length>;

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

@ -6,8 +6,8 @@
//!
//! https://drafts.csswg.org/css-align/
use values::computed::{Context, ToComputedValue};
use values::specified;
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified;
pub use super::specified::{AlignContent, AlignItems, JustifyContent, SelfAlignment};
pub use super::specified::{AlignSelf, JustifySelf};
@ -60,7 +60,7 @@ impl ToComputedValue for specified::JustifyItems {
/// <https://drafts.csswg.org/css-align/#valdef-justify-items-legacy>
fn to_computed_value(&self, _context: &Context) -> JustifyItems {
use values::specified::align;
use crate::values::specified::align;
let specified = *self;
let computed = if self.0 != align::AlignFlags::LEGACY {
*self

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

@ -6,14 +6,14 @@
use crate::values::computed::color::Color;
use crate::values::computed::length::{Length, NonNegativeLength};
#[cfg(feature = "gecko")]
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::{Angle, NonNegativeNumber};
use crate::values::generics::effects::BoxShadow as GenericBoxShadow;
use crate::values::generics::effects::Filter as GenericFilter;
use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow;
#[cfg(not(feature = "gecko"))]
use crate::values::Impossible;
#[cfg(feature = "gecko")]
use values::computed::url::ComputedUrl;
/// A computed value for a single shadow of the `box-shadow` property.
pub type BoxShadow = GenericBoxShadow<Color, Length, NonNegativeLength, Length>;

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

@ -12,7 +12,7 @@ pub type Width = crate::values::computed::NonNegativeLengthOrPercentageOrAuto;
/// The `width` value type.
#[cfg(feature = "gecko")]
pub type Width = ::values::computed::MozLength;
pub type Width = crate::values::computed::MozLength;
/// A computed value for the `flex-basis` property.
pub type FlexBasis = GenericFlexBasis<Width>;

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

@ -6,6 +6,10 @@
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::{bindings, structs};
use crate::values::animated::{ToAnimatedValue, ToAnimatedZero};
use crate::values::computed::{Angle, Context, Integer, NonNegativeLength, NonNegativePercentage};
use crate::values::computed::{Number, Percentage, ToComputedValue};
@ -18,10 +22,6 @@ use crate::values::CSSFloat;
use crate::Atom;
use cssparser::{serialize_identifier, CssStringWriter, Parser};
#[cfg(feature = "gecko")]
use gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
use gecko_bindings::{bindings, structs};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::fmt::{self, Write};
use std::hash::{Hash, Hasher};
@ -441,7 +441,7 @@ impl SingleFontFamily {
#[cfg(feature = "gecko")]
/// Return the generic ID for a given generic font name
pub fn generic(name: &Atom) -> (structs::FontFamilyType, u8) {
use gecko_bindings::structs::FontFamilyType;
use crate::gecko_bindings::structs::FontFamilyType;
if *name == atom!("serif") {
(FontFamilyType::eFamily_serif, structs::kGenericFont_serif)
} else if *name == atom!("sans-serif") {
@ -477,7 +477,7 @@ impl SingleFontFamily {
#[cfg(feature = "gecko")]
/// Get the corresponding font-family with family name
fn from_font_family_name(family: &structs::FontFamilyName) -> SingleFontFamily {
use gecko_bindings::structs::FontFamilyType;
use crate::gecko_bindings::structs::FontFamilyType;
match family.mType {
FontFamilyType::eFamily_sans_serif => SingleFontFamily::Generic(atom!("sans-serif")),
@ -545,7 +545,7 @@ impl Hash for FontFamilyList {
where
H: Hasher,
{
use string_cache::WeakAtom;
use crate::string_cache::WeakAtom;
for name in self.0.mNames.iter() {
name.mType.hash(state);
@ -827,7 +827,7 @@ impl ToComputedValue for specified::MozScriptLevel {
type ComputedValue = MozScriptLevel;
fn to_computed_value(&self, cx: &Context) -> i8 {
use properties::longhands::_moz_math_display::SpecifiedValue as DisplayValue;
use crate::properties::longhands::_moz_math_display::SpecifiedValue as DisplayValue;
use std::{cmp, i8};
let int = match *self {

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

@ -4,8 +4,8 @@
//! Computed types for legacy Gecko-only properties.
use values::computed::length::LengthOrPercentage;
use values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint;
use crate::values::computed::length::LengthOrPercentage;
use crate::values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint;
/// A computed type for scroll snap points.
pub type ScrollSnapPoint = GenericScrollSnapPoint<LengthOrPercentage>;

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

@ -9,6 +9,8 @@
use crate::values::computed::position::Position;
use crate::values::computed::url::ComputedImageUrl;
#[cfg(feature = "gecko")]
use crate::values::computed::Percentage;
use crate::values::computed::{Angle, Color, Context};
use crate::values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
use crate::values::generics::image::{self as generic, CompatMode};
@ -18,8 +20,6 @@ use crate::values::{Either, None_};
use std::f32::consts::PI;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
#[cfg(feature = "gecko")]
use values::computed::Percentage;
/// A computed image layer.
pub type ImageLayer = Either<None_, Image>;

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

@ -4,9 +4,9 @@
//! `list` computed values.
pub use crate::values::specified::list::{QuotePair, Quotes};
#[cfg(feature = "gecko")]
pub use values::specified::list::ListStyleType;
pub use crate::values::specified::list::ListStyleType;
pub use crate::values::specified::list::{QuotePair, Quotes};
use servo_arc::Arc;

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

@ -14,14 +14,14 @@ use super::{CSSFloat, CSSInteger};
use crate::context::QuirksMode;
use crate::font_metrics::{get_metrics_provider_for_product, FontMetricsProvider};
use crate::media_queries::Device;
#[cfg(feature = "gecko")]
use crate::properties;
use crate::properties::{ComputedValues, LonghandId, StyleBuilder};
use crate::rule_cache::RuleCacheConditions;
use crate::Atom;
#[cfg(feature = "servo")]
use crate::Prefix;
use euclid::Size2D;
#[cfg(feature = "gecko")]
use properties;
use std::cell::RefCell;
use std::cmp;
use std::f32;

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

@ -6,10 +6,10 @@
use crate::values::generics::url::UrlOrNone as GenericUrlOrNone;
#[cfg(feature = "gecko")]
pub use crate::gecko::url::{ComputedImageUrl, ComputedUrl};
#[cfg(feature = "servo")]
pub use crate::servo::url::{ComputedImageUrl, ComputedUrl};
#[cfg(feature = "gecko")]
pub use gecko::url::{ComputedImageUrl, ComputedUrl};
/// Computed <url> | <none>
pub type UrlOrNone = GenericUrlOrNone<ComputedUrl>;

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

@ -6,12 +6,12 @@
#[cfg(feature = "servo")]
use crate::computed_values::list_style_type::T as ListStyleType;
#[cfg(feature = "gecko")]
use crate::values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use crate::values::specified::Attr;
use crate::values::CustomIdent;
use std::ops::Deref;
#[cfg(feature = "gecko")]
use values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use values::specified::Attr;
/// A name / value pair for counters.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]

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

@ -58,7 +58,7 @@ pub enum TimingKeyword {
#[cfg(feature = "gecko")]
fn step_position_jump_enabled(_context: &ParserContext) -> bool {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
unsafe { structs::StaticPrefs_sVarCache_layout_css_step_position_jump_enabled }
}

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

@ -54,7 +54,7 @@ pub enum SymbolsType {
impl SymbolsType {
/// Convert symbols type to their corresponding Gecko values.
pub fn to_gecko_keyword(self) -> u8 {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
match self {
SymbolsType::Cyclic => structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC as u8,
SymbolsType::Numeric => structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC as u8,
@ -66,7 +66,7 @@ impl SymbolsType {
/// Convert Gecko value to symbol type.
pub fn from_gecko_keyword(gecko_value: u32) -> SymbolsType {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
match gecko_value {
structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC => SymbolsType::Cyclic,
structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC => SymbolsType::Numeric,

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

@ -8,20 +8,20 @@
#![deny(missing_docs)]
pub use cssparser::{serialize_identifier, serialize_name, CowRcStr, Parser};
pub use cssparser::{SourceLocation, Token, RGBA};
use crate::Atom;
use crate::parser::{Parse, ParserContext};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::Atom;
pub use cssparser::{serialize_identifier, serialize_name, CowRcStr, Parser};
pub use cssparser::{SourceLocation, Token, RGBA};
use selectors::parser::SelectorParseErrorKind;
use std::fmt::{self, Debug, Write};
use std::hash;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
#[cfg(feature = "gecko")]
pub use crate::gecko::url::CssUrl;
#[cfg(feature = "servo")]
pub use crate::servo::url::CssUrl;
#[cfg(feature = "gecko")]
pub use gecko::url::CssUrl;
pub mod animated;
pub mod computed;

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

@ -6,9 +6,9 @@
//!
//! https://drafts.csswg.org/css-align/
use crate::gecko_bindings::structs;
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use gecko_bindings::structs;
use parser::{Parse, ParserContext};
use std::fmt::{self, Write};
use style_traits::{CssWriter, KeywordsCollectFn, ParseError, SpecifiedValueInfo, ToCss};
@ -195,25 +195,25 @@ impl ContentDistribution {
// when this function is updated.
// Try to parse normal first
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("normal")).is_ok() {
return Ok(ContentDistribution::normal());
}
// Parse <baseline-position>, but only on the block axis.
if axis == AxisDirection::Block {
if let Ok(value) = input.try(parse_baseline) {
if let Ok(value) = input.r#try(parse_baseline) {
return Ok(ContentDistribution::new(value));
}
}
// <content-distribution>
if let Ok(value) = input.try(parse_content_distribution) {
if let Ok(value) = input.r#try(parse_content_distribution) {
return Ok(ContentDistribution::new(value));
}
// <overflow-position>? <content-position>
let overflow_position = input
.try(parse_overflow_position)
.r#try(parse_overflow_position)
.unwrap_or(AlignFlags::empty());
let content_position = try_match_ident_ignore_ascii_case! { input,
@ -358,18 +358,18 @@ impl SelfAlignment {
//
// It's weird that this accepts <baseline-position>, but not
// justify-content...
if let Ok(value) = input.try(parse_baseline) {
if let Ok(value) = input.r#try(parse_baseline) {
return Ok(SelfAlignment(value));
}
// auto | normal | stretch
if let Ok(value) = input.try(parse_auto_normal_stretch) {
if let Ok(value) = input.r#try(parse_auto_normal_stretch) {
return Ok(SelfAlignment(value));
}
// <overflow-position>? <self-position>
let overflow_position = input
.try(parse_overflow_position)
.r#try(parse_overflow_position)
.unwrap_or(AlignFlags::empty());
let self_position = parse_self_position(input, axis)?;
Ok(SelfAlignment(overflow_position | self_position))
@ -484,17 +484,17 @@ impl Parse for AlignItems {
// this function is updated.
// <baseline-position>
if let Ok(baseline) = input.try(parse_baseline) {
if let Ok(baseline) = input.r#try(parse_baseline) {
return Ok(AlignItems(baseline));
}
// normal | stretch
if let Ok(value) = input.try(parse_normal_stretch) {
if let Ok(value) = input.r#try(parse_normal_stretch) {
return Ok(AlignItems(value));
}
// <overflow-position>? <self-position>
let overflow = input
.try(parse_overflow_position)
.r#try(parse_overflow_position)
.unwrap_or(AlignFlags::empty());
let self_position = parse_self_position(input, AxisDirection::Block)?;
Ok(AlignItems(self_position | overflow))
@ -542,23 +542,23 @@ impl Parse for JustifyItems {
//
// It's weird that this accepts <baseline-position>, but not
// justify-content...
if let Ok(baseline) = input.try(parse_baseline) {
if let Ok(baseline) = input.r#try(parse_baseline) {
return Ok(JustifyItems(baseline));
}
// normal | stretch
if let Ok(value) = input.try(parse_normal_stretch) {
if let Ok(value) = input.r#try(parse_normal_stretch) {
return Ok(JustifyItems(value));
}
// legacy | [ legacy && [ left | right | center ] ]
if let Ok(value) = input.try(parse_legacy) {
if let Ok(value) = input.r#try(parse_legacy) {
return Ok(JustifyItems(value));
}
// <overflow-position>? <self-position>
let overflow = input
.try(parse_overflow_position)
.r#try(parse_overflow_position)
.unwrap_or(AlignFlags::empty());
let self_position = parse_self_position(input, AxisDirection::Inline)?;
Ok(JustifyItems(overflow | self_position))
@ -714,7 +714,7 @@ fn parse_legacy<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseE
// when this function is updated.
let flags = try_match_ident_ignore_ascii_case! { input,
"legacy" => {
let flags = input.try(parse_left_right_center)
let flags = input.r#try(parse_left_right_center)
.unwrap_or(AlignFlags::empty());
return Ok(AlignFlags::LEGACY | flags)

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

@ -54,7 +54,7 @@ pub type Polygon = generic::Polygon<LengthOrPercentage>;
#[cfg(feature = "gecko")]
fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
context.chrome_rules_enabled() ||
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled }
}

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

@ -29,14 +29,14 @@ fn in_ua_or_chrome_sheet(context: &ParserContext) -> bool {
#[cfg(feature = "gecko")]
fn moz_display_values_enabled(context: &ParserContext) -> bool {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
in_ua_or_chrome_sheet(context) ||
unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled }
}
#[cfg(feature = "gecko")]
fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
in_ua_or_chrome_sheet(context) ||
unsafe {
structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled
@ -670,7 +670,7 @@ impl_bitflags_conversions!(TouchAction);
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_touch_action_matches() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
macro_rules! check_touch_action {
( $( $a:ident => $b:path),*, ) => {
@ -883,10 +883,12 @@ impl TransitionProperty {
/// Convert TransitionProperty to nsCSSPropertyID.
#[cfg(feature = "gecko")]
pub fn to_nscsspropertyid(&self) -> Result<::gecko_bindings::structs::nsCSSPropertyID, ()> {
pub fn to_nscsspropertyid(
&self,
) -> Result<crate::gecko_bindings::structs::nsCSSPropertyID, ()> {
Ok(match *self {
TransitionProperty::Shorthand(ShorthandId::All) => {
::gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties
crate::gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties
},
TransitionProperty::Shorthand(ref id) => id.to_nscsspropertyid(),
TransitionProperty::Longhand(ref id) => id.to_nscsspropertyid(),

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

@ -5,17 +5,17 @@
//! Specified color values.
use super::AllowQuirks;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs::nscolor;
use crate::parser::{Parse, ParserContext};
#[cfg(feature = "gecko")]
use crate::properties::longhands::system_colors::SystemColor;
use crate::values::computed::{Color as ComputedColor, Context, ToComputedValue};
use crate::values::generics::color::Color as GenericColor;
use crate::values::specified::calc::CalcNode;
use cssparser::{AngleOrNumber, Color as CSSParserColor, Parser, Token, RGBA};
use cssparser::{BasicParseErrorKind, NumberOrPercentage, ParseErrorKind};
#[cfg(feature = "gecko")]
use gecko_bindings::structs::nscolor;
use itoa;
#[cfg(feature = "gecko")]
use properties::longhands::system_colors::SystemColor;
use std::fmt::{self, Write};
use std::io::Write as IoWrite;
use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError, StyleParseErrorKind};
@ -329,7 +329,7 @@ impl Color {
#[cfg(feature = "gecko")]
fn convert_nscolor_to_computedcolor(color: nscolor) -> ComputedColor {
use gecko::values::convert_nscolor_to_rgba;
use crate::gecko::values::convert_nscolor_to_rgba;
ComputedColor::rgba(convert_nscolor_to_rgba(color))
}

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

@ -11,16 +11,16 @@ use crate::values::generics::counters as generics;
use crate::values::generics::counters::CounterIncrement as GenericCounterIncrement;
use crate::values::generics::counters::CounterPair;
use crate::values::generics::counters::CounterReset as GenericCounterReset;
#[cfg(feature = "gecko")]
use crate::values::generics::CounterStyleOrNone;
use crate::values::specified::url::SpecifiedImageUrl;
#[cfg(feature = "gecko")]
use crate::values::specified::Attr;
use crate::values::specified::Integer;
use crate::values::CustomIdent;
use cssparser::{Parser, Token};
use selectors::parser::SelectorParseErrorKind;
use style_traits::{ParseError, StyleParseErrorKind};
#[cfg(feature = "gecko")]
use values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use values::specified::Attr;
/// A specified value for the `counter-increment` property.
pub type CounterIncrement = GenericCounterIncrement<Integer>;

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

@ -16,13 +16,13 @@ use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow;
use crate::values::generics::NonNegative;
use crate::values::specified::color::Color;
use crate::values::specified::length::{Length, NonNegativeLength};
#[cfg(feature = "gecko")]
use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::{Angle, NumberOrPercentage};
#[cfg(not(feature = "gecko"))]
use crate::values::Impossible;
use cssparser::{self, BasicParseErrorKind, Parser, Token};
use style_traits::{ParseError, StyleParseErrorKind, ValueParseErrorKind};
#[cfg(feature = "gecko")]
use values::specified::url::SpecifiedUrl;
/// A specified value for a single shadow of the `box-shadow` property.
pub type BoxShadow =

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

@ -15,7 +15,7 @@ pub type Width = crate::values::specified::NonNegativeLengthOrPercentageOrAuto;
/// The `width` value type.
#[cfg(feature = "gecko")]
pub type Width = ::values::specified::MozLength;
pub type Width = crate::values::specified::MozLength;
/// A specified value for the `flex-basis` property.
pub type FlexBasis = GenericFlexBasis<Width>;

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

@ -6,6 +6,8 @@
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::bindings;
use crate::parser::{Parse, ParserContext};
use crate::properties::longhands::system_font::SystemFont;
use crate::values::computed::font::{FamilyName, FontFamilyList, FontStyleAngle, SingleFontFamily};
@ -23,15 +25,12 @@ use crate::values::CustomIdent;
use crate::Atom;
use cssparser::{Parser, Token};
#[cfg(feature = "gecko")]
use gecko_bindings::bindings;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::fmt::{self, Write};
use style_traits::values::SequenceWriter;
use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
// FIXME(emilio): The system font code is copy-pasta, and should be cleaned up.
macro_rules! system_font_methods {
($ty:ident, $field:ident) => {
@ -753,8 +752,8 @@ impl ToComputedValue for KeywordSize {
type ComputedValue = NonNegativeLength;
#[inline]
fn to_computed_value(&self, cx: &Context) -> NonNegativeLength {
use context::QuirksMode;
use values::specified::length::au_to_int_px;
use crate::context::QuirksMode;
use crate::values::specified::length::au_to_int_px;
// The tables in this function are originally from
// nsRuleNode::CalcFontPointSize in Gecko:
@ -1310,7 +1309,7 @@ macro_rules! impl_variant_east_asian {
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_variant_east_asian_matches() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
$(
debug_assert_eq!(structs::$gecko as u16, VariantEastAsian::$ident.bits());
)+
@ -1520,7 +1519,7 @@ macro_rules! impl_variant_ligatures {
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_variant_ligatures_matches() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
$(
debug_assert_eq!(structs::$gecko as u16, VariantLigatures::$ident.bits());
)+
@ -1739,7 +1738,7 @@ macro_rules! impl_variant_numeric {
#[cfg(feature = "gecko")]
#[inline]
pub fn assert_variant_numeric_matches() {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
$(
debug_assert_eq!(structs::$gecko as u8, VariantNumeric::$ident.bits());
)+
@ -2019,7 +2018,7 @@ impl ToCss for FontSynthesis {
#[cfg(feature = "gecko")]
impl From<u8> for FontSynthesis {
fn from(bits: u8) -> FontSynthesis {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
FontSynthesis {
weight: bits & structs::NS_FONT_SYNTHESIS_WEIGHT as u8 != 0,
@ -2031,7 +2030,7 @@ impl From<u8> for FontSynthesis {
#[cfg(feature = "gecko")]
impl From<FontSynthesis> for u8 {
fn from(v: FontSynthesis) -> u8 {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
let mut bits: u8 = 0;
if v.weight {

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

@ -4,18 +4,18 @@
//! Specified types for legacy Gecko-only properties.
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut};
use crate::parser::{Parse, ParserContext};
use crate::values::computed;
use crate::values::computed::length::CSSPixelLength;
use crate::values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint;
use crate::values::generics::rect::Rect;
use crate::values::specified::length::LengthOrPercentage;
use cssparser::{Parser, Token};
use gecko::values::GeckoStyleCoordConvertible;
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut};
use parser::{Parse, ParserContext};
use std::fmt;
use style_traits::values::SequenceWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use values::computed;
use values::computed::length::CSSPixelLength;
use values::generics::gecko::ScrollSnapPoint as GenericScrollSnapPoint;
use values::generics::rect::Rect;
use values::specified::length::LengthOrPercentage;
/// A specified type for scroll snap points.
pub type ScrollSnapPoint = GenericScrollSnapPoint<LengthOrPercentage>;
@ -25,7 +25,7 @@ impl Parse for ScrollSnapPoint {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("none")).is_ok() {
return Ok(GenericScrollSnapPoint::None);
}
input.expect_function_matching("repeat")?;

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

@ -388,7 +388,7 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> {
#[cfg(feature = "gecko")]
#[inline]
fn allow_grid_template_subgrids() -> bool {
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled }
}

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

@ -9,6 +9,8 @@
use crate::custom_properties::SpecifiedValue;
use crate::parser::{Parse, ParserContext};
#[cfg(feature = "gecko")]
use crate::values::computed::{Context, Position as ComputedPosition, ToComputedValue};
use crate::values::generics::image::PaintWorklet;
use crate::values::generics::image::{self as generic, Circle, CompatMode, Ellipse, ShapeExtent};
use crate::values::generics::position::Position as GenericPosition;
@ -26,8 +28,6 @@ use std::cmp::Ordering;
use std::fmt::{self, Write};
use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
#[cfg(feature = "gecko")]
use values::computed::{Context, Position as ComputedPosition, ToComputedValue};
/// A specified image layer.
pub type ImageLayer = Either<None_, Image>;
@ -268,7 +268,7 @@ impl Parse for Gradient {
#[cfg(feature = "gecko")]
{
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
if compat_mode == CompatMode::Moz &&
!unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_gradients }
{
@ -691,8 +691,8 @@ impl generic::LineDirection for LineDirection {
}),
None,
) => {
use values::computed::Percentage as ComputedPercentage;
use values::specified::transform::OriginComponent;
use crate::values::computed::Percentage as ComputedPercentage;
use crate::values::specified::transform::OriginComponent;
// `50% 0%` is the default value for line direction.
// These percentage values can also be keywords.

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

@ -5,13 +5,13 @@
//! `list` specified values.
use crate::parser::{Parse, ParserContext};
#[cfg(feature = "gecko")]
use crate::values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use crate::values::CustomIdent;
use cssparser::{Parser, Token};
use servo_arc::Arc;
use style_traits::{ParseError, StyleParseErrorKind};
#[cfg(feature = "gecko")]
use values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use values::CustomIdent;
/// Specified and computed `list-style-type` property.
#[cfg(feature = "gecko")]
@ -37,7 +37,7 @@ impl ListStyleType {
/// list-style-type, and thus only values possible in that
/// attribute is considered here.
pub fn from_gecko_keyword(value: u32) -> Self {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
if value == structs::NS_STYLE_LIST_STYLE_NONE {
return ListStyleType::CounterStyle(CounterStyleOrNone::None);

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

@ -522,7 +522,7 @@ impl Parse for GridAutoFlow {
#[cfg(feature = "gecko")]
impl From<u8> for GridAutoFlow {
fn from(bits: u8) -> GridAutoFlow {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
GridAutoFlow {
autoflow: if bits & structs::NS_STYLE_GRID_AUTO_FLOW_ROW as u8 != 0 {
@ -538,7 +538,7 @@ impl From<u8> for GridAutoFlow {
#[cfg(feature = "gecko")]
impl From<GridAutoFlow> for u8 {
fn from(v: GridAutoFlow) -> u8 {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
let mut result: u8 = match v.autoflow {
AutoFlow::Row => structs::NS_STYLE_GRID_AUTO_FLOW_ROW as u8,

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

@ -5,13 +5,13 @@
//! https://html.spec.whatwg.org/multipage/#source-size-list
use app_units::Au;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
use cssparser::{Delimiter, Parser, Token};
#[cfg(feature = "gecko")]
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use selectors::context::QuirksMode;
use style_traits::ParseError;
@ -142,7 +142,7 @@ impl SourceSizeList {
#[cfg(feature = "gecko")]
unsafe impl HasFFI for SourceSizeList {
type FFIType = ::gecko_bindings::structs::RawServoSourceSizeList;
type FFIType = crate::gecko_bindings::structs::RawServoSourceSizeList;
}
#[cfg(feature = "gecko")]
unsafe impl HasSimpleFFI for SourceSizeList {}

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

@ -29,7 +29,7 @@ fn is_context_value_enabled() -> bool {
// The prefs can only be mutated on the main thread, so it is safe
// to read whenever we are on the main thread or the main thread is
// blocked.
use gecko_bindings::structs::mozilla;
use crate::gecko_bindings::structs::mozilla;
unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled }
}
#[cfg(not(feature = "gecko"))]

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

@ -769,7 +769,7 @@ impl TextEmphasisPosition {
#[cfg(feature = "gecko")]
/// Converts an enumerated value coming from Gecko to a `TextEmphasisPosition`.
pub fn from_gecko_keyword(kw: u32) -> Self {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
let vert = if kw & structs::NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT != 0 {
TextEmphasisVerticalWritingModeValue::Right
@ -815,7 +815,7 @@ impl From<u8> for TextEmphasisPosition {
#[cfg(feature = "gecko")]
impl From<TextEmphasisPosition> for u8 {
fn from(v: TextEmphasisPosition) -> u8 {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
let mut result = match v.0 {
TextEmphasisHorizontalWritingModeValue::Over => {

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

@ -6,10 +6,10 @@
use crate::values::generics::url::UrlOrNone as GenericUrlOrNone;
#[cfg(feature = "gecko")]
pub use crate::gecko::url::{SpecifiedImageUrl, SpecifiedUrl};
#[cfg(feature = "servo")]
pub use crate::servo::url::{SpecifiedImageUrl, SpecifiedUrl};
#[cfg(feature = "gecko")]
pub use gecko::url::{SpecifiedImageUrl, SpecifiedUrl};
/// Specified <url> | <none>
pub type UrlOrNone = GenericUrlOrNone<SpecifiedUrl>;