Move ParsingMode into style_traits.

This commit is contained in:
Hiroyuki Ikezoe 2017-06-14 09:51:35 +09:00
parent 849bdc958c
commit 8bfed4cb3c
23 changed files with 73 additions and 62 deletions

1
Cargo.lock generated
View file

@ -2972,6 +2972,7 @@ name = "style_traits"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -10,9 +10,10 @@ use dom::bindings::str::DOMString;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::stylesheets::CssRuleType; use style::stylesheets::CssRuleType;
use style::stylesheets::supports_rule::{Declaration, parse_condition_or_declaration}; use style::stylesheets::supports_rule::{Declaration, parse_condition_or_declaration};
use style_traits::PARSING_MODE_DEFAULT;
#[dom_struct] #[dom_struct]
pub struct CSS { pub struct CSS {

View file

@ -16,11 +16,11 @@ use dom::medialist::MediaList;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, MediaRule}; use style::stylesheets::{CssRuleType, MediaRule};
use style_traits::ToCss; use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct] #[dom_struct]
pub struct CSSMediaRule { pub struct CSSMediaRule {

View file

@ -17,13 +17,12 @@ use dom_struct::dom_struct;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use style::attr::AttrValue; use style::attr::AttrValue;
use style::parser::PARSING_MODE_DEFAULT;
use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId}; use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId};
use style::properties::{parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration}; use style::properties::{parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration};
use style::selector_parser::PseudoElement; use style::selector_parser::PseudoElement;
use style::shared_lock::Locked; use style::shared_lock::Locked;
use style::stylearc::Arc; use style::stylearc::Arc;
use style_traits::ToCss; use style_traits::{PARSING_MODE_DEFAULT, ToCss};
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
#[dom_struct] #[dom_struct]

View file

@ -13,12 +13,12 @@ use dom::cssrule::SpecificCSSRule;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window; use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::shared_lock::{Locked, ToCssWithGuard}; use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, SupportsRule}; use style::stylesheets::{CssRuleType, SupportsRule};
use style::stylesheets::supports_rule::SupportsCondition; use style::stylesheets::supports_rule::SupportsCondition;
use style_traits::ToCss; use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct] #[dom_struct]
pub struct CSSSupportsRule { pub struct CSSSupportsRule {

View file

@ -32,10 +32,11 @@ use std::cell::Cell;
use std::default::Default; use std::default::Default;
use style::attr::AttrValue; use style::attr::AttrValue;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext}; use style::parser::ParserContext as CssParserContext;
use style::str::HTML_SPACE_CHARACTERS; use style::str::HTML_SPACE_CHARACTERS;
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet}; use style::stylesheets::{CssRuleType, Stylesheet};
use style_traits::PARSING_MODE_DEFAULT;
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner}; use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};
unsafe_no_jsmanaged_fields!(Stylesheet); unsafe_no_jsmanaged_fields!(Stylesheet);

View file

@ -23,9 +23,10 @@ use net_traits::ReferrerPolicy;
use script_layout_interface::message::Msg; use script_layout_interface::message::Msg;
use std::cell::Cell; use std::cell::Cell;
use style::media_queries::parse_media_query_list; use style::media_queries::parse_media_query_list;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext}; use style::parser::ParserContext as CssParserContext;
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet, Origin}; use style::stylesheets::{CssRuleType, Stylesheet, Origin};
use style_traits::PARSING_MODE_DEFAULT;
use stylesheet_loader::{StylesheetLoader, StylesheetOwner}; use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
#[dom_struct] #[dom_struct]

View file

@ -14,11 +14,11 @@ use dom::window::Window;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use style::media_queries::{MediaQuery, parse_media_query_list}; use style::media_queries::{MediaQuery, parse_media_query_list};
use style::media_queries::MediaList as StyleMediaList; use style::media_queries::MediaList as StyleMediaList;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::shared_lock::{SharedRwLock, Locked}; use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::CssRuleType; use style::stylesheets::CssRuleType;
use style_traits::ToCss; use style_traits::{PARSING_MODE_DEFAULT, ToCss};
#[dom_struct] #[dom_struct]
pub struct MediaList { pub struct MediaList {

View file

@ -107,12 +107,13 @@ use std::sync::mpsc::TryRecvError::{Disconnected, Empty};
use style::context::ReflowGoal; use style::context::ReflowGoal;
use style::error_reporting::ParseErrorReporter; use style::error_reporting::ParseErrorReporter;
use style::media_queries; use style::media_queries;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext as CssParserContext}; use style::parser::ParserContext as CssParserContext;
use style::properties::PropertyId; use style::properties::PropertyId;
use style::properties::longhands::overflow_x; use style::properties::longhands::overflow_x;
use style::selector_parser::PseudoElement; use style::selector_parser::PseudoElement;
use style::str::HTML_SPACE_CHARACTERS; use style::str::HTML_SPACE_CHARACTERS;
use style::stylesheets::CssRuleType; use style::stylesheets::CssRuleType;
use style_traits::PARSING_MODE_DEFAULT;
use task_source::dom_manipulation::DOMManipulationTaskSource; use task_source::dom_manipulation::DOMManipulationTaskSource;
use task_source::file_reading::FileReadingTaskSource; use task_source::file_reading::FileReadingTaskSource;
use task_source::history_traversal::HistoryTraversalTaskSource; use task_source::history_traversal::HistoryTraversalTaskSource;

View file

@ -7,37 +7,11 @@
use context::QuirksMode; use context::QuirksMode;
use cssparser::{Parser, SourcePosition, UnicodeRange}; use cssparser::{Parser, SourcePosition, UnicodeRange};
use error_reporting::{ParseErrorReporter, ContextualParseError}; use error_reporting::{ParseErrorReporter, ContextualParseError};
use style_traits::{OneOrMoreCommaSeparated, ParseError}; use style_traits::{OneOrMoreCommaSeparated, ParseError, ParsingMode};
#[cfg(feature = "gecko")]
use style_traits::{PARSING_MODE_DEFAULT, PARSING_MODE_ALLOW_UNITLESS_LENGTH, PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES};
use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces}; use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces};
bitflags! {
/// The mode to use when parsing values.
pub flags ParsingMode: u8 {
/// In CSS, lengths must have units, except for zero values, where the unit can be omitted.
/// https://www.w3.org/TR/css3-values/#lengths
const PARSING_MODE_DEFAULT = 0x00,
/// In SVG, a coordinate or length value without a unit identifier (e.g., "25") is assumed
/// to be in user units (px).
/// https://www.w3.org/TR/SVG/coords.html#Units
const PARSING_MODE_ALLOW_UNITLESS_LENGTH = 0x01,
/// In SVG, out-of-range values are not treated as an error in parsing.
/// https://www.w3.org/TR/SVG/implnote.html#RangeClamping
const PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES = 0x02,
}
}
impl ParsingMode {
/// Whether the parsing mode allows unitless lengths for non-zero values to be intpreted as px.
pub fn allows_unitless_lengths(&self) -> bool {
self.intersects(PARSING_MODE_ALLOW_UNITLESS_LENGTH)
}
/// Whether the parsing mode allows all numeric values.
pub fn allows_all_numeric_values(&self) -> bool {
self.intersects(PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES)
}
}
/// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko. /// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
#[inline] #[inline]

View file

@ -10,13 +10,13 @@ use context::QuirksMode;
use cssparser::{DeclarationListParser, parse_important, ParserInput}; use cssparser::{DeclarationListParser, parse_important, ParserInput};
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter}; use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter};
use error_reporting::{ParseErrorReporter, ContextualParseError}; use error_reporting::{ParseErrorReporter, ContextualParseError};
use parser::{PARSING_MODE_DEFAULT, ParsingMode, ParserContext, log_css_error}; use parser::{ParserContext, log_css_error};
use properties::animated_properties::AnimationValue; use properties::animated_properties::AnimationValue;
use selectors::parser::SelectorParseError; use selectors::parser::SelectorParseError;
use shared_lock::Locked; use shared_lock::Locked;
use std::fmt; use std::fmt;
use std::slice::Iter; use std::slice::Iter;
use style_traits::{ToCss, ParseError, StyleParseError}; use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, ParsingMode, StyleParseError};
use stylesheets::{CssRuleType, Origin, UrlExtraData}; use stylesheets::{CssRuleType, Origin, UrlExtraData};
use stylesheets::{MallocSizeOf, MallocSizeOfFn}; use stylesheets::{MallocSizeOf, MallocSizeOfFn};
use super::*; use super::*;

View file

@ -31,13 +31,13 @@ use font_metrics::FontMetricsProvider;
#[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide}; #[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide};
use logical_geometry::WritingMode; use logical_geometry::WritingMode;
use media_queries::Device; use media_queries::Device;
use parser::{PARSING_MODE_DEFAULT, Parse, ParserContext}; use parser::{Parse, ParserContext};
use properties::animated_properties::TransitionProperty; use properties::animated_properties::TransitionProperty;
#[cfg(feature = "gecko")] use properties::longhands::system_font::SystemFont; #[cfg(feature = "gecko")] use properties::longhands::system_font::SystemFont;
use selectors::parser::SelectorParseError; use selectors::parser::SelectorParseError;
#[cfg(feature = "servo")] use servo_config::prefs::PREFS; #[cfg(feature = "servo")] use servo_config::prefs::PREFS;
use shared_lock::StylesheetGuards; use shared_lock::StylesheetGuards;
use style_traits::{HasViewportPercentage, ToCss, ParseError, PropertyDeclarationParseError}; use style_traits::{PARSING_MODE_DEFAULT, HasViewportPercentage, ToCss, ParseError, PropertyDeclarationParseError};
use stylesheets::{CssRuleType, MallocSizeOf, MallocSizeOfFn, Origin, UrlExtraData}; use stylesheets::{CssRuleType, MallocSizeOf, MallocSizeOfFn, Origin, UrlExtraData};
#[cfg(feature = "servo")] use values::Either; #[cfg(feature = "servo")] use values::Either;
use values::generics::text::LineHeight; use values::generics::text::LineHeight;

View file

@ -7,7 +7,7 @@
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, RuleListParser, ParserInput}; use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, RuleListParser, ParserInput};
use cssparser::{DeclarationListParser, DeclarationParser, parse_one_rule, SourceLocation}; use cssparser::{DeclarationListParser, DeclarationParser, parse_one_rule, SourceLocation};
use error_reporting::{NullReporter, ContextualParseError}; use error_reporting::{NullReporter, ContextualParseError};
use parser::{PARSING_MODE_DEFAULT, ParserContext, log_css_error}; use parser::{ParserContext, log_css_error};
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId}; use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
use properties::{PropertyDeclarationId, LonghandId, SourcePropertyDeclaration}; use properties::{PropertyDeclarationId, LonghandId, SourcePropertyDeclaration};
use properties::LonghandIdSet; use properties::LonghandIdSet;
@ -17,7 +17,7 @@ use selectors::parser::SelectorParseError;
use shared_lock::{DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard, Locked, ToCssWithGuard}; use shared_lock::{DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard, Locked, ToCssWithGuard};
use std::borrow::Cow; use std::borrow::Cow;
use std::fmt; use std::fmt;
use style_traits::{ToCss, ParseError, StyleParseError}; use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, StyleParseError};
use stylearc::Arc; use stylearc::Arc;
use stylesheets::{CssRuleType, Stylesheet}; use stylesheets::{CssRuleType, Stylesheet};
use stylesheets::rule_parser::VendorPrefix; use stylesheets::rule_parser::VendorPrefix;

View file

@ -24,9 +24,10 @@ pub mod viewport_rule;
use cssparser::{parse_one_rule, Parser, ParserInput}; use cssparser::{parse_one_rule, Parser, ParserInput};
use error_reporting::NullReporter; use error_reporting::NullReporter;
use parser::{ParserContext, PARSING_MODE_DEFAULT}; use parser::ParserContext;
use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard}; use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt; use std::fmt;
use style_traits::PARSING_MODE_DEFAULT;
use stylearc::Arc; use stylearc::Arc;
pub use self::counter_style_rule::CounterStyleRule; pub use self::counter_style_rule::CounterStyleRule;

View file

@ -9,10 +9,11 @@ use error_reporting::{ParseErrorReporter, ContextualParseError};
use fnv::FnvHashMap; use fnv::FnvHashMap;
use media_queries::{MediaList, Device}; use media_queries::{MediaList, Device};
use parking_lot::RwLock; use parking_lot::RwLock;
use parser::{PARSING_MODE_DEFAULT, ParserContext, log_css_error}; use parser::{ParserContext, log_css_error};
use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard}; use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard};
use std::mem; use std::mem;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use style_traits::PARSING_MODE_DEFAULT;
use stylearc::Arc; use stylearc::Arc;
use stylesheets::{CssRule, CssRules, Origin, UrlExtraData}; use stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
use stylesheets::loader::StylesheetLoader; use stylesheets::loader::StylesheetLoader;

View file

@ -16,6 +16,7 @@ gecko = []
[dependencies] [dependencies]
app_units = "0.4.1" app_units = "0.4.1"
bitflags = "0.7"
cssparser = "0.14.0" cssparser = "0.14.0"
euclid = "0.13" euclid = "0.13"
heapsize = {version = "0.4", optional = true} heapsize = {version = "0.4", optional = true}

View file

