mirror of
https://github.com/servo/servo.git
synced 2025-09-05 04:28:22 +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
|
@ -16,9 +16,15 @@ use test::{self, Bencher};
|
|||
|
||||
struct ErrorringErrorReporter;
|
||||
impl ParseErrorReporter for ErrorringErrorReporter {
|
||||
fn report_error(&self, _input: &mut Parser, position: SourcePosition, message: &str,
|
||||
url: &ServoUrl) {
|
||||
panic!("CSS error: {}\t\n{:?} {}", url.as_str(), position, message);
|
||||
fn report_error(&self,
|
||||
input: &mut Parser,
|
||||
position: SourcePosition,
|
||||
message: &str,
|
||||
url: &ServoUrl,
|
||||
line_number_offset: u64) {
|
||||
let location = input.source_location(position);
|
||||
let line_offset = location.line + line_number_offset as usize;
|
||||
panic!("CSS error: {}\t\n{}:{} {}", url.as_str(), line_offset, location.column, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +57,8 @@ fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> {
|
|||
media,
|
||||
lock,
|
||||
None,
|
||||
&ErrorringErrorReporter);
|
||||
&ErrorringErrorReporter,
|
||||
0u64);
|
||||
let guard = s.shared_lock.read();
|
||||
let rules = s.rules.read_with(&guard);
|
||||
rules.0.iter().filter_map(|rule| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue