mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
984f3ccc41
commit
99eb457fc7
19 changed files with 154 additions and 119 deletions
|
@ -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.
|
||||
|
|
|
@ -296,16 +296,15 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
|
||||
let webrender_id = match node.node_type {
|
||||
ClipScrollNodeType::Clip => builder.define_clip_with_parent(
|
||||
node.id,
|
||||
parent_id,
|
||||
item_rect,
|
||||
node.clip.get_complex_clips(),
|
||||
None,
|
||||
),
|
||||
ClipScrollNodeType::ScrollFrame(scroll_sensitivity) => builder
|
||||
ClipScrollNodeType::ScrollFrame(scroll_sensitivity, external_id) => builder
|
||||
.define_scroll_frame_with_parent(
|
||||
node.id,
|
||||
parent_id,
|
||||
Some(external_id),
|
||||
node.content_rect,
|
||||
node.clip.main.to_layout(),
|
||||
node.clip.get_complex_clips(),
|
||||
|
@ -316,7 +315,6 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
// TODO: Add define_sticky_frame_with_parent to WebRender.
|
||||
builder.push_clip_id(parent_id);
|
||||
let id = builder.define_sticky_frame(
|
||||
node.id,
|
||||
item_rect,
|
||||
sticky_data.margins,
|
||||
sticky_data.vertical_offset_bounds,
|
||||
|
@ -328,7 +326,6 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
},
|
||||
};
|
||||
|
||||
debug_assert!(node.id.is_none() || node.id == Some(webrender_id));
|
||||
clip_ids[item.node_index.0] = Some(webrender_id);
|
||||
},
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use ipc_channel::ipc::IpcSender;
|
|||
use msg::constellation_msg::PipelineId;
|
||||
use opaque_node::OpaqueNodeMethods;
|
||||
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
|
||||
use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollRootIdResponse};
|
||||
use script_layout_interface::rpc::{NodeGeometryResponse, NodeScrollIdResponse};
|
||||
use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse, StyleResponse};
|
||||
use script_layout_interface::rpc::TextIndexResponse;
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
|
@ -34,7 +34,7 @@ use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirecti
|
|||
use style::properties::{style_structs, PropertyId, PropertyDeclarationId, LonghandId};
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::ToCss;
|
||||
use webrender_api::ClipId;
|
||||
use webrender_api::ExternalScrollId;
|
||||
use wrapper::LayoutNodeLayoutData;
|
||||
|
||||
/// Mutable data belonging to the LayoutThread.
|
||||
|
@ -56,8 +56,8 @@ pub struct LayoutThreadData {
|
|||
/// A queued response for the client {top, left, width, height} of a node in pixels.
|
||||
pub client_rect_response: Rect<i32>,
|
||||
|
||||
/// A queued response for the scroll root id for a given node.
|
||||
pub scroll_root_id_response: Option<ClipId>,
|
||||
/// A queued response for the scroll id for a given node.
|
||||
pub scroll_id_response: Option<ExternalScrollId>,
|
||||
|
||||
/// A queued response for the scroll {top, left, width, height} of a node in pixels.
|
||||
pub scroll_area_response: Rect<i32>,
|
||||
|
@ -131,10 +131,10 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
}
|
||||
}
|
||||
|
||||
fn node_scroll_root_id(&self) -> NodeScrollRootIdResponse {
|
||||
NodeScrollRootIdResponse(self.0.lock()
|
||||
.unwrap().scroll_root_id_response
|
||||
.expect("scroll_root_id is not correctly fetched"))
|
||||
fn node_scroll_id(&self) -> NodeScrollIdResponse {
|
||||
NodeScrollIdResponse(self.0.lock()
|
||||
.unwrap().scroll_id_response
|
||||
.expect("scroll id is not correctly fetched"))
|
||||
}
|
||||
|
||||
/// Retrieves the resolved value for a CSS style property.
|
||||
|
@ -611,11 +611,12 @@ pub fn process_node_geometry_request<N: LayoutNode>(requested_node: N, layout_ro
|
|||
iterator.client_rect
|
||||
}
|
||||
|
||||
pub fn process_node_scroll_root_id_request<N: LayoutNode>(id: PipelineId,
|
||||
requested_node: N)
|
||||
-> ClipId {
|
||||
pub fn process_node_scroll_id_request<N: LayoutNode>(
|
||||
id: PipelineId,
|
||||
requested_node: N
|
||||
) -> ExternalScrollId {
|
||||
let layout_node = requested_node.to_threadsafe();
|
||||
layout_node.generate_scroll_root_id(id)
|
||||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layout_root: &mut Flow)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue