mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
Remove the url! plugin.
In rust-url 1.0 the `Url` struct is going to have private fields, and there is no way to to create an aribitrary one without going through the parser. The plugin never had a clear demonstrated performance benefit, it was made mostly because it was possible and relatively easy at the time.
This commit is contained in:
parent
87d5424d4d
commit
6889f37d9e
27 changed files with 84 additions and 296 deletions
|
@ -11,6 +11,7 @@ use style::media_queries::*;
|
|||
use style::servo::Stylesheet;
|
||||
use style::stylesheets::{Origin, CSSRuleIteratorExt};
|
||||
use style::values::specified;
|
||||
use url::Url;
|
||||
|
||||
pub struct CSSErrorReporterTest;
|
||||
|
||||
|
@ -23,7 +24,7 @@ impl ParseErrorReporter for CSSErrorReporterTest {
|
|||
}
|
||||
|
||||
fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) {
|
||||
let url = url!("http://localhost");
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
|
||||
let mut rule_count = 0;
|
||||
for rule in stylesheet.rules().media() {
|
||||
|
@ -34,7 +35,7 @@ fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str)
|
|||
}
|
||||
|
||||
fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
|
||||
let url = url!("http://localhost");
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let ss = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
|
||||
let rule_count = ss.effective_rules(device).style().count();
|
||||
assert!(rule_count == expected_rule_count, css.to_owned());
|
||||
|
|
|
@ -13,6 +13,7 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, DeclaredV
|
|||
use style::stylesheets::{CSSRule, StyleRule, Origin};
|
||||
use style::error_reporting::ParseErrorReporter;
|
||||
use style::servo::Stylesheet;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
fn test_parse_stylesheet() {
|
||||
|
@ -23,7 +24,7 @@ fn test_parse_stylesheet() {
|
|||
html , body /**/ { display: block; }
|
||||
#d1 > .ok { background: blue; }
|
||||
";
|
||||
let url = url!("about::test");
|
||||
let url = Url::parse("about::test").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent,
|
||||
Box::new(CSSErrorReporterTest));
|
||||
assert_eq!(stylesheet, Stylesheet {
|
||||
|
@ -198,7 +199,7 @@ fn test_report_error_stylesheet() {
|
|||
invalid: true;
|
||||
}
|
||||
";
|
||||
let url = url!("about::test");
|
||||
let url = Url::parse("about::test").unwrap();
|
||||
let error_reporter = Box::new(CSSInvalidErrorReporterTest::new());
|
||||
|
||||
let errors = error_reporter.errors.clone();
|
||||
|
|
|
@ -16,10 +16,11 @@ use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
|||
use style::values::specified::ViewportPercentageLength::Vw;
|
||||
use style::viewport::*;
|
||||
use style_traits::viewport::*;
|
||||
use url::Url;
|
||||
|
||||
macro_rules! stylesheet {
|
||||
($css:expr, $origin:ident, $error_reporter:expr) => {
|
||||
Stylesheet::from_str($css, url!("http://localhost"), Origin::$origin, $error_reporter);
|
||||
Stylesheet::from_str($css, Url::parse("http://localhost").unwrap(), Origin::$origin, $error_reporter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +280,7 @@ fn multiple_stylesheets_cascading() {
|
|||
|
||||
#[test]
|
||||
fn constrain_viewport() {
|
||||
let url = url!("http://localhost");
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
|
||||
macro_rules! from_css {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue