mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Remove support for hiding compositor layers
This is currently unused, because we always know the size of the layer.
This commit is contained in:
parent
1f21d3bd2f
commit
601b8ec970
3 changed files with 3 additions and 31 deletions
|
@ -527,8 +527,7 @@ impl IOCompositor {
|
|||
point: Point2D<f32>) {
|
||||
let page_window = self.page_window();
|
||||
let (ask, move): (bool, bool) = match self.scene.root {
|
||||
Some(ref layer) if layer.extra_data.borrow().pipeline.id == pipeline_id &&
|
||||
!layer.extra_data.borrow().hidden => {
|
||||
Some(ref layer) if layer.extra_data.borrow().pipeline.id == pipeline_id => {
|
||||
(true,
|
||||
events::move(layer.clone(), pipeline_id, layer_id, point, page_window))
|
||||
}
|
||||
|
@ -746,7 +745,7 @@ impl IOCompositor {
|
|||
let scale = self.device_pixels_per_page_px();
|
||||
let page_window = self.page_window();
|
||||
match self.scene.root {
|
||||
Some(ref mut layer) if !layer.extra_data.borrow().hidden => {
|
||||
Some(ref mut layer) => {
|
||||
let rect = Rect(Point2D(0f32, 0f32), page_window.to_untyped());
|
||||
let recomposite =
|
||||
CompositorData::send_buffer_requests_recursively(layer.clone(),
|
||||
|
@ -755,9 +754,6 @@ impl IOCompositor {
|
|||
scale.get());
|
||||
self.recomposite = self.recomposite || recomposite;
|
||||
}
|
||||
Some(_) => {
|
||||
debug!("Compositor: root layer is hidden!");
|
||||
}
|
||||
None => { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,8 @@ pub struct CompositorData {
|
|||
|
||||
/// The size of the underlying page in page coordinates. This is an option
|
||||
/// because we may not know the size of the page until layout is finished completely.
|
||||
/// if we have no size yet, the layer is hidden until a size message is recieved.
|
||||
pub page_size: Option<Size2D<f32>>,
|
||||
|
||||
/// When set to true, this layer is ignored by its parents. This is useful for
|
||||
/// soft deletion or when waiting on a page size.
|
||||
pub hidden: bool,
|
||||
|
||||
/// The behavior of this layer when a scroll message is received.
|
||||
pub wants_scroll_events: WantsScrollEventsFlag,
|
||||
|
||||
|
@ -88,7 +83,6 @@ impl CompositorData {
|
|||
id: layer_id,
|
||||
scroll_offset: TypedPoint2D(0f32, 0f32),
|
||||
page_size: page_size,
|
||||
hidden: false,
|
||||
wants_scroll_events: wants_scroll_events,
|
||||
scroll_policy: scroll_policy,
|
||||
cpu_painting: cpu_painting,
|
||||
|
@ -188,14 +182,11 @@ impl CompositorData {
|
|||
}
|
||||
};
|
||||
|
||||
layer.children().iter().filter(|x| !x.extra_data.borrow().hidden)
|
||||
.map(send_child_buffer_request)
|
||||
.any(|b| b) || redisplay
|
||||
layer.children().iter().map(send_child_buffer_request).any(|b| b) || redisplay
|
||||
}
|
||||
|
||||
// Move the sublayer to an absolute position in page coordinates relative to its parent,
|
||||
// and clip the layer to the specified size in page coordinates.
|
||||
// If the layer is hidden and has a defined page size, unhide it.
|
||||
// This method returns false if the specified layer is not found.
|
||||
pub fn set_clipping_rect(layer: Rc<Layer<CompositorData>>,
|
||||
pipeline_id: PipelineId,
|
||||
|
@ -209,12 +200,6 @@ impl CompositorData {
|
|||
Some(child_node) => {
|
||||
debug!("compositor_data: node found for set_clipping_rect()");
|
||||
*child_node.bounds.borrow_mut() = new_rect;
|
||||
|
||||
// If possible, unhide child
|
||||
let mut child_data = child_node.extra_data.borrow_mut();
|
||||
if child_data.hidden && child_data.page_size.is_some() {
|
||||
child_data.hidden = false;
|
||||
}
|
||||
true
|
||||
}
|
||||
None => {
|
||||
|
|
|
@ -46,11 +46,6 @@ pub fn handle_scroll_event(layer: Rc<Layer<CompositorData>>,
|
|||
cursor: TypedPoint2D<PagePx, f32>,
|
||||
window_size: TypedSize2D<PagePx, f32>)
|
||||
-> bool {
|
||||
// If this layer is hidden, neither it nor its children will scroll.
|
||||
if layer.extra_data.borrow().hidden {
|
||||
return false
|
||||
}
|
||||
|
||||
// If this layer doesn't want scroll events, neither it nor its children can handle scroll
|
||||
// events.
|
||||
if layer.extra_data.borrow().wants_scroll_events != WantsScrollEvents {
|
||||
|
@ -130,10 +125,6 @@ pub fn send_mouse_event(layer: Rc<Layer<CompositorData>>,
|
|||
event: MouseWindowEvent, cursor: TypedPoint2D<PagePx, f32>) {
|
||||
let cursor = cursor - layer.extra_data.borrow().scroll_offset;
|
||||
for child in layer.children().iter() {
|
||||
if child.extra_data.borrow().hidden {
|
||||
continue;
|
||||
}
|
||||
|
||||
let rect: TypedRect<PagePx, f32> = Rect::from_untyped(&*child.bounds.borrow());
|
||||
if rect.contains(&cursor) {
|
||||
send_mouse_event(child.clone(), event, cursor - rect.origin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue