Skip to content

Commit

Permalink
stylo: make GetRuleColumn report a 1-based value
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Jul 24, 2017
1 parent a56bd46 commit 5cabb0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion components/style/stylesheets/rule_parser.rs
Expand Up @@ -516,6 +516,7 @@ fn get_location_with_offset(
) -> SourceLocation {
SourceLocation {
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,
}
}
10 changes: 5 additions & 5 deletions tests/unit/style/stylesheets.rs
Expand Up @@ -85,7 +85,7 @@ fn test_parse_stylesheet() {
url: NsAtom::from("http://www.w3.org/1999/xhtml"),
source_location: SourceLocation {
line: 1,
column: 18,
column: 19,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
Expand Down Expand Up @@ -115,7 +115,7 @@ fn test_parse_stylesheet() {
]))),
source_location: SourceLocation {
line: 3,
column: 8,
column: 9,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
Expand All @@ -142,7 +142,7 @@ fn test_parse_stylesheet() {
]))),
source_location: SourceLocation {
line: 11,
column: 8,
column: 9,
},
}))),
CssRule::Style(Arc::new(stylesheet.shared_lock.wrap(StyleRule {
Expand Down Expand Up @@ -204,7 +204,7 @@ fn test_parse_stylesheet() {
]))),
source_location: SourceLocation {
line: 15,
column: 8,
column: 9,
},
}))),
CssRule::Keyframes(Arc::new(stylesheet.shared_lock.wrap(KeyframesRule {
Expand Down Expand Up @@ -236,7 +236,7 @@ fn test_parse_stylesheet() {
vendor_prefix: None,
source_location: SourceLocation {
line: 16,
column: 18,
column: 19,
},
})))

Expand Down

0 comments on commit 5cabb0f

Please sign in to comment.