@ -14,6 +14,7 @@
#![cfg_attr(feature = "servo", feature(plugin))] #![cfg_attr(feature = "servo", feature(plugin))]
extern crate app_units; extern crate app_units;
#[macro_use] extern crate bitflags;
#[macro_use] extern crate cssparser; #[macro_use] extern crate cssparser;
extern crate euclid; extern crate euclid;
#[cfg(feature = "servo")] extern crate heapsize; #[cfg(feature = "servo")] extern crate heapsize;
@ -140,3 +141,32 @@ impl<'a> From<PropertyDeclarationParseError> for ParseError<'a> {
cssparser::ParseError::Custom(SelectorParseError::Custom(StyleParseError::PropertyDeclaration(this))) cssparser::ParseError::Custom(SelectorParseError::Custom(StyleParseError::PropertyDeclaration(this)))
} }
} }
bitflags! {
/// The mode to use when parsing values.
pub flags ParsingMode: u8 {
/// In CSS, lengths must have units, except for zero values, where the unit can be omitted.
/// https://www.w3.org/TR/css3-values/#lengths
const PARSING_MODE_DEFAULT = 0x00,
/// In SVG, a coordinate or length value without a unit identifier (e.g., "25") is assumed
/// to be in user units (px).
/// https://www.w3.org/TR/SVG/coords.html#Units
const PARSING_MODE_ALLOW_UNITLESS_LENGTH = 0x01,
/// In SVG, out-of-range values are not treated as an error in parsing.
/// https://www.w3.org/TR/SVG/implnote.html#RangeClamping
const PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES = 0x02,
}
}
impl ParsingMode {
/// Whether the parsing mode allows unitless lengths for non-zero values to be intpreted as px.
pub fn allows_unitless_lengths(&self) -> bool {
self.intersects(PARSING_MODE_ALLOW_UNITLESS_LENGTH)
}
/// Whether the parsing mode allows all numeric values.
pub fn allows_all_numeric_values(&self) -> bool {
self.intersects(PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES)
}
}

View file

@ -91,7 +91,7 @@ use style::gecko_properties::{self, style_structs};
use style::invalidation::element::restyle_hints::{self, RestyleHint}; use style::invalidation::element::restyle_hints::{self, RestyleHint};
use style::media_queries::{MediaList, parse_media_query_list}; use style::media_queries::{MediaList, parse_media_query_list};
use style::parallel; use style::parallel;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::properties::{CascadeFlags, ComputedValues, Importance, SourcePropertyDeclaration}; use style::properties::{CascadeFlags, ComputedValues, Importance, SourcePropertyDeclaration};
use style::properties::{LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, PropertyId, StyleBuilder}; use style::properties::{LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, PropertyId, StyleBuilder};
use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP; use style::properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
@ -118,7 +118,7 @@ use style::traversal::{FOR_DEFAULT_STYLES, TraversalDriver, TraversalFlags, UNST
use style::traversal::{resolve_style, resolve_default_style}; use style::traversal::{resolve_style, resolve_default_style};
use style::values::{CustomIdent, KeyframesName}; use style::values::{CustomIdent, KeyframesName};
use style::values::computed::Context; use style::values::computed::Context;
use style_traits::ToCss; use style_traits::{PARSING_MODE_DEFAULT, ToCss};
use super::stylesheet_loader::StylesheetLoader; use super::stylesheet_loader::StylesheetLoader;
/* /*
@ -1594,7 +1594,7 @@ fn parse_property_into(declarations: &mut SourcePropertyDeclaration,
data: *mut URLExtraData, data: *mut URLExtraData,
parsing_mode: structs::ParsingMode, parsing_mode: structs::ParsingMode,
quirks_mode: QuirksMode) -> Result<(), ()> { quirks_mode: QuirksMode) -> Result<(), ()> {
use style::parser::ParsingMode; use style_traits::ParsingMode;
let value = unsafe { value.as_ref().unwrap().as_str_unchecked() }; let value = unsafe { value.as_ref().unwrap().as_str_unchecked() };
let url_data = unsafe { RefPtr::from_ptr_ref(&data) }; let url_data = unsafe { RefPtr::from_ptr_ref(&data) };
let parsing_mode = ParsingMode::from_bits_truncate(parsing_mode); let parsing_mode = ParsingMode::from_bits_truncate(parsing_mode);

View file

@ -6,12 +6,12 @@ use cssparser::{Parser, ParserInput};
use media_queries::CSSErrorReporterTest; use media_queries::CSSErrorReporterTest;
use parsing::parse; use parsing::parse;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::parser::{PARSING_MODE_ALLOW_UNITLESS_LENGTH, Parse, ParserContext}; use style::parser::{Parse, ParserContext};
use style::stylesheets::{CssRuleType, Origin}; use style::stylesheets::{CssRuleType, Origin};
use style::values::Either; use style::values::Either;
use style::values::specified::{LengthOrPercentageOrNumber, Number}; use style::values::specified::{LengthOrPercentageOrNumber, Number};
use style::values::specified::length::{AbsoluteLength, Length, NoCalcLength}; use style::values::specified::length::{AbsoluteLength, Length, NoCalcLength};
use style_traits::ToCss; use style_traits::{PARSING_MODE_ALLOW_UNITLESS_LENGTH, ToCss};
#[test] #[test]
fn test_calc() { fn test_calc() {

View file

@ -10,11 +10,11 @@ use media_queries::CSSErrorReporterTest;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::font_metrics::ServoMetricsProvider; use style::font_metrics::ServoMetricsProvider;
use style::media_queries::{Device, MediaType}; use style::media_queries::{Device, MediaType};
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::properties::{ComputedValues, StyleBuilder}; use style::properties::{ComputedValues, StyleBuilder};
use style::stylesheets::{CssRuleType, Origin}; use style::stylesheets::{CssRuleType, Origin};
use style::values::computed::{Context, ToComputedValue}; use style::values::computed::{Context, ToComputedValue};
use style_traits::{ToCss, ParseError}; use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError};
fn parse<T, F>(f: F, s: &'static str) -> Result<T, ParseError<'static>> fn parse<T, F>(f: F, s: &'static str) -> Result<T, ParseError<'static>>
where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>> { where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>> {

View file

@ -6,10 +6,10 @@ use app_units::Au;
use cssparser::{Parser, ParserInput}; use cssparser::{Parser, ParserInput};
use media_queries::CSSErrorReporterTest; use media_queries::CSSErrorReporterTest;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::parser::{PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES, ParserContext}; use style::parser::ParserContext;
use style::stylesheets::{CssRuleType, Origin}; use style::stylesheets::{CssRuleType, Origin};
use style::values::specified::{AbsoluteLength, NoCalcLength, Number, ViewportPercentageLength}; use style::values::specified::{AbsoluteLength, NoCalcLength, Number, ViewportPercentageLength};
use style_traits::HasViewportPercentage; use style_traits::{PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES, HasViewportPercentage};
#[test] #[test]
fn length_has_viewport_percentage() { fn length_has_viewport_percentage() {

View file

@ -5,9 +5,9 @@
use cssparser::{Parser, ParserInput}; use cssparser::{Parser, ParserInput};
use media_queries::CSSErrorReporterTest; use media_queries::CSSErrorReporterTest;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::parser::{PARSING_MODE_DEFAULT, ParserContext}; use style::parser::ParserContext;
use style::stylesheets::{CssRuleType, Origin}; use style::stylesheets::{CssRuleType, Origin};
use style_traits::ParseError; use style_traits::{PARSING_MODE_DEFAULT, ParseError};
fn parse<T, F>(f: F, s: &'static str) -> Result<T, ParseError<'static>> fn parse<T, F>(f: F, s: &'static str) -> Result<T, ParseError<'static>>
where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>> { where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>> {

View file

@ -9,7 +9,7 @@ use servo_config::prefs::{PREFS, PrefValue};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use style::context::QuirksMode; use style::context::QuirksMode;
use style::media_queries::{Device, MediaList, MediaType}; use style::media_queries::{Device, MediaList, MediaType};
use style::parser::{PARSING_MODE_DEFAULT, Parse, ParserContext}; use style::parser::{Parse, ParserContext};
use style::shared_lock::SharedRwLock; use style::shared_lock::SharedRwLock;
use style::stylearc::Arc; use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet, Origin}; use style::stylesheets::{CssRuleType, Stylesheet, Origin};
@ -17,7 +17,7 @@ use style::stylesheets::viewport_rule::*;
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto}; use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
use style::values::specified::NoCalcLength::{self, ViewportPercentage}; use style::values::specified::NoCalcLength::{self, ViewportPercentage};
use style::values::specified::ViewportPercentageLength::Vw; use style::values::specified::ViewportPercentageLength::Vw;
use style_traits::PinchZoomFactor; use style_traits::{PARSING_MODE_DEFAULT, PinchZoomFactor};
use style_traits::viewport::*; use style_traits::viewport::*;
macro_rules! stylesheet { macro_rules! stylesheet {