Stylo: Bug 1350175 - Support getting line / column number of CSS rules

Fix font_cache_thread test
This commit is contained in:
Fernando Jiménez Moreno 2017-05-12 13:46:00 +02:00
parent 58253f545b
commit bc156cfe1c
12 changed files with 151 additions and 56 deletions

View file

@ -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};
use cssparser::{self, Parser as CssParser, SourcePosition, SourceLocation};
use html5ever::{Namespace as NsAtom};
use media_queries::CSSErrorReporterTest;
use parking_lot::RwLock;
@ -82,7 +82,11 @@ fn test_parse_stylesheet() {
rules: CssRules::new(vec![
CssRule::Namespace(Arc::new(stylesheet.shared_lock.wrap(NamespaceRule {
prefix: None,
url: NsAtom::from("http://www.w3.org/1999/xhtml")
url: NsAtom::from("http://www.w3.org/1999/xhtml"),
source_location: SourceLocation {
line: 1,
column: 19,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
@ -116,6 +120,10 @@ fn test_parse_stylesheet() {
DeclaredValueOwned::CSSWideKeyword(CSSWideKeyword::Inherit)),
Importance::Important),
]))),
source_location: SourceLocation {
line: 3,
column: 31,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
@ -152,6 +160,10 @@ fn test_parse_stylesheet() {
(PropertyDeclaration::Display(longhands::display::SpecifiedValue::block),
Importance::Normal),
]))),
source_location: SourceLocation {
line: 11,
column: 27,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
selectors: SelectorList(vec![
@ -220,6 +232,10 @@ fn test_parse_stylesheet() {
::get_initial_specified_value()])),
Importance::Normal),
]))),
source_location: SourceLocation {
line: 15,
column: 20,
},
}))),
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
name: KeyframesName::Ident(CustomIdent("foo".into())),