Remove get_location_with_offset

Now that rust-cssparser reports 1-based locations, bump the required
cssparser version and remove get_location_with_offset.  Previously,
some code paths were not calling get_location_with_offset; see
https://bugzilla.mozilla.org/show_bug.cgi?id=1398869 for some
background.
This commit is contained in:
Tom Tromey 2017-09-11 14:19:04 -06:00
parent 61fac2c10d
commit 4768597b13
15 changed files with 31 additions and 41 deletions

View file

@ -167,7 +167,7 @@ impl<'a, 'i, R: ParseErrorReporter> AtRuleParser<'i> for TopLevelRuleParser<'a,
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>
) -> Result<AtRuleType<AtRuleNonBlockPrelude, AtRuleBlockPrelude>, ParseError<'i>> {
let location = get_location_with_offset(input.current_source_location());
let location = input.current_source_location();
match_ignore_ascii_case! { &*name,
"import" => {
if self.state > State::Imports {
@ -352,7 +352,7 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> AtRuleParser<'i> for NestedRuleParser<'a
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>
) -> Result<AtRuleType<AtRuleNonBlockPrelude, AtRuleBlockPrelude>, ParseError<'i>> {
let location = get_location_with_offset(input.current_source_location());
let location = input.current_source_location();
match_ignore_ascii_case! { &*name,
"media" => {
@ -560,7 +560,7 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> QualifiedRuleParser<'i> for NestedRulePa
url_data: Some(self.context.url_data),
};
let location = get_location_with_offset(input.current_source_location());
let location = input.current_source_location();
let selectors = SelectorList::parse(&selector_parser, input)?;
Ok(QualifiedRuleParserPrelude {
@ -588,12 +588,3 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> QualifiedRuleParser<'i> for NestedRulePa
}))))
}
}
/// Adjust a location's column to accommodate DevTools.
pub fn get_location_with_offset(location: SourceLocation) -> SourceLocation {
SourceLocation {
line: location.line,
// Column offsets are not yet supported, but Gecko devtools expect 1-based columns.
column: location.column + 1,
}
}