Skip to content
Permalink
Browse files

Replace the WebRenderDisplayItemConverter trait with an inherent method

  • Loading branch information...
SimonSapin committed Sep 6, 2019
1 parent e852d02 commit 526619a78aa88944e917ab97c0f969eceea3ebc7
@@ -8,7 +8,6 @@ pub use self::builder::IndexableText;
pub use self::builder::StackingContextCollectionFlags;
pub use self::builder::StackingContextCollectionState;
pub use self::conversions::ToLayout;
pub use self::webrender_helpers::WebRenderDisplayListConverter;

mod background;
mod border;
@@ -17,28 +17,15 @@ use webrender_api::{
RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext,
};

pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
}

struct ClipScrollState {
clip_ids: Vec<Option<ClipId>>,
spatial_ids: Vec<Option<SpatialId>>,
active_clip_id: ClipId,
active_spatial_id: SpatialId,
}

trait WebRenderDisplayItemConverter {
fn convert_to_webrender(
&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 {
impl DisplayList {
pub fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
let mut clip_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(
&mut self,
clip_scroll_nodes: &[ClipScrollNode],
@@ -2,7 +2,5 @@
* 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/. */

pub use self::webrender_helpers::WebRenderDisplayListConverter;

pub mod items;
mod webrender_helpers;
@@ -7,12 +7,8 @@ use msg::constellation_msg::PipelineId;
use webrender_api::units::LayoutSize;
use webrender_api::{self, DisplayListBuilder};

pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
}

impl WebRenderDisplayListConverter for DisplayList {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
impl DisplayList {
pub fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder {
let webrender_pipeline = pipeline_id.to_webrender();

let builder = DisplayListBuilder::with_capacity(
@@ -45,7 +45,7 @@ use layout::context::LayoutContext;
use layout::context::RegisteredPainter;
use layout::context::RegisteredPainters;
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_ref::FlowRef;
use layout::incremental::{RelayoutMode, SpecialRestyleDamage};
@@ -38,7 +38,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout::context::LayoutContext;
use layout::display_list::items::DisplayList;
use layout::display_list::WebRenderDisplayListConverter;
use layout::query::{
process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData,
};

0 comments on commit 526619a

Please sign in to comment.
You can’t perform that action at this time.