Skip to content

Commit

Permalink
servo: Merge #16264 - Update WR (border fast paths, clip interfaces) …
Browse files Browse the repository at this point in the history
…(from glennw:update-wr-borders-and-clips); r=Manishearth

Source-Repo: https://github.com/servo/servo
Source-Revision: 6a67688924b1b122be9c8ec456d6029dc02366a4

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 88b484524f996cce0d5c77dfd7e3634684cdb6da
  • Loading branch information
gw3583 committed Apr 5, 2017
1 parent 1c93a16 commit 341d05c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions servo/components/gfx/display_list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ pub struct ScrollRoot {
/// The position of this scroll root's frame in the parent stacking context.
pub clip: Rect<Au>,

/// The size of the contents that can be scrolled inside of the scroll root.
pub size: Size2D<Au>,
/// The rect of the contents that can be scrolled inside of the scroll root.
pub content_rect: Rect<Au>,
}

impl ScrollRoot {
Expand Down
21 changes: 13 additions & 8 deletions servo/components/layout/display_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,24 +1963,29 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
&self.base.early_absolute_position_info.relative_containing_block_size,
self.base.early_absolute_position_info.relative_containing_block_mode,
coordinate_system);
let clip = self.fragment.stacking_relative_content_box(&border_box);
let content_box = self.fragment.stacking_relative_content_box(&border_box);

let has_scrolling_overflow = self.base.overflow.scroll.origin != Point2D::zero() ||
self.base.overflow.scroll.size.width > clip.size.width ||
self.base.overflow.scroll.size.height > clip.size.height;
self.mark_scrolling_overflow(has_scrolling_overflow);
if !has_scrolling_overflow {
// If we don't overflow our box at all, we can avoid creating a scroll root.
if self.base.overflow.scroll.origin == Point2D::zero() &&
self.base.overflow.scroll.size.width <= content_box.size.width &&
self.base.overflow.scroll.size.height <= content_box.size.height {
self.mark_scrolling_overflow(false);
return containing_scroll_root_id;
}

self.mark_scrolling_overflow(true);

let new_scroll_root_id = ScrollRootId::new_of_type(self.fragment.node.id() as usize,
self.fragment.fragment_type());

let content_size = self.base.overflow.scroll.origin + self.base.overflow.scroll.size;
state.add_scroll_root(
ScrollRoot {
id: new_scroll_root_id,
parent_id: containing_scroll_root_id,
clip: clip,
size: self.base.overflow.scroll.size,
clip: Rect::new(Point2D::zero(), content_box.size),
content_rect: Rect::new(content_box.origin,
Size2D::new(content_size.x, content_size.y)),
},
self.base.stacking_context_id
);
Expand Down
5 changes: 3 additions & 2 deletions servo/components/layout/webrender_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
stacking_context.bounds.to_rectf(),
stacking_context.z_index,
transform,
webrender_traits::TransformStyle::Flat,
perspective,
stacking_context.blend_mode.to_blend_mode(),
stacking_context.filters.to_filter_ops());
Expand All @@ -425,8 +426,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
None);

let provided_id = ScrollLayerId::new(item.scroll_root.id.0 as u64, builder.pipeline_id);
let id = builder.define_clip(clip,
item.scroll_root.size.to_sizef(),
let id = builder.define_clip(item.scroll_root.content_rect.to_rectf(),
clip,
Some(provided_id));
debug_assert!(provided_id == id);
}
Expand Down

0 comments on commit 341d05c

Please sign in to comment.