diff --git a/direct-composition/src/main_windows.rs b/direct-composition/src/main_windows.rs index 44e20e4cee..dcdca12f87 100644 --- a/direct-composition/src/main_windows.rs +++ b/direct-composition/src/main_windows.rs @@ -158,6 +158,7 @@ impl Rectangle { clip_id, }, ), + rect, self.color, ); diff --git a/example-compositor/compositor/src/main.rs b/example-compositor/compositor/src/main.rs index cd992220d1..f87b28a6bc 100644 --- a/example-compositor/compositor/src/main.rs +++ b/example-compositor/compositor/src/main.rs @@ -210,6 +210,7 @@ fn push_rotated_rect( clip_id: ClipId::root(root_pipeline_id), }, ), + rect, color, ); } @@ -248,6 +249,7 @@ fn build_display_list( LayoutRect::new(LayoutPoint::zero(), layout_size).inflate(-10.0, -10.0), fixed_space_info, ), + LayoutRect::new(LayoutPoint::zero(), layout_size).inflate(-10.0, -10.0), ColorF::new(0.8, 0.8, 0.8, 1.0), ); diff --git a/examples/alpha_perf.rs b/examples/alpha_perf.rs index 5a4ab1eb10..c7db98e0e0 100644 --- a/examples/alpha_perf.rs +++ b/examples/alpha_perf.rs @@ -43,6 +43,7 @@ impl Example for App { for _ in 0 .. self.rect_count { builder.push_rect( &CommonItemProperties::new(bounds, space_and_clip), + bounds, ColorF::new(1.0, 1.0, 1.0, 0.05) ); } diff --git a/examples/animation.rs b/examples/animation.rs index d442ab0309..00f3534ff7 100644 --- a/examples/animation.rs +++ b/examples/animation.rs @@ -95,6 +95,7 @@ impl App { clip_id, } ), + LayoutRect::new(LayoutPoint::zero(), bounds.size), color, ); diff --git a/examples/basic.rs b/examples/basic.rs index 3f31d52d23..8369c5b40e 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -229,6 +229,7 @@ impl Example for App { (100, 100).to(200, 200), SpaceAndClipInfo { spatial_id, clip_id }, ), + (100, 100).to(200, 200), ColorF::new(0.0, 1.0, 0.0, 1.0), ); @@ -237,6 +238,7 @@ impl Example for App { (250, 100).to(350, 200), SpaceAndClipInfo { spatial_id, clip_id }, ), + (250, 100).to(350, 200), ColorF::new(0.0, 1.0, 0.0, 1.0), ); let border_side = BorderSide { diff --git a/examples/document.rs b/examples/document.rs index ea11ec5187..5f8712ff39 100644 --- a/examples/document.rs +++ b/examples/document.rs @@ -122,6 +122,7 @@ impl Example for App { ); builder.push_rect( &CommonItemProperties::new(local_rect, space_and_clip), + local_rect, doc.color, ); builder.pop_stacking_context(); diff --git a/examples/frame_output.rs b/examples/frame_output.rs index e1b889243a..f9902ae8e9 100644 --- a/examples/frame_output.rs +++ b/examples/frame_output.rs @@ -124,6 +124,7 @@ impl App { builder.push_rect( &CommonItemProperties::new(document.content_rect, space_and_clip), + document.content_rect, ColorF::new(1.0, 1.0, 0.0, 1.0) ); builder.pop_stacking_context(); diff --git a/examples/iframe.rs b/examples/iframe.rs index c5cb38120c..aa1bec956e 100644 --- a/examples/iframe.rs +++ b/examples/iframe.rs @@ -47,6 +47,7 @@ impl Example for App { // green rect visible == success sub_builder.push_rect( &CommonItemProperties::new(sub_bounds, space_and_clip), + sub_bounds, ColorF::new(0.0, 1.0, 0.0, 1.0) ); sub_builder.pop_stacking_context(); @@ -79,6 +80,7 @@ impl Example for App { // red rect under the iframe: if this is visible, things have gone wrong builder.push_rect( &CommonItemProperties::new(sub_bounds, space_and_clip), + sub_bounds, ColorF::new(1.0, 0.0, 0.0, 1.0) ); builder.push_iframe(sub_bounds, sub_bounds, &space_and_clip, sub_pipeline_id, false); diff --git a/examples/multiwindow.rs b/examples/multiwindow.rs index 84a123fde4..738a27e069 100644 --- a/examples/multiwindow.rs +++ b/examples/multiwindow.rs @@ -201,6 +201,10 @@ impl Window { ), space_and_clip, ), + LayoutRect::new( + LayoutPoint::new(100.0, 200.0), + LayoutSize::new(100.0, 200.0), + ), ColorF::new(0.0, 1.0, 0.0, 1.0)); let text_bounds = LayoutRect::new( diff --git a/examples/scrolling.rs b/examples/scrolling.rs index 21cda52497..05aa5b6e6c 100644 --- a/examples/scrolling.rs +++ b/examples/scrolling.rs @@ -64,12 +64,12 @@ impl Example for App { // start with a white background let mut info = CommonItemProperties::new((0, 0).to(1000, 1000), space_and_clip1); info.hit_info = Some((0, 1)); - builder.push_rect(&info, ColorF::new(1.0, 1.0, 1.0, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(1.0, 1.0, 1.0, 1.0)); // let's make a 50x50 blue square as a visual reference let mut info = CommonItemProperties::new((0, 0).to(50, 50), space_and_clip1); info.hit_info = Some((0, 2)); - builder.push_rect(&info, ColorF::new(0.0, 0.0, 1.0, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 0.0, 1.0, 1.0)); // and a 50x50 green square next to it with an offset clip // to see what that looks like @@ -78,7 +78,7 @@ impl Example for App { space_and_clip1, ); info.hit_info = Some((0, 3)); - builder.push_rect(&info, ColorF::new(0.0, 1.0, 0.0, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 0.0, 1.0)); // Below the above rectangles, set up a nested scrollbox. It's still in // the same stacking context, so note that the rects passed in need to @@ -101,13 +101,13 @@ impl Example for App { space_and_clip2, ); info.hit_info = Some((0, 4)); - builder.push_rect(&info, ColorF::new(0.5, 0.5, 0.5, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(0.5, 0.5, 0.5, 1.0)); // add a teal square to visualize the scrolling/clipping behaviour // as you scroll the nested scrollbox let mut info = CommonItemProperties::new((0, 200).to(50, 250), space_and_clip2); info.hit_info = Some((0, 5)); - builder.push_rect(&info, ColorF::new(0.0, 1.0, 1.0, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 1.0, 1.0)); // Add a sticky frame. It will "stick" twice while scrolling, once // at a margin of 10px from the bottom, for 40 pixels of scrolling, @@ -132,6 +132,7 @@ impl Example for App { info.hit_info = Some((0, 6)); builder.push_rect( &info, + info.clip_rect, ColorF::new(0.5, 0.5, 1.0, 1.0), ); @@ -142,7 +143,7 @@ impl Example for App { space_and_clip2, ); info.hit_info = Some((0, 7)); - builder.push_rect(&info, ColorF::new(0.0, 1.0, 1.0, 1.0)); + builder.push_rect(&info, info.clip_rect, ColorF::new(0.0, 1.0, 1.0, 1.0)); builder.pop_stacking_context(); } diff --git a/webrender/src/scene_building.rs b/webrender/src/scene_building.rs index 2dc898e156..37c407a23d 100644 --- a/webrender/src/scene_building.rs +++ b/webrender/src/scene_building.rs @@ -1194,9 +1194,9 @@ impl<'a> SceneBuilder<'a> { ); } DisplayItem::Rectangle(ref info) => { - let (layout, _, clip_and_scroll) = self.process_common_properties( + let (layout, _, clip_and_scroll) = self.process_common_properties_with_bounds( &info.common, - None, + &info.bounds, apply_pipeline_clip, ); @@ -1220,9 +1220,9 @@ impl<'a> SceneBuilder<'a> { ); } DisplayItem::ClearRectangle(ref info) => { - let (layout, _, clip_and_scroll) = self.process_common_properties( + let (layout, _, clip_and_scroll) = self.process_common_properties_with_bounds( &info.common, - None, + &info.bounds, apply_pipeline_clip, ); diff --git a/webrender_api/src/display_item.rs b/webrender_api/src/display_item.rs index 3d54a37247..39f2f9245e 100644 --- a/webrender_api/src/display_item.rs +++ b/webrender_api/src/display_item.rs @@ -295,6 +295,7 @@ pub struct ScrollFrameDisplayItem { #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pub struct RectangleDisplayItem { pub common: CommonItemProperties, + pub bounds: LayoutRect, pub color: PropertyBinding, } @@ -303,6 +304,7 @@ pub struct RectangleDisplayItem { #[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)] pub struct ClearRectangleDisplayItem { pub common: CommonItemProperties, + pub bounds: LayoutRect, } /// A minimal hit-testable item for the parent browser's convenience, and is diff --git a/webrender_api/src/display_list.rs b/webrender_api/src/display_list.rs index eddd9b3e9a..5e463b6884 100644 --- a/webrender_api/src/display_list.rs +++ b/webrender_api/src/display_list.rs @@ -1189,11 +1189,13 @@ impl DisplayListBuilder { pub fn push_rect( &mut self, common: &di::CommonItemProperties, + bounds: LayoutRect, color: ColorF, ) { let item = di::DisplayItem::Rectangle(di::RectangleDisplayItem { common: *common, color: PropertyBinding::Value(color), + bounds, }); self.push_item(&item); } @@ -1201,11 +1203,13 @@ impl DisplayListBuilder { pub fn push_rect_with_animation( &mut self, common: &di::CommonItemProperties, + bounds: LayoutRect, color: PropertyBinding, ) { let item = di::DisplayItem::Rectangle(di::RectangleDisplayItem { common: *common, color, + bounds, }); self.push_item(&item); } @@ -1213,9 +1217,11 @@ impl DisplayListBuilder { pub fn push_clear_rect( &mut self, common: &di::CommonItemProperties, + bounds: LayoutRect, ) { let item = di::DisplayItem::ClearRectangle(di::ClearRectangleDisplayItem { common: *common, + bounds, }); self.push_item(&item); } diff --git a/wrench/reftests/filters/filter-large-blur-radius.png b/wrench/reftests/filters/filter-large-blur-radius.png index ba1413f53f..3b0a501ded 100644 Binary files a/wrench/reftests/filters/filter-large-blur-radius.png and b/wrench/reftests/filters/filter-large-blur-radius.png differ diff --git a/wrench/reftests/filters/svg-filter-blur-transforms.png b/wrench/reftests/filters/svg-filter-blur-transforms.png index 6cac2f6f20..65a448e773 100644 Binary files a/wrench/reftests/filters/svg-filter-blur-transforms.png and b/wrench/reftests/filters/svg-filter-blur-transforms.png differ diff --git a/wrench/src/rawtest.rs b/wrench/src/rawtest.rs index bb270e31e4..bbd04eb25d 100644 --- a/wrench/src/rawtest.rs +++ b/wrench/src/rawtest.rs @@ -1087,6 +1087,7 @@ impl<'a> RawtestHarness<'a> { rect(100., 100., 100., 100.), clip_id, spatial_id), + rect(100., 100., 100., 100.), ColorF::new(0.0, 0.0, 1.0, 1.0), ); @@ -1107,6 +1108,7 @@ impl<'a> RawtestHarness<'a> { rect(110., 110., 50., 50.), clip_id, spatial_id), + rect(110., 110., 50., 50.), ColorF::new(0.0, 1.0, 0.0, 1.0), ); builder.push_shadow( @@ -1148,6 +1150,7 @@ impl<'a> RawtestHarness<'a> { rect(150., 150., 100., 100.), clip_id, spatial_id), + rect(150., 150., 100., 100.), ColorF::new(0.0, 0.0, 1.0, 1.0), ); builder.clear_save(); @@ -1313,6 +1316,7 @@ impl<'a> RawtestHarness<'a> { LayoutSize::new(100.0, 100.0))); builder.push_rect( &info, + info.clip_rect, ColorF::new(0.0, 1.0, 0.0, 1.0), ); @@ -1343,7 +1347,7 @@ impl<'a> RawtestHarness<'a> { // Add a rectangle that covers the entire scene. let mut info = self.make_common_properties(LayoutRect::new(LayoutPoint::zero(), layout_size)); info.hit_info = Some((0, 1)); - builder.push_rect(&info, ColorF::new(1.0, 1.0, 1.0, 1.0)); + 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 mut info = self.make_common_properties(LayoutRect::new( @@ -1351,7 +1355,7 @@ impl<'a> RawtestHarness<'a> { LayoutSize::new(100., 100.) )); info.hit_info = Some((0, 2)); - builder.push_rect(&info, ColorF::new(1.0, 1.0, 1.0, 1.0)); + 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); @@ -1379,6 +1383,7 @@ impl<'a> RawtestHarness<'a> { spatial_id: space_and_clip.spatial_id, flags: PrimitiveFlags::default(), }, + rect, ColorF::new(1.0, 1.0, 1.0, 1.0), ); @@ -1399,6 +1404,7 @@ impl<'a> RawtestHarness<'a> { spatial_id: space_and_clip.spatial_id, flags: PrimitiveFlags::default(), }, + rect, ColorF::new(1.0, 1.0, 1.0, 1.0), ); diff --git a/wrench/src/yaml_frame_reader.rs b/wrench/src/yaml_frame_reader.rs index 22ff0b801f..7e1779bb1a 100644 --- a/wrench/src/yaml_frame_reader.rs +++ b/wrench/src/yaml_frame_reader.rs @@ -955,7 +955,7 @@ impl YamlFrameReader { &mut self, dl: &mut DisplayListBuilder, item: &Yaml, - info: &mut CommonItemProperties, + info: &CommonItemProperties, ) { let bounds_key = if item["type"].is_badvalue() { "rect" @@ -963,26 +963,19 @@ impl YamlFrameReader { "bounds" }; - info.clip_rect = try_intersect!( - self.resolve_rect(&item[bounds_key]), - &info.clip_rect - ); - + let bounds = self.resolve_rect(&item[bounds_key]); let color = self.resolve_colorf(&item["color"], ColorF::BLACK); - dl.push_rect(&info, color); + dl.push_rect(&info, bounds, color); } fn handle_clear_rect( &mut self, dl: &mut DisplayListBuilder, item: &Yaml, - info: &mut CommonItemProperties, + info: &CommonItemProperties, ) { - info.clip_rect = try_intersect!( - item["bounds"].as_rect().expect("clear-rect type must have bounds"), - &info.clip_rect - ); - dl.push_clear_rect(&info); + let bounds = item["bounds"].as_rect().expect("clear-rect type must have bounds"); + dl.push_clear_rect(&info, bounds); } fn handle_hit_test(