mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
cargo fix --edition --features gecko
This commit is contained in:
parent
a15d33a10e
commit
b1822a39fa
87 changed files with 614 additions and 585 deletions
|
@ -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"))]
|
||||
|
|
|
@ -793,7 +793,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
|
||||
|
@ -839,7 +839,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>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue