mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Update to cssparser 0.19, count line numbers during tokenization
This commit is contained in:
parent
32f835260c
commit
7382dad939
33 changed files with 145 additions and 196 deletions
|
@ -10,7 +10,7 @@ path = "lib.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
cssparser = "0.18"
|
||||
cssparser = "0.19"
|
||||
gfx = {path = "../../../components/gfx"}
|
||||
ipc-channel = "0.8"
|
||||
style = {path = "../../../components/style"}
|
||||
|
|
|
@ -12,7 +12,7 @@ doctest = false
|
|||
[dependencies]
|
||||
byteorder = "1.0"
|
||||
app_units = "0.5"
|
||||
cssparser = "0.18"
|
||||
cssparser = "0.19"
|
||||
euclid = "0.15"
|
||||
html5ever = "0.18"
|
||||
parking_lot = "0.4"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::{Parser, SourcePosition};
|
||||
use cssparser::SourceLocation;
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::TypedSize2D;
|
||||
use servo_arc::Arc;
|
||||
|
@ -21,12 +21,10 @@ use style_traits::ToCss;
|
|||
pub struct CSSErrorReporterTest;
|
||||
|
||||
impl ParseErrorReporter for CSSErrorReporterTest {
|
||||
fn report_error<'a>(&self,
|
||||
_input: &mut Parser,
|
||||
_position: SourcePosition,
|
||||
_error: ContextualParseError<'a>,
|
||||
_url: &ServoUrl,
|
||||
_line_number_offset: u64) {
|
||||
fn report_error(&self,
|
||||
_url: &ServoUrl,
|
||||
_location: SourceLocation,
|
||||
_error: ContextualParseError) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::{Parser, SourcePosition};
|
||||
use cssparser::SourceLocation;
|
||||
use rayon;
|
||||
use servo_arc::Arc;
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -18,15 +18,11 @@ use test::{self, Bencher};
|
|||
|
||||
struct ErrorringErrorReporter;
|
||||
impl ParseErrorReporter for ErrorringErrorReporter {
|
||||
fn report_error<'a>(&self,
|
||||
input: &mut Parser,
|
||||
position: SourcePosition,
|
||||
error: ContextualParseError<'a>,
|
||||
url: &ServoUrl,
|
||||
line_number_offset: u64) {
|
||||
let location = input.source_location(position);
|
||||
let line_offset = location.line + line_number_offset as u32;
|
||||
panic!("CSS error: {}\t\n{}:{} {}", url.as_str(), line_offset, location.column, error.to_string());
|
||||
fn report_error(&self,
|
||||
url: &ServoUrl,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError) {
|
||||
panic!("CSS error: {}\t\n{}:{} {}", url.as_str(), location.line, location.column, error.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::{self, Parser as CssParser, SourcePosition, SourceLocation};
|
||||
use cssparser::{self, SourceLocation};
|
||||
use html5ever::{Namespace as NsAtom};
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use parking_lot::RwLock;
|
||||
|
@ -270,21 +270,15 @@ impl CSSInvalidErrorReporterTest {
|
|||
}
|
||||
|
||||
impl ParseErrorReporter for CSSInvalidErrorReporterTest {
|
||||
fn report_error<'a>(&self,
|
||||
input: &mut CssParser,
|
||||
position: SourcePosition,
|
||||
error: ContextualParseError<'a>,
|
||||
url: &ServoUrl,
|
||||
line_number_offset: u64) {
|
||||
|
||||
let location = input.source_location(position);
|
||||
let line_offset = location.line + line_number_offset as u32;
|
||||
|
||||
fn report_error(&self,
|
||||
url: &ServoUrl,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError) {
|
||||
let mut errors = self.errors.lock().unwrap();
|
||||
errors.push(
|
||||
CSSError{
|
||||
url: url.clone(),
|
||||
line: line_offset,
|
||||
line: location.line,
|
||||
column: location.column,
|
||||
message: error.to_string()
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ use style::context::QuirksMode;
|
|||
use style::media_queries::{Device, MediaType};
|
||||
use style::properties::{PropertyDeclarationBlock, PropertyDeclaration};
|
||||
use style::properties::{longhands, Importance};
|
||||
use style::rule_tree::CascadeLevel;
|
||||
use style::selector_map::{self, SelectorMap};
|
||||
use style::selector_parser::{SelectorImpl, SelectorParser};
|
||||
use style::shared_lock::SharedRwLock;
|
||||
|
|
|
@ -13,7 +13,7 @@ doctest = false
|
|||
|
||||
[dependencies]
|
||||
atomic_refcell = "0.1"
|
||||
cssparser = "0.18"
|
||||
cssparser = "0.19"
|
||||
env_logger = "0.4"
|
||||
euclid = "0.15"
|
||||
geckoservo = {path = "../../../ports/geckolib"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue