mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Simplify the display list slightly
Now that WebRender uses an Iframe display item, we do not need the Noop item for the non-WebRender path. We can simply reuse the Iframe display item. Also remove the layer_id member from the LayeredItem struct, as it is unused.
This commit is contained in:
parent
e8aeebbac5
commit
474033c39f
3 changed files with 14 additions and 29 deletions
|
@ -744,7 +744,6 @@ pub enum DisplayItem {
|
||||||
LineClass(Box<LineDisplayItem>),
|
LineClass(Box<LineDisplayItem>),
|
||||||
BoxShadowClass(Box<BoxShadowDisplayItem>),
|
BoxShadowClass(Box<BoxShadowDisplayItem>),
|
||||||
LayeredItemClass(Box<LayeredItem>),
|
LayeredItemClass(Box<LayeredItem>),
|
||||||
NoopClass(Box<BaseDisplayItem>),
|
|
||||||
IframeClass(Box<IframeDisplayItem>),
|
IframeClass(Box<IframeDisplayItem>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,9 +1167,6 @@ pub struct LayeredItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub item: DisplayItem,
|
pub item: DisplayItem,
|
||||||
|
|
||||||
/// The id of the layer this item belongs to.
|
|
||||||
pub layer_id: LayerId,
|
|
||||||
|
|
||||||
/// The id of the layer this item belongs to.
|
/// The id of the layer this item belongs to.
|
||||||
pub layer_info: LayerInfo,
|
pub layer_info: LayerInfo,
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1247,6 @@ impl DisplayItem {
|
||||||
|
|
||||||
DisplayItem::LayeredItemClass(ref item) => item.item.draw_into_context(paint_context),
|
DisplayItem::LayeredItemClass(ref item) => item.item.draw_into_context(paint_context),
|
||||||
|
|
||||||
DisplayItem::NoopClass(_) => { }
|
|
||||||
DisplayItem::IframeClass(..) => {}
|
DisplayItem::IframeClass(..) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1275,6 @@ impl DisplayItem {
|
||||||
DisplayItem::LineClass(ref line) => &line.base,
|
DisplayItem::LineClass(ref line) => &line.base,
|
||||||
DisplayItem::BoxShadowClass(ref box_shadow) => &box_shadow.base,
|
DisplayItem::BoxShadowClass(ref box_shadow) => &box_shadow.base,
|
||||||
DisplayItem::LayeredItemClass(ref layered_item) => layered_item.item.base(),
|
DisplayItem::LayeredItemClass(ref layered_item) => layered_item.item.base(),
|
||||||
DisplayItem::NoopClass(ref base_item) => base_item,
|
|
||||||
DisplayItem::IframeClass(ref iframe) => &iframe.base,
|
DisplayItem::IframeClass(ref iframe) => &iframe.base,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1358,6 @@ impl fmt::Debug for DisplayItem {
|
||||||
DisplayItem::BoxShadowClass(_) => "BoxShadow".to_owned(),
|
DisplayItem::BoxShadowClass(_) => "BoxShadow".to_owned(),
|
||||||
DisplayItem::LayeredItemClass(ref layered_item) =>
|
DisplayItem::LayeredItemClass(ref layered_item) =>
|
||||||
format!("LayeredItem({:?})", layered_item.item),
|
format!("LayeredItem({:?})", layered_item.item),
|
||||||
DisplayItem::NoopClass(_) => "Noop".to_owned(),
|
|
||||||
DisplayItem::IframeClass(_) => "Iframe".to_owned(),
|
DisplayItem::IframeClass(_) => "Iframe".to_owned(),
|
||||||
},
|
},
|
||||||
self.bounds(),
|
self.bounds(),
|
||||||
|
|
|
@ -1141,28 +1141,22 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
SpecificFragmentInfo::Iframe(ref fragment_info) => {
|
SpecificFragmentInfo::Iframe(ref fragment_info) => {
|
||||||
if !stacking_relative_content_box.is_empty() {
|
if !stacking_relative_content_box.is_empty() {
|
||||||
|
let item = DisplayItem::IframeClass(box IframeDisplayItem {
|
||||||
|
base: BaseDisplayItem::new(
|
||||||
|
&stacking_relative_content_box,
|
||||||
|
DisplayItemMetadata::new(self.node,
|
||||||
|
&*self.style,
|
||||||
|
Cursor::DefaultCursor),
|
||||||
|
clip),
|
||||||
|
iframe: fragment_info.pipeline_id,
|
||||||
|
});
|
||||||
|
|
||||||
if opts::get().use_webrender {
|
if opts::get().use_webrender {
|
||||||
state.add_display_item(DisplayItem::IframeClass(box IframeDisplayItem {
|
state.add_display_item(item, DisplayListSection::Content);
|
||||||
base: BaseDisplayItem::new(
|
|
||||||
&stacking_relative_content_box,
|
|
||||||
DisplayItemMetadata::new(self.node,
|
|
||||||
&*self.style,
|
|
||||||
Cursor::DefaultCursor),
|
|
||||||
clip),
|
|
||||||
iframe: fragment_info.pipeline_id,
|
|
||||||
}), DisplayListSection::Content);
|
|
||||||
} else {
|
} else {
|
||||||
let layer_id = self.layer_id();
|
|
||||||
state.add_display_item(DisplayItem::LayeredItemClass(box LayeredItem {
|
state.add_display_item(DisplayItem::LayeredItemClass(box LayeredItem {
|
||||||
item: DisplayItem::NoopClass(
|
item: item,
|
||||||
box BaseDisplayItem::new(
|
layer_info: LayerInfo::new(self.layer_id(),
|
||||||
&stacking_relative_content_box,
|
|
||||||
DisplayItemMetadata::new(self.node,
|
|
||||||
&*self.style,
|
|
||||||
Cursor::DefaultCursor),
|
|
||||||
clip)),
|
|
||||||
layer_id: layer_id,
|
|
||||||
layer_info: LayerInfo::new(layer_id,
|
|
||||||
ScrollPolicy::Scrollable,
|
ScrollPolicy::Scrollable,
|
||||||
Some(fragment_info.pipeline_id),
|
Some(fragment_info.pipeline_id),
|
||||||
color::transparent()),
|
color::transparent()),
|
||||||
|
@ -1248,7 +1242,6 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
} else {
|
} else {
|
||||||
state.add_display_item(DisplayItem::LayeredItemClass(box LayeredItem {
|
state.add_display_item(DisplayItem::LayeredItemClass(box LayeredItem {
|
||||||
item: display_item,
|
item: display_item,
|
||||||
layer_id: layer_id,
|
|
||||||
layer_info: LayerInfo::new(layer_id,
|
layer_info: LayerInfo::new(layer_id,
|
||||||
ScrollPolicy::Scrollable,
|
ScrollPolicy::Scrollable,
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -504,8 +504,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
DisplayItem::LineClass(..) => {
|
DisplayItem::LineClass(..) => {
|
||||||
println!("TODO DisplayItem::LineClass");
|
println!("TODO DisplayItem::LineClass");
|
||||||
}
|
}
|
||||||
DisplayItem::LayeredItemClass(..) |
|
DisplayItem::LayeredItemClass(..) => {
|
||||||
DisplayItem::NoopClass(..) => {
|
|
||||||
panic!("Unexpected in webrender!");
|
panic!("Unexpected in webrender!");
|
||||||
}
|
}
|
||||||
DisplayItem::BoxShadowClass(ref item) => {
|
DisplayItem::BoxShadowClass(ref item) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue