mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
auto merge of #801 : eschweic/servo/comp-fixed-pos, r=metajack
Some changes that need to happen for #782.
This commit is contained in:
commit
3f2969cfa8
1 changed files with 41 additions and 22 deletions
|
@ -47,6 +47,8 @@ pub struct CompositorLayer {
|
||||||
/// A monotonically increasing counter that keeps track of the current epoch.
|
/// A monotonically increasing counter that keeps track of the current epoch.
|
||||||
/// add_buffer() calls that don't match the current epoch will be ignored.
|
/// add_buffer() calls that don't match the current epoch will be ignored.
|
||||||
epoch: Epoch,
|
epoch: Epoch,
|
||||||
|
/// The behavior of this layer when a scroll message is received.
|
||||||
|
scroll_behavior: ScrollBehavior,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper struct for keeping CompositorLayer children organized.
|
/// Helper struct for keeping CompositorLayer children organized.
|
||||||
|
@ -65,6 +67,16 @@ enum MaybeQuadtree {
|
||||||
NoTree(uint, Option<uint>),
|
NoTree(uint, Option<uint>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Determines the behavior of the layer when a scroll message is recieved.
|
||||||
|
enum ScrollBehavior {
|
||||||
|
/// Normal scrolling behavior.
|
||||||
|
Scroll,
|
||||||
|
/// Scrolling messages targeted at this layer are ignored, but can be
|
||||||
|
/// passed on to child layers.
|
||||||
|
FixedPosition,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl CompositorLayer {
|
impl CompositorLayer {
|
||||||
/// Creates a new CompositorLayer with an optional page size. If no page size is given,
|
/// Creates a new CompositorLayer with an optional page size. If no page size is given,
|
||||||
/// the layer is initially hidden and initialized without a quadtree.
|
/// the layer is initially hidden and initialized without a quadtree.
|
||||||
|
@ -85,6 +97,7 @@ impl CompositorLayer {
|
||||||
root_layer: @mut ContainerLayer(),
|
root_layer: @mut ContainerLayer(),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
epoch: Epoch(0),
|
epoch: Epoch(0),
|
||||||
|
scroll_behavior: Scroll,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +154,9 @@ impl CompositorLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This scroll event is mine!
|
||||||
|
match self.scroll_behavior {
|
||||||
|
Scroll => {
|
||||||
// Scroll this layer!
|
// Scroll this layer!
|
||||||
let old_origin = self.scroll_offset;
|
let old_origin = self.scroll_offset;
|
||||||
self.scroll_offset = self.scroll_offset + delta;
|
self.scroll_offset = self.scroll_offset + delta;
|
||||||
|
@ -165,6 +181,9 @@ impl CompositorLayer {
|
||||||
0.0));
|
0.0));
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
FixedPosition => false, // Ignore this scroll event.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Takes in a MouseWindowEvent, determines if it should be passed to children, and
|
// Takes in a MouseWindowEvent, determines if it should be passed to children, and
|
||||||
// sends the event off to the appropriate pipeline. NB: the cursor position is in
|
// sends the event off to the appropriate pipeline. NB: the cursor position is in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue