mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
dependencies: Upgrade to WebRender 0.64 (#31486)
This brings the version of WebRender used in Servo up-to-date with Gecko upstream. The big change here is that HiDPI is no longer handled via WebRender. Instead this happens via a scale applied to the root layer in the compositor. In addition to this change, various changes are made to Servo to adapt to the new WebRender API. Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
4597aeae5f
commit
ad37a54f59
102 changed files with 704 additions and 600 deletions
|
@ -7,9 +7,17 @@
|
|||
use embedder_traits::Cursor;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use webrender_api::units::{LayoutSize, LayoutVector2D};
|
||||
use webrender_api::{
|
||||
Epoch, ExternalScrollId, PipelineId, ScrollLocation, ScrollSensitivity, SpatialId,
|
||||
};
|
||||
use webrender_api::{Epoch, ExternalScrollId, PipelineId, ScrollLocation, SpatialId};
|
||||
|
||||
/// The scroll sensitivity of a scroll node ie whether it can be scrolled due to input event and
|
||||
/// script events or only script events.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub enum ScrollSensitivity {
|
||||
/// This node can be scrolled by input and script events.
|
||||
ScriptAndInputEvents,
|
||||
/// This node can only be scrolled by script events.
|
||||
Script,
|
||||
}
|
||||
|
||||
/// Information that Servo keeps alongside WebRender display items
|
||||
/// in order to add more context to hit test results.
|
||||
|
@ -208,6 +216,25 @@ impl ScrollTree {
|
|||
|
||||
parent.and_then(|parent| self.scroll_node_or_ancestor(&parent, scroll_location))
|
||||
}
|
||||
|
||||
/// Given an [`ExternalScrollId`] and an offset, update the scroll offset of the scroll node
|
||||
/// with the given id.
|
||||
pub fn set_scroll_offsets_for_node_with_external_scroll_id(
|
||||
&mut self,
|
||||
external_scroll_id: ExternalScrollId,
|
||||
offset: LayoutVector2D,
|
||||
) -> bool {
|
||||
for node in self.nodes.iter_mut() {
|
||||
match node.scroll_info {
|
||||
Some(ref mut scroll_info) if scroll_info.external_id == external_scroll_id => {
|
||||
scroll_info.offset = offset;
|
||||
return true;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// A data structure which stores compositor-side information about
|
||||
|
|
|
@ -56,7 +56,7 @@ use servo_atoms::Atom;
|
|||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use style_traits::{CSSPixel, SpeculativePainter};
|
||||
use webgpu::identity::WebGPUMsg;
|
||||
use webrender_api::units::{DeviceIntSize, DevicePixel, LayoutPixel, LayoutPoint, WorldPoint};
|
||||
use webrender_api::units::{DeviceIntSize, DevicePixel, DevicePoint, LayoutPixel, LayoutPoint};
|
||||
use webrender_api::{
|
||||
BuiltDisplayList, BuiltDisplayListDescriptor, DocumentId, ExternalImageData, ExternalScrollId,
|
||||
HitTestFlags, ImageData, ImageDescriptor, ImageKey, PipelineId as WebRenderPipelineId,
|
||||
|
@ -1121,7 +1121,7 @@ pub enum ScriptToCompositorMsg {
|
|||
/// Inform WebRender of the existence of this pipeline.
|
||||
SendInitialTransaction(WebRenderPipelineId),
|
||||
/// Perform a scroll operation.
|
||||
SendScrollNode(LayoutPoint, ExternalScrollId),
|
||||
SendScrollNode(WebRenderPipelineId, LayoutPoint, ExternalScrollId),
|
||||
/// Inform WebRender of a new display list for the given pipeline.
|
||||
SendDisplayList {
|
||||
/// The [CompositorDisplayListInfo] that describes the display list being sent.
|
||||
|
@ -1135,7 +1135,7 @@ pub enum ScriptToCompositorMsg {
|
|||
/// the provided channel sender.
|
||||
HitTest(
|
||||
Option<WebRenderPipelineId>,
|
||||
WorldPoint,
|
||||
DevicePoint,
|
||||
HitTestFlags,
|
||||
IpcSender<Vec<CompositorHitTestResult>>,
|
||||
),
|
||||
|
@ -1167,11 +1167,17 @@ impl WebrenderIpcSender {
|
|||
}
|
||||
|
||||
/// Perform a scroll operation.
|
||||
pub fn send_scroll_node(&self, point: LayoutPoint, scroll_id: ExternalScrollId) {
|
||||
if let Err(e) = self
|
||||
.0
|
||||
.send(ScriptToCompositorMsg::SendScrollNode(point, scroll_id))
|
||||
{
|
||||
pub fn send_scroll_node(
|
||||
&self,
|
||||
pipeline_id: WebRenderPipelineId,
|
||||
point: LayoutPoint,
|
||||
scroll_id: ExternalScrollId,
|
||||
) {
|
||||
if let Err(e) = self.0.send(ScriptToCompositorMsg::SendScrollNode(
|
||||
pipeline_id,
|
||||
point,
|
||||
scroll_id,
|
||||
)) {
|
||||
warn!("Error sending scroll node: {}", e);
|
||||
}
|
||||
}
|
||||
|
@ -1192,8 +1198,14 @@ impl WebrenderIpcSender {
|
|||
warn!("Error sending display list: {}", e);
|
||||
}
|
||||
|
||||
if let Err(e) = display_list_sender.send(&display_list_data) {
|
||||
warn!("Error sending display data: {}", e);
|
||||
if let Err(error) = display_list_sender.send(&display_list_data.items_data) {
|
||||
warn!("Error sending display list items: {}", error);
|
||||
}
|
||||
if let Err(error) = display_list_sender.send(&display_list_data.cache_data) {
|
||||
warn!("Error sending display list cache data: {}", error);
|
||||
}
|
||||
if let Err(error) = display_list_sender.send(&display_list_data.spatial_tree) {
|
||||
warn!("Error sending display spatial tree: {}", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,7 +1214,7 @@ impl WebrenderIpcSender {
|
|||
pub fn hit_test(
|
||||
&self,
|
||||
pipeline: Option<WebRenderPipelineId>,
|
||||
point: WorldPoint,
|
||||
point: DevicePoint,
|
||||
flags: HitTestFlags,
|
||||
) -> Vec<CompositorHitTestResult> {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use euclid::Size2D;
|
||||
use script_traits::compositor::{ScrollTree, ScrollTreeNodeId, ScrollableNodeInfo};
|
||||
use script_traits::compositor::{
|
||||
ScrollSensitivity, ScrollTree, ScrollTreeNodeId, ScrollableNodeInfo,
|
||||
};
|
||||
use webrender_api::units::LayoutVector2D;
|
||||
use webrender_api::{ExternalScrollId, PipelineId, ScrollLocation, ScrollSensitivity, SpatialId};
|
||||
use webrender_api::{ExternalScrollId, PipelineId, ScrollLocation, SpatialId};
|
||||
|
||||
fn add_mock_scroll_node(tree: &mut ScrollTree) -> ScrollTreeNodeId {
|
||||
let pipeline_id = PipelineId(0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue