Use cssparser's new_with_line_number_offset

cssparser provides a way to set the initial line number on a
ParserInput.  This patch changes servo to use this facility, rather than
reimplement the same functionality itself.
This commit is contained in:
Tom Tromey 2017-08-24 07:37:02 -06:00
parent a266e96d28
commit 546ecaeee9
11 changed files with 26 additions and 60 deletions

View file

@ -70,7 +70,7 @@ fn test_parse_stylesheet() {
let lock = SharedRwLock::new();
let media = Arc::new(lock.wrap(MediaList::empty()));
let stylesheet = Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock,
None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0u64);
None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0);
let mut namespaces = Namespaces::default();
namespaces.default = Some((ns!(html), ()));
let expected = Stylesheet {
@ -304,7 +304,7 @@ fn test_report_error_stylesheet() {
let lock = SharedRwLock::new();
let media = Arc::new(lock.wrap(MediaList::empty()));
Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock,
None, &error_reporter, QuirksMode::NoQuirks, 5u64);
None, &error_reporter, QuirksMode::NoQuirks, 5);
let mut errors = errors.lock().unwrap();
@ -341,7 +341,7 @@ fn test_no_report_unrecognized_vendor_properties() {
let lock = SharedRwLock::new();
let media = Arc::new(lock.wrap(MediaList::empty()));
Stylesheet::from_str(css, url, Origin::UserAgent, media, lock,
None, &error_reporter, QuirksMode::NoQuirks, 0u64);
None, &error_reporter, QuirksMode::NoQuirks, 0);
let mut errors = errors.lock().unwrap();
let error = errors.pop().unwrap();
@ -364,7 +364,7 @@ fn test_source_map_url() {
let media = Arc::new(lock.wrap(MediaList::empty()));
let stylesheet = Stylesheet::from_str(test.0, url.clone(), Origin::UserAgent, media, lock,
None, &CSSErrorReporterTest, QuirksMode::NoQuirks,
0u64);
0);
let url_opt = stylesheet.contents.source_map_url.read();
assert_eq!(*url_opt, test.1);
}