зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #16136 - to_css of counter-increment returns none when there are no properties (from streichgeorg:counter); r=emilio
<!-- Please describe your changes on the following line: --> Changed to_css in style::properties::longhands::counter_increment returns "none" if there are no properties defined. --- <!-- 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 #15977 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- 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: f4371dfa0231282ef4dfa47bdfc6d31fa5ce1a0d --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : c09d2af0d5eabc68a48798e40d08bf2a03425ba3
This commit is contained in:
Родитель
ec4e11d887
Коммит
926cc5294b
|
@ -269,6 +269,10 @@
|
|||
|
||||
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 {
|
||||
|
@ -278,6 +282,7 @@
|
|||
try!(serialize_identifier(&pair.0, dest));
|
||||
try!(write!(dest, " {}", pair.1));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1170,4 +1170,30 @@ mod shorthand_serialization {
|
|||
assert_eq!(shadow.to_css_string(), shadow_css);
|
||||
}
|
||||
}
|
||||
|
||||
mod counter_increment {
|
||||
pub use super::*;
|
||||
pub use style::properties::longhands::counter_increment::SpecifiedValue as CounterIncrement;
|
||||
|
||||
#[test]
|
||||
fn counter_increment_with_properties_should_serialize_correctly() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
properties.push(("counter1".to_owned(), 1));
|
||||
properties.push(("counter2".to_owned(), -4));
|
||||
|
||||
let counter_increment = CounterIncrement(properties);
|
||||
let counter_increment_css = "counter1 1 counter2 -4";
|
||||
|
||||
assert_eq!(counter_increment.to_css_string(), counter_increment_css);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn counter_increment_without_properties_should_serialize_correctly() {
|
||||
let counter_increment = CounterIncrement(Vec::new());
|
||||
let counter_increment_css = "none";
|
||||
|
||||
assert_eq!(counter_increment.to_css_string(), counter_increment_css);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче