@@ -17,7 +17,7 @@ use webrender::api::*;
17
17
use webrender:: render_api:: * ;
18
18
use webrender:: api:: units:: * ;
19
19
use webrender:: api:: FillRule ;
20
- use crate :: wrench:: { FontDescriptor , Wrench , WrenchThing } ;
20
+ use crate :: wrench:: { FontDescriptor , Wrench , WrenchThing , DisplayList } ;
21
21
use crate :: yaml_helper:: { StringEnum , YamlHelper , make_perspective} ;
22
22
use yaml_rust:: { Yaml , YamlLoader } ;
23
23
use crate :: PLATFORM_DEFAULT_FACE_NAME ;
@@ -322,7 +322,7 @@ pub struct YamlFrameReader {
322
322
aux_dir : PathBuf ,
323
323
frame_count : u32 ,
324
324
325
- display_lists : Vec < ( PipelineId , BuiltDisplayList ) > ,
325
+ display_lists : Vec < DisplayList > ,
326
326
327
327
watch_source : bool ,
328
328
list_resources : bool ,
@@ -447,13 +447,23 @@ impl YamlFrameReader {
447
447
448
448
if let Some ( pipelines) = yaml[ "pipelines" ] . as_vec ( ) {
449
449
for pipeline in pipelines {
450
- self . build_pipeline ( wrench, pipeline[ "id" ] . as_pipeline_id ( ) . unwrap ( ) , pipeline) ;
450
+ let pipeline_id = pipeline[ "id" ] . as_pipeline_id ( ) . unwrap ( ) ;
451
+ let mut builder = DisplayListBuilder :: new ( pipeline_id) ;
452
+ self . build_pipeline ( wrench, & mut builder, pipeline_id, false , pipeline) ;
451
453
}
452
454
}
453
455
454
- let root_stacking_context = & yaml[ "root" ] ;
455
- assert_ne ! ( * root_stacking_context, Yaml :: BadValue ) ;
456
- self . build_pipeline ( wrench, wrench. root_pipeline_id , root_stacking_context) ;
456
+ let mut builder = DisplayListBuilder :: new ( wrench. root_pipeline_id ) ;
457
+
458
+ if let Some ( frames) = yaml[ "frames" ] . as_vec ( ) {
459
+ for frame in frames {
460
+ self . build_pipeline ( wrench, & mut builder, wrench. root_pipeline_id , true , frame) ;
461
+ }
462
+ } else {
463
+ let root_stacking_context = & yaml[ "root" ] ;
464
+ assert_ne ! ( * root_stacking_context, Yaml :: BadValue ) ;
465
+ self . build_pipeline ( wrench, & mut builder, wrench. root_pipeline_id , true , root_stacking_context) ;
466
+ }
457
467
458
468
// If replaying the same frame during interactive use, the frame gets rebuilt,
459
469
// but the external image handler has already been consumed by the renderer.
@@ -465,26 +475,37 @@ impl YamlFrameReader {
465
475
fn build_pipeline (
466
476
& mut self ,
467
477
wrench : & mut Wrench ,
478
+ builder : & mut DisplayListBuilder ,
468
479
pipeline_id : PipelineId ,
480
+ send_transaction : bool ,
469
481
yaml : & Yaml
470
482
) {
483
+ // By default, present if send_transaction is set to true. Can be overridden
484
+ // by a field in the pipeline's root.
485
+ let present = yaml[ "present" ] . as_bool ( ) . unwrap_or ( send_transaction) ;
486
+
471
487
// Don't allow referencing clips between pipelines for now.
472
488
self . user_clip_id_map . clear ( ) ;
473
489
self . user_clipchain_id_map . clear ( ) ;
474
490
self . user_spatial_id_map . clear ( ) ;
475
491
self . spatial_id_stack . clear ( ) ;
476
492
self . spatial_id_stack . push ( SpatialId :: root_scroll_node ( pipeline_id) ) ;
477
493
478
- let mut builder = DisplayListBuilder :: new ( pipeline_id) ;
479
494
builder. begin ( ) ;
480
495
let mut info = CommonItemProperties {
481
496
clip_rect : LayoutRect :: zero ( ) ,
482
497
clip_chain_id : ClipChainId :: INVALID ,
483
498
spatial_id : SpatialId :: new ( 0 , PipelineId :: dummy ( ) ) ,
484
499
flags : PrimitiveFlags :: default ( ) ,
485
500
} ;
486
- self . add_stacking_context_from_yaml ( & mut builder, wrench, yaml, IsRoot ( true ) , & mut info) ;
487
- self . display_lists . push ( builder. end ( ) ) ;
501
+ self . add_stacking_context_from_yaml ( builder, wrench, yaml, IsRoot ( true ) , & mut info) ;
502
+ let ( pipeline, payload) = builder. end ( ) ;
503
+ self . display_lists . push ( DisplayList {
504
+ pipeline,
505
+ payload,
506
+ present,
507
+ send_transaction,
508
+ } ) ;
488
509
489
510
assert_eq ! ( self . spatial_id_stack. len( ) , 1 ) ;
490
511
}
@@ -2139,15 +2160,14 @@ impl WrenchThing for YamlFrameReader {
2139
2160
if should_build_yaml || wrench. should_rebuild_display_lists ( ) {
2140
2161
wrench. begin_frame ( ) ;
2141
2162
wrench. send_lists (
2142
- self . frame_count ,
2163
+ & mut self . frame_count ,
2143
2164
self . display_lists . clone ( ) ,
2144
2165
& self . scroll_offsets ,
2145
2166
) ;
2146
2167
} else {
2147
2168
wrench. refresh ( ) ;
2148
2169
}
2149
2170
2150
- self . frame_count += 1 ;
2151
2171
self . frame_count
2152
2172
}
2153
2173
0 commit comments