diff options
author | bors-servo <infra@servo.org> | 2023-07-10 20:35:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 20:35:59 +0200 |
commit | 71c3b34384030dcb734b268ec2eb693be807b3f7 (patch) | |
tree | e4344d74de73bf1b120a4f21929e5d3b802141af /components/layout_thread | |
parent | 734d8b3d49aff8f15f2cb63e85817576dd54232c (diff) | |
parent | 3230162fd0ac96dea77c683b2067ae65ec7ed0b4 (diff) | |
download | servo-71c3b34384030dcb734b268ec2eb693be807b3f7.tar.gz servo-71c3b34384030dcb734b268ec2eb693be807b3f7.zip |
Auto merge of #29987 - mrobinson:normalize-more-webrender-use-statements, r=jdm
normalize more webrender use statements
- Use the WebRender clip chain API
- Use explicit WebRender hit test items in legacy layout
- Try to `use` WebRender types more
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes do not require tests because they do not change behavior.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/layout_thread')
-rw-r--r-- | components/layout_thread/lib.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 4ada89155ee..3d0bc1a1cc7 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -117,6 +117,7 @@ use style::traversal_flags::TraversalFlags; use style_traits::CSSPixel; use style_traits::DevicePixel; use style_traits::SpeculativePainter; +use webrender_api::{units, ColorF, HitTestFlags, ScrollClamping}; /// Information needed by the layout thread. pub struct LayoutThread { @@ -1060,7 +1061,7 @@ impl LayoutThread { debug!("Layout done!"); - let viewport_size = webrender_api::units::LayoutSize::new( + let viewport_size = units::LayoutSize::new( self.viewport_size.width.to_f32_px(), self.viewport_size.height.to_f32_px(), ); @@ -1471,15 +1472,15 @@ impl LayoutThread { &QueryMsg::StyleQuery => {}, &QueryMsg::NodesFromPointQuery(client_point, ref reflow_goal) => { let mut flags = match reflow_goal { - &NodesFromPointQueryType::Topmost => webrender_api::HitTestFlags::empty(), - &NodesFromPointQueryType::All => webrender_api::HitTestFlags::FIND_ALL, + &NodesFromPointQueryType::Topmost => HitTestFlags::empty(), + &NodesFromPointQueryType::All => HitTestFlags::FIND_ALL, }; // The point we get is not relative to the entire WebRender scene, but to this // particular pipeline, so we need to tell WebRender about that. - flags.insert(webrender_api::HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT); + flags.insert(HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT); - let client_point = webrender_api::units::WorldPoint::from_untyped(client_point); + let client_point = units::WorldPoint::from_untyped(client_point); let results = self.webrender_api.hit_test( Some(self.id.to_webrender()), client_point, @@ -1516,9 +1517,9 @@ impl LayoutThread { let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y); self.webrender_api.send_scroll_node( - webrender_api::units::LayoutPoint::from_untyped(point), + units::LayoutPoint::from_untyped(point), state.scroll_id, - webrender_api::ScrollClamping::ToContentBounds, + ScrollClamping::ToContentBounds, ); } @@ -1769,8 +1770,8 @@ impl ProfilerMetadataFactory for LayoutThread { // clearing the frame buffer to white. This ensures that setting a background // color on an iframe element, while the iframe content itself has a default // transparent background color is handled correctly. -fn get_root_flow_background_color(flow: &mut dyn Flow) -> webrender_api::ColorF { - let transparent = webrender_api::ColorF { +fn get_root_flow_background_color(flow: &mut dyn Flow) -> ColorF { + let transparent = ColorF { r: 0.0, g: 0.0, b: 0.0, @@ -1797,7 +1798,7 @@ fn get_root_flow_background_color(flow: &mut dyn Flow) -> webrender_api::ColorF .get_background() .background_color, ); - webrender_api::ColorF::new( + ColorF::new( color.red_f32(), color.green_f32(), color.blue_f32(), |