mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Port the style crate to rust 2018.
Differential Revision: https://phabricator.services.mozilla.com/D80101
This commit is contained in:
parent
9b980e2f49
commit
8f215a8444
9 changed files with 18 additions and 14 deletions
|
@ -6,6 +6,7 @@ license = "MPL-2.0"
|
|||
publish = false
|
||||
|
||||
build = "build.rs"
|
||||
edition = "2018"
|
||||
|
||||
# https://github.com/rust-lang/cargo/issues/3544
|
||||
links = "servo_style_crate"
|
||||
|
|
|
@ -318,7 +318,7 @@ fn generate_structs() {
|
|||
|
||||
fixups.push(Fixup {
|
||||
pat: format!("\\broot\\s*::\\s*{}\\b", gecko),
|
||||
rep: format!("::gecko_bindings::structs::{}", gecko_name),
|
||||
rep: format!("crate::gecko_bindings::structs::{}", gecko_name),
|
||||
});
|
||||
builder.blacklist_type(gecko).raw_line(format!(
|
||||
"pub type {0}{2} = {1}{2};",
|
||||
|
|
|
@ -816,7 +816,7 @@ pub trait TElement:
|
|||
Self: 'a,
|
||||
F: FnMut(&'a CascadeData, Self),
|
||||
{
|
||||
use rule_collector::containing_shadow_ignoring_svg_use;
|
||||
use crate::rule_collector::containing_shadow_ignoring_svg_use;
|
||||
|
||||
let target = self.rule_hash_target();
|
||||
if !target.matches_user_and_author_rules() {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Helpers for different FFI pointer kinds that Gecko's FFI layer uses.
|
||||
|
||||
use gecko_bindings::structs::root::mozilla::detail::CopyablePtr;
|
||||
use crate::gecko_bindings::structs::root::mozilla::detail::CopyablePtr;
|
||||
use servo_arc::{Arc, RawOffsetArc};
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::{forget, transmute};
|
||||
|
|
|
@ -371,7 +371,7 @@ trait PrivateMatchMethods: TElement {
|
|||
// since we have no way to know whether the decendants
|
||||
// need to be traversed at the beginning of the animation-only
|
||||
// restyle).
|
||||
let task = ::context::SequentialTask::process_post_animation(
|
||||
let task = crate::context::SequentialTask::process_post_animation(
|
||||
*self,
|
||||
PostAnimationTasks::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL,
|
||||
);
|
||||
|
@ -464,8 +464,11 @@ trait PrivateMatchMethods: TElement {
|
|||
}
|
||||
|
||||
if !tasks.is_empty() {
|
||||
let task =
|
||||
::context::SequentialTask::update_animations(*self, before_change_style, tasks);
|
||||
let task = crate::context::SequentialTask::update_animations(
|
||||
*self,
|
||||
before_change_style,
|
||||
tasks,
|
||||
);
|
||||
context.thread_local.tasks.push(task);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use void::{self, Void};
|
|||
#[allow(non_upper_case_globals)]
|
||||
impl From<nsCSSPropertyID> for TransitionProperty {
|
||||
fn from(property: nsCSSPropertyID) -> TransitionProperty {
|
||||
use properties::ShorthandId;
|
||||
use crate::properties::ShorthandId;
|
||||
match property {
|
||||
% for prop in data.longhands:
|
||||
${prop.nscsspropertyid()} => {
|
||||
|
|
|
@ -87,7 +87,7 @@ macro_rules! computed_length_percentage_or_auto {
|
|||
/// Returns true if the computed value is absolute 0 or 0%.
|
||||
#[inline]
|
||||
pub fn is_definitely_zero(&self) -> bool {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
use crate::values::generics::length::LengthPercentageOrAuto::*;
|
||||
match *self {
|
||||
LengthPercentage(ref l) => l.is_definitely_zero(),
|
||||
Auto => false,
|
||||
|
@ -102,7 +102,7 @@ pub type LengthPercentageOrAuto = generics::GenericLengthPercentageOrAuto<Length
|
|||
impl LengthPercentageOrAuto {
|
||||
/// Clamps the value to a non-negative value.
|
||||
pub fn clamp_to_non_negative(self) -> Self {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
use crate::values::generics::length::LengthPercentageOrAuto::*;
|
||||
match self {
|
||||
LengthPercentage(l) => LengthPercentage(l.clamp_to_non_negative()),
|
||||
Auto => Auto,
|
||||
|
@ -111,7 +111,7 @@ impl LengthPercentageOrAuto {
|
|||
|
||||
/// Convert to have a borrow inside the enum
|
||||
pub fn as_ref(&self) -> generics::GenericLengthPercentageOrAuto<&LengthPercentage> {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
use crate::values::generics::length::LengthPercentageOrAuto::*;
|
||||
match *self {
|
||||
LengthPercentage(ref lp) => LengthPercentage(lp),
|
||||
Auto => Auto,
|
||||
|
@ -125,7 +125,7 @@ impl generics::GenericLengthPercentageOrAuto<&LengthPercentage> {
|
|||
/// Resolves the percentage.
|
||||
#[inline]
|
||||
pub fn percentage_relative_to(&self, basis: Length) -> LengthOrAuto {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
use crate::values::generics::length::LengthPercentageOrAuto::*;
|
||||
match self {
|
||||
LengthPercentage(length_percentage) => {
|
||||
LengthPercentage(length_percentage.percentage_relative_to(basis))
|
||||
|
@ -137,7 +137,7 @@ impl generics::GenericLengthPercentageOrAuto<&LengthPercentage> {
|
|||
/// Maybe resolves the percentage.
|
||||
#[inline]
|
||||
pub fn maybe_percentage_relative_to(&self, basis: Option<Length>) -> LengthOrAuto {
|
||||
use values::generics::length::LengthPercentageOrAuto::*;
|
||||
use crate::values::generics::length::LengthPercentageOrAuto::*;
|
||||
match self {
|
||||
LengthPercentage(length_percentage) => length_percentage
|
||||
.maybe_percentage_relative_to(basis)
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
//! [images]: https://drafts.csswg.org/css-images/#image-values
|
||||
|
||||
use crate::custom_properties;
|
||||
use crate::values::generics::position::PositionComponent;
|
||||
use crate::values::serialize_atom_identifier;
|
||||
use crate::Atom;
|
||||
use crate::Zero;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::generics::position::PositionComponent;
|
||||
|
||||
/// An `<image> | none` value.
|
||||
///
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
//! Generic values for UI properties.
|
||||
|
||||
use crate::values::specified::ui::CursorKind;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::specified::ui::CursorKind;
|
||||
|
||||
/// A generic value for the `cursor` property.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue