mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #14089 - Wafflespeanut:tocss, r=SimonSapin
Make use of Servo-specific ToCss everywhere! <!-- Please describe your changes on the following line: --> This will allow types to be generic over our local `ToCss` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a refactor <!-- 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/14089) <!-- Reviewable:end -->
This commit is contained in:
commit
f48b3fe219
56 changed files with 221 additions and 213 deletions
|
@ -5,6 +5,7 @@
|
|||
use parsing::parse;
|
||||
use style::parser::Parse;
|
||||
use style::values::specified::basic_shape::*;
|
||||
use style_traits::ToCss;
|
||||
|
||||
// Ensure that basic-shape sub-functions parse as both basic shapes
|
||||
// and their individual components
|
||||
|
@ -21,14 +22,14 @@ macro_rules! assert_border_radius_values {
|
|||
let input = parse(BorderRadius::parse, $input)
|
||||
.expect(&format!("Failed parsing {} as border radius",
|
||||
$input));
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.width), $tlw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.width), $trw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.height), $tlh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.height), $trh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
|
||||
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.width), $tlw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.width), $trw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.height), $tlh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.height), $trh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
|
||||
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use style::properties::longhands::font_feature_settings;
|
|||
use style::properties::longhands::font_feature_settings::computed_value;
|
||||
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
|
||||
use style::stylesheets::Origin;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
|
@ -100,7 +101,7 @@ fn font_language_override_should_parse_properly() {
|
|||
#[test]
|
||||
#[should_panic]
|
||||
fn font_language_override_should_fail_on_empty_str() {
|
||||
use style::properties::longhands::font_language_override::{self, SpecifiedValue};
|
||||
use style::properties::longhands::font_language_override;
|
||||
|
||||
parse_longhand!(font_language_override, "");
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use media_queries::CSSErrorReporterTest;
|
|||
use style::parser::ParserContext;
|
||||
use style::stylesheets::Origin;
|
||||
use style::values::specified::image::*;
|
||||
use style_traits::ToCss;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -21,12 +21,12 @@ macro_rules! assert_roundtrip {
|
|||
($fun:expr, $input:expr, $output:expr) => {
|
||||
let parsed = $crate::parsing::parse($fun, $input)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
let serialized = ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let re_parsed = $crate::parsing::parse($fun, &serialized)
|
||||
.expect(&format!("Failed to parse serialization {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
let re_serialized = ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ macro_rules! assert_roundtrip_with_context {
|
|||
let mut parser = Parser::new($input);
|
||||
let parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
let serialized = ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let mut parser = Parser::new(&serialized);
|
||||
let re_parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
let re_serialized = ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use parsing::parse;
|
||||
use style::values::specified::position::*;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[test]
|
||||
fn test_position() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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 cssparser::{Parser, ToCss};
|
||||
use selectors::parser::{Selector, ParserContext, parse_selector_list};
|
||||
use style::selector_impl::TheSelectorImpl;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
pub use cssparser::ToCss;
|
||||
pub use std::sync::Arc;
|
||||
pub use style::computed_values::display::T::inline_block;
|
||||
pub use style::properties::{DeclaredValue, PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
|
@ -11,6 +10,7 @@ pub use style::values::specified::{LengthOrPercentage, LengthOrPercentageOrAuto,
|
|||
pub use style::properties::longhands::outline_color::computed_value::T as ComputedColor;
|
||||
pub use style::values::RGBA;
|
||||
pub use style::values::specified::UrlExtraData;
|
||||
pub use style_traits::ToCss;
|
||||
pub use url::Url;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -11,6 +11,7 @@ extern crate libc;
|
|||
#[macro_use] extern crate log;
|
||||
extern crate parking_lot;
|
||||
extern crate style;
|
||||
extern crate style_traits;
|
||||
extern crate url;
|
||||
|
||||
mod sanity_checks;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue