mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Stop splitting scroll roots
Now that WebRender can handle splitting scrolling layers on its own, we don't need to do any work to split up scroll roots. This should also make it possible to handle overflow:scroll and containing block scroll roots in the future.
This commit is contained in:
parent
2f6cf2e9c8
commit
9d72e89ce3
5 changed files with 173 additions and 163 deletions
|
@ -16,14 +16,16 @@ use msg::constellation_msg::PipelineId;
|
|||
use style::computed_values::{image_rendering, mix_blend_mode};
|
||||
use style::computed_values::filter::{self, Filter};
|
||||
use style::values::computed::BorderStyle;
|
||||
use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform};
|
||||
use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform, ScrollLayerId};
|
||||
|
||||
pub trait WebRenderDisplayListConverter {
|
||||
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder;
|
||||
}
|
||||
|
||||
trait WebRenderDisplayItemConverter {
|
||||
fn convert_to_webrender(&self, builder: &mut DisplayListBuilder);
|
||||
fn convert_to_webrender(&self,
|
||||
builder: &mut DisplayListBuilder,
|
||||
current_scroll_root_id: &mut ScrollRootId);
|
||||
}
|
||||
|
||||
trait ToBorderStyle {
|
||||
|
@ -212,16 +214,31 @@ impl ToFilterOps for filter::T {
|
|||
impl WebRenderDisplayListConverter for DisplayList {
|
||||
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder {
|
||||
let traversal = DisplayListTraversal::new(self);
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id.to_webrender());
|
||||
let webrender_pipeline_id = pipeline_id.to_webrender();
|
||||
let mut builder = DisplayListBuilder::new(webrender_pipeline_id);
|
||||
|
||||
let mut current_scroll_root_id = ScrollRootId::root();
|
||||
builder.push_clip_id(current_scroll_root_id.convert_to_webrender(webrender_pipeline_id));
|
||||
|
||||
for item in traversal {
|
||||
item.convert_to_webrender(&mut builder);
|
||||
item.convert_to_webrender(&mut builder, &mut current_scroll_root_id);
|
||||
}
|
||||
builder
|
||||
}
|
||||
}
|
||||
|
||||
impl WebRenderDisplayItemConverter for DisplayItem {
|
||||
fn convert_to_webrender(&self, builder: &mut DisplayListBuilder) {
|
||||
fn convert_to_webrender(&self,
|
||||
builder: &mut DisplayListBuilder,
|
||||
current_scroll_root_id: &mut ScrollRootId) {
|
||||
let scroll_root_id = self.base().scroll_root_id;
|
||||
if scroll_root_id != *current_scroll_root_id {
|
||||
let pipeline_id = builder.pipeline_id;
|
||||
builder.pop_clip_id();
|
||||
builder.push_clip_id(scroll_root_id.convert_to_webrender(pipeline_id));
|
||||
*current_scroll_root_id = scroll_root_id;
|
||||
}
|
||||
|
||||
match *self {
|
||||
DisplayItem::SolidColor(ref item) => {
|
||||
let color = item.color;
|
||||
|
@ -403,21 +420,26 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
vec![],
|
||||
None);
|
||||
|
||||
builder.push_scroll_layer(clip,
|
||||
item.scroll_root.size.to_sizef(),
|
||||
Some(item.scroll_root.id.convert_to_webrender()));
|
||||
let provided_id = ScrollLayerId::new(item.scroll_root.id.0, builder.pipeline_id);
|
||||
let id = builder.define_clip(clip,
|
||||
item.scroll_root.size.to_sizef(),
|
||||
Some(provided_id));
|
||||
debug_assert!(provided_id == id);
|
||||
}
|
||||
DisplayItem::PopScrollRoot(_) => builder.pop_scroll_layer(),
|
||||
DisplayItem::PopScrollRoot(_) => {} //builder.pop_scroll_layer(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait WebRenderScrollRootIdConverter {
|
||||
fn convert_to_webrender(&self) -> webrender_traits::ServoScrollRootId;
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId;
|
||||
}
|
||||
|
||||
impl WebRenderScrollRootIdConverter for ScrollRootId {
|
||||
fn convert_to_webrender(&self) -> webrender_traits::ServoScrollRootId {
|
||||
webrender_traits::ServoScrollRootId(self.0)
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId {
|
||||
if *self == ScrollRootId::root() {
|
||||
ScrollLayerId::root_scroll_layer(pipeline_id)
|
||||
} else {
|
||||
ScrollLayerId::new(self.0, pipeline_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue