mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #15226 - dashed:gh-15208, r=emilio
Fix text-overflow serialization. Fixes https://github.com/servo/servo/issues/15208 - [x] **More tests pending PR review.** - [x] **Correct placement of unit test** <!-- Please describe your changes on the following line: --> --- <!-- 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 #15208 (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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15226) <!-- Reviewable:end -->
This commit is contained in:
commit
d77465b166
3 changed files with 29 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use values::NoViewportPercentage;
|
use values::NoViewportPercentage;
|
||||||
use values::computed::ComputedValueAsSpecified;
|
use values::computed::ComputedValueAsSpecified;
|
||||||
|
use cssparser;
|
||||||
|
|
||||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||||
impl NoViewportPercentage for SpecifiedValue {}
|
impl NoViewportPercentage for SpecifiedValue {}
|
||||||
|
@ -75,7 +76,9 @@
|
||||||
match *self {
|
match *self {
|
||||||
Side::Clip => dest.write_str("clip"),
|
Side::Clip => dest.write_str("clip"),
|
||||||
Side::Ellipsis => dest.write_str("ellipsis"),
|
Side::Ellipsis => dest.write_str("ellipsis"),
|
||||||
Side::String(ref s) => dest.write_str(s)
|
Side::String(ref s) => {
|
||||||
|
cssparser::serialize_string(s, dest)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,3 +78,4 @@ mod mask;
|
||||||
mod position;
|
mod position;
|
||||||
mod selectors;
|
mod selectors;
|
||||||
mod supports;
|
mod supports;
|
||||||
|
mod text_overflow;
|
||||||
|
|
24
tests/unit/style/parsing/text_overflow.rs
Normal file
24
tests/unit/style/parsing/text_overflow.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use cssparser::Parser;
|
||||||
|
use media_queries::CSSErrorReporterTest;
|
||||||
|
use style::parser::ParserContext;
|
||||||
|
use style::stylesheets::Origin;
|
||||||
|
use style_traits::ToCss;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_text_overflow() {
|
||||||
|
use style::properties::longhands::text_overflow;
|
||||||
|
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#"clip"#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#"ellipsis"#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#"clip ellipsis"#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#""x""#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#"'x'"#, r#""x""#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#"clip "x""#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#""x" clip"#);
|
||||||
|
assert_roundtrip_with_context!(text_overflow::parse, r#""x" "y""#);
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue