stylo: make GetRuleColumn report a 1-based value

This commit is contained in:
Fernando Jiménez Moreno 2017-07-24 15:28:02 +02:00
parent a56bd4663b
commit 5cabb0f86b
2 changed files with 7 additions and 6 deletions

View file

@ -516,6 +516,7 @@ fn get_location_with_offset(
) -> SourceLocation { ) -> SourceLocation {
SourceLocation { SourceLocation {
line: location.line + offset as u32, line: location.line + offset as u32,
column: location.column, // Column offsets are not yet supported, but Gecko devtools expect 1-based columns.
column: location.column + 1,
} }
} }

View file

@ -85,7 +85,7 @@ fn test_parse_stylesheet() {
url: NsAtom::from("http://www.w3.org/1999/xhtml"), url: NsAtom::from("http://www.w3.org/1999/xhtml"),
source_location: SourceLocation { source_location: SourceLocation {
line: 1, line: 1,
column: 18, column: 19,
}, },
}))), }))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule { CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
@ -115,7 +115,7 @@ fn test_parse_stylesheet() {
]))), ]))),
source_location: SourceLocation { source_location: SourceLocation {
line: 3, line: 3,
column: 8, column: 9,
}, },
}))), }))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule { CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
@ -142,7 +142,7 @@ fn test_parse_stylesheet() {
]))), ]))),
source_location: SourceLocation { source_location: SourceLocation {
line: 11, line: 11,
column: 8, column: 9,
}, },
}))), }))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule { CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
@ -204,7 +204,7 @@ fn test_parse_stylesheet() {
]))), ]))),
source_location: SourceLocation { source_location: SourceLocation {
line: 15, line: 15,
column: 8, column: 9,
}, },
}))), }))),
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule { CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
@ -236,7 +236,7 @@ fn test_parse_stylesheet() {
vendor_prefix: None, vendor_prefix: None,
source_location: SourceLocation { source_location: SourceLocation {
line: 16, line: 16,
column: 18, column: 19,
}, },
}))) })))