Bug 1506391 - Use 2018-style paths in code generated by Mako. r=emilio

This commit is contained in:
Simon Sapin 2018-11-01 11:50:25 +01:00 коммит произвёл Emilio Cobos Álvarez
Родитель 1f69b0da92
Коммит 81f4b86edb
26 изменённых файлов: 598 добавлений и 597 удалений

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

@ -156,7 +156,7 @@ impl PseudoElement {
/// Construct a `CSSPseudoElementType` from a pseudo-element
#[inline]
fn pseudo_type(&self) -> CSSPseudoElementType {
use gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox;
use crate::gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox;
match *self {
% for pseudo in PSEUDOS:

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

@ -270,12 +270,12 @@ class Longhand(object):
def base_type(self):
if self.predefined_type and not self.is_vector:
return "::values::specified::{}".format(self.predefined_type)
return "crate::values::specified::{}".format(self.predefined_type)
return "longhands::{}::SpecifiedValue".format(self.ident)
def specified_type(self):
if self.predefined_type and not self.is_vector:
ty = "::values::specified::{}".format(self.predefined_type)
ty = "crate::values::specified::{}".format(self.predefined_type)
else:
ty = "longhands::{}::SpecifiedValue".format(self.ident)
if self.boxed:

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

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

@ -17,15 +17,15 @@
#[allow(unused_imports)]
use cssparser::{Color as CSSParserColor, RGBA};
#[allow(unused_imports)]
use values::specified::AllowQuirks;
use crate::values::specified::AllowQuirks;
#[allow(unused_imports)]
use smallvec::SmallVec;
pub use values::specified::${type} as SpecifiedValue;
pub use crate::values::specified::${type} as SpecifiedValue;
pub mod computed_value {
% if computed_type:
pub use ${computed_type} as T;
% else:
pub use values::computed::${type} as T;
pub use crate::values::computed::${type} as T;
% endif
}
% if initial_value:
@ -91,19 +91,19 @@
#[allow(unused_imports)]
use cssparser::{Parser, BasicParseError};
#[allow(unused_imports)]
use parser::{Parse, ParserContext};
use crate::parser::{Parse, ParserContext};
#[allow(unused_imports)]
use properties::ShorthandId;
use crate::properties::ShorthandId;
#[allow(unused_imports)]
use selectors::parser::SelectorParseErrorKind;
#[allow(unused_imports)]
use style_traits::{ParseError, StyleParseErrorKind};
#[allow(unused_imports)]
use values::computed::{Context, ToComputedValue};
use crate::values::computed::{Context, ToComputedValue};
#[allow(unused_imports)]
use values::{computed, specified};
use crate::values::{computed, specified};
#[allow(unused_imports)]
use values::{Auto, Either, None_, Normal};
use crate::values::{Auto, Either, None_, Normal};
${caller.body()}
}
@ -116,7 +116,7 @@
% else:
use smallvec::{IntoIter, SmallVec};
% endif
use values::computed::ComputedVecIter;
use crate::values::computed::ComputedVecIter;
/// The generic type defining the value for this property.
///
@ -148,9 +148,9 @@
Sorry, this is stupid but needed for now.
% endif
use properties::animated_properties::ListAnimation;
use values::animated::{Animate, ToAnimatedValue, ToAnimatedZero, Procedure};
use values::distance::{SquaredDistance, ComputeSquaredDistance};
use crate::properties::animated_properties::ListAnimation;
use crate::values::animated::{Animate, ToAnimatedValue, ToAnimatedZero, Procedure};
use crate::values::distance::{SquaredDistance, ComputeSquaredDistance};
// FIXME(emilio): For some reason rust thinks that this alias is
// unused, even though it's clearly used below?
@ -235,7 +235,7 @@
}
% endif
::style_traits::${separator}::parse(input, |parser| {
style_traits::${separator}::parse(input, |parser| {
single_value::parse(context, parser)
}).map(SpecifiedValue)
}
@ -279,21 +279,21 @@
#[allow(unused_imports)]
use cssparser::{Parser, BasicParseError, Token};
#[allow(unused_imports)]
use parser::{Parse, ParserContext};
use crate::parser::{Parse, ParserContext};
#[allow(unused_imports)]
use properties::{UnparsedValue, ShorthandId};
use crate::properties::{UnparsedValue, ShorthandId};
#[allow(unused_imports)]
use values::{Auto, Either, None_, Normal};
use crate::values::{Auto, Either, None_, Normal};
#[allow(unused_imports)]
use error_reporting::ParseErrorReporter;
use crate::error_reporting::ParseErrorReporter;
#[allow(unused_imports)]
use properties::longhands;
use crate::properties::longhands;
#[allow(unused_imports)]
use properties::{LonghandId, LonghandIdSet};
use crate::properties::{LonghandId, LonghandIdSet};
#[allow(unused_imports)]
use properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
use crate::properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
#[allow(unused_imports)]
use properties::style_structs;
use crate::properties::style_structs;
#[allow(unused_imports)]
use selectors::parser::SelectorParseErrorKind;
#[allow(unused_imports)]
@ -301,11 +301,11 @@
#[allow(unused_imports)]
use style_traits::{ParseError, StyleParseErrorKind};
#[allow(unused_imports)]
use values::computed::{Context, ToComputedValue};
use crate::values::computed::{Context, ToComputedValue};
#[allow(unused_imports)]
use values::{computed, generics, specified};
use crate::values::{computed, generics, specified};
#[allow(unused_imports)]
use Atom;
use crate::Atom;
${caller.body()}
#[allow(unused_variables)]
pub fn cascade_property(
@ -428,7 +428,7 @@
keyword = keyword=Keyword(name, values, **keyword_kwargs)
%>
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
use properties::longhands::system_font::SystemFont;
use crate::properties::longhands::system_font::SystemFont;
pub mod computed_value {
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
@ -511,7 +511,7 @@
///
/// Intended for use with presentation attributes, not style structs
pub fn from_gecko_keyword(kw: u32) -> Self {
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
% for value in values:
// We can't match on enum values if we're matching on a u32
const ${to_rust_ident(value).upper()}: ${const_type}
@ -535,7 +535,7 @@
/// Intended for use with presentation attributes, not style structs
pub fn from_gecko_keyword(kw: ${kw_type}) -> Self {
% for gecko_bit in bit_map.values():
use gecko_bindings::structs::${gecko_bit_prefix}${gecko_bit};
use crate::gecko_bindings::structs::${gecko_bit_prefix}${gecko_bit};
% endfor
let mut bits = ${type}::empty();
@ -549,7 +549,7 @@
pub fn to_gecko_keyword(self) -> ${kw_type} {
% for gecko_bit in bit_map.values():
use gecko_bindings::structs::${gecko_bit_prefix}${gecko_bit};
use crate::gecko_bindings::structs::${gecko_bit_prefix}${gecko_bit};
% endfor
let mut bits: ${kw_type} = 0;
@ -668,8 +668,8 @@
/// ${shorthand.spec}
pub mod ${shorthand.ident} {
use cssparser::Parser;
use parser::ParserContext;
use properties::{PropertyDeclaration, SourcePropertyDeclaration, MaybeBoxed, longhands};
use crate::parser::ParserContext;
use crate::properties::{PropertyDeclaration, SourcePropertyDeclaration, MaybeBoxed, longhands};
#[allow(unused_imports)]
use selectors::parser::SelectorParseErrorKind;
#[allow(unused_imports)]
@ -772,7 +772,7 @@
input: &mut Parser<'i, 't>,
) -> Result<(), ParseError<'i>> {
#[allow(unused_imports)]
use properties::{NonCustomPropertyId, LonghandId};
use crate::properties::{NonCustomPropertyId, LonghandId};
input.parse_entirely(|input| parse_value(context, input)).map(|longhands| {
% for sub_property in shorthand.sub_properties:
% if sub_property.may_be_disabled_in(shorthand, product):
@ -798,9 +798,9 @@
<% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %>
<%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)">
#[allow(unused_imports)]
use parser::Parse;
use values::generics::rect::Rect;
use values::specified;
use crate::parser::Parse;
use crate::values::generics::rect::Rect;
use crate::values::specified;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -852,7 +852,7 @@
return to_rust_ident(name.replace(side, phy_side).replace("inset-", ""))
%>
% if side is not None:
use logical_geometry::PhysicalSide;
use crate::logical_geometry::PhysicalSide;
match wm.${to_rust_ident(side)}_physical_side() {
% for phy_side in PHYSICAL_SIDES:
PhysicalSide::${phy_side.title()} => {

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

@ -9,40 +9,40 @@
from itertools import groupby
%>
#[cfg(feature = "gecko")] use gecko_bindings::structs::RawServoAnimationValueMap;
#[cfg(feature = "gecko")] use gecko_bindings::structs::RawGeckoGfxMatrix4x4;
#[cfg(feature = "gecko")] use gecko_bindings::structs::nsCSSPropertyID;
#[cfg(feature = "gecko")] use gecko_bindings::sugar::ownership::{HasFFI, HasSimpleFFI};
#[cfg(feature = "gecko")] use crate::gecko_bindings::structs::RawServoAnimationValueMap;
#[cfg(feature = "gecko")] use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
#[cfg(feature = "gecko")] use crate::gecko_bindings::structs::nsCSSPropertyID;
#[cfg(feature = "gecko")] use crate::gecko_bindings::sugar::ownership::{HasFFI, HasSimpleFFI};
use itertools::{EitherOrBoth, Itertools};
use num_traits::Zero;
use properties::{CSSWideKeyword, PropertyDeclaration};
use properties::longhands;
use properties::longhands::visibility::computed_value::T as Visibility;
use properties::LonghandId;
use crate::properties::{CSSWideKeyword, PropertyDeclaration};
use crate::properties::longhands;
use crate::properties::longhands::visibility::computed_value::T as Visibility;
use crate::properties::LonghandId;
use servo_arc::Arc;
use smallvec::SmallVec;
use std::{cmp, ptr};
use std::mem::{self, ManuallyDrop};
use hash::FxHashMap;
use crate::hash::FxHashMap;
use super::ComputedValues;
use values::CSSFloat;
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::animated::effects::Filter as AnimatedFilter;
#[cfg(feature = "gecko")] use values::computed::TransitionProperty;
use values::computed::Angle;
use values::computed::{ClipRect, Context};
use values::computed::{Length, LengthOrPercentage};
use values::computed::{Number, Percentage};
use values::computed::ToComputedValue;
use values::computed::transform::{DirectionVector, Matrix, Matrix3D};
use values::computed::transform::TransformOperation as ComputedTransformOperation;
use values::computed::transform::Transform as ComputedTransform;
use values::computed::transform::Rotate as ComputedRotate;
use values::computed::transform::Translate as ComputedTranslate;
use values::computed::transform::Scale as ComputedScale;
use values::generics::transform::{self, Rotate, Translate, Scale, Transform, TransformOperation};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::effects::Filter;
use crate::values::CSSFloat;
use crate::values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use crate::values::animated::effects::Filter as AnimatedFilter;
#[cfg(feature = "gecko")] use crate::values::computed::TransitionProperty;
use crate::values::computed::Angle;
use crate::values::computed::{ClipRect, Context};
use crate::values::computed::{Length, LengthOrPercentage};
use crate::values::computed::{Number, Percentage};
use crate::values::computed::ToComputedValue;
use crate::values::computed::transform::{DirectionVector, Matrix, Matrix3D};
use crate::values::computed::transform::TransformOperation as ComputedTransformOperation;
use crate::values::computed::transform::Transform as ComputedTransform;
use crate::values::computed::transform::Rotate as ComputedRotate;
use crate::values::computed::transform::Translate as ComputedTranslate;
use crate::values::computed::transform::Scale as ComputedScale;
use crate::values::generics::transform::{self, Rotate, Translate, Scale, Transform, TransformOperation};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::effects::Filter;
use void::{self, Void};
/// Convert nsCSSPropertyID to TransitionProperty
@ -357,7 +357,7 @@ impl AnimationValue {
/// "Uncompute" this animation value in order to be used inside the CSS
/// cascade.
pub fn uncompute(&self) -> PropertyDeclaration {
use properties::longhands;
use crate::properties::longhands;
use self::AnimationValue::*;
use super::PropertyDeclarationVariantRepr;
@ -401,7 +401,7 @@ impl AnimationValue {
pub fn from_declaration(
decl: &PropertyDeclaration,
context: &mut Context,
extra_custom_properties: Option<<&Arc<::custom_properties::CustomPropertiesMap>>,
extra_custom_properties: Option<<&Arc<crate::custom_properties::CustomPropertiesMap>>,
initial: &ComputedValues
) -> Option<Self> {
use super::PropertyDeclarationVariantRepr;
@ -815,7 +815,7 @@ impl ToAnimatedZero for Visibility {
impl Animate for ClipRect {
#[inline]
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
use values::computed::Length;
use crate::values::computed::Length;
let animate_component = |this: &Option<Length>, other: &Option<Length>| {
match (this.animate(other, procedure)?, procedure) {
(None, Procedure::Interpolate { .. }) => Ok(None),
@ -1070,8 +1070,8 @@ impl Animate for ComputedTransformOperation {
&TransformOperation::Perspective(ref fd),
&TransformOperation::Perspective(ref td),
) => {
use values::computed::CSSPixelLength;
use values::generics::transform::create_perspective_matrix;
use crate::values::computed::CSSPixelLength;
use crate::values::generics::transform::create_perspective_matrix;
// From https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions:
//
@ -1246,7 +1246,7 @@ impl ComputeSquaredDistance for MatrixDecomposed2D {
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
// Use Radian to compute the distance.
const RAD_PER_DEG: f64 = ::std::f64::consts::PI / 180.0;
const RAD_PER_DEG: f64 = std::f64::consts::PI / 180.0;
let angle1 = self.angle as f64 * RAD_PER_DEG;
let angle2 = other.angle as f64 * RAD_PER_DEG;
Ok(self.translate.compute_squared_distance(&other.translate)? +

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

@ -48,8 +48,8 @@
${helpers.predefined_type(
"border-%s-width" % side_name,
"BorderSideWidth",
"::values::computed::NonNegativeLength::new(3.)",
computed_type="::values::computed::NonNegativeLength",
"crate::values::computed::NonNegativeLength::new(3.)",
computed_type="crate::values::computed::NonNegativeLength",
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"),
spec=maybe_logical_spec(side, "width"),
animation_value_type="NonNegativeLength",
@ -64,7 +64,7 @@
${helpers.gecko_keyword_conversion(
Keyword('border-style',
"none solid double dotted dashed hidden groove ridge inset outset"),
type="::values::specified::BorderStyle",
type="crate::values::specified::BorderStyle",
)}
// FIXME(#4126): when gfx supports painting it, make this Size2D<LengthOrPercentage>
@ -160,11 +160,11 @@ ${helpers.predefined_type(
)}
#[cfg(feature = "gecko")]
impl ::values::computed::BorderImageWidth {
pub fn to_gecko_rect(&self, sides: &mut ::gecko_bindings::structs::nsStyleSides) {
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use gecko::values::GeckoStyleCoordConvertible;
use values::generics::border::BorderImageSideWidth;
impl crate::values::computed::BorderImageWidth {
pub fn to_gecko_rect(&self, sides: &mut crate::gecko_bindings::structs::nsStyleSides) {
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::values::generics::border::BorderImageSideWidth;
% for i in range(0, 4):
match self.${i} {
@ -182,16 +182,16 @@ impl ::values::computed::BorderImageWidth {
}
pub fn from_gecko_rect(
sides: &::gecko_bindings::structs::nsStyleSides,
) -> Option<::values::computed::BorderImageWidth> {
use gecko_bindings::structs::nsStyleUnit::{eStyleUnit_Factor, eStyleUnit_Auto};
use gecko_bindings::sugar::ns_style_coord::CoordData;
use gecko::values::GeckoStyleCoordConvertible;
use values::computed::{LengthOrPercentage, Number};
use values::generics::border::BorderImageSideWidth;
sides: &crate::gecko_bindings::structs::nsStyleSides,
) -> Option<crate::values::computed::BorderImageWidth> {
use crate::gecko_bindings::structs::nsStyleUnit::{eStyleUnit_Factor, eStyleUnit_Auto};
use crate::gecko_bindings::sugar::ns_style_coord::CoordData;
use crate::gecko::values::GeckoStyleCoordConvertible;
use crate::values::computed::{LengthOrPercentage, Number};
use crate::values::generics::border::BorderImageSideWidth;
Some(
::values::computed::BorderImageWidth::new(
crate::values::computed::BorderImageWidth::new(
% for i in range(0, 4):
match sides.data_at(${i}).unit() {
eStyleUnit_Auto => {

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

@ -63,11 +63,11 @@ pub mod system_colors {
IMESelectedConvertedTextBackground IMESelectedConvertedTextForeground
IMESelectedConvertedTextUnderline SpellCheckerUnderline""".split()
%>
use gecko_bindings::bindings::Gecko_GetLookAndFeelSystemColor;
use gecko_bindings::structs::root::mozilla::LookAndFeel_ColorID;
use crate::gecko_bindings::bindings::Gecko_GetLookAndFeelSystemColor;
use crate::gecko_bindings::structs::root::mozilla::LookAndFeel_ColorID;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::computed::{Context, ToComputedValue};
use crate::values::computed::{Context, ToComputedValue};
pub type SystemColor = LookAndFeel_ColorID;

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

@ -43,9 +43,9 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"column-rule-width",
"BorderSideWidth",
"::values::computed::NonNegativeLength::new(3.)",
"crate::values::computed::NonNegativeLength::new(3.)",
initial_specified_value="specified::BorderSideWidth::Medium",
computed_type="::values::computed::NonNegativeLength",
computed_type="crate::values::computed::NonNegativeLength",
products="gecko",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width",
animation_value_type="NonNegativeLength",

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

@ -326,12 +326,12 @@ ${helpers.predefined_type(
use app_units::Au;
use cssparser::{Parser, ToCss};
use gecko_bindings::structs::FontFamilyType;
use properties::longhands;
use crate::gecko_bindings::structs::FontFamilyType;
use crate::properties::longhands;
use std::fmt;
use std::hash::{Hash, Hasher};
use style_traits::ParseError;
use values::computed::{ToComputedValue, Context};
use crate::values::computed::{ToComputedValue, Context};
<%
system_fonts = """caption icon menu message-box small-caption status-bar
@ -375,12 +375,12 @@ ${helpers.predefined_type(
type ComputedValue = ComputedSystemFont;
fn to_computed_value(&self, cx: &Context) -> Self::ComputedValue {
use gecko_bindings::bindings;
use gecko_bindings::structs::{LookAndFeel_FontID, nsFont};
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs::{LookAndFeel_FontID, nsFont};
use std::mem;
use values::computed::Percentage;
use values::computed::font::{FontSize, FontStretch, FontStyle, FontFamilyList};
use values::generics::NonNegative;
use crate::values::computed::Percentage;
use crate::values::computed::font::{FontSize, FontStretch, FontStyle, FontFamilyList};
use crate::values::generics::NonNegative;
let id = match *self {
% for font in system_fonts:

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

@ -39,7 +39,7 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"fill",
"SVGPaint",
"::values::computed::SVGPaint::black()",
"crate::values::computed::SVGPaint::black()",
products="gecko",
animation_value_type="IntermediateSVGPaint",
boxed=True,
@ -87,7 +87,7 @@ ${helpers.predefined_type(
"stroke-width", "SVGWidth",
"computed::SVGWidth::one()",
products="gecko",
animation_value_type="::values::computed::SVGWidth",
animation_value_type="crate::values::computed::SVGWidth",
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth",
)}
@ -112,7 +112,7 @@ ${helpers.predefined_type(
"GreaterThanOrEqualToOneNumber",
"From::from(4.0)",
products="gecko",
animation_value_type="::values::computed::GreaterThanOrEqualToOneNumber",
animation_value_type="crate::values::computed::GreaterThanOrEqualToOneNumber",
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty",
)}
@ -130,7 +130,7 @@ ${helpers.predefined_type(
"SVGStrokeDashArray",
"Default::default()",
products="gecko",
animation_value_type="::values::computed::SVGStrokeDashArray",
animation_value_type="crate::values::computed::SVGStrokeDashArray",
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing",
)}

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

@ -294,9 +294,9 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"-webkit-text-stroke-width",
"BorderSideWidth",
"::values::computed::NonNegativeLength::new(0.)",
"crate::values::computed::NonNegativeLength::new(0.)",
initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())",
computed_type="::values::computed::NonNegativeLength",
computed_type="crate::values::computed::NonNegativeLength",
products="gecko",
gecko_pref="layout.css.prefixes.webkit",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",

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

@ -32,9 +32,9 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"outline-width",
"BorderSideWidth",
"::values::computed::NonNegativeLength::new(3.)",
"crate::values::computed::NonNegativeLength::new(3.)",
initial_specified_value="specified::BorderSideWidth::Medium",
computed_type="::values::computed::NonNegativeLength",
computed_type="crate::values::computed::NonNegativeLength",
animation_value_type="NonNegativeLength",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-width",
)}
@ -55,7 +55,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"outline-offset",
"Length",
"::values::computed::Length::new(0.)",
"crate::values::computed::Length::new(0.)",
products="servo gecko",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset",

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

@ -42,7 +42,7 @@ macro_rules! impl_align_conversions {
($name: path) => {
impl From<u8> for $name {
fn from(bits: u8) -> $name {
$name(::values::specified::align::AlignFlags::from_bits(bits)
$name(crate::values::specified::align::AlignFlags::from_bits(bits)
.expect("bits contain valid flag"))
}
}
@ -149,7 +149,7 @@ ${helpers.single_keyword(
)}
#[cfg(feature = "gecko")]
impl_align_conversions!(::values::specified::align::AlignItems);
impl_align_conversions!(crate::values::specified::align::AlignItems);
${helpers.predefined_type(
"justify-items",
@ -160,7 +160,7 @@ ${helpers.single_keyword(
)}
#[cfg(feature = "gecko")]
impl_align_conversions!(::values::specified::align::JustifyItems);
impl_align_conversions!(crate::values::specified::align::JustifyItems);
% endif
// Flex item properties
@ -214,7 +214,7 @@ ${helpers.predefined_type(
)}
#[cfg(feature = "gecko")]
impl_align_conversions!(::values::specified::align::SelfAlignment);
impl_align_conversions!(crate::values::specified::align::SelfAlignment);
% endif
// https://drafts.csswg.org/css-flexbox/#propdef-order

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

@ -22,28 +22,28 @@ use std::mem::{self, ManuallyDrop};
use cssparser::{Parser, RGBA, TokenSerializationType};
use cssparser::ParserInput;
#[cfg(feature = "servo")] use euclid::SideOffsets2D;
use context::QuirksMode;
#[cfg(feature = "gecko")] use gecko_bindings::structs::{self, nsCSSPropertyID};
#[cfg(feature = "servo")] use logical_geometry::LogicalMargin;
#[cfg(feature = "servo")] use computed_values;
use logical_geometry::WritingMode;
use crate::context::QuirksMode;
#[cfg(feature = "gecko")] use crate::gecko_bindings::structs::{self, nsCSSPropertyID};
#[cfg(feature = "servo")] use crate::logical_geometry::LogicalMargin;
#[cfg(feature = "servo")] use crate::computed_values;
use crate::logical_geometry::WritingMode;
#[cfg(feature = "gecko")] use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use media_queries::Device;
use parser::ParserContext;
use properties::longhands::system_font::SystemFont;
use selector_parser::PseudoElement;
use crate::media_queries::Device;
use crate::parser::ParserContext;
use crate::properties::longhands::system_font::SystemFont;
use crate::selector_parser::PseudoElement;
use selectors::parser::SelectorParseErrorKind;
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
use style_traits::{CssWriter, KeywordsCollectFn, ParseError, ParsingMode};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
use stylesheets::{CssRuleType, Origin, UrlExtraData};
use values::generics::text::LineHeight;
use values::computed;
use values::computed::NonNegativeLength;
use values::serialize_atom_name;
use rule_tree::StrongRuleNode;
use crate::stylesheets::{CssRuleType, Origin, UrlExtraData};
use crate::values::generics::text::LineHeight;
use crate::values::computed;
use crate::values::computed::NonNegativeLength;
use crate::values::serialize_atom_name;
use crate::rule_tree::StrongRuleNode;
use self::computed_value_flags::*;
use str::{CssString, CssStringBorrow, CssStringWriter};
use crate::str::{CssString, CssStringBorrow, CssStringWriter};
pub use self::declaration_block::*;
pub use self::cascade::*;
@ -110,12 +110,12 @@ macro_rules! unwrap_or_initial {
#[allow(missing_docs)]
pub mod shorthands {
use cssparser::Parser;
use parser::{Parse, ParserContext};
use crate::parser::{Parse, ParserContext};
use style_traits::{ParseError, StyleParseErrorKind};
use values::specified;
use crate::values::specified;
use style_traits::{CssWriter, ToCss};
use values::specified::{BorderStyle, Color};
use crate::values::specified::{BorderStyle, Color};
use std::fmt::{self, Write};
fn serialize_directional_border<W, I,>(
@ -427,7 +427,7 @@ pub const NON_CUSTOM_PROPERTY_ID_COUNT: usize =
#[allow(dead_code)]
unsafe fn static_assert_nscsspropertyid() {
% for i, property in enumerate(data.longhands + data.shorthands + data.all_aliases()):
::std::mem::transmute::<[u8; ${i}], [u8; ${property.nscsspropertyid()} as usize]>([0; ${i}]); // ${property.name}
std::mem::transmute::<[u8; ${i}], [u8; ${property.nscsspropertyid()} as usize]>([0; ${i}]); // ${property.name}
% endfor
}
% endif
@ -442,7 +442,7 @@ impl NonCustomPropertyId {
#[inline]
fn to_nscsspropertyid(self) -> nsCSSPropertyID {
// unsafe: guaranteed by static_assert_nscsspropertyid above.
unsafe { ::std::mem::transmute(self.0 as i32) }
unsafe { std::mem::transmute(self.0 as i32) }
}
/// Convert an `nsCSSPropertyID` into a `NonCustomPropertyId`.
@ -457,7 +457,7 @@ impl NonCustomPropertyId {
return Err(());
}
// unsafe: guaranteed by static_assert_nscsspropertyid above.
Ok(unsafe { ::std::mem::transmute(prop as usize) })
Ok(unsafe { std::mem::transmute(prop as usize) })
}
/// Get the property name.
@ -1301,7 +1301,7 @@ impl LonghandId {
/// shorthand, if that shorthand is enabled for all content too.
pub struct NonCustomPropertyIterator<Item: 'static> {
filter: bool,
iter: ::std::slice::Iter<'static, Item>,
iter: std::slice::Iter<'static, Item>,
}
impl<Item> Iterator for NonCustomPropertyIterator<Item>
@ -1534,11 +1534,11 @@ impl UnparsedValue {
fn substitute_variables(
&self,
longhand_id: LonghandId,
custom_properties: Option<<&Arc<::custom_properties::CustomPropertiesMap>>,
custom_properties: Option<<&Arc<crate::custom_properties::CustomPropertiesMap>>,
quirks_mode: QuirksMode,
environment: &::custom_properties::CssEnvironment,
) -> PropertyDeclaration {
::custom_properties::substitute(
crate::custom_properties::substitute(
&self.css,
self.first_token_type,
custom_properties,
@ -1617,7 +1617,7 @@ pub enum PropertyDeclarationId<'a> {
/// A longhand.
Longhand(LonghandId),
/// A custom property declaration.
Custom(&'a ::custom_properties::Name),
Custom(&'a crate::custom_properties::Name),
}
impl<'a> ToCss for PropertyDeclarationId<'a> {
@ -1699,7 +1699,7 @@ pub enum PropertyId {
/// An alias for a shorthand property.
ShorthandAlias(ShorthandId, AliasId),
/// A custom property.
Custom(::custom_properties::Name),
Custom(crate::custom_properties::Name),
}
impl fmt::Debug for PropertyId {
@ -1763,8 +1763,8 @@ impl PropertyId {
return Ok(id.clone())
}
let name = ::custom_properties::parse_name(property_name)?;
Ok(PropertyId::Custom(::custom_properties::Name::from(name)))
let name = crate::custom_properties::parse_name(property_name)?;
Ok(PropertyId::Custom(crate::custom_properties::Name::from(name)))
}
/// Parses a property name, and returns an error if it's unknown or isn't
@ -1948,7 +1948,7 @@ pub struct VariableDeclaration {
#[derive(Clone, PartialEq, ToCss)]
pub enum CustomDeclarationValue {
/// A value.
Value(Arc<::custom_properties::SpecifiedValue>),
Value(Arc<crate::custom_properties::SpecifiedValue>),
/// A wide keyword.
CSSWideKeyword(CSSWideKeyword),
}
@ -1959,7 +1959,7 @@ pub enum CustomDeclarationValue {
pub struct CustomDeclaration {
/// The name of the custom property.
#[css(skip)]
pub name: ::custom_properties::Name,
pub name: crate::custom_properties::Name,
/// The value of the custom property.
#[cfg_attr(feature = "gecko", ignore_malloc_size_of = "XXX: how to handle this?")]
pub value: CustomDeclarationValue,
@ -2196,7 +2196,7 @@ impl PropertyDeclaration {
// This probably affects some test results.
let value = match input.try(CSSWideKeyword::parse) {
Ok(keyword) => CustomDeclarationValue::CSSWideKeyword(keyword),
Err(()) => match ::custom_properties::SpecifiedValue::parse(input) {
Err(()) => match crate::custom_properties::SpecifiedValue::parse(input) {
Ok(value) => CustomDeclarationValue::Value(value),
Err(e) => return Err(StyleParseErrorKind::new_invalid(
format!("--{}", property_name),
@ -2230,7 +2230,7 @@ impl PropertyDeclaration {
}
input.reset(&start);
let (first_token_type, css) =
::custom_properties::parse_non_custom_with_var(input).map_err(|e| {
crate::custom_properties::parse_non_custom_with_var(input).map_err(|e| {
StyleParseErrorKind::new_invalid(
non_custom_id.unwrap().name(),
e,
@ -2282,7 +2282,7 @@ impl PropertyDeclaration {
input.reset(&start);
let (first_token_type, css) =
::custom_properties::parse_non_custom_with_var(input).map_err(|e| {
crate::custom_properties::parse_non_custom_with_var(input).map_err(|e| {
StyleParseErrorKind::new_invalid(
non_custom_id.unwrap().name(),
e,
@ -2424,7 +2424,7 @@ impl<'a> Iterator for AllShorthandDeclarationIterator<'a> {
}
#[cfg(feature = "gecko")]
pub use gecko_properties::style_structs;
pub use crate::gecko_properties::style_structs;
/// The module where all the style structs are defined.
#[cfg(feature = "servo")]
@ -2432,9 +2432,9 @@ pub mod style_structs {
use fxhash::FxHasher;
use super::longhands;
use std::hash::{Hash, Hasher};
use logical_geometry::WritingMode;
use media_queries::Device;
use values::computed::NonNegativeLength;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::values::computed::NonNegativeLength;
% for style_struct in data.active_style_structs():
% if style_struct.name == "Font":
@ -2453,7 +2453,7 @@ pub mod style_structs {
///
/// FIXME(emilio): This is technically a box-tree concept, and
/// would be nice to move away from style.
pub text_decorations_in_effect: ::values::computed::text::TextDecorationsInEffect,
pub text_decorations_in_effect: crate::values::computed::text::TextDecorationsInEffect,
% endif
% if style_struct.name == "Font":
/// The font hash, used for font caching.
@ -2700,7 +2700,7 @@ pub mod style_structs {
/// Whether this is a multicol style.
#[cfg(feature = "servo")]
pub fn is_multicol(&self) -> bool {
use values::Either;
use crate::values::Either;
match self.column_width {
Either::First(_width) => true,
Either::Second(_auto) => !self.column_count.is_auto(),
@ -2736,7 +2736,7 @@ pub mod style_structs {
#[cfg(feature = "gecko")]
pub use gecko_properties::{ComputedValues, ComputedValuesInner};
pub use crate::gecko_properties::{ComputedValues, ComputedValuesInner};
#[cfg(feature = "servo")]
#[cfg_attr(feature = "servo", derive(Clone, Debug))]
@ -2745,7 +2745,7 @@ pub struct ComputedValuesInner {
% for style_struct in data.active_style_structs():
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
/// The writing mode of this computed values struct.
pub writing_mode: WritingMode,
@ -2804,7 +2804,7 @@ impl ComputedValues {
}
/// Gets a reference to the custom properties map (if one exists).
pub fn custom_properties(&self) -> Option<<&Arc<::custom_properties::CustomPropertiesMap>> {
pub fn custom_properties(&self) -> Option<<&Arc<crate::custom_properties::CustomPropertiesMap>> {
self.custom_properties.as_ref()
}
@ -2874,7 +2874,7 @@ impl ComputedValues {
pub fn new(
_: &Device,
_: Option<<&PseudoElement>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
@ -2978,7 +2978,7 @@ impl ComputedValuesInner {
/// ineffective, and would yield an empty `::before` or `::after`
/// pseudo-element.
pub fn ineffective_content_property(&self) -> bool {
use values::generics::counters::Content;
use crate::values::generics::counters::Content;
match self.get_counters().content {
Content::Normal | Content::None => true,
Content::Items(ref items) => items.is_empty(),
@ -3100,7 +3100,7 @@ impl ComputedValuesInner {
/// Return true if the effects force the transform style to be Flat
pub fn overrides_transform_style(&self) -> bool {
use computed_values::mix_blend_mode::T as MixBlendMode;
use crate::computed_values::mix_blend_mode::T as MixBlendMode;
let effects = self.get_effects();
// TODO(gw): Add clip-path, isolation, mask-image, mask-border-source when supported.
@ -3112,7 +3112,7 @@ impl ComputedValuesInner {
/// <https://drafts.csswg.org/css-transforms/#grouping-property-values>
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
use computed_values::transform_style::T as TransformStyle;
use crate::computed_values::transform_style::T as TransformStyle;
let box_ = self.get_box();
@ -3127,7 +3127,7 @@ impl ComputedValuesInner {
/// Whether given this transform value, the compositor would require a
/// layer.
pub fn transform_requires_layer(&self) -> bool {
use values::generics::transform::TransformOperation;
use crate::values::generics::transform::TransformOperation;
// Check if the transform matrix is 2D or 3D
for transform in &self.get_box().transform.0 {
match *transform {
@ -3160,13 +3160,13 @@ impl ComputedValuesInner {
}
% if product == "gecko":
pub use ::servo_arc::RawOffsetArc as BuilderArc;
pub use crate::servo_arc::RawOffsetArc as BuilderArc;
/// Clone an arc, returning a regular arc
fn clone_arc<T: 'static>(x: &BuilderArc<T>) -> Arc<T> {
Arc::from_raw_offset(x.clone())
}
% else:
pub use ::servo_arc::Arc as BuilderArc;
pub use crate::servo_arc::Arc as BuilderArc;
/// Clone an arc, returning a regular arc
fn clone_arc<T: 'static>(x: &BuilderArc<T>) -> Arc<T> {
x.clone()
@ -3301,7 +3301,7 @@ pub struct StyleBuilder<'a> {
/// node.
pub rules: Option<StrongRuleNode>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
/// The pseudo-element this style will represent.
pub pseudo: Option<<&'a PseudoElement>,
@ -3334,12 +3334,12 @@ impl<'a> StyleBuilder<'a> {
parent_style_ignoring_first_line: Option<<&'a ComputedValues>,
pseudo: Option<<&'a PseudoElement>,
rules: Option<StrongRuleNode>,
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
) -> Self {
debug_assert_eq!(parent_style.is_some(), parent_style_ignoring_first_line.is_some());
#[cfg(feature = "gecko")]
debug_assert!(parent_style.is_none() ||
::std::ptr::eq(parent_style.unwrap(),
std::ptr::eq(parent_style.unwrap(),
parent_style_ignoring_first_line.unwrap()) ||
parent_style.unwrap().pseudo() == Some(PseudoElement::FirstLine));
let reset_style = device.default_computed_values();
@ -3604,7 +3604,7 @@ impl<'a> StyleBuilder<'a> {
/// Returns whether this computed style represents an out of flow-positioned
/// object.
pub fn out_of_flow_positioned(&self) -> bool {
use properties::longhands::position::computed_value::T as Position;
use crate::properties::longhands::position::computed_value::T as Position;
matches!(self.get_box().clone_position(),
Position::Absolute | Position::Fixed)
}
@ -3653,7 +3653,7 @@ impl<'a> StyleBuilder<'a> {
///
/// Cloning the Arc here is fine because it only happens in the case where
/// we have custom properties, and those are both rare and expensive.
fn custom_properties(&self) -> Option<<&Arc<::custom_properties::CustomPropertiesMap>> {
fn custom_properties(&self) -> Option<<&Arc<crate::custom_properties::CustomPropertiesMap>> {
self.custom_properties.as_ref()
}
@ -3697,7 +3697,7 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES;
#[cfg(feature = "servo")]
#[allow(missing_docs)]
mod lazy_static_module {
use logical_geometry::WritingMode;
use crate::logical_geometry::WritingMode;
use servo_arc::Arc;
use super::{ComputedValues, ComputedValuesInner, longhands, style_structs};
use super::computed_value_flags::ComputedValueFlags;
@ -3712,7 +3712,8 @@ mod lazy_static_module {
${longhand.ident}: longhands::${longhand.ident}::get_initial_value(),
% endfor
% if style_struct.name == "InheritedText":
text_decorations_in_effect: ::values::computed::text::TextDecorationsInEffect::default(),
text_decorations_in_effect:
crate::values::computed::text::TextDecorationsInEffect::default(),
% endif
% if style_struct.name == "Font":
hash: 0,

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

@ -10,13 +10,13 @@
background-attachment background-image background-size background-origin
background-clip"
spec="https://drafts.csswg.org/css-backgrounds/#the-background">
use properties::longhands::{background_position_x, background_position_y, background_repeat};
use properties::longhands::{background_attachment, background_image, background_size, background_origin};
use properties::longhands::background_clip;
use properties::longhands::background_clip::single_value::computed_value::T as Clip;
use properties::longhands::background_origin::single_value::computed_value::T as Origin;
use values::specified::{Color, Position, PositionComponent};
use parser::Parse;
use crate::properties::longhands::{background_position_x, background_position_y, background_repeat};
use crate::properties::longhands::{background_attachment, background_image, background_size, background_origin};
use crate::properties::longhands::background_clip;
use crate::properties::longhands::background_clip::single_value::computed_value::T as Clip;
use crate::properties::longhands::background_origin::single_value::computed_value::T as Origin;
use crate::values::specified::{Color, Position, PositionComponent};
use crate::parser::Parse;
// FIXME(emilio): Should be the same type!
impl From<background_origin::single_value::SpecifiedValue> for background_clip::single_value::SpecifiedValue {
@ -199,9 +199,9 @@
flags="SHORTHAND_IN_GETCS"
sub_properties="background-position-x background-position-y"
spec="https://drafts.csswg.org/css-backgrounds-4/#the-background-position">
use properties::longhands::{background_position_x, background_position_y};
use values::specified::AllowQuirks;
use values::specified::position::Position;
use crate::properties::longhands::{background_position_x, background_position_y};
use crate::values::specified::AllowQuirks;
use crate::values::specified::position::Position;
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -21,8 +21,8 @@ ${helpers.four_sides_shorthand(
' '.join('border-%s-width' % side
for side in PHYSICAL_SIDES)}"
spec="https://drafts.csswg.org/css-backgrounds/#border-width">
use values::generics::rect::Rect;
use values::specified::{AllowQuirks, BorderSideWidth};
use crate::values::generics::rect::Rect;
use crate::values::specified::{AllowQuirks, BorderSideWidth};
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -54,7 +54,7 @@ pub fn parse_border<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<(specified::Color, specified::BorderStyle, specified::BorderSideWidth), ParseError<'i>> {
use values::specified::{Color, BorderStyle, BorderSideWidth};
use crate::values::specified::{Color, BorderStyle, BorderSideWidth};
let _unused = context;
let mut color = None;
let mut style = None;
@ -147,8 +147,8 @@ pub fn parse_border<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use properties::longhands::{border_image_source, border_image_width};
use crate::properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use crate::properties::longhands::{border_image_source, border_image_width};
let (color, style, width) = super::parse_border(context, input)?;
Ok(expanded! {
@ -206,7 +206,7 @@ pub fn parse_border<'i, 't>(
// Just use the same as border-left. The border shorthand can't accept
// any value that the sub-shorthand couldn't.
<%
border_left = "<::properties::shorthands::border_left::Longhands as SpecifiedValueInfo>"
border_left = "<crate::properties::shorthands::border_left::Longhands as SpecifiedValueInfo>"
%>
impl SpecifiedValueInfo for Longhands {
const SUPPORTED_TYPES: u8 = ${border_left}::SUPPORTED_TYPES;
@ -220,10 +220,10 @@ pub fn parse_border<'i, 't>(
'border-%s-radius' % (corner)
for corner in ['top-left', 'top-right', 'bottom-right', 'bottom-left']
)}" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#border-radius">
use values::generics::rect::Rect;
use values::generics::border::BorderCornerRadius;
use values::specified::border::BorderRadius;
use parser::Parse;
use crate::values::generics::rect::Rect;
use crate::values::generics::border::BorderCornerRadius;
use crate::values::specified::border::BorderRadius;
use crate::parser::Parse;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -260,8 +260,8 @@ pub fn parse_border<'i, 't>(
border-image-repeat border-image-slice border-image-source border-image-width"
extra_prefixes="moz:layout.css.prefixes.border-image webkit"
spec="https://drafts.csswg.org/css-backgrounds-3/#border-image">
use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use properties::longhands::{border_image_source, border_image_width};
use crate::properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use crate::properties::longhands::{border_image_source, border_image_width};
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -10,9 +10,9 @@
sub_properties="overflow-x overflow-y"
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow"
>
use properties::longhands::overflow_x::parse as parse_overflow;
use crate::properties::longhands::overflow_x::parse as parse_overflow;
% if product == "gecko":
use properties::longhands::overflow_x::SpecifiedValue;
use crate::properties::longhands::overflow_x::SpecifiedValue;
% endif
pub fn parse_value<'i, 't>(
@ -20,7 +20,7 @@
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
% if product == "gecko":
use gecko_bindings::structs;
use crate::gecko_bindings::structs;
let moz_kw_enabled = unsafe {
structs::StaticPrefs_sVarCache_layout_css_overflow_moz_scrollbars_enabled
};
@ -82,7 +82,7 @@
"(https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)"
products="gecko"
>
use values::specified::OverflowClipBox;
use crate::values::specified::OverflowClipBox;
pub fn parse_value<'i, 't>(
_: &ParserContext,
input: &mut Parser<'i, 't>,
@ -130,11 +130,11 @@ macro_rules! try_parse_one {
transition-timing-function
transition-delay"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition">
use parser::Parse;
use crate::parser::Parse;
% for prop in "delay duration property timing_function".split():
use properties::longhands::transition_${prop};
use crate::properties::longhands::transition_${prop};
% endfor
use values::specified::TransitionProperty;
use crate::values::specified::TransitionProperty;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -282,7 +282,7 @@ macro_rules! try_parse_one {
direction fill_mode play_state".split()
%>
% for prop in props:
use properties::longhands::animation_${prop};
use crate::properties::longhands::animation_${prop};
% endfor
pub fn parse_value<'i, 't>(
@ -391,7 +391,7 @@ macro_rules! try_parse_one {
gecko_pref="layout.css.scroll-snap.enabled"
sub_properties="scroll-snap-type-x scroll-snap-type-y"
spec="https://drafts.csswg.org/css-scroll-snap/#propdef-scroll-snap-type">
use properties::longhands::scroll_snap_type_x;
use crate::properties::longhands::scroll_snap_type_x;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -425,7 +425,7 @@ macro_rules! try_parse_one {
_: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
use values::specified::OverscrollBehavior;
use crate::values::specified::OverscrollBehavior;
let behavior_x = OverscrollBehavior::parse(input)?;
let behavior_y = input.try(OverscrollBehavior::parse).unwrap_or(behavior_x);
Ok(expanded! {

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

@ -9,7 +9,7 @@
servo_pref="layout.columns.enabled",
derive_serialize="True"
extra_prefixes="moz" spec="https://drafts.csswg.org/css-multicol/#propdef-columns">
use properties::longhands::{column_count, column_width};
use crate::properties::longhands::{column_count, column_width};
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -59,8 +59,8 @@
sub_properties="column-rule-width column-rule-style column-rule-color"
derive_serialize="True"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule">
use properties::longhands::{column_rule_width, column_rule_style};
use properties::longhands::column_rule_color;
use crate::properties::longhands::{column_rule_width, column_rule_style};
use crate::properties::longhands::column_rule_color;
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -21,14 +21,14 @@
${'font-variation-settings' if product == 'gecko' else ''}"
derive_value_info="False"
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font">
use parser::Parse;
use properties::longhands::{font_family, font_style, font_weight, font_stretch};
use properties::longhands::font_variant_caps;
use crate::parser::Parse;
use crate::properties::longhands::{font_family, font_style, font_weight, font_stretch};
use crate::properties::longhands::font_variant_caps;
#[cfg(feature = "gecko")]
use properties::longhands::system_font::SystemFont;
use values::specified::text::LineHeight;
use values::specified::FontSize;
use values::specified::font::{FontStretch, FontStretchKeyword};
use crate::properties::longhands::system_font::SystemFont;
use crate::values::specified::text::LineHeight;
use crate::values::specified::FontSize;
use crate::values::specified::font::{FontStretch, FontStretchKeyword};
<%
gecko_sub_properties = "kerning language_override size_adjust \
@ -39,7 +39,7 @@
%>
% if product == "gecko":
% for prop in gecko_sub_properties:
use properties::longhands::font_${prop};
use crate::properties::longhands::font_${prop};
% endfor
% endif
use self::font_family::SpecifiedValue as FontFamily;
@ -301,10 +301,10 @@
%>
% for prop in sub_properties:
use properties::longhands::font_variant_${prop};
use crate::properties::longhands::font_variant_${prop};
% endfor
#[allow(unused_imports)]
use values::specified::FontVariantLigatures;
use crate::values::specified::FontVariantLigatures;
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -7,13 +7,13 @@
<%helpers:shorthand name="marker" products="gecko"
sub_properties="marker-start marker-end marker-mid"
spec="https://www.w3.org/TR/SVG2/painting.html#MarkerShorthand">
use values::specified::url::UrlOrNone;
use crate::values::specified::url::UrlOrNone;
pub fn parse_value<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
use parser::Parse;
use crate::parser::Parse;
let url = UrlOrNone::parse(context, input)?;
Ok(expanded! {

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

@ -8,7 +8,7 @@
sub_properties="text-emphasis-style text-emphasis-color"
derive_serialize="True"
spec="https://drafts.csswg.org/css-text-decor-3/#text-emphasis-property">
use properties::longhands::{text_emphasis_color, text_emphasis_style};
use crate::properties::longhands::{text_emphasis_color, text_emphasis_style};
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -52,7 +52,7 @@
products="gecko"
derive_serialize="True"
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke">
use properties::longhands::{_webkit_text_stroke_color, _webkit_text_stroke_width};
use crate::properties::longhands::{_webkit_text_stroke_color, _webkit_text_stroke_width};
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -8,8 +8,8 @@
sub_properties="list-style-position list-style-image list-style-type"
derive_serialize="True"
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
use properties::longhands::{list_style_image, list_style_position, list_style_type};
use values::specified::url::ImageUrlOrNone;
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
use crate::values::specified::url::ImageUrlOrNone;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -64,7 +64,7 @@
% if product == "servo":
list_style_type::SpecifiedValue::None
% else:
use values::generics::CounterStyleOrNone;
use crate::values::generics::CounterStyleOrNone;
list_style_type::SpecifiedValue::CounterStyle(CounterStyleOrNone::None)
% endif
}

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

@ -8,9 +8,9 @@
sub_properties="outline-color outline-style outline-width"
derive_serialize="True"
spec="https://drafts.csswg.org/css-ui/#propdef-outline">
use properties::longhands::{outline_color, outline_width, outline_style};
use values::specified;
use parser::Parse;
use crate::properties::longhands::{outline_color, outline_width, outline_style};
use crate::values::specified;
use crate::parser::Parse;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -62,9 +62,9 @@
'-moz-outline-radius-%s' % corner
for corner in ['topleft', 'topright', 'bottomright', 'bottomleft']
)}" products="gecko" spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)">
use values::generics::rect::Rect;
use values::specified::border::BorderRadius;
use parser::Parse;
use crate::values::generics::rect::Rect;
use crate::values::specified::border::BorderRadius;
use crate::parser::Parse;
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -81,7 +81,7 @@
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
use values::generics::border::BorderCornerRadius;
use crate::values::generics::border::BorderCornerRadius;
let LonghandsToSerialize {
_moz_outline_radius_topleft: &BorderCornerRadius(ref tl),

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

@ -9,7 +9,7 @@
extra_prefixes="webkit"
derive_serialize="True"
spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
use properties::longhands::{flex_direction, flex_wrap};
use crate::properties::longhands::{flex_direction, flex_wrap};
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -48,9 +48,9 @@
extra_prefixes="webkit"
derive_serialize="True"
spec="https://drafts.csswg.org/css-flexbox/#flex-property">
use parser::Parse;
use values::specified::NonNegativeNumber;
use properties::longhands::flex_basis::SpecifiedValue as FlexBasis;
use crate::parser::Parse;
use crate::values::specified::NonNegativeNumber;
use crate::properties::longhands::flex_basis::SpecifiedValue as FlexBasis;
fn parse_flexibility<'i, 't>(
context: &ParserContext,
@ -111,7 +111,7 @@
<%helpers:shorthand name="gap" alias="grid-gap" sub_properties="row-gap column-gap"
spec="https://drafts.csswg.org/css-align-3/#gap-shorthand"
products="gecko">
use properties::longhands::{row_gap, column_gap};
use crate::properties::longhands::{row_gap, column_gap};
pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<Longhands, ParseError<'i>> {
@ -142,8 +142,8 @@
<%helpers:shorthand name="grid-${kind}" sub_properties="grid-${kind}-start grid-${kind}-end"
spec="https://drafts.csswg.org/css-grid/#propdef-grid-${kind}"
products="gecko">
use values::specified::GridLine;
use parser::Parse;
use crate::values::specified::GridLine;
use crate::parser::Parse;
// NOTE: Since both the shorthands have the same code, we should (re-)use code from one to implement
// the other. This might not be a big deal for now, but we should consider looking into this in the future
@ -184,8 +184,8 @@
sub_properties="grid-row-start grid-row-end grid-column-start grid-column-end"
spec="https://drafts.csswg.org/css-grid/#propdef-grid-area"
products="gecko">
use values::specified::GridLine;
use parser::Parse;
use crate::values::specified::GridLine;
use crate::parser::Parse;
// The code is the same as `grid-{row,column}` except that this can have four values at most.
pub fn parse_value<'i, 't>(
@ -251,14 +251,14 @@
sub_properties="grid-template-rows grid-template-columns grid-template-areas"
spec="https://drafts.csswg.org/css-grid/#propdef-grid-template"
products="gecko">
use parser::Parse;
use crate::parser::Parse;
use servo_arc::Arc;
use values::{Either, None_};
use values::generics::grid::{LineNameList, TrackSize, TrackList, TrackListType};
use values::generics::grid::{TrackListValue, concat_serialize_idents};
use values::specified::{GridTemplateComponent, GenericGridTemplateComponent};
use values::specified::grid::parse_line_names;
use values::specified::position::{TemplateAreas, TemplateAreasArc};
use crate::values::{Either, None_};
use crate::values::generics::grid::{LineNameList, TrackSize, TrackList, TrackListType};
use crate::values::generics::grid::{TrackListValue, concat_serialize_idents};
use crate::values::specified::{GridTemplateComponent, GenericGridTemplateComponent};
use crate::values::specified::grid::parse_line_names;
use crate::values::specified::position::{TemplateAreas, TemplateAreasArc};
/// Parsing for `<grid-template>` shorthand (also used by `grid` shorthand).
pub fn parse_grid_template<'i, 't>(
@ -484,12 +484,12 @@
grid-auto-rows grid-auto-columns grid-auto-flow"
spec="https://drafts.csswg.org/css-grid/#propdef-grid"
products="gecko">
use parser::Parse;
use properties::longhands::{grid_auto_columns, grid_auto_rows, grid_auto_flow};
use values::{Either, None_};
use values::generics::grid::{GridTemplateComponent, TrackListType};
use values::specified::{GenericGridTemplateComponent, TrackSize};
use values::specified::position::{AutoFlow, GridAutoFlow};
use crate::parser::Parse;
use crate::properties::longhands::{grid_auto_columns, grid_auto_rows, grid_auto_flow};
use crate::values::{Either, None_};
use crate::values::generics::grid::{GridTemplateComponent, TrackListType};
use crate::values::specified::{GenericGridTemplateComponent, TrackSize};
use crate::values::specified::position::{AutoFlow, GridAutoFlow};
pub fn parse_value<'i, 't>(
context: &ParserContext,
@ -636,7 +636,7 @@
<%helpers:shorthand name="place-content" sub_properties="align-content justify-content"
spec="https://drafts.csswg.org/css-align/#propdef-place-content"
products="gecko">
use values::specified::align::{AlignContent, JustifyContent, ContentDistribution, AxisDirection};
use crate::values::specified::align::{AlignContent, JustifyContent, ContentDistribution, AxisDirection};
pub fn parse_value<'i, 't>(
_: &ParserContext,
@ -688,7 +688,7 @@
<%helpers:shorthand name="place-self" sub_properties="align-self justify-self"
spec="https://drafts.csswg.org/css-align/#place-self-property"
products="gecko">
use values::specified::align::{AlignSelf, JustifySelf, SelfAlignment, AxisDirection};
use crate::values::specified::align::{AlignSelf, JustifySelf, SelfAlignment, AxisDirection};
pub fn parse_value<'i, 't>(
_: &ParserContext,
@ -726,8 +726,8 @@
<%helpers:shorthand name="place-items" sub_properties="align-items justify-items"
spec="https://drafts.csswg.org/css-align/#place-items-property"
products="gecko">
use values::specified::align::{AlignItems, JustifyItems};
use parser::Parse;
use crate::values::specified::align::{AlignItems, JustifyItems};
use crate::parser::Parse;
impl From<AlignItems> for JustifyItems {
fn from(align: AlignItems) -> JustifyItems {

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

@ -9,11 +9,11 @@
sub_properties="mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x
mask-position-y mask-size mask-image"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask">
use properties::longhands::{mask_mode, mask_repeat, mask_clip, mask_origin, mask_composite, mask_position_x,
use crate::properties::longhands::{mask_mode, mask_repeat, mask_clip, mask_origin, mask_composite, mask_position_x,
mask_position_y};
use properties::longhands::{mask_size, mask_image};
use values::specified::{Position, PositionComponent};
use parser::Parse;
use crate::properties::longhands::{mask_size, mask_image};
use crate::values::specified::{Position, PositionComponent};
use crate::parser::Parse;
// FIXME(emilio): These two mask types should be the same!
impl From<mask_origin::single_value::SpecifiedValue> for mask_clip::single_value::SpecifiedValue {
@ -125,8 +125,8 @@
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
use properties::longhands::mask_origin::single_value::computed_value::T as Origin;
use properties::longhands::mask_clip::single_value::computed_value::T as Clip;
use crate::properties::longhands::mask_origin::single_value::computed_value::T as Origin;
use crate::properties::longhands::mask_clip::single_value::computed_value::T as Clip;
let len = self.mask_image.0.len();
if len == 0 {
@ -186,9 +186,9 @@
flags="SHORTHAND_IN_GETCS"
sub_properties="mask-position-x mask-position-y"
spec="https://drafts.csswg.org/css-masks-4/#the-mask-position">
use properties::longhands::{mask_position_x,mask_position_y};
use values::specified::position::Position;
use parser::Parse;
use crate::properties::longhands::{mask_position_x,mask_position_y};
use crate::values::specified::position::Position;
use crate::parser::Parse;
pub fn parse_value<'i, 't>(
context: &ParserContext,

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

@ -11,10 +11,10 @@
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration">
% if product == "gecko":
use values::specified;
use properties::longhands::{text_decoration_line, text_decoration_style, text_decoration_color};
use crate::values::specified;
use crate::properties::longhands::{text_decoration_line, text_decoration_style, text_decoration_color};
% else:
use properties::longhands::text_decoration_line;
use crate::properties::longhands::text_decoration_line;
% endif
pub fn parse_value<'i, 't>(