mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -29,6 +29,7 @@ use log::{debug, warn};
|
|||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use net_traits::image_cache::UsePlaceholder;
|
||||
use range::Range;
|
||||
use script_traits::compositor::ScrollSensitivity;
|
||||
use servo_config::opts;
|
||||
use servo_geometry::{self, MaxRect};
|
||||
use style::color::AbsoluteColor;
|
||||
|
@ -51,7 +52,7 @@ use webrender_api::units::{LayoutRect, LayoutTransform, LayoutVector2D};
|
|||
use webrender_api::{
|
||||
self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ColorU,
|
||||
ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LineStyle, NinePatchBorder,
|
||||
NinePatchBorderSource, NormalBorder, PropertyBinding, ScrollSensitivity, StickyOffsetBounds,
|
||||
NinePatchBorderSource, NormalBorder, PropertyBinding, StickyOffsetBounds,
|
||||
};
|
||||
|
||||
use crate::block::BlockFlow;
|
||||
|
@ -384,6 +385,7 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
&self,
|
||||
clip_rect: Rect<Au>,
|
||||
node: OpaqueNode,
|
||||
unique_id: u64,
|
||||
cursor: Option<Cursor>,
|
||||
section: DisplayListSection,
|
||||
) -> BaseDisplayItem {
|
||||
|
@ -397,6 +399,7 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
self.create_base_display_item_with_clipping_and_scrolling(
|
||||
clip_rect,
|
||||
node,
|
||||
unique_id,
|
||||
cursor,
|
||||
section,
|
||||
clipping_and_scrolling,
|
||||
|
@ -407,12 +410,17 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
&self,
|
||||
clip_rect: Rect<Au>,
|
||||
node: OpaqueNode,
|
||||
unique_id: u64,
|
||||
cursor: Option<Cursor>,
|
||||
section: DisplayListSection,
|
||||
clipping_and_scrolling: ClippingAndScrolling,
|
||||
) -> BaseDisplayItem {
|
||||
BaseDisplayItem::new(
|
||||
DisplayItemMetadata { node, cursor },
|
||||
DisplayItemMetadata {
|
||||
node,
|
||||
unique_id,
|
||||
cursor,
|
||||
},
|
||||
clip_rect.to_layout(),
|
||||
section,
|
||||
self.current_stacking_context_id,
|
||||
|
@ -702,6 +710,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
bounds,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -842,6 +851,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
placement.clip_rect,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -964,6 +974,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
placement.clip_rect,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -1040,6 +1051,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -1126,6 +1138,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -1221,7 +1234,7 @@ impl Fragment {
|
|||
)?;
|
||||
width = image.width;
|
||||
height = image.height;
|
||||
NinePatchBorderSource::Image(image.key?)
|
||||
NinePatchBorderSource::Image(image.key?, ImageRendering::Auto)
|
||||
},
|
||||
Image::PaintWorklet(ref paint_worklet) => {
|
||||
let image = self.get_webrender_image_for_paint_worklet(
|
||||
|
@ -1232,7 +1245,7 @@ impl Fragment {
|
|||
)?;
|
||||
width = image.width;
|
||||
height = image.height;
|
||||
NinePatchBorderSource::Image(image.key?)
|
||||
NinePatchBorderSource::Image(image.key?, ImageRendering::Auto)
|
||||
},
|
||||
Image::Gradient(ref gradient) => match **gradient {
|
||||
Gradient::Linear {
|
||||
|
@ -1288,7 +1301,6 @@ impl Fragment {
|
|||
fill: border_image_fill,
|
||||
repeat_horizontal: border_image_repeat.0.to_layout(),
|
||||
repeat_vertical: border_image_repeat.1.to_layout(),
|
||||
outset: SideOffsets2D::zero(),
|
||||
});
|
||||
state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data(
|
||||
base,
|
||||
|
@ -1340,6 +1352,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
DisplayListSection::Outlines,
|
||||
);
|
||||
|
@ -1372,6 +1385,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
|
@ -1402,12 +1416,13 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(style, Cursor::Default),
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
// TODO(gw): Use a better estimate for wavy line thickness.
|
||||
let area = baseline.to_layout();
|
||||
let wavy_line_thickness = (0.33 * area.size.height).ceil();
|
||||
let wavy_line_thickness = (0.33 * area.size().height).ceil();
|
||||
state.add_display_item(DisplayItem::Line(CommonDisplayItem::new(
|
||||
base,
|
||||
webrender_api::LineDisplayItem {
|
||||
|
@ -1432,6 +1447,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, Cursor::Default),
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
|
@ -1475,6 +1491,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
stacking_relative_border_box,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, Cursor::Default),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -1522,6 +1539,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
insertion_point_bounds,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, cursor),
|
||||
display_list_section,
|
||||
);
|
||||
|
@ -1709,6 +1727,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item_with_clipping_and_scrolling(
|
||||
content_size,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
// FIXME(emilio): Why does this ignore pointer-events?
|
||||
get_cursor(&self.style, Cursor::Default).or(Some(Cursor::Default)),
|
||||
display_list_section,
|
||||
|
@ -1773,6 +1792,7 @@ impl Fragment {
|
|||
state.create_base_display_item(
|
||||
stacking_relative_border_box,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, Cursor::Default),
|
||||
DisplayListSection::Content,
|
||||
)
|
||||
|
@ -1859,7 +1879,7 @@ impl Fragment {
|
|||
// looks bogus.
|
||||
state.iframe_sizes.insert(
|
||||
browsing_context_id,
|
||||
euclid::Size2D::new(bounds.size.width, bounds.size.height),
|
||||
euclid::Size2D::new(bounds.size().width, bounds.size().height),
|
||||
);
|
||||
|
||||
let pipeline_id = match fragment_info.pipeline_id {
|
||||
|
@ -2067,6 +2087,7 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, cursor),
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
|
@ -2230,13 +2251,14 @@ impl Fragment {
|
|||
let base = state.create_base_display_item(
|
||||
clip,
|
||||
self.node,
|
||||
self.unique_id(),
|
||||
get_cursor(&self.style, Cursor::Default),
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
|
||||
// TODO(gw): Use a better estimate for wavy line thickness.
|
||||
let area = stacking_relative_box.to_layout();
|
||||
let wavy_line_thickness = (0.33 * area.size.height).ceil();
|
||||
let wavy_line_thickness = (0.33 * area.size().height).ceil();
|
||||
state.add_display_item(DisplayItem::Line(CommonDisplayItem::new(
|
||||
base,
|
||||
webrender_api::LineDisplayItem {
|
||||
|
@ -2945,8 +2967,15 @@ impl BaseFlow {
|
|||
|
||||
let mut color = THREAD_TINT_COLORS[thread_id as usize % THREAD_TINT_COLORS.len()];
|
||||
color.a = 1.0;
|
||||
let base =
|
||||
state.create_base_display_item(self.clip, node, None, DisplayListSection::Content);
|
||||
let base = state.create_base_display_item(
|
||||
self.clip,
|
||||
node,
|
||||
// This item will never become a spatial tree node, so it's fine
|
||||
// to pass 0 here.
|
||||
0,
|
||||
None,
|
||||
DisplayListSection::Content,
|
||||
);
|
||||
let bounds = stacking_context_relative_bounds.inflate(Au::from_px(2), Au::from_px(2));
|
||||
state.add_display_item(DisplayItem::Border(CommonDisplayItem::with_data(
|
||||
base,
|
||||
|
@ -3123,6 +3152,6 @@ trait ToF32Px {
|
|||
impl ToF32Px for Rect<Au> {
|
||||
type Output = LayoutRect;
|
||||
fn to_f32_px(&self) -> LayoutRect {
|
||||
LayoutRect::from_untyped(&servo_geometry::au_rect_to_f32_rect(*self))
|
||||
LayoutRect::from_untyped(&servo_geometry::au_rect_to_f32_rect(*self).to_box2d())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue