mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #13860 - canaltinova:text-emphasis-style, r=Manishearth,emilio
Implement parsing/serialization and gecko glue for text-emphasis-style <!-- Please describe your changes on the following line: --> Implementation of parsing/serialization and gecko glue for text-emphasis-style. r? @Manishearth --- <!-- 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 #13853 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- 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/13860) <!-- Reviewable:end -->
This commit is contained in:
commit
bfd966f819
5 changed files with 297 additions and 2 deletions
46
tests/unit/style/parsing/inherited_text.rs
Normal file
46
tests/unit/style/parsing/inherited_text.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* 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 url::Url;
|
||||
|
||||
#[test]
|
||||
fn text_emphasis_style_longhand_should_parse_properly() {
|
||||
use style::properties::longhands::text_emphasis_style;
|
||||
use style::properties::longhands::text_emphasis_style::{ShapeKeyword, SpecifiedValue, KeywordValue};
|
||||
|
||||
let none = parse_longhand!(text_emphasis_style, "none");
|
||||
assert_eq!(none, SpecifiedValue::None);
|
||||
|
||||
let fill = parse_longhand!(text_emphasis_style, "open");
|
||||
let fill_struct = SpecifiedValue::Keyword(KeywordValue::Fill(false));
|
||||
assert_eq!(fill, fill_struct);
|
||||
|
||||
let shape = parse_longhand!(text_emphasis_style, "triangle");
|
||||
let shape_struct = SpecifiedValue::Keyword(KeywordValue::Shape(ShapeKeyword::Triangle));
|
||||
assert_eq!(shape, shape_struct);
|
||||
|
||||
let fill_shape = parse_longhand!(text_emphasis_style, "filled dot");
|
||||
let fill_shape_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot));
|
||||
assert_eq!(fill_shape, fill_shape_struct);
|
||||
|
||||
let shape_fill = parse_longhand!(text_emphasis_style, "dot filled");
|
||||
let shape_fill_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot));
|
||||
assert_eq!(shape_fill, shape_fill_struct);
|
||||
|
||||
let a_string = parse_longhand!(text_emphasis_style, "\"a\"");
|
||||
let a_string_struct = SpecifiedValue::String("a".to_string());
|
||||
assert_eq!(a_string, a_string_struct);
|
||||
|
||||
let chinese_string = parse_longhand!(text_emphasis_style, "\"点\"");
|
||||
let chinese_string_struct = SpecifiedValue::String("点".to_string());
|
||||
assert_eq!(chinese_string, chinese_string_struct);
|
||||
|
||||
let unicode_string = parse_longhand!(text_emphasis_style, "\"\\25B2\"");
|
||||
let unicode_string_struct = SpecifiedValue::String("▲".to_string());
|
||||
assert_eq!(unicode_string, unicode_string_struct);
|
||||
}
|
|
@ -63,6 +63,7 @@ macro_rules! parse_longhand {
|
|||
|
||||
mod basic_shape;
|
||||
mod image;
|
||||
mod inherited_text;
|
||||
mod mask;
|
||||
mod position;
|
||||
mod selectors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue