Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make use of Servo-specific ToCss everywhere! #14089

Merged
merged 3 commits into from Nov 7, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -34,7 +34,7 @@ use style::properties::longhands::{display, position};
use style::properties::style_structs;
use style::selector_impl::PseudoElement;
use style::selector_matching::Stylist;
use style::values::LocalToCss;
use style_traits::ToCss;
use style_traits::cursor::Cursor;
use wrapper::{LayoutNodeHelpers, LayoutNodeLayoutData};

@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cssparser::ToCss;
use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{self, CSSStyleDeclarationMethods};
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
@@ -20,6 +19,7 @@ use style::parser::ParserContextExtraData;
use style::properties::{Shorthand, Importance, PropertyDeclarationBlock};
use style::properties::{is_supported_property, parse_one_declaration, parse_style_attribute};
use style::selector_impl::PseudoElement;
use style_traits::ToCss;

// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
#[dom_struct]
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cssparser::ToCss;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
@@ -22,7 +21,7 @@ use std::cell::Cell;
use std::rc::Rc;
use style;
use style::media_queries::{Device, MediaType};
use style_traits::{PagePx, ViewportPx};
use style_traits::{PagePx, ToCss, ViewportPx};

pub enum MediaQueryListMatchState {
Same(bool),

Some generated files are not rendered by default. Learn more.

@@ -7,13 +7,14 @@
//! [custom]: https://drafts.csswg.org/css-variables/

use Atom;
use cssparser::{Delimiter, Parser, SourcePosition, ToCss, Token, TokenSerializationType};
use cssparser::{Delimiter, Parser, SourcePosition, Token, TokenSerializationType};
use properties::DeclaredValue;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::sync::Arc;
use style_traits::ToCss;

// Does not include the `--` prefix
pub type Name = Atom;
@@ -132,9 +132,9 @@ pub mod values;
pub mod viewport;
pub mod workqueue;

use cssparser::ToCss;
use std::fmt;
use std::sync::Arc;
use style_traits::ToCss;

#[cfg(feature = "gecko")] pub use gecko_string_cache as string_cache;
#[cfg(feature = "gecko")] pub use gecko_string_cache::Atom;
@@ -8,12 +8,12 @@

use Atom;
use app_units::Au;
use cssparser::{Delimiter, Parser, ToCss, Token};
use cssparser::{Delimiter, Parser, Token};
use euclid::size::{Size2D, TypedSize2D};
use properties::longhands;
use serialize_comma_separated_list;
use std::fmt::{self, Write};
use style_traits::ViewportPx;
use style_traits::{ToCss, ViewportPx};
use values::specified;


@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cssparser::{DeclarationListParser, parse_important, ToCss};
use cssparser::{DeclarationListParser, parse_important};
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
use error_reporting::ParseErrorReporter;
use parser::{ParserContext, ParserContextExtraData, log_css_error};
use std::ascii::AsciiExt;
use std::boxed::Box as StdBox;
use std::fmt;
use style_traits::ToCss;
use stylesheets::Origin;
use super::*;
use url::Url;
@@ -54,9 +54,9 @@
<%def name="vector_longhand(name, gecko_only=False, allow_empty=False, **kwargs)">
<%call expr="longhand(name, **kwargs)">
% if product == "gecko" or not gecko_only:
use cssparser::ToCss;
use std::fmt;
use values::HasViewportPercentage;
use style_traits::ToCss;

impl HasViewportPercentage for SpecifiedValue {
fn has_viewport_percentage(&self) -> bool {
@@ -324,6 +324,7 @@
<%def name="inner_body()">
pub use self::computed_value::T as SpecifiedValue;
pub mod computed_value {
use style_traits::ToCss;
define_css_keyword_enum! { T:
% for value in data.longhands_by_name[name].keyword.values_for(product):
"${value}" => ${to_rust_ident(value)},
@@ -370,8 +371,8 @@
use values::NoViewportPercentage;
impl NoViewportPercentage for SpecifiedValue {}
pub mod computed_value {
use cssparser::ToCss;
use std::fmt;
use style_traits::ToCss;

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@@ -438,10 +439,11 @@
% if shorthand:
pub mod ${shorthand.ident} {
#[allow(unused_imports)]
use cssparser::{Parser, ToCss};
use cssparser::Parser;
use parser::ParserContext;
use properties::{longhands, PropertyDeclaration, DeclaredValue, Shorthand};
use std::fmt;
use style_traits::ToCss;

pub struct Longhands {
% for sub_property in shorthand.sub_properties:
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use app_units::Au;
use cssparser::{Color as CSSParserColor, Parser, RGBA, ToCss};
use cssparser::{Color as CSSParserColor, Parser, RGBA};
use euclid::{Point2D, Size2D};
use properties::PropertyDeclaration;
use properties::longhands;
@@ -20,6 +20,7 @@ use properties::longhands::visibility::computed_value::T as Visibility;
use properties::longhands::z_index::computed_value::T as ZIndex;
use std::cmp;
use std::fmt;
use style_traits::ToCss;
use super::ComputedValues;
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::{BorderRadiusSize, LengthOrNone};
@@ -12,10 +12,9 @@ ${helpers.predefined_type("background-color", "CSSColor",

<%helpers:vector_longhand name="background-image" animatable="False"
has_uncacheable_values="${product == 'gecko'}">
use cssparser::ToCss;
use std::fmt;
use style_traits::ToCss;
use values::specified::Image;
use values::LocalToCss;
use values::NoViewportPercentage;

pub mod computed_value {
@@ -88,9 +87,8 @@ ${helpers.predefined_type("background-color", "CSSColor",
</%helpers:vector_longhand>

<%helpers:vector_longhand name="background-position" animatable="True">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::specified::position::Position;

@@ -149,9 +147,10 @@ ${helpers.single_keyword("background-origin",
animatable=False)}

<%helpers:vector_longhand name="background-size" animatable="True">
use cssparser::{ToCss, Token};
use cssparser::Token;
use std::ascii::AsciiExt;
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;

pub mod computed_value {
@@ -24,8 +24,8 @@
% for side in ["top", "right", "bottom", "left"]:
<%helpers:longhand name="border-${side}-width" animatable="True">
use app_units::Au;
use cssparser::ToCss;
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::specified::BorderWidth;

@@ -67,9 +67,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",

// https://drafts.csswg.org/css-backgrounds-3/#border-image-source
<%helpers:longhand name="border-image-source" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
use style_traits::ToCss;
use values::NoViewportPercentage;
use values::specified::Image;

@@ -139,10 +138,9 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",

// https://drafts.csswg.org/css-backgrounds-3/#border-image-outset
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::LocalToCss;
use values::specified::LengthOrNumber;

impl HasViewportPercentage for SpecifiedValue {
@@ -253,9 +251,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",

// https://drafts.csswg.org/css-backgrounds-3/#border-image-repeat
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
use style_traits::ToCss;
use values::NoViewportPercentage;

impl NoViewportPercentage for SpecifiedValue {}
@@ -327,9 +324,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",

// https://drafts.csswg.org/css-backgrounds-3/#border-image-width
<%helpers:longhand name="border-image-width" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::specified::{LengthOrPercentage, Number};

@@ -523,9 +519,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",

// https://drafts.csswg.org/css-backgrounds-3/#border-image-slice
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
use style_traits::ToCss;
use values::NoViewportPercentage;
use values::specified::{Number, Percentage};

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