From 5cabb0f86bd71d86c5716f8504b8c46bfa1a7da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 24 Jul 2017 15:28:02 +0200 Subject: [PATCH] stylo: make GetRuleColumn report a 1-based value --- components/style/stylesheets/rule_parser.rs | 3 ++- tests/unit/style/stylesheets.rs | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/style/stylesheets/rule_parser.rs b/components/style/stylesheets/rule_parser.rs index a0923b41232..458372dcd10 100644 --- a/components/style/stylesheets/rule_parser.rs +++ b/components/style/stylesheets/rule_parser.rs @@ -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, } } diff --git a/tests/unit/style/stylesheets.rs b/tests/unit/style/stylesheets.rs index 35c93eb1729..f41686c76ff 100644 --- a/tests/unit/style/stylesheets.rs +++ b/tests/unit/style/stylesheets.rs @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -236,7 +236,7 @@ fn test_parse_stylesheet() { vendor_prefix: None, source_location: SourceLocation { line: 16, - column: 18, + column: 19, }, })))