mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Implement basic overflow: scroll
functionality.
Known issues: * Display list optimization can sometimes optimize out elements that should be shown. This affects the Enyo demo. * The `overflow: scroll` container doesn't clip the inner layer properly when borders, border radius, etc. are present. * `overflow-x: scroll` and `overflow-y: scroll` don't work individually; elements are scrolled all at once. * Scrolling only works on absolutely-positioned elements.
This commit is contained in:
parent
fc13dd1169
commit
df4acbac04
8 changed files with 221 additions and 72 deletions
|
@ -342,29 +342,27 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
|
|||
transform: &Matrix4,
|
||||
perspective: &Matrix4,
|
||||
parent_id: Option<LayerId>) {
|
||||
|
||||
let transform = transform.mul(&stacking_context.transform);
|
||||
let perspective = perspective.mul(&stacking_context.perspective);
|
||||
|
||||
let (next_parent_id, page_position, transform, perspective) =
|
||||
match stacking_context.layer {
|
||||
Some(ref paint_layer) => {
|
||||
// Layers start at the top left of their overflow rect, as far as the info we
|
||||
// give to the compositor is concerned.
|
||||
let overflow_size =
|
||||
Size2D::new(stacking_context.overflow.size.width.to_nearest_px() as f32,
|
||||
stacking_context.overflow.size.height.to_nearest_px() as f32);
|
||||
let establishes_3d_context = stacking_context.establishes_3d_context;
|
||||
let scrolls_overflow_area = stacking_context.scrolls_overflow_area;
|
||||
|
||||
// Layers start at the top left of their overflow rect, as far as the info
|
||||
// we give to the compositor is concerned.
|
||||
let overflow_relative_page_position = *page_position +
|
||||
stacking_context.bounds.origin +
|
||||
stacking_context.overflow.origin;
|
||||
let layer_position =
|
||||
Rect::new(Point2D::new(overflow_relative_page_position.x.to_nearest_px() as
|
||||
f32,
|
||||
overflow_relative_page_position.y.to_nearest_px() as
|
||||
f32),
|
||||
Size2D::new(stacking_context.overflow.size.width.to_nearest_px()
|
||||
as f32,
|
||||
stacking_context.overflow.size.height.to_nearest_px()
|
||||
as f32));
|
||||
|
||||
let establishes_3d_context = stacking_context.establishes_3d_context;
|
||||
let layer_position = Rect::new(
|
||||
Point2D::new(overflow_relative_page_position.x.to_nearest_px() as f32,
|
||||
overflow_relative_page_position.y.to_nearest_px() as f32),
|
||||
overflow_size);
|
||||
|
||||
properties.push(LayerProperties {
|
||||
id: paint_layer.id,
|
||||
|
@ -375,6 +373,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
|
|||
transform: transform,
|
||||
perspective: perspective,
|
||||
establishes_3d_context: establishes_3d_context,
|
||||
scrolls_overflow_area: scrolls_overflow_area,
|
||||
});
|
||||
|
||||
// When there is a new layer, the transforms and origin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue