Replace the WebRenderDisplayItemConverter trait with an inherent method

This commit is contained in:
Simon Sapin 2019-09-06 16:59:11 +02:00
parent e852d02f1c
commit 526619a78a
6 changed files with 6 additions and 27 deletions

View file

@ -8,7 +8,6 @@ pub use self::builder::IndexableText;
pub use self::builder::StackingContextCollectionFlags; pub use self::builder::StackingContextCollectionFlags;
pub use self::builder::StackingContextCollectionState; pub use self::builder::StackingContextCollectionState;
pub use self::conversions::ToLayout; pub use self::conversions::ToLayout;
pub use self::webrender_helpers::WebRenderDisplayListConverter;
mod background; mod background;
mod border; mod border;

View file

@ -17,10 +17,6 @@ use webrender_api::{
RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext, RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext,
}; };
pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
}
struct ClipScrollState { struct ClipScrollState {
clip_ids: Vec<Option<ClipId>>, clip_ids: Vec<Option<ClipId>>,
spatial_ids: Vec<Option<SpatialId>>, spatial_ids: Vec<Option<SpatialId>>,
@ -28,17 +24,8 @@ struct ClipScrollState {
active_spatial_id: SpatialId, active_spatial_id: SpatialId,
} }
trait WebRenderDisplayItemConverter { impl DisplayList {
fn convert_to_webrender( pub fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
&mut self,
clip_scroll_nodes: &[ClipScrollNode],
state: &mut ClipScrollState,
builder: &mut DisplayListBuilder,
);
}
impl WebRenderDisplayListConverter for DisplayList {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
let mut clip_ids = vec![None; self.clip_scroll_nodes.len()]; let mut clip_ids = vec![None; self.clip_scroll_nodes.len()];
let mut spatial_ids = vec![None; self.clip_scroll_nodes.len()]; let mut spatial_ids = vec![None; self.clip_scroll_nodes.len()];
@ -75,7 +62,7 @@ impl WebRenderDisplayListConverter for DisplayList {
} }
} }
impl WebRenderDisplayItemConverter for DisplayItem { impl DisplayItem {
fn convert_to_webrender( fn convert_to_webrender(
&mut self, &mut self,
clip_scroll_nodes: &[ClipScrollNode], clip_scroll_nodes: &[ClipScrollNode],

View file

@ -2,7 +2,5 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
pub use self::webrender_helpers::WebRenderDisplayListConverter;
pub mod items; pub mod items;
mod webrender_helpers; mod webrender_helpers;

View file

@ -7,12 +7,8 @@ use msg::constellation_msg::PipelineId;
use webrender_api::units::LayoutSize; use webrender_api::units::LayoutSize;
use webrender_api::{self, DisplayListBuilder}; use webrender_api::{self, DisplayListBuilder};
pub trait WebRenderDisplayListConverter { impl DisplayList {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder; pub fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
}
impl WebRenderDisplayListConverter for DisplayList {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
let webrender_pipeline = pipeline_id.to_webrender(); let webrender_pipeline = pipeline_id.to_webrender();
let builder = DisplayListBuilder::with_capacity( let builder = DisplayListBuilder::with_capacity(

View file

@ -45,7 +45,7 @@ use layout::context::LayoutContext;
use layout::context::RegisteredPainter; use layout::context::RegisteredPainter;
use layout::context::RegisteredPainters; use layout::context::RegisteredPainters;
use layout::display_list::items::{OpaqueNode, WebRenderImageInfo}; use layout::display_list::items::{OpaqueNode, WebRenderImageInfo};
use layout::display_list::{IndexableText, ToLayout, WebRenderDisplayListConverter}; use layout::display_list::{IndexableText, ToLayout};
use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils}; use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
use layout::flow_ref::FlowRef; use layout::flow_ref::FlowRef;
use layout::incremental::{RelayoutMode, SpecialRestyleDamage}; use layout::incremental::{RelayoutMode, SpecialRestyleDamage};

View file

@ -38,7 +38,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layout::context::LayoutContext; use layout::context::LayoutContext;
use layout::display_list::items::DisplayList; use layout::display_list::items::DisplayList;
use layout::display_list::WebRenderDisplayListConverter;
use layout::query::{ use layout::query::{
process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData,
}; };