servo: Merge #18449 - Remove get_location_with_offset (from tromey:remove-get_location_with_offset); r=jdm

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.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1398869 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests are in rust-cssparser and/or M-C

Source-Repo: https://github.com/servo/servo
Source-Revision: 7746896bc4cf5a2a6dc78c00f643e4cff8e49da4

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 919aeee03abfd07cd5dbcc9d478dd98cc76f054e
This commit is contained in:
Tom Tromey 2017-09-12 09:44:53 -05:00
parent f41a14797a
commit eb5a0d0bde
15 changed files with 31 additions and 41 deletions

26
servo/Cargo.lock generated
View File

@ -327,7 +327,7 @@ dependencies = [
"azure 0.21.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"compositing 0.0.1",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -343,7 +343,7 @@ dependencies = [
name = "canvas_traits"
version = "0.0.1"
dependencies = [
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -591,7 +591,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.20.2"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1077,7 +1077,7 @@ name = "geckoservo"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1146,7 +1146,7 @@ dependencies = [
name = "gfx_tests"
version = "0.0.1"
dependencies = [
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1",
@ -2566,7 +2566,7 @@ dependencies = [
"caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deny_public_fields 0.0.1",
"devtools_traits 0.0.1",
"dom_struct 0.0.1",
@ -2638,7 +2638,7 @@ dependencies = [
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2710,7 +2710,7 @@ name = "selectors"
version = "0.19.0"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
@ -3115,7 +3115,7 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fallible 0.0.1",
@ -3176,7 +3176,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3198,7 +3198,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3213,7 +3213,7 @@ name = "stylo_tests"
version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
@ -3803,7 +3803,7 @@ dependencies = [
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f841e9637adec70838c537cae52cb4c751cc6514ad05669b51d107c2021c79"
"checksum core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ce16d9ed00181016c11ff48e561314bec92bfbce9fe48f319366618d4e5de6"
"checksum cssparser 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)" = "71773af1c6bbbafa27cba64f310b95fea1f87cd82d5a8cd827bd96b4559e5c48"
"checksum cssparser 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e88f0308699ff4e42b2ae57f170673f180a5b41f59364c95ae5c0c8022dbcbd1"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"

View File

@ -13,7 +13,7 @@ path = "lib.rs"
azure = {git = "https://github.com/servo/rust-azure"}
canvas_traits = {path = "../canvas_traits"}
compositing = {path = "../compositing"}
cssparser = "0.20.2"
cssparser = "0.21.0"
euclid = "0.15"
fnv = "1.0"
gleam = "0.4"

View File

@ -10,7 +10,7 @@ name = "canvas_traits"
path = "lib.rs"
[dependencies]
cssparser = "0.20.2"
cssparser = "0.21.0"
euclid = "0.15"
heapsize = "0.4"
heapsize_derive = "0.1"

View File

@ -33,7 +33,7 @@ byteorder = "1.0"
canvas_traits = {path = "../canvas_traits"}
caseless = "0.1.0"
cookie = "0.6"
cssparser = "0.20.2"
cssparser = "0.21.0"
deny_public_fields = {path = "../deny_public_fields"}
devtools_traits = {path = "../devtools_traits"}
dom_struct = {path = "../dom_struct"}

View File

@ -13,7 +13,7 @@ path = "lib.rs"
app_units = "0.5"
atomic_refcell = "0.1"
canvas_traits = {path = "../canvas_traits"}
cssparser = "0.20.2"
cssparser = "0.21.0"
euclid = "0.15"
gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4"

View File

@ -25,7 +25,7 @@ unstable = []
[dependencies]
bitflags = "0.7"
matches = "0.1"
cssparser = "0.20.2"
cssparser = "0.21.0"
log = "0.3"
fnv = "1.0"
malloc_size_of = { path = "../malloc_size_of" }

View File

@ -37,7 +37,7 @@ atomic_refcell = "0.1"
bitflags = "0.7"
byteorder = "1.0"
cfg-if = "0.1.0"
cssparser = "0.20.2"
cssparser = "0.21.0"
encoding = {version = "0.2", optional = true}
euclid = "0.15"
fallible = { path = "../fallible" }

View File

@ -20,7 +20,7 @@ use std::fmt;
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, StyleParseError};
use style_traits::PropertyDeclarationParseError;
use stylesheets::{CssRuleType, StylesheetContents};
use stylesheets::rule_parser::{VendorPrefix, get_location_with_offset};
use stylesheets::rule_parser::VendorPrefix;
use values::{KeyframesName, serialize_percentage};
/// A [`@keyframes`][keyframes] rule.
@ -507,12 +507,11 @@ impl<'a, 'i, R: ParseErrorReporter> QualifiedRuleParser<'i> for KeyframeListPars
fn parse_prelude<'t>(&mut self, input: &mut Parser<'i, 't>) -> Result<Self::Prelude, ParseError<'i>> {
let start_position = input.position();
let start_location = input.current_source_location();
let location = get_location_with_offset(start_location);
match KeyframeSelector::parse(input) {
Ok(sel) => {
Ok(KeyframeSelectorParserPrelude {
selector: sel,
source_location: location,
source_location: start_location,
})
},
Err(e) => {

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,
}
}

View File

@ -16,7 +16,7 @@ gecko = []
[dependencies]
app_units = "0.5"
bitflags = "0.7"
cssparser = "0.20.2"
cssparser = "0.21.0"
euclid = "0.15"
heapsize = {version = "0.4", optional = true}
heapsize_derive = {version = "0.1", optional = true}

View File

@ -15,7 +15,7 @@ gecko_debug = ["style/gecko_debug"]
[dependencies]
atomic_refcell = "0.1"
cssparser = "0.20.2"
cssparser = "0.21.0"
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]}

View File

@ -10,7 +10,7 @@ path = "lib.rs"
doctest = false
[dependencies]
cssparser = "0.20.2"
cssparser = "0.21.0"
gfx = {path = "../../../components/gfx"}
ipc-channel = "0.8"
style = {path = "../../../components/style"}

View File

@ -12,7 +12,7 @@ doctest = false
[dependencies]
byteorder = "1.0"
app_units = "0.5"
cssparser = "0.20.2"
cssparser = "0.21.0"
euclid = "0.15"
html5ever = "0.19"
parking_lot = "0.4"

View File

@ -320,13 +320,13 @@ fn test_report_error_stylesheet() {
assert_eq!("Unsupported property declaration: 'invalid: true;', \
Custom(PropertyDeclaration(UnknownProperty(\"invalid\")))", error.message);
assert_eq!(9, error.line);
assert_eq!(8, error.column);
assert_eq!(9, error.column);
let error = errors.pop().unwrap();
assert_eq!("Unsupported property declaration: 'display: invalid;', \
Custom(PropertyDeclaration(InvalidValue(\"display\", None)))", error.message);
assert_eq!(8, error.line);
assert_eq!(8, error.column);
assert_eq!(9, error.column);
// testing for the url
assert_eq!(url, error.url);

View File

@ -13,7 +13,7 @@ doctest = false
[dependencies]
atomic_refcell = "0.1"
cssparser = "0.20.2"
cssparser = "0.21.0"
env_logger = "0.4"
euclid = "0.15"
geckoservo = {path = "../../../ports/geckolib"}