Update WebRender

This allows servo to use the ExternalScrollId API from WebRender fixing
some issues related to duplicate scroll root ids.

Fixes #17176.
Fixes #19287.
Fixes #19648.
This commit is contained in:
Martin Robinson 2018-01-16 18:47:05 +01:00
parent 984f3ccc41
commit 99eb457fc7
19 changed files with 154 additions and 119 deletions

View file

@ -73,8 +73,8 @@ use style_traits::CSSPixel;
use style_traits::ToCss;
use style_traits::cursor::CursorKind;
use table_cell::CollapsedBordersForCell;
use webrender_api::{self, BorderSide, BoxShadowClipMode, ClipId, ClipMode, ColorF};
use webrender_api::{ComplexClipRegion, FilterOp, ImageBorder, ImageRendering, LayoutRect};
use webrender_api::{self, BorderSide, BoxShadowClipMode, ClipMode, ColorF, ComplexClipRegion};
use webrender_api::{ExternalScrollId, FilterOp, ImageBorder, ImageRendering, LayoutRect};
use webrender_api::{LayoutSize, LayoutVector2D, LineStyle, LocalClip, NinePatchDescriptor};
use webrender_api::{NormalBorder, ScrollPolicy, ScrollSensitivity, StickyOffsetBounds};
@ -243,11 +243,13 @@ impl StackingContextCollectionState {
// This is just a dummy node to take up a slot in the array. WebRender
// takes care of adding this root node and it can be ignored during DL conversion.
let root_node = ClipScrollNode {
id: Some(ClipId::root_scroll_node(pipeline_id.to_webrender())),
parent_index: ClipScrollNodeIndex(0),
clip: ClippingRegion::from_rect(&TypedRect::zero()),
content_rect: LayoutRect::zero(),
node_type: ClipScrollNodeType::ScrollFrame(ScrollSensitivity::ScriptAndInputEvents),
node_type: ClipScrollNodeType::ScrollFrame(
ScrollSensitivity::ScriptAndInputEvents,
pipeline_id.root_scroll_id(),
),
};
StackingContextCollectionState {
@ -2666,7 +2668,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
};
let new_clip_scroll_index = state.add_clip_scroll_node(ClipScrollNode {
id: None,
parent_index: self.clipping_and_scrolling().scrolling,
clip: ClippingRegion::from_rect(border_box),
content_rect: LayoutRect::zero(),
@ -2699,12 +2700,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
return;
}
// If we already have a scroll root for this flow, just return. This can happen
// when fragments map to more than one flow, such as in the case of table
// wrappers. We just accept the first scroll root in that case.
let new_clip_scroll_node_id =
ClipId::new(self.fragment.unique_id(), state.pipeline_id.to_webrender());
let sensitivity = if StyleOverflow::Hidden == self.fragment.style.get_box().overflow_x &&
StyleOverflow::Hidden == self.fragment.style.get_box().overflow_y
{
@ -2723,12 +2718,15 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
let content_size = self.base.overflow.scroll.origin + self.base.overflow.scroll.size;
let content_size = Size2D::new(content_size.x, content_size.y);
let external_id = ExternalScrollId(
self.fragment.unique_id(),
state.pipeline_id.to_webrender()
);
let new_clip_scroll_index = state.add_clip_scroll_node(ClipScrollNode {
id: Some(new_clip_scroll_node_id),
parent_index: self.clipping_and_scrolling().scrolling,
clip: clip,
content_rect: Rect::new(content_box.origin, content_size).to_layout(),
node_type: ClipScrollNodeType::ScrollFrame(sensitivity),
node_type: ClipScrollNodeType::ScrollFrame(sensitivity, external_id),
});
let new_clipping_and_scrolling = ClippingAndScrolling::simple(new_clip_scroll_index);
@ -2777,7 +2775,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
preserved_state.push_clip(state, &clip_rect, self.positioning());
let new_index = state.add_clip_scroll_node(ClipScrollNode {
id: None,
parent_index: self.clipping_and_scrolling().scrolling,
clip: ClippingRegion::from_rect(&clip_rect),
content_rect: LayoutRect::zero(), // content_rect isn't important for clips.