mirror of
https://github.com/servo/servo.git
synced 2025-08-19 04:15:33 +01:00
Auto merge of #16802 - emilio:slim-down-slc, r=bholley
style: Slim down SharedStyleContext, and do various other cleanups around the style crate. This slims down SharedStyleContext, in preparation for a few things. First, I would like to eventually move the stylist to the document in Servo, in order for it to hold the StyleSheetSet. Also, this gets rid of a fair amount of overhead while creating it in stylo. Fixes bug 1363245. <!-- 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/16802) <!-- Reviewable:end -->
This commit is contained in:
commit
eeb1ee9723
11 changed files with 171 additions and 141 deletions
|
@ -25,7 +25,7 @@ macro_rules! stylesheet {
|
|||
stylesheet!($css, $origin, $error_reporter, SharedRwLock::new())
|
||||
};
|
||||
($css:expr, $origin:ident, $error_reporter:expr, $shared_lock:expr) => {
|
||||
Box::new(Stylesheet::from_str(
|
||||
Arc::new(Stylesheet::from_str(
|
||||
$css,
|
||||
ServoUrl::parse("http://localhost").unwrap(),
|
||||
Origin::$origin,
|
||||
|
@ -269,7 +269,7 @@ fn multiple_stylesheets_cascading() {
|
|||
Author, error_reporter, shared_lock.clone())
|
||||
];
|
||||
|
||||
let declarations = Cascade::from_stylesheets(&stylesheets, &shared_lock.read(), &device).finish();
|
||||
let declarations = Cascade::from_stylesheets(stylesheets.iter(), &shared_lock.read(), &device).finish();
|
||||
assert_decl_len!(declarations == 3);
|
||||
assert_decl_eq!(&declarations[0], UserAgent, Zoom: Zoom::Number(1.));
|
||||
assert_decl_eq!(&declarations[1], User, MinHeight: viewport_length!(200., px));
|
||||
|
@ -283,7 +283,7 @@ fn multiple_stylesheets_cascading() {
|
|||
stylesheet!("@viewport { min-width: 300px !important; min-height: 300px !important; zoom: 3 !important; }",
|
||||
Author, error_reporter, shared_lock.clone())
|
||||
];
|
||||
let declarations = Cascade::from_stylesheets(&stylesheets, &shared_lock.read(), &device).finish();
|
||||
let declarations = Cascade::from_stylesheets(stylesheets.iter(), &shared_lock.read(), &device).finish();
|
||||
assert_decl_len!(declarations == 3);
|
||||
assert_decl_eq!(&declarations[0], UserAgent, MinWidth: viewport_length!(100., px), !important);
|
||||
assert_decl_eq!(&declarations[1], User, MinHeight: viewport_length!(200., px), !important);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue