mirror of
https://github.com/servo/servo.git
synced 2025-08-29 00:58:20 +01:00
Support line number offsets for inline stylesheets
This commit is contained in:
parent
ea20bd6f63
commit
5d8cbd8e6a
11 changed files with 87 additions and 37 deletions
|
@ -19,8 +19,12 @@ use style_traits::ToCss;
|
|||
pub struct CSSErrorReporterTest;
|
||||
|
||||
impl ParseErrorReporter for CSSErrorReporterTest {
|
||||
fn report_error(&self, _input: &mut Parser, _position: SourcePosition, _message: &str,
|
||||
_url: &ServoUrl) {
|
||||
fn report_error(&self,
|
||||
_input: &mut Parser,
|
||||
_position: SourcePosition,
|
||||
_message: &str,
|
||||
_url: &ServoUrl,
|
||||
_line_number_offset: u64) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +37,7 @@ fn test_media_rule<F>(css: &str, callback: F)
|
|||
let media_list = Arc::new(lock.wrap(MediaList::empty()));
|
||||
let stylesheet = Stylesheet::from_str(
|
||||
css, url, Origin::Author, media_list, lock,
|
||||
None, &CSSErrorReporterTest);
|
||||
None, &CSSErrorReporterTest, 0u64);
|
||||
let mut rule_count = 0;
|
||||
let guard = stylesheet.shared_lock.read();
|
||||
media_queries(&guard, &stylesheet.rules.read_with(&guard).0, &mut |mq| {
|
||||
|
@ -62,7 +66,7 @@ fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
|
|||
let media_list = Arc::new(lock.wrap(MediaList::empty()));
|
||||
let ss = Stylesheet::from_str(
|
||||
css, url, Origin::Author, media_list, lock,
|
||||
None, &CSSErrorReporterTest);
|
||||
None, &CSSErrorReporterTest, 0u64);
|
||||
let mut rule_count = 0;
|
||||
ss.effective_style_rules(device, &ss.shared_lock.read(), |_| rule_count += 1);
|
||||
assert!(rule_count == expected_rule_count, css.to_owned());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue