Skip to content

Commit b351bbf

Browse files
author
bors-servo
authored
Auto merge of #162 - canaltinova:currentcolor, r=Manishearth
Serialize currentcolor as canonicalized form Serialize currentcolor as canonicalized form instead of currentColor. This is needed for servo/servo#15397 I'm not sure about version bump though. Is that a breaking change? <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/162) <!-- Reviewable:end -->
2 parents 631bc49 + acbef22 commit b351bbf

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "cssparser"
4-
version = "0.16.0"
4+
version = "0.17.0"
55
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
66

77
description = "Rust implementation of CSS Syntax Level 3"

src/color.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl ToCss for RGBA {
118118
/// A <color> value.
119119
#[derive(Clone, Copy, PartialEq, Debug)]
120120
pub enum Color {
121-
/// The 'currentColor' keyword
121+
/// The 'currentcolor' keyword
122122
CurrentColor,
123123
/// Everything else gets converted to RGBA during parsing
124124
RGBA(RGBA),
@@ -130,7 +130,7 @@ known_heap_size!(0, Color);
130130
impl ToCss for Color {
131131
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
132132
match *self {
133-
Color::CurrentColor => dest.write_str("currentColor"),
133+
Color::CurrentColor => dest.write_str("currentcolor"),
134134
Color::RGBA(ref rgba) => rgba.to_css(dest),
135135
}
136136
}

src/css-parsing-tests/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ associated with the expected result.
116116
the output as one of:
117117

118118
* null if the input is not a valid color in CSS syntax
119-
* The string "currentColor" for the currentColor keyword
119+
* The string "currentcolor" for the currentcolor keyword
120120
* An array of length 4 for every other values:
121121
four (floating point) numbers for the Red, Green, Blue and Alpha channel.
122122
Each value is between 0 and 1.

src/css-parsing-tests/color3.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"transparent", [0, 0, 0, 0],
88
" transparent\n", [0, 0, 0, 0],
99
"TransParent", [0, 0, 0, 0],
10-
"currentColor", "currentColor",
11-
"CURRENTcolor", "currentColor",
10+
"currentcolor", "currentcolor",
11+
"currentColor", "currentcolor",
12+
"CURRENTcolor", "currentcolor",
1213
"current-Color", null,
1314

1415
"black", [0, 0, 0, 255],

src/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn serializer(preserve_comments: bool) {
426426
#[test]
427427
fn serialize_current_color() {
428428
let c = Color::CurrentColor;
429-
assert!(c.to_css_string() == "currentColor");
429+
assert!(c.to_css_string() == "currentcolor");
430430
}
431431

432432
#[test]
@@ -622,7 +622,7 @@ impl ToJson for Color {
622622
Color::RGBA(ref rgba) => {
623623
[rgba.red, rgba.green, rgba.blue, rgba.alpha].to_json()
624624
},
625-
Color::CurrentColor => "currentColor".to_json(),
625+
Color::CurrentColor => "currentcolor".to_json(),
626626
}
627627
}
628628
}

0 commit comments

Comments
 (0)