Auto merge of #16264 - glennw:update-wr-borders-and-clips, r=Manishearth

Update WR (border fast paths, clip interfaces).

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16264)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-04 20:35:19 -05:00 committed by GitHub
commit 6a67688924
4 changed files with 20 additions and 14 deletions

4
Cargo.lock generated
View file

@ -3146,7 +3146,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender" name = "webrender"
version = "0.30.0" version = "0.30.0"
source = "git+https://github.com/servo/webrender#7e74c1018d47cf5586f05c409c17a25c76f28e56" source = "git+https://github.com/servo/webrender#ba14e0b619477628d3dbb7384b2cb19b3b88a6c5"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3174,7 +3174,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender_traits" name = "webrender_traits"
version = "0.31.0" version = "0.31.0"
source = "git+https://github.com/servo/webrender#7e74c1018d47cf5586f05c409c17a25c76f28e56" source = "git+https://github.com/servo/webrender#ba14e0b619477628d3dbb7384b2cb19b3b88a6c5"
dependencies = [ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -510,8 +510,8 @@ pub struct ScrollRoot {
/// The position of this scroll root's frame in the parent stacking context. /// The position of this scroll root's frame in the parent stacking context.
pub clip: Rect<Au>, pub clip: Rect<Au>,
/// The size of the contents that can be scrolled inside of the scroll root. /// The rect of the contents that can be scrolled inside of the scroll root.
pub size: Size2D<Au>, pub content_rect: Rect<Au>,
} }
impl ScrollRoot { impl ScrollRoot {

View file

@ -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_size,
self.base.early_absolute_position_info.relative_containing_block_mode, self.base.early_absolute_position_info.relative_containing_block_mode,
coordinate_system); 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() || // If we don't overflow our box at all, we can avoid creating a scroll root.
self.base.overflow.scroll.size.width > clip.size.width || if self.base.overflow.scroll.origin == Point2D::zero() &&
self.base.overflow.scroll.size.height > clip.size.height; self.base.overflow.scroll.size.width <= content_box.size.width &&
self.mark_scrolling_overflow(has_scrolling_overflow); self.base.overflow.scroll.size.height <= content_box.size.height {
if !has_scrolling_overflow { self.mark_scrolling_overflow(false);
return containing_scroll_root_id; 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, let new_scroll_root_id = ScrollRootId::new_of_type(self.fragment.node.id() as usize,
self.fragment.fragment_type()); self.fragment.fragment_type());
let content_size = self.base.overflow.scroll.origin + self.base.overflow.scroll.size;
state.add_scroll_root( state.add_scroll_root(
ScrollRoot { ScrollRoot {
id: new_scroll_root_id, id: new_scroll_root_id,
parent_id: containing_scroll_root_id, parent_id: containing_scroll_root_id,
clip: clip, clip: Rect::new(Point2D::zero(), content_box.size),
size: self.base.overflow.scroll.size, content_rect: Rect::new(content_box.origin,
Size2D::new(content_size.x, content_size.y)),
}, },
self.base.stacking_context_id self.base.stacking_context_id
); );

View file

@ -414,6 +414,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
stacking_context.bounds.to_rectf(), stacking_context.bounds.to_rectf(),
stacking_context.z_index, stacking_context.z_index,
transform, transform,
webrender_traits::TransformStyle::Flat,
perspective, perspective,
stacking_context.blend_mode.to_blend_mode(), stacking_context.blend_mode.to_blend_mode(),
stacking_context.filters.to_filter_ops()); stacking_context.filters.to_filter_ops());
@ -425,8 +426,8 @@ impl WebRenderDisplayItemConverter for DisplayItem {
None); None);
let provided_id = ScrollLayerId::new(item.scroll_root.id.0 as u64, builder.pipeline_id); let provided_id = ScrollLayerId::new(item.scroll_root.id.0 as u64, builder.pipeline_id);
let id = builder.define_clip(clip, let id = builder.define_clip(item.scroll_root.content_rect.to_rectf(),
item.scroll_root.size.to_sizef(), clip,
Some(provided_id)); Some(provided_id));
debug_assert!(provided_id == id); debug_assert!(provided_id == id);
} }