From 70d9da254ae7f7b404105abbdb26fc9307633649 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 1 Oct 2019 01:04:54 +0000 Subject: [PATCH] servo: Merge #13459 - Use parking_lot::RwLock for PropertyDeclarationBlock (from servo:no-arc-heapsize); r=emilio As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1305141 Closes #13176 --- Original PR title: Stop relying on `impl HeapSizeOf for Arc` https://github.com/servo/heapsize/issues/37#issuecomment-249861171 This builds on top of that. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). - [ ] There are tests for these changes OR - [x] These changes do not require tests because refactor Source-Repo: https://github.com/servo/servo Source-Revision: aea9545e16fd6ea4a6b1234d1b969457313a5fa7 UltraBlame original commit: 0e74d9fe18cf1cbbab7d7410027a051f94eac90f --- servo/components/layout/Cargo.toml | 11 - .../plugins/lints/unrooted_must_root.rs | 42 --- servo/components/script/Cargo.toml | 18 +- servo/components/script/body.rs | 16 +- servo/components/script/dom/attr.rs | 18 +- .../dom/bindings/cell.rs} | 24 +- servo/components/script/dom/bindings/mod.rs | 11 +- servo/components/script/dom/bindings/trace.rs | 21 +- servo/components/script/dom/characterdata.rs | 4 +- .../script/dom/cssstyledeclaration.rs | 303 +++++++++--------- servo/components/script/dom/document.rs | 81 +++-- .../script/dom/dommatrixreadonly.rs | 12 +- servo/components/script/dom/element.rs | 239 +++++++------- .../components/script/dom/htmlimageelement.rs | 8 + .../components/script/dom/htmllinkelement.rs | 8 + .../components/script/dom/htmlmetaelement.rs | 8 + .../script/dom/htmlobjectelement.rs | 8 + .../components/script/dom/htmlstyleelement.rs | 8 + servo/components/script/dom/request.rs | 12 +- servo/components/script/dom/response.rs | 18 +- .../script/dom/workerglobalscope.rs | 8 + servo/components/script/layout_wrapper.rs | 9 + servo/components/script/lib.rs | 12 + .../script_layout_interface/Cargo.toml | 11 - servo/components/servo/Cargo.lock | 172 +++++----- servo/components/style/Cargo.toml | 10 +- servo/components/style/animation.rs | 6 +- servo/components/style/dom.rs | 9 + servo/components/style/gecko/wrapper.rs | 12 + servo/components/style/keyframes.rs | 90 +++++- servo/components/style/lib.rs | 4 - servo/components/style/matching.rs | 122 ++++++- .../style/properties/properties.mako.rs | 155 ++++++++- servo/components/style/refcell.rs | 144 --------- servo/components/style/restyle_hints.rs | 16 + servo/components/style/selector_matching.rs | 215 ++++++++++++- servo/components/style/stylesheets.rs | 99 +----- servo/ports/cef/Cargo.lock | 143 ++++----- servo/ports/geckolib/Cargo.lock | 45 ++- servo/ports/geckolib/Cargo.toml | 7 + servo/ports/geckolib/glue.rs | 20 ++ servo/ports/geckolib/lib.rs | 4 + servo/tests/unit/style/Cargo.toml | 18 +- servo/tests/unit/style/lib.rs | 4 + servo/tests/unit/style/selector_matching.rs | 29 ++ servo/tests/unit/style/stylesheets.rs | 127 ++++---- 46 files changed, 1384 insertions(+), 977 deletions(-) rename servo/components/{style/domrefcell.rs => script/dom/bindings/cell.rs} (98%) diff --git a/servo/components/layout/Cargo.toml b/servo/components/layout/Cargo.toml index 039fa5361bf3f..70769a0350120 100644 --- a/servo/components/layout/Cargo.toml +++ b/servo/components/layout/Cargo.toml @@ -321,22 +321,11 @@ script_traits } selectors = -{ -version -= " 0 . 13 " -features -= -[ -" -heap_size -" -] -} serde_macros = " diff --git a/servo/components/plugins/lints/unrooted_must_root.rs b/servo/components/plugins/lints/unrooted_must_root.rs index 4b4ad91e53a0d..5d8fdb607c790 100644 --- a/servo/components/plugins/lints/unrooted_must_root.rs +++ b/servo/components/plugins/lints/unrooted_must_root.rs @@ -539,48 +539,6 @@ did & [ " -style -" -" -refcell -" -" -Ref -" -] -) -| -| -match_def_path -( -cx -did -. -did -& -[ -" -style -" -" -refcell -" -" -RefMut -" -] -) -| -| -match_def_path -( -cx -did -. -did -& -[ -" core " " diff --git a/servo/components/script/Cargo.toml b/servo/components/script/Cargo.toml index 011cd26c21371..d4409ce864fca 100644 --- a/servo/components/script/Cargo.toml +++ b/servo/components/script/Cargo.toml @@ -486,6 +486,13 @@ open . 1 " +parking_lot += +" +0 +. +3 +" phf = " @@ -598,22 +605,11 @@ script_traits } selectors = -{ -version -= " 0 . 13 " -features -= -[ -" -heap_size -" -] -} serde = " diff --git a/servo/components/script/body.rs b/servo/components/script/body.rs index c19fa80154ca8..ef5144b73173d 100644 --- a/servo/components/script/body.rs +++ b/servo/components/script/body.rs @@ -249,25 +249,25 @@ use std : : -rc +cell : : -Rc +Ref ; use std : : -str -; -use -style +rc : : -refcell +Rc +; +use +std : : -Ref +str ; use url diff --git a/servo/components/script/dom/attr.rs b/servo/components/script/dom/attr.rs index e4c6e25ea8bb3..8f708334c91a1 100644 --- a/servo/components/script/dom/attr.rs +++ b/servo/components/script/dom/attr.rs @@ -220,6 +220,15 @@ use std : : +cell +: +: +Ref +; +use +std +: +: mem ; use @@ -243,15 +252,6 @@ AttrIdentifier AttrValue } ; -use -style -: -: -refcell -: -: -Ref -; / / https diff --git a/servo/components/style/domrefcell.rs b/servo/components/script/dom/bindings/cell.rs similarity index 98% rename from servo/components/style/domrefcell.rs rename to servo/components/script/dom/bindings/cell.rs index dcbfd9a34fde3..8a3a3117b946d 100644 --- a/servo/components/style/domrefcell.rs +++ b/servo/components/script/dom/bindings/cell.rs @@ -68,7 +68,10 @@ the DOM . use -refcell +std +: +: +cell : : { @@ -80,6 +83,9 @@ RefMut } ; use +style +: +: thread_state ; / @@ -132,22 +138,10 @@ builds derive ( Clone -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( +PartialEq +Debug HeapSizeOf ) -) ] pub struct diff --git a/servo/components/script/dom/bindings/mod.rs b/servo/components/script/dom/bindings/mod.rs index 4b629bb5c6d03..1f0adbc2cdd5c 100644 --- a/servo/components/script/dom/bindings/mod.rs +++ b/servo/components/script/dom/bindings/mod.rs @@ -1731,17 +1731,12 @@ html ) . pub -use -style -: -: -domrefcell -as -cell +mod +callback ; pub mod -callback +cell ; pub mod diff --git a/servo/components/script/dom/bindings/trace.rs b/servo/components/script/dom/bindings/trace.rs index d6c980fdf707d..d1cdde97c8c49 100644 --- a/servo/components/script/dom/bindings/trace.rs +++ b/servo/components/script/dom/bindings/trace.rs @@ -443,6 +443,18 @@ dom bindings : : +cell +: +: +DOMRefCell +; +use +dom +: +: +bindings +: +: js : : @@ -1006,15 +1018,6 @@ use style : : -domrefcell -: -: -DOMRefCell -; -use -style -: -: element_state : : diff --git a/servo/components/script/dom/characterdata.rs b/servo/components/script/dom/characterdata.rs index ae89f372bc4d0..d2e1f5cca64ed 100644 --- a/servo/components/script/dom/characterdata.rs +++ b/servo/components/script/dom/characterdata.rs @@ -258,10 +258,10 @@ text Text ; use -style +std : : -refcell +cell : : Ref diff --git a/servo/components/script/dom/cssstyledeclaration.rs b/servo/components/script/dom/cssstyledeclaration.rs index 6d0ea991b3290..4853a90479b5f 100644 --- a/servo/components/script/dom/cssstyledeclaration.rs +++ b/servo/components/script/dom/cssstyledeclaration.rs @@ -197,19 +197,19 @@ window Window ; use -std -: -: -ascii +parking_lot : : -AsciiExt +RwLock ; use std : : -slice +ascii +: +: +AsciiExt ; use std @@ -243,7 +243,6 @@ properties : : { -PropertyDeclaration Shorthand Importance } @@ -265,15 +264,6 @@ use style : : -refcell -: -: -Ref -; -use -style -: -: selector_impl : : @@ -717,6 +707,10 @@ declarations > declarations . +read +( +) +. declarations . len @@ -898,6 +892,77 @@ from_name property ) { +let +style_attribute += +owner +. +style_attribute +( +) +. +borrow +( +) +; +let +style_attribute += +if +let +Some +( +ref +style_attribute +) += +* +style_attribute +{ +style_attribute +. +read +( +) +} +else +{ +/ +/ +shorthand +. +longhands +( +) +is +never +empty +so +with +no +style +attribute +/ +/ +step +2 +. +2 +. +2 +would +do +this +: +return +DOMString +: +: +new +( +) +} +; / / Step @@ -939,20 +1004,12 @@ Step let declaration = -owner +style_attribute . -get_inline_style_declaration -( -& -Atom -: -: -from +get ( -* longhand ) -) ; / / @@ -973,7 +1030,12 @@ declaration { Some ( +& +( +ref declaration +_importance +) ) = > @@ -1003,114 +1065,6 @@ Step 3 / / -Work -around -closures -not -being -Clone -# -[ -derive -( -Clone -) -] -struct -Map -< -' -a -' -b -: -' -a -> -( -slice -: -: -Iter -< -' -a -Ref -< -' -b -( -PropertyDeclaration -Importance -) -> -> -) -; -impl -< -' -a -' -b -> -Iterator -for -Map -< -' -a -' -b -> -{ -type -Item -= -& -' -a -PropertyDeclaration -; -fn -next -( -& -mut -self -) -- -> -Option -< -Self -: -: -Item -> -{ -self -. -0 -. -next -( -) -. -map -( -| -r -| -& -r -. -0 -) -} -} -/ -/ TODO : important @@ -1132,14 +1086,7 @@ shorthand . serialize_shorthand_value_to_string ( -Map -( list -. -iter -( -) -) Importance : : @@ -1162,14 +1109,17 @@ Step 3 & 4 -match owner . get_inline_style_declaration ( & property -) +| +d +| +match +d { Some ( @@ -1200,6 +1150,7 @@ new ( ) } +) } / / @@ -1348,20 +1299,14 @@ important ) ; } +} +else +{ / / Step 3 -} -else -{ -if -let -Some -( -decl -) -= +return self . owner @@ -1370,7 +1315,18 @@ get_inline_style_declaration ( & property +| +d +| +{ +if +let +Some +( +decl ) += +d { if decl @@ -1394,6 +1350,18 @@ important ; } } +/ +/ +Step +4 +DOMString +: +: +new +( +) +} +) } / / @@ -2357,26 +2325,33 @@ declarations { declarations . +read +( +) +. declarations . get ( index ) -} -) . map ( | -& +entry +| +{ +let ( ref declaration importance ) -| -{ += +* +entry +; let mut css @@ -2413,6 +2388,8 @@ css } ) } +) +} / / https @@ -2492,6 +2469,10 @@ from ( declarations . +read +( +) +. to_css_string ( ) @@ -2659,9 +2640,15 @@ Arc : new ( +RwLock +: +: +new +( decl_block ) ) +) } ; element diff --git a/servo/components/script/dom/document.rs b/servo/components/script/dom/document.rs index d2869dfa98bed..6c69a5e6f8afc 100644 --- a/servo/components/script/dom/document.rs +++ b/servo/components/script/dom/document.rs @@ -1285,7 +1285,11 @@ std cell : : +{ Cell +Ref +RefMut +} ; use std @@ -1399,18 +1403,6 @@ use style : : -refcell -: -: -{ -Ref -RefMut -} -; -use -style -: -: selector_impl : : @@ -1493,6 +1485,42 @@ ParserBlockedByScript Blocked Unblocked } +# +[ +derive +( +JSTraceable +HeapSizeOf +) +] +# +[ +must_root +] +struct +StylesheetInDocument +{ +node +: +JS +< +Node +> +# +[ +ignore_heap_size_of += +" +Arc +" +] +stylesheet +: +Arc +< +Stylesheet +> +} / / https @@ -1764,16 +1792,7 @@ Option < Vec < -( -JS -< -Node -> -Arc -< -Stylesheet -> -) +StylesheetInDocument > > > @@ -14662,7 +14681,10 @@ map | stylesheet | -( +StylesheetInDocument +{ +node +: JS : : @@ -14673,7 +14695,9 @@ from_ref node ) stylesheet -) +: +stylesheet +} ) } ) @@ -14709,13 +14733,10 @@ iter map ( | -& -( -_ -ref -stylesheet -) +s | +s +. stylesheet . clone diff --git a/servo/components/script/dom/dommatrixreadonly.rs b/servo/components/script/dom/dommatrixreadonly.rs index 51882820fa8fa..323536b44abb2 100644 --- a/servo/components/script/dom/dommatrixreadonly.rs +++ b/servo/components/script/dom/dommatrixreadonly.rs @@ -224,7 +224,10 @@ std cell : : +{ Cell +Ref +} ; use std @@ -232,15 +235,6 @@ std : f64 ; -use -style -: -: -refcell -: -: -Ref -; # [ dom_struct diff --git a/servo/components/script/dom/element.rs b/servo/components/script/dom/element.rs index f8b5092887469..98ca4f27e3ce2 100644 --- a/servo/components/script/dom/element.rs +++ b/servo/components/script/dom/element.rs @@ -849,6 +849,12 @@ Quirks } ; use +parking_lot +: +: +RwLock +; +use selectors : : @@ -912,7 +918,10 @@ std cell : : +{ Cell +Ref +} ; use std @@ -1062,15 +1071,6 @@ use style : : -refcell -: -: -Ref -; -use -style -: -: selector_impl : : @@ -1223,6 +1223,14 @@ Option Atom > > +# +[ +ignore_heap_size_of += +" +Arc +" +] style_attribute : DOMRefCell @@ -1231,10 +1239,13 @@ Option < Arc < +RwLock +< PropertyDeclarationBlock > > > +> attr_list : MutNullableHeap @@ -2601,9 +2612,12 @@ Option < Arc < +RwLock +< PropertyDeclarationBlock > > +> ; fn local_name @@ -2885,6 +2899,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -2905,6 +2924,7 @@ important_count 0 } ) +) Importance : : @@ -5106,9 +5126,12 @@ Option < Arc < +RwLock +< PropertyDeclarationBlock > > +> { unsafe { @@ -5582,10 +5605,13 @@ Option < Arc < +RwLock +< PropertyDeclarationBlock > > > +> { & self @@ -5913,6 +5939,10 @@ borrow { declarations . +read +( +) +. to_css_string ( ) @@ -6168,6 +6198,10 @@ index = declarations . +read +( +) +. declarations . iter @@ -6219,14 +6253,13 @@ index index { let +mut declarations = -Arc -: -: -make_mut -( declarations +. +write +( ) ; declarations @@ -6339,40 +6372,25 @@ mut inline_declarations { { -/ -/ -Usually -the -reference -count -will -be -1 -here -. -But -transitions -could -make -it -greater -/ -/ -than -that -. let +mut declaration_block = -Arc -: -: -make_mut -( declaration_block +. +write +( ) ; let +declaration_block += +& +mut +* +declaration_block +; +let existing_declarations = & @@ -6546,6 +6564,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -6576,6 +6599,7 @@ important_count } ) ) +) ; } update @@ -6641,44 +6665,25 @@ mut * inline_declarations { -/ -/ -Usually -the -reference -counts -of -from -and -to -will -be -1 -here -. -But -transitions -/ -/ -could -make -them -greater -than -that -. let +mut block = -Arc -: -: -make_mut -( block +. +write +( ) ; let +block += +& +mut +* +block +; +let declarations = & @@ -6798,32 +6803,45 @@ sync_property_with_attrs_style pub fn get_inline_style_declaration +< +F +R +> ( & self property : & -Atom +str +f +: +F ) - > +R +where +F +: +FnOnce +( Option < -Ref -< +& ( PropertyDeclaration Importance ) > +) +- > +R { -Ref -: -: -filter_map -( +let +style_attr += self . style_attribute @@ -6831,53 +6849,44 @@ style_attribute borrow ( ) -| -inline_declarations -| -{ -inline_declarations -. -as_ref +; +if +let +Some ( +ref +block ) -. -and_then -( -| -declarations -| += +* +style_attr { -declarations -. -declarations +let +block += +block . -iter +read ( ) -. -find -( -| -& -& +; +f ( -ref -decl -_ -) -| -decl +block . -matches +get ( -& property ) ) } +else +{ +f +( +None ) } -) } pub fn @@ -16873,6 +16882,11 @@ Arc : new ( +RwLock +: +: +new +( parse_style_attribute ( & @@ -16896,6 +16910,7 @@ default ) ) ) +) } ) ; diff --git a/servo/components/script/dom/htmlimageelement.rs b/servo/components/script/dom/htmlimageelement.rs index 1a30d9226e692..5c29ab8f35d2b 100644 --- a/servo/components/script/dom/htmlimageelement.rs +++ b/servo/components/script/dom/htmlimageelement.rs @@ -432,6 +432,14 @@ Option < DOMString > +# +[ +ignore_heap_size_of += +" +Arc +" +] image : Option diff --git a/servo/components/script/dom/htmllinkelement.rs b/servo/components/script/dom/htmllinkelement.rs index b6675e621deaf..f0ddd13d1ea23 100644 --- a/servo/components/script/dom/htmllinkelement.rs +++ b/servo/components/script/dom/htmllinkelement.rs @@ -516,6 +516,14 @@ JS DOMTokenList > > +# +[ +ignore_heap_size_of += +" +Arc +" +] stylesheet : DOMRefCell diff --git a/servo/components/script/dom/htmlmetaelement.rs b/servo/components/script/dom/htmlmetaelement.rs index 4ad370e16bc2c..b3cfd825d342e 100644 --- a/servo/components/script/dom/htmlmetaelement.rs +++ b/servo/components/script/dom/htmlmetaelement.rs @@ -303,6 +303,14 @@ HTMLMetaElement htmlelement : HTMLElement +# +[ +ignore_heap_size_of += +" +Arc +" +] stylesheet : DOMRefCell diff --git a/servo/components/script/dom/htmlobjectelement.rs b/servo/components/script/dom/htmlobjectelement.rs index b57f4189c1749..15d09ffa91bac 100644 --- a/servo/components/script/dom/htmlobjectelement.rs +++ b/servo/components/script/dom/htmlobjectelement.rs @@ -265,6 +265,14 @@ HTMLObjectElement htmlelement : HTMLElement +# +[ +ignore_heap_size_of += +" +Arc +" +] image : DOMRefCell diff --git a/servo/components/script/dom/htmlstyleelement.rs b/servo/components/script/dom/htmlstyleelement.rs index 9ea86103de2c2..9208966269caf 100644 --- a/servo/components/script/dom/htmlstyleelement.rs +++ b/servo/components/script/dom/htmlstyleelement.rs @@ -260,6 +260,14 @@ HTMLStyleElement htmlelement : HTMLElement +# +[ +ignore_heap_size_of += +" +Arc +" +] stylesheet : DOMRefCell diff --git a/servo/components/script/dom/request.rs b/servo/components/script/dom/request.rs index 8abe2994d3545..2749308689bbe 100644 --- a/servo/components/script/dom/request.rs +++ b/servo/components/script/dom/request.rs @@ -528,7 +528,10 @@ std cell : : +{ Cell +Ref +} ; use std @@ -546,15 +549,6 @@ rc Rc ; use -style -: -: -refcell -: -: -Ref -; -use url : : diff --git a/servo/components/script/dom/response.rs b/servo/components/script/dom/response.rs index ac53f867810f1..6193586a912d7 100644 --- a/servo/components/script/dom/response.rs +++ b/servo/components/script/dom/response.rs @@ -320,6 +320,15 @@ use std : : +cell +: +: +Ref +; +use +std +: +: mem ; use @@ -341,15 +350,6 @@ str FromStr ; use -style -: -: -refcell -: -: -Ref -; -use url : : diff --git a/servo/components/script/dom/workerglobalscope.rs b/servo/components/script/dom/workerglobalscope.rs index 41358c7608f88..42f8196b1dcef 100644 --- a/servo/components/script/dom/workerglobalscope.rs +++ b/servo/components/script/dom/workerglobalscope.rs @@ -770,6 +770,14 @@ PipelineId worker_url : Url +# +[ +ignore_heap_size_of += +" +Arc +" +] closing : Option diff --git a/servo/components/script/layout_wrapper.rs b/servo/components/script/layout_wrapper.rs index 466ba9b9ffab9..37c8deaf878f4 100644 --- a/servo/components/script/layout_wrapper.rs +++ b/servo/components/script/layout_wrapper.rs @@ -479,6 +479,12 @@ constellation_msg PipelineId ; use +parking_lot +: +: +RwLock +; +use range : : @@ -3215,9 +3221,12 @@ Option & Arc < +RwLock +< PropertyDeclarationBlock > > +> { unsafe { diff --git a/servo/components/script/lib.rs b/servo/components/script/lib.rs index 12594c2711fd3..096f9e689a0a8 100644 --- a/servo/components/script/lib.rs +++ b/servo/components/script/lib.rs @@ -181,6 +181,14 @@ question_mark [ feature ( +try_borrow +) +] +# +! +[ +feature +( try_from ) ] @@ -391,6 +399,10 @@ open ; extern crate +parking_lot +; +extern +crate phf ; # diff --git a/servo/components/script_layout_interface/Cargo.toml b/servo/components/script_layout_interface/Cargo.toml index d5e72b2d80436..a56c96715694f 100644 --- a/servo/components/script_layout_interface/Cargo.toml +++ b/servo/components/script_layout_interface/Cargo.toml @@ -242,22 +242,11 @@ script_traits } selectors = -{ -version -= " 0 . 13 " -features -= -[ -" -heap_size -" -] -} string_cache = { diff --git a/servo/components/servo/Cargo.lock b/servo/components/servo/Cargo.lock index fb3b14685f0f3..5edca0965f1f8 100644 --- a/servo/components/servo/Cargo.lock +++ b/servo/components/servo/Cargo.lock @@ -983,7 +983,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -1608,7 +1608,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -3321,7 +3321,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -6046,7 +6046,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -7027,7 +7027,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -8870,7 +8870,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -10412,7 +10412,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -11257,7 +11257,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -12576,7 +12576,7 @@ version . 3 . -6 +7 " source = @@ -13053,7 +13053,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -15334,7 +15334,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -15889,7 +15889,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -16346,7 +16346,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -17047,7 +17047,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -19331,7 +19331,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -21033,7 +21033,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -26130,7 +26130,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -27297,7 +27297,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -27743,6 +27743,35 @@ index ) " " +parking_lot +0 +. +3 +. +3 +( +registry ++ +https +: +/ +/ +github +. +com +/ +rust +- +lang +/ +crates +. +io +- +index +) +" +" phf 0 . @@ -28442,7 +28471,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -28950,7 +28979,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -29474,64 +29503,6 @@ index ) " " -heapsize -0 -. -3 -. -6 -( -registry -+ -https -: -/ -/ -github -. -com -/ -rust -- -lang -/ -crates -. -io -- -index -) -" -" -heapsize_plugin -0 -. -1 -. -6 -( -registry -+ -https -: -/ -/ -github -. -com -/ -rust -- -lang -/ -crates -. -io -- -index -) -" -" matches 0 . @@ -32268,7 +32239,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -32670,7 +32641,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -33476,6 +33447,35 @@ index ) " " +parking_lot +0 +. +3 +. +3 +( +registry ++ +https +: +/ +/ +github +. +com +/ +rust +- +lang +/ +crates +. +io +- +index +) +" +" rustc - serialize @@ -33733,7 +33733,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -35441,7 +35441,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -35956,7 +35956,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -38637,7 +38637,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -42616,7 +42616,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -42641,7 +42641,7 @@ index " = " -abb306abb8d398e053cfb1b3e7b72c2f580be048b85745c52652954f8ad1439c +8c80e194758495a9109566134dc06e42ea0423987d6ceca016edaa90381b3549 " " checksum diff --git a/servo/components/style/Cargo.toml b/servo/components/style/Cargo.toml index 48293db195e09..6b50dabe6532e 100644 --- a/servo/components/style/Cargo.toml +++ b/servo/components/style/Cargo.toml @@ -108,11 +108,6 @@ serialization " selectors / -heap_size -" -" -selectors -/ unstable " " @@ -126,6 +121,11 @@ heap_size " plugins " +" +parking_lot +/ +nightly +" ] testing = diff --git a/servo/components/style/animation.rs b/servo/components/style/animation.rs index 8bc5c645611b5..fc3b01a9762f1 100644 --- a/servo/components/style/animation.rs +++ b/servo/components/style/animation.rs @@ -2752,10 +2752,12 @@ KeyframesStepValue : : Declarations -( +{ +block +: ref declarations -) +} = > { diff --git a/servo/components/style/dom.rs b/servo/components/style/dom.rs index 4ed320eae03b0..d044cfd6616ea 100644 --- a/servo/components/style/dom.rs +++ b/servo/components/style/dom.rs @@ -101,6 +101,12 @@ element_state ElementState ; use +parking_lot +: +: +RwLock +; +use properties : : @@ -1632,9 +1638,12 @@ Option & Arc < +RwLock +< PropertyDeclarationBlock > > +> ; fn get_state diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs index 598b792c679f5..a3cd818e9229f 100644 --- a/servo/components/style/gecko/wrapper.rs +++ b/servo/components/style/gecko/wrapper.rs @@ -341,6 +341,12 @@ libc uintptr_t ; use +parking_lot +: +: +RwLock +; +use parser : : @@ -509,9 +515,12 @@ Option < Arc < +RwLock +< PropertyDeclarationBlock > > +> / / XXX @@ -3482,9 +3491,12 @@ Option & Arc < +RwLock +< PropertyDeclarationBlock > > +> { let declarations diff --git a/servo/components/style/keyframes.rs b/servo/components/style/keyframes.rs index ee8a075d99d35..54f21e269a70e 100644 --- a/servo/components/style/keyframes.rs +++ b/servo/components/style/keyframes.rs @@ -77,6 +77,12 @@ DeclarationParser } ; use +parking_lot +: +: +RwLock +; +use parser : : @@ -580,7 +586,6 @@ derive ( Debug Clone -PartialEq ) ] # @@ -673,13 +678,32 @@ Vec _ > . +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] pub block : Arc < +RwLock +< PropertyDeclarationBlock > +> } / / @@ -736,7 +760,6 @@ derive ( Debug Clone -PartialEq ) ] # @@ -775,12 +798,33 @@ of Importance . Declarations +{ +# +[ +cfg_attr ( +feature += +" +servo +" +ignore_heap_size_of += +" Arc +" +) +] +block +: +Arc +< +RwLock < PropertyDeclarationBlock > -) +> +} ComputedValues } / @@ -800,7 +844,6 @@ derive ( Debug Clone -PartialEq ) ] # @@ -919,6 +962,13 @@ KeyframesStep { # [ +allow +( +unsafe_code +) +] +# +[ inline ] fn @@ -945,15 +995,19 @@ KeyframesStepValue : : Declarations -( +{ ref block -) +} = > { block . +read +( +) +. declarations . iter @@ -1057,7 +1111,6 @@ derive ( Debug Clone -PartialEq ) ] # @@ -1189,6 +1242,13 @@ and deduplicate properties . +# +[ +allow +( +unsafe_code +) +] fn get_animated_properties ( @@ -1247,6 +1307,10 @@ keyframe . block . +read +( +) +. declarations . iter @@ -1379,7 +1443,9 @@ KeyframesStepValue : : Declarations -( +{ +block +: keyframe . block @@ -1387,7 +1453,7 @@ block clone ( ) -) +} ) ) ; @@ -2024,6 +2090,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -2034,6 +2105,7 @@ important_count 0 } ) +) } ) ) diff --git a/servo/components/style/lib.rs b/servo/components/style/lib.rs index ef5ed85a77808..7328315ed20ba 100644 --- a/servo/components/style/lib.rs +++ b/servo/components/style/lib.rs @@ -697,10 +697,6 @@ dom ; pub mod -domrefcell -; -pub -mod element_state ; pub diff --git a/servo/components/style/matching.rs b/servo/components/style/matching.rs index 3c857fa0af090..20345d6719b8e 100644 --- a/servo/components/style/matching.rs +++ b/servo/components/style/matching.rs @@ -130,7 +130,6 @@ properties : { ComputedValues -PropertyDeclarationBlock cascade } ; @@ -235,6 +234,15 @@ use std : : +ops +: +: +Deref +; +use +std +: +: slice : : @@ -932,13 +940,18 @@ ptr : * const -PropertyDeclarationBlock +_ = +Arc +: +: +deref +( & -* declaration . mixed_declarations +) ; ptr . @@ -3027,11 +3040,112 @@ StyleContext a > { +/ +/ +Don +t +cache +applicable +declarations +for +elements +with +a +style +attribute +. +/ +/ +Since +the +style +attribute +contributes +to +that +set +no +other +element +would +have +the +same +set +/ +/ +and +the +cache +would +not +be +effective +anyway +. +/ +/ +This +also +works +around +the +test +failures +at +/ +/ +https +: +/ +/ +github +. +com +/ +servo +/ +servo +/ +pull +/ +13459 +# +issuecomment +- +250717584 +let +has_style_attribute += +self +. +as_element +( +) +. +map_or +( +false +| +e +| +e +. +style_attribute +( +) +. +is_some +( +) +) +; let mut cacheable = -true +! +has_style_attribute ; let shared_context diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index b3a0d724927fe..aff9543a2b600 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -352,7 +352,10 @@ use selector_matching : : +{ ApplicableDeclarationBlock +ApplicableDeclarationBlockReadGuard +} ; use stylesheets @@ -2574,6 +2577,55 @@ important_count as usize } +pub +fn +get +( +& +self +property_name +: +& +str +) +- +> +Option +< +& +( +PropertyDeclaration +Importance +) +> +{ +self +. +declarations +. +iter +( +) +. +find +( +| +& +& +( +ref +decl +_ +) +| +decl +. +matches +( +property_name +) +) +} } impl ToCss @@ -5491,7 +5543,7 @@ String where I : -Iterator +IntoIterator < Item = @@ -5500,7 +5552,11 @@ Item a PropertyDeclaration > -+ +I +: +: +IntoIter +: Clone { let @@ -5624,7 +5680,7 @@ W Write I : -Iterator +IntoIterator < Item = @@ -5633,7 +5689,11 @@ Item a PropertyDeclaration > -+ +I +: +: +IntoIter +: Clone { match @@ -5714,12 +5774,15 @@ AppendableValue ' a I +: +: +IntoIter > > where I : -Iterator +IntoIterator < Item = @@ -5728,9 +5791,22 @@ Item a PropertyDeclaration > -+ +I +: +: +IntoIter +: Clone { +let +declarations += +declarations +. +into_iter +( +) +; / / Only @@ -9929,7 +10005,6 @@ derive ( Clone Debug -HeapSizeOf ) ) ] @@ -12467,7 +12542,7 @@ applicable_declarations : & [ -ApplicableDeclarationBlock +ApplicableDeclarationBlockReadGuard ] shareable : @@ -12625,7 +12700,7 @@ order here . for -sub_list +block in applicable_declarations . @@ -12640,7 +12715,7 @@ rev for declaration in -sub_list +block . iter ( @@ -13579,6 +13654,51 @@ initial_values ) } ; +/ +/ +Aquire +locks +for +at +least +the +lifetime +of +specified_custom_properties +. +let +applicable_declarations += +applicable_declarations +. +iter +( +) +. +map +( +| +block +| +block +. +read +( +) +) +. +collect +: +: +< +Vec +< +_ +> +> +( +) +; let inherited_custom_properties = @@ -13590,7 +13710,7 @@ custom_properties ; let mut -custom_properties +specified_custom_properties = None ; @@ -13606,7 +13726,7 @@ new ) ; for -sub_list +block in applicable_declarations . @@ -13621,7 +13741,7 @@ rev for declaration in -sub_list +block . iter ( @@ -13657,7 +13777,7 @@ cascade ( & mut -custom_properties +specified_custom_properties & inherited_custom_properties & @@ -13685,7 +13805,7 @@ custom_properties : finish_cascade ( -custom_properties +specified_custom_properties & inherited_custom_properties ) @@ -13714,6 +13834,7 @@ style cascade_with_cached_declarations ( viewport_size +& applicable_declarations shareable parent_style @@ -13926,7 +14047,7 @@ other ] : for -sub_list +block in applicable_declarations . @@ -13941,7 +14062,7 @@ rev for declaration in -sub_list +block . iter ( diff --git a/servo/components/style/refcell.rs b/servo/components/style/refcell.rs index 0a153877f7bc3..492487d3a34a1 100644 --- a/servo/components/style/refcell.rs +++ b/servo/components/style/refcell.rs @@ -199,23 +199,6 @@ allow unsafe_code ) ] -# -[ -cfg -( -feature -= -" -servo -" -) -] -use -heapsize -: -: -HeapSizeOf -; use std : @@ -377,51 +360,6 @@ UnsafeCell T > } -# -[ -cfg -( -feature -= -" -servo -" -) -] -impl -< -T -: -HeapSizeOf -> -HeapSizeOf -for -RefCell -< -T -> -{ -fn -heap_size_of_children -( -& -self -) -- -> -usize -{ -self -. -borrow -( -) -. -heap_size_of_children -( -) -} -} / / / @@ -4223,88 +4161,6 @@ orig borrow } } -# -[ -inline -] -pub -fn -filter_map -< -U -: -? -Sized -F -> -( -orig -: -Ref -< -' -b -T -> -f -: -F -) -- -> -Option -< -Ref -< -' -b -U -> -> -where -F -: -FnOnce -( -& -T -) -- -> -Option -< -& -U -> -{ -f -( -orig -. -value -) -. -map -( -move -| -new_value -| -{ -Ref -{ -value -: -new_value -borrow -: -orig -. -borrow -} -} -) -} } impl < diff --git a/servo/components/style/restyle_hints.rs b/servo/components/style/restyle_hints.rs index 7bb36c2127151..dda529c746330 100644 --- a/servo/components/style/restyle_hints.rs +++ b/servo/components/style/restyle_hints.rs @@ -2570,6 +2570,22 @@ HeapSizeOf struct Dependency { +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] selector : Arc diff --git a/servo/components/style/selector_matching.rs b/servo/components/style/selector_matching.rs index a2f0f1f662139..b4910c687b6a6 100644 --- a/servo/components/style/selector_matching.rs +++ b/servo/components/style/selector_matching.rs @@ -96,6 +96,15 @@ MediaType } ; use +parking_lot +: +: +{ +RwLock +RwLockReadGuard +} +; +use properties : : @@ -645,6 +654,22 @@ the page affecting siblings +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] sibling_affecting_selectors : Vec @@ -675,6 +700,22 @@ affecting / attributes . +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] non_common_style_affecting_attributes_selectors : Vec @@ -1204,7 +1245,7 @@ declarations : style_rule . -declarations +block . clone ( @@ -2257,6 +2298,13 @@ PrivateMatchMethods : candidate_element_allows_for_style_sharing . +# +[ +allow +( +unsafe_code +) +] pub fn push_applicable_declarations @@ -2285,9 +2333,12 @@ Option & Arc < +RwLock +< PropertyDeclarationBlock > > +> pseudo_element : Option @@ -2679,6 +2730,10 @@ style_attribute if sa . +read +( +) +. any_normal ( ) @@ -2796,6 +2851,10 @@ style_attribute if sa . +read +( +) +. any_important ( ) @@ -4466,6 +4525,13 @@ and source order . +# +[ +allow +( +unsafe_code +) +] pub fn get_universal_rules @@ -4538,11 +4604,20 @@ is_none ( ) { -if +let +block += rule . declarations . +read +( +) +; +if +block +. any_normal ( ) @@ -4564,9 +4639,7 @@ Normal ; } if -rule -. -declarations +block . any_important ( @@ -4744,6 +4817,13 @@ the matching_rules list . +# +[ +allow +( +unsafe_code +) +] fn get_matching_rules < @@ -4813,10 +4893,13 @@ iter let block = -& rule . declarations +. +read +( +) ; let any_declaration_for_importance @@ -5371,6 +5454,22 @@ avoid the allocation . +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] pub selector : @@ -5381,13 +5480,32 @@ ComplexSelector TheSelectorImpl > > +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] pub declarations : Arc < +RwLock +< PropertyDeclarationBlock > +> pub source_order : @@ -5518,13 +5636,32 @@ ApplicableDeclarationBlock : : iter +# +[ +cfg_attr +( +feature += +" +servo +" +ignore_heap_size_of += +" +Arc +" +) +] pub mixed_declarations : Arc < +RwLock +< PropertyDeclarationBlock > +> pub importance : @@ -5553,8 +5690,11 @@ declarations : Arc < +RwLock +< PropertyDeclarationBlock > +> importance : Importance @@ -5581,6 +5721,67 @@ specificity } pub fn +read +( +& +self +) +- +> +ApplicableDeclarationBlockReadGuard +{ +ApplicableDeclarationBlockReadGuard +{ +guard +: +self +. +mixed_declarations +. +read +( +) +importance +: +self +. +importance +} +} +} +pub +struct +ApplicableDeclarationBlockReadGuard +< +' +a +> +{ +guard +: +RwLockReadGuard +< +' +a +PropertyDeclarationBlock +> +importance +: +Importance +} +impl +< +' +a +> +ApplicableDeclarationBlockReadGuard +< +' +a +> +{ +pub +fn iter ( & @@ -5596,7 +5797,7 @@ iter : self . -mixed_declarations +guard . declarations . diff --git a/servo/components/style/stylesheets.rs b/servo/components/style/stylesheets.rs index 7cc3707d208e9..98cedba93d7a2 100644 --- a/servo/components/style/stylesheets.rs +++ b/servo/components/style/stylesheets.rs @@ -128,6 +128,12 @@ parse_media_query_list } ; use +parking_lot +: +: +RwLock +; +use parser : : @@ -381,22 +387,6 @@ User derive ( Debug -PartialEq -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( -HeapSizeOf -) ) ] pub @@ -495,22 +485,6 @@ Stylesheet derive ( Debug -PartialEq -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( -HeapSizeOf -) ) ] pub @@ -647,22 +621,6 @@ Namespace derive ( Debug -PartialEq -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( -HeapSizeOf -) ) ] pub @@ -689,22 +647,6 @@ Keyframe derive ( Debug -PartialEq -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( -HeapSizeOf -) ) ] pub @@ -763,22 +705,6 @@ device derive ( Debug -PartialEq -) -] -# -[ -cfg_attr -( -feature -= -" -servo -" -derive -( -HeapSizeOf -) ) ] pub @@ -796,12 +722,15 @@ TheSelectorImpl > > pub -declarations +block : Arc < +RwLock +< PropertyDeclarationBlock > +> } impl Stylesheet @@ -4066,13 +3995,18 @@ StyleRule selectors : prelude -declarations +block : Arc : : new ( +RwLock +: +: +new +( parse_property_declaration_list ( self @@ -4081,6 +4015,7 @@ context input ) ) +) } ) ) diff --git a/servo/ports/cef/Cargo.lock b/servo/ports/cef/Cargo.lock index 32709c7dfe5d8..02f8034809173 100644 --- a/servo/ports/cef/Cargo.lock +++ b/servo/ports/cef/Cargo.lock @@ -676,7 +676,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -1301,7 +1301,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -3014,7 +3014,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -5581,7 +5581,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -6562,7 +6562,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -7931,7 +7931,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -9473,7 +9473,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -10248,7 +10248,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -11567,7 +11567,7 @@ version . 3 . -6 +7 " source = @@ -12044,7 +12044,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -14325,7 +14325,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -14880,7 +14880,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -15337,7 +15337,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -16007,7 +16007,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -18291,7 +18291,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -19649,7 +19649,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -24540,7 +24540,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -25707,7 +25707,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -26153,6 +26153,35 @@ index ) " " +parking_lot +0 +. +3 +. +3 +( +registry ++ +https +: +/ +/ +github +. +com +/ +rust +- +lang +/ +crates +. +io +- +index +) +" +" phf 0 . @@ -26852,7 +26881,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -27284,7 +27313,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -27808,64 +27837,6 @@ index ) " " -heapsize -0 -. -3 -. -6 -( -registry -+ -https -: -/ -/ -github -. -com -/ -rust -- -lang -/ -crates -. -io -- -index -) -" -" -heapsize_plugin -0 -. -1 -. -6 -( -registry -+ -https -: -/ -/ -github -. -com -/ -rust -- -lang -/ -crates -. -io -- -index -) -" -" matches 0 . @@ -31189,7 +31160,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -31591,7 +31562,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -32402,7 +32373,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -34110,7 +34081,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -34625,7 +34596,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -37275,7 +37246,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -41040,7 +41011,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -41065,7 +41036,7 @@ index " = " -abb306abb8d398e053cfb1b3e7b72c2f580be048b85745c52652954f8ad1439c +8c80e194758495a9109566134dc06e42ea0423987d6ceca016edaa90381b3549 " " checksum diff --git a/servo/ports/geckolib/Cargo.lock b/servo/ports/geckolib/Cargo.lock index 620df0ec88732..62aa22e1bf131 100644 --- a/servo/ports/geckolib/Cargo.lock +++ b/servo/ports/geckolib/Cargo.lock @@ -222,6 +222,35 @@ index ) " " +parking_lot +0 +. +3 +. +3 +( +registry ++ +https +: +/ +/ +github +. +com +/ +rust +- +lang +/ +crates +. +io +- +index +) +" +" selectors 0 . @@ -432,7 +461,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -713,7 +742,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -1719,7 +1748,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -1964,7 +1993,7 @@ version . 3 . -6 +7 " source = @@ -4497,7 +4526,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -6115,7 +6144,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -7237,7 +7266,7 @@ heapsize . 3 . -6 +7 ( registry + @@ -7262,7 +7291,7 @@ index " = " -abb306abb8d398e053cfb1b3e7b72c2f580be048b85745c52652954f8ad1439c +8c80e194758495a9109566134dc06e42ea0423987d6ceca016edaa90381b3549 " " checksum diff --git a/servo/ports/geckolib/Cargo.toml b/servo/ports/geckolib/Cargo.toml index 0b84b2231abbf..42fad0925c66b 100644 --- a/servo/ports/geckolib/Cargo.toml +++ b/servo/ports/geckolib/Cargo.toml @@ -130,6 +130,13 @@ num_cpus . 2 " +parking_lot += +" +0 +. +3 +" selectors = " diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 707bf9c16e9b2..566ba3d11724c 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -80,6 +80,12 @@ euclid Size2D ; use +parking_lot +: +: +RwLock +; +use std : : @@ -2727,10 +2733,24 @@ value . map ( +| +block +| +{ Arc : : new +( +RwLock +: +: +new +( +block +) +) +} ) cache : diff --git a/servo/ports/geckolib/lib.rs b/servo/ports/geckolib/lib.rs index 6cbd7d5b257ac..77ecc95b9ea52 100644 --- a/servo/ports/geckolib/lib.rs +++ b/servo/ports/geckolib/lib.rs @@ -90,6 +90,10 @@ log ; extern crate +parking_lot +; +extern +crate url ; # diff --git a/servo/tests/unit/style/Cargo.toml b/servo/tests/unit/style/Cargo.toml index 96c14da528023..b35debf4a43c7 100644 --- a/servo/tests/unit/style/Cargo.toml +++ b/servo/tests/unit/style/Cargo.toml @@ -89,6 +89,13 @@ euclid . 1 " +parking_lot += +" +0 +. +3 +" rustc - serialize @@ -100,22 +107,11 @@ serialize " selectors = -{ -version -= " 0 . 13 " -features -= -[ -" -heap_size -" -] -} string_cache = { diff --git a/servo/tests/unit/style/lib.rs b/servo/tests/unit/style/lib.rs index 1651378fb9435..d940f6829356a 100644 --- a/servo/tests/unit/style/lib.rs +++ b/servo/tests/unit/style/lib.rs @@ -94,6 +94,10 @@ euclid ; extern crate +parking_lot +; +extern +crate rustc_serialize ; extern diff --git a/servo/tests/unit/style/selector_matching.rs b/servo/tests/unit/style/selector_matching.rs index aef7825f5d47a..3bb17e6b9a9ee 100644 --- a/servo/tests/unit/style/selector_matching.rs +++ b/servo/tests/unit/style/selector_matching.rs @@ -63,6 +63,12 @@ cssparser Parser ; use +parking_lot +: +: +RwLock +; +use selectors : : @@ -127,6 +133,12 @@ Rule SelectorMap } ; +use +style +: +: +thread_state +; / / / @@ -253,6 +265,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -294,6 +311,7 @@ important_count 0 } ) +) specificity : s @@ -961,6 +979,17 @@ test_get_universal_rules ( ) { +thread_state +: +: +initialize +( +thread_state +: +: +LAYOUT +) +; let map = diff --git a/servo/tests/unit/style/stylesheets.rs b/servo/tests/unit/style/stylesheets.rs index 30d506bbe2d64..7133bae7f6e08 100644 --- a/servo/tests/unit/style/stylesheets.rs +++ b/servo/tests/unit/style/stylesheets.rs @@ -73,6 +73,12 @@ media_queries CSSErrorReporterTest ; use +parking_lot +: +: +RwLock +; +use selectors : : @@ -460,64 +466,9 @@ default ) ) ; -macro_rules -! -assert_eq -{ -( -left -: -expr -right -: -expr -) -= -> -{ -let -left -= -left -; let -right +expected = -right -; -if -left -! -= -right -{ -panic -! -( -" -{ -: -# -? -} -! -= -{ -: -# -? -} -" -left -right -) -} -} -} -assert_eq -! -( -stylesheet Stylesheet { origin @@ -770,13 +721,18 @@ specificity ) } ] -declarations +block : Arc : : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -843,6 +799,7 @@ important_count 2 } ) +) } ) ) @@ -1090,13 +1047,18 @@ specificity ) } ] -declarations +block : Arc : : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -1138,6 +1100,7 @@ important_count 0 } ) +) } ) ) @@ -1339,13 +1302,18 @@ specificity ) } ] -declarations +block : Arc : : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -1732,6 +1700,7 @@ important_count 0 } ) +) } ) ) @@ -1795,6 +1764,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -1837,6 +1811,7 @@ important_count 0 } ) +) } ) Arc @@ -1873,6 +1848,11 @@ Arc : new ( +RwLock +: +: +new +( PropertyDeclarationBlock { declarations @@ -1950,6 +1930,7 @@ important_count 0 } ) +) } ) ] @@ -1958,6 +1939,34 @@ important_count ) ] } +; +assert_eq +! +( +format +! +( +" +{ +: +# +? +} +" +stylesheet +) +format +! +( +" +{ +: +# +? +} +" +expected +) ) ; }