mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
style: Parameterize the update and rebuild methods to take an iterator.
In preparation to avoid cloning the stylesheets while rebuilding in Gecko.
This commit is contained in:
parent
50e0c67e2c
commit
677daaabc5
5 changed files with 39 additions and 30 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