mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
servo: Merge #15546 - fixes quote transform: none serialization (from eddiequan:15209_fix_quotes_serialization_transform_none); r=Wafflespeanut
<!-- Please describe your changes on the following line: --> Adds a unit test to reproduce faulty behaviour, and serializes "none" correctly when provided an empty list. --- <!-- 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 #15209 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 2ea55ae1ad22cadb7e808ce9d538ff25564383f0 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 692b382f0ef9bb0ae130b68a612d528d1fb3cb70
This commit is contained in:
parent
370aca412d
commit
46751c85a2
@ -54,6 +54,10 @@ ${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
if self.0.is_empty() {
|
||||
return dest.write_str("none")
|
||||
}
|
||||
|
||||
let mut first = true;
|
||||
for pair in &self.0 {
|
||||
if !first {
|
||||
|
@ -1114,4 +1114,28 @@ mod shorthand_serialization {
|
||||
assert_eq!(s, "none");
|
||||
}
|
||||
}
|
||||
|
||||
mod quotes {
|
||||
pub use super::*;
|
||||
|
||||
#[test]
|
||||
fn should_serialize_none_correctly() {
|
||||
use cssparser::Parser;
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::longhands::quotes;
|
||||
use style::stylesheets::Origin;
|
||||
|
||||
let mut s = String::new();
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
|
||||
let parsed = quotes::parse(&context, &mut Parser::new("none")).unwrap();
|
||||
let try_serialize = parsed.to_css(&mut s);
|
||||
|
||||
assert_eq!(try_serialize.is_ok(), true);
|
||||
assert_eq!(s, "none");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user