diff options
Diffstat (limited to 'third_party/webrender/wrench/src/rawtest.rs')
-rw-r--r-- | third_party/webrender/wrench/src/rawtest.rs | 105 |
1 files changed, 56 insertions, 49 deletions
diff --git a/third_party/webrender/wrench/src/rawtest.rs b/third_party/webrender/wrench/src/rawtest.rs index b86b5836176..f0315155b17 100644 --- a/third_party/webrender/wrench/src/rawtest.rs +++ b/third_party/webrender/wrench/src/rawtest.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use std::sync::atomic::{AtomicIsize, Ordering}; use std::sync::mpsc::Receiver; use webrender::api::*; -use webrender::render_api::*; use webrender::api::units::*; use crate::{WindowWrapper, NotifierEvent}; use crate::blob; @@ -107,7 +106,7 @@ impl<'a> RawtestHarness<'a> { ); epoch.0 += 1; - txn.generate_frame(0); + txn.generate_frame(); self.wrench.api.send_transaction(self.wrench.document_id, txn); } @@ -118,6 +117,7 @@ impl<'a> RawtestHarness<'a> { clip_id: space_and_clip.clip_id, spatial_id: space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, } } @@ -132,6 +132,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, } } @@ -154,7 +155,7 @@ impl<'a> RawtestHarness<'a> { None, ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 0.0, 64.0, 64.0)); builder.push_image( @@ -181,7 +182,7 @@ impl<'a> RawtestHarness<'a> { &DirtyRect::All, ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 0.0, 1024.0, 1024.0)); builder.push_image( @@ -206,7 +207,7 @@ impl<'a> RawtestHarness<'a> { &DirtyRect::All, ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 0.0, 1024.0, 1024.0)); builder.push_image( @@ -242,7 +243,7 @@ impl<'a> RawtestHarness<'a> { Some(128), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(448.899994, 74.0, 151.000031, 56.)); @@ -306,7 +307,7 @@ impl<'a> RawtestHarness<'a> { called_inner.fetch_add(1, Ordering::SeqCst); }); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let root_space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id); let clip_id = builder.define_clip_rect( @@ -319,6 +320,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id: root_space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; // setup some malicious image size parameters @@ -389,7 +391,7 @@ impl<'a> RawtestHarness<'a> { Some(100), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let image_size = size2(400.0, 400.0); @@ -404,6 +406,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id: root_space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; builder.push_repeating_image( @@ -485,7 +488,7 @@ impl<'a> RawtestHarness<'a> { Some(128), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let root_space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id); let clip_id = builder.define_clip_rect( @@ -498,6 +501,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id: root_space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; builder.push_repeating_image( @@ -529,7 +533,7 @@ impl<'a> RawtestHarness<'a> { size: size2(400, 400), }); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let root_space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id); let clip_id = builder.define_clip_rect( @@ -542,6 +546,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id: root_space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; builder.push_repeating_image( @@ -575,7 +580,7 @@ impl<'a> RawtestHarness<'a> { Some(128), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let root_space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id); let clip_id = builder.define_clip_rect( @@ -588,6 +593,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id: root_space_and_clip.spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; builder.push_repeating_image( @@ -640,7 +646,7 @@ impl<'a> RawtestHarness<'a> { None, ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0., 0.0, 1510., 1510.)); @@ -666,7 +672,7 @@ impl<'a> RawtestHarness<'a> { let mut epoch = Epoch(1); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(-10000., 0.0, 1510., 1510.)); @@ -698,7 +704,7 @@ impl<'a> RawtestHarness<'a> { &rect(10, 10, 100, 100).into(), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0., 0.0, 1510., 1510.)); @@ -765,7 +771,7 @@ impl<'a> RawtestHarness<'a> { }); // draw the blob the first time - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 60.0, 200.0, 200.0)); builder.push_image( @@ -788,7 +794,7 @@ impl<'a> RawtestHarness<'a> { // draw the blob image a second time at a different location // make a new display list that refers to the first image - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(1.0, 60.0, 200.0, 200.0)); builder.push_image( &info, @@ -872,7 +878,7 @@ impl<'a> RawtestHarness<'a> { }); // create two blob images and draw them - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 60.0, 200.0, 200.0)); let info2 = self.make_common_properties(rect(200.0, 60.0, 200.0, 200.0)); let push_images = |builder: &mut DisplayListBuilder| { @@ -918,7 +924,7 @@ impl<'a> RawtestHarness<'a> { &rect(100, 100, 100, 100).into(), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); push_images(&mut builder); self.submit_dl(&mut epoch, layout_size, builder, txn); let _pixels_second = self.render_and_get_pixels(window_rect); @@ -933,7 +939,7 @@ impl<'a> RawtestHarness<'a> { &rect(200, 200, 100, 100).into(), ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); push_images(&mut builder); self.submit_dl(&mut epoch, layout_size, builder, txn); let _pixels_third = self.render_and_get_pixels(window_rect); @@ -972,7 +978,7 @@ impl<'a> RawtestHarness<'a> { }; // draw the blobs the first time - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 60.0, 200.0, 200.0)); builder.push_image( @@ -1000,7 +1006,7 @@ impl<'a> RawtestHarness<'a> { ); // make a new display list that refers to the first image - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 60.0, 200.0, 200.0)); builder.push_image( &info, @@ -1025,7 +1031,7 @@ impl<'a> RawtestHarness<'a> { ); // make a new display list that refers to the first image - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(0.0, 60.0, 200.0, 200.0)); builder.push_image( &info, @@ -1056,7 +1062,7 @@ impl<'a> RawtestHarness<'a> { let layout_size = LayoutSize::new(400., 400.); let mut do_test = |should_try_and_fail| { - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let spatial_id = SpatialId::root_scroll_node(self.wrench.root_pipeline_id); let clip_id = builder.define_clip_rect( @@ -1104,6 +1110,7 @@ impl<'a> RawtestHarness<'a> { clip_id, spatial_id, flags: PrimitiveFlags::default(), + hit_info: None, }; builder.push_line( &info, @@ -1159,7 +1166,7 @@ impl<'a> RawtestHarness<'a> { let layout_size = LayoutSize::new(400., 400.); let mut do_test = |shadow_is_red| { - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let shadow_color = if shadow_is_red { ColorF::new(1.0, 0.0, 0.0, 1.0) } else { @@ -1218,7 +1225,7 @@ impl<'a> RawtestHarness<'a> { None, ); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(rect(300.0, 70.0, 150.0, 50.0)); builder.push_image( @@ -1239,7 +1246,7 @@ impl<'a> RawtestHarness<'a> { builder.finalize(), false, ); - txn.generate_frame(0); + txn.generate_frame(); self.wrench.api.send_transaction(self.wrench.document_id, txn); @@ -1250,7 +1257,7 @@ impl<'a> RawtestHarness<'a> { // 3. set a different scene - builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let mut txn = Transaction::new(); txn.set_display_list( @@ -1274,7 +1281,7 @@ impl<'a> RawtestHarness<'a> { // 6. rebuild the scene and compare again let mut txn = Transaction::new(); txn.set_root_pipeline(captured.root_pipeline_id.unwrap()); - txn.generate_frame(0); + txn.generate_frame(); self.wrench.api.send_transaction(captured.document_id, txn); let pixels2 = self.render_and_get_pixels(window_rect); self.compare_pixels(pixels0, pixels2, window_rect.size); @@ -1285,9 +1292,9 @@ impl<'a> RawtestHarness<'a> { let layout_size = LayoutSize::new(120.0, 0.0); let window_size = DeviceIntSize::new(layout_size.width as i32, layout_size.height as i32); - let doc_id = self.wrench.api.add_document(window_size); + let doc_id = self.wrench.api.add_document(window_size, 1); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let info = self.make_common_properties(LayoutRect::new(LayoutPoint::zero(), LayoutSize::new(100.0, 100.0))); builder.push_rect( @@ -1305,12 +1312,12 @@ impl<'a> RawtestHarness<'a> { builder.finalize(), false, ); - txn.generate_frame(0); + txn.generate_frame(); self.wrench.api.send_transaction(doc_id, txn); // Ensure we get a notification from rendering the above, even though // there are zero visible pixels - assert!(self.rx.recv().unwrap() == NotifierEvent::WakeUp { composite_needed: true }); + assert!(self.rx.recv().unwrap() == NotifierEvent::WakeUp); } @@ -1318,24 +1325,20 @@ impl<'a> RawtestHarness<'a> { println!("\thit testing test..."); let layout_size = LayoutSize::new(400., 400.); - let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); // Add a rectangle that covers the entire scene. - let info = self.make_common_properties(LayoutRect::new(LayoutPoint::zero(), layout_size)); - builder.push_hit_test( - &info, - (0, 1), - ); + let mut info = self.make_common_properties(LayoutRect::new(LayoutPoint::zero(), layout_size)); + info.hit_info = Some((0, 1)); + builder.push_rect(&info, info.clip_rect, ColorF::new(1.0, 1.0, 1.0, 1.0)); // Add a simple 100x100 rectangle at 100,0. - let info = self.make_common_properties(LayoutRect::new( + let mut info = self.make_common_properties(LayoutRect::new( LayoutPoint::new(100., 0.), LayoutSize::new(100., 100.) )); - builder.push_hit_test( - &info, - (0, 2), - ); + info.hit_info = Some((0, 2)); + builder.push_rect(&info, info.clip_rect, ColorF::new(1.0, 1.0, 1.0, 1.0)); let space_and_clip = SpaceAndClipInfo::root_scroll(self.wrench.root_pipeline_id); @@ -1353,14 +1356,16 @@ impl<'a> RawtestHarness<'a> { &space_and_clip, make_rounded_complex_clip(&rect, 20.), ); - builder.push_hit_test( + builder.push_rect( &CommonItemProperties { + hit_info: Some((0, 4)), clip_rect: rect, clip_id: temp_clip_id, spatial_id: space_and_clip.spatial_id, flags: PrimitiveFlags::default(), }, - (0, 4), + rect, + ColorF::new(1.0, 1.0, 1.0, 1.0), ); // Add a rectangle that is clipped by a ClipChain containing a rounded rect. @@ -1370,14 +1375,16 @@ impl<'a> RawtestHarness<'a> { make_rounded_complex_clip(&rect, 20.), ); let clip_chain_id = builder.define_clip_chain(None, vec![clip_id]); - builder.push_hit_test( + builder.push_rect( &CommonItemProperties { + hit_info: Some((0, 5)), clip_rect: rect, clip_id: ClipId::ClipChain(clip_chain_id), spatial_id: space_and_clip.spatial_id, flags: PrimitiveFlags::default(), }, - (0, 5), + rect, + ColorF::new(1.0, 1.0, 1.0, 1.0), ); let mut epoch = Epoch(0); @@ -1393,7 +1400,7 @@ impl<'a> RawtestHarness<'a> { self.wrench.document_id, None, point, - HitTetFlags::empty(), + HitTestFlags::FIND_ALL, ) }; @@ -1444,7 +1451,7 @@ impl<'a> RawtestHarness<'a> { self.wrench.api.send_message(ApiMsg::DebugCommand(DebugCommand::ClearCaches(ClearCache::all()))); let layout_size = LayoutSize::new(400., 400.); - let builder = DisplayListBuilder::new(self.wrench.root_pipeline_id); + let builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size); let txn = Transaction::new(); let mut epoch = Epoch(0); |