Skip to content
Permalink
Browse files

Auto merge of #23516 - pcwalton:webrenderup, r=jdm,pcwalton

Upgrade WebRender

This is against an old Servo because I can't build current Servo due to compile errors in RNG crates. I verified that it starts up.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #23516
- [x] There are tests for these changes

<!-- 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/23516)
<!-- Reviewable:end -->
  • Loading branch information...
bors-servo committed Jul 12, 2019
2 parents 5fdc7c0 + 857eeb6 commit c6156be535554079b3273686ab4c5fc2d4e55e23
Showing with 492 additions and 438 deletions.
  1. +142 −170 Cargo.lock
  2. +0 −4 Cargo.toml
  3. +1 −1 components/canvas/canvas_data.rs
  4. +2 −2 components/canvas/webgl_mode/inprocess.rs
  5. +1 −1 components/canvas/webgl_thread.rs
  6. +36 −25 components/compositing/compositor.rs
  7. +2 −1 components/compositing/compositor_thread.rs
  8. +6 −7 components/compositing/windowing.rs
  9. +1 −1 components/embedder_traits/lib.rs
  10. +1 −1 components/geometry/lib.rs
  11. +1 −1 components/gfx/Cargo.toml
  12. +2 −2 components/layout/display_list/border.rs
  13. +69 −59 components/layout/display_list/builder.rs
  14. +10 −10 components/layout/display_list/conversions.rs
  15. +32 −13 components/layout/display_list/items.rs
  16. +98 −99 components/layout/display_list/webrender_helpers.rs
  17. +1 −1 components/layout/flow.rs
  18. +2 −1 components/layout/fragment.rs
  19. +1 −1 components/layout/query.rs
  20. +23 −3 components/layout/sequential.rs
  21. +16 −13 components/layout_thread/lib.rs
  22. +2 −1 components/net/image_cache.rs
  23. +1 −1 components/script/dom/screen.rs
  24. +2 −1 components/script/dom/window.rs
  25. +2 −3 components/script_traits/lib.rs
  26. +1 −1 components/script_traits/script_msg.rs
  27. +11 −1 components/servo/lib.rs
  28. +1 −1 components/style_traits/lib.rs
  29. +3 −2 components/webrender_traits/lib.rs
  30. +3 −4 ports/glutin/headed_window.rs
  31. +2 −2 ports/glutin/headless_window.rs
  32. +1 −1 ports/glutin/window_trait.rs
  33. +2 −1 ports/libsimpleservo/api/src/lib.rs
  34. +4 −0 python/tidy/servo_tidy/tidy.py
  35. +0 −2 servo-tidy.toml
  36. +4 −1 tests/unit/metrics/paint_time.rs
  37. +2 −0 ...ing/mix-blend-mode/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.html.ini
  38. +4 −0 tests/wpt/mozilla/meta/css/text_decoration_underline_subpx_a.html.ini

Large diffs are not rendered by default.

@@ -29,7 +29,3 @@ opt-level = 3
mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
iovec = { git = "https://github.com/servo/iovec.git", branch = "servo" }
cmake = { git = "https://github.com/alexcrichton/cmake-rs" }

[patch."https://github.com/servo/webrender"]
webrender = { git = "https://github.com/jdm/webrender", branch = "servo-hl" }
webrender_api = { git = "https://github.com/jdm/webrender", branch = "servo-hl" }
@@ -941,7 +941,7 @@ impl<'a> CanvasData<'a> {
let size = self.drawtarget.get_size();

let descriptor = webrender_api::ImageDescriptor {
size: webrender_api::DeviceIntSize::new(size.width, size.height),
size: webrender_api::units::DeviceIntSize::new(size.width, size.height),
stride: None,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
@@ -159,7 +159,7 @@ impl webrender::OutputImageHandler for OutputHandler {
fn lock(
&mut self,
id: webrender_api::PipelineId,
) -> Option<(u32, webrender_api::FramebufferIntSize)> {
) -> Option<(u32, webrender_api::units::FramebufferIntSize)> {
// Insert a fence in the WR command queue
let gl_sync = self
.webrender_gl
@@ -172,7 +172,7 @@ impl webrender::OutputImageHandler for OutputHandler {
self.lock_channel.1.recv().unwrap().map(|(tex_id, size)| {
(
tex_id,
webrender_api::FramebufferIntSize::new(size.width, size.height),
webrender_api::units::FramebufferIntSize::new(size.width, size.height),
)
})
}
@@ -659,7 +659,7 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> {
/// Helper function to create a `webrender_api::ImageDescriptor`.
fn image_descriptor(size: Size2D<i32>, alpha: bool) -> webrender_api::ImageDescriptor {
webrender_api::ImageDescriptor {
size: webrender_api::DeviceIntSize::new(size.width, size.height),
size: webrender_api::units::DeviceIntSize::new(size.width, size.height),
stride: None,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
@@ -32,7 +32,7 @@ use script_traits::{
MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId, WheelDelta,
};
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
use servo_geometry::DeviceIndependentPixel;
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
use std::collections::HashMap;
use std::env;
use std::fs::{create_dir_all, File};
@@ -42,10 +42,8 @@ use std::rc::Rc;
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use time::{now, precise_time_ns, precise_time_s};
use webrender_api::{
self, DeviceIntPoint, DevicePoint, FramebufferIntSize, HitTestFlags, HitTestResult,
};
use webrender_api::{LayoutVector2D, ScrollLocation};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePoint, LayoutVector2D};
use webrender_api::{self, HitTestFlags, HitTestResult, ScrollLocation};
use webvr_traits::WebVRMainThreadHeartbeat;

#[derive(Debug, PartialEq)]
@@ -724,7 +722,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let dppx = self.page_zoom * self.hidpi_factor();
let scaled_point = (point / dppx).to_untyped();

let world_cursor = webrender_api::WorldPoint::from_untyped(&scaled_point);
let world_cursor = webrender_api::units::WorldPoint::from_untyped(&scaled_point);
self.webrender_api.hit_test(
self.webrender_document,
None,
@@ -844,9 +842,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let cursor = TypedPoint2D::new(-1, -1); // Make sure this hits the base layer.
self.pending_scroll_zoom_events.push(ScrollZoomEvent {
magnification: magnification,
scroll_location: ScrollLocation::Delta(
webrender_api::LayoutVector2D::from_untyped(&scroll_delta.to_untyped()),
),
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&scroll_delta.to_untyped(),
)),
cursor: cursor,
event_count: 1,
});
@@ -933,9 +931,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
last_combined_event @ &mut None => {
*last_combined_event = Some(ScrollZoomEvent {
magnification: scroll_event.magnification,
scroll_location: ScrollLocation::Delta(
webrender_api::LayoutVector2D::from_untyped(&this_delta.to_untyped()),
),
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&this_delta.to_untyped(),
)),
cursor: this_cursor,
event_count: 1,
})
@@ -966,15 +964,14 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let scaled_delta = (TypedVector2D::from_untyped(&delta.to_untyped()) /
self.scale)
.to_untyped();
let calculated_delta =
webrender_api::LayoutVector2D::from_untyped(&scaled_delta);
let calculated_delta = LayoutVector2D::from_untyped(&scaled_delta);
ScrollLocation::Delta(calculated_delta)
},
// Leave ScrollLocation unchanged if it is Start or End location.
sl @ ScrollLocation::Start | sl @ ScrollLocation::End => sl,
};
let cursor = (combined_event.cursor.to_f32() / self.scale).to_untyped();
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
let cursor = webrender_api::units::WorldPoint::from_untyped(&cursor);
let mut txn = webrender_api::Transaction::new();
txn.scroll(scroll_location, cursor);
if combined_event.magnification != 1.0 {
@@ -1168,8 +1165,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let mut pipeline_epochs = HashMap::new();
for (id, _) in &self.pipeline_details {
let webrender_pipeline_id = id.to_webrender();
if let Some(webrender_api::Epoch(epoch)) =
self.webrender.current_epoch(webrender_pipeline_id)
if let Some(webrender_api::Epoch(epoch)) = self
.webrender
.current_epoch(self.webrender_document, webrender_pipeline_id)
{
let epoch = Epoch(epoch);
pipeline_epochs.insert(*id, epoch);
@@ -1269,9 +1267,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
#[cfg(feature = "gl")]
CompositeTarget::Window => gl::RenderTargetInfo::default(),
#[cfg(feature = "gl")]
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => {
gl::initialize_png(&*self.window.gl(), width, height)
},
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => gl::initialize_png(
&*self.window.gl(),
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
),
#[cfg(not(feature = "gl"))]
_ => (),
};
@@ -1283,7 +1283,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|| {
debug!("compositor: compositing");

let size = FramebufferIntSize::from_untyped(
let size = DeviceIntSize::from_untyped(
&self.embedder_coordinates.framebuffer.to_untyped(),
);

@@ -1304,8 +1304,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
// For each pending paint metrics pipeline id
for (id, pending_epoch) in &self.pending_paint_metrics {
// we get the last painted frame id from webrender
if let Some(webrender_api::Epoch(epoch)) =
self.webrender.current_epoch(id.to_webrender())
if let Some(webrender_api::Epoch(epoch)) = self
.webrender
.current_epoch(self.webrender_document, id.to_webrender())
{
// and check if it is the one the layout thread is expecting,
let epoch = Epoch(epoch);
@@ -1332,7 +1333,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
CompositeTarget::Window => None,
#[cfg(feature = "gl")]
CompositeTarget::WindowAndPng => {
let img = gl::draw_img(&*self.window.gl(), rt_info, width, height);
let img = gl::draw_img(
&*self.window.gl(),
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
);
Some(Image {
width: img.width(),
height: img.height(),
@@ -1351,7 +1357,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|| match self.output_file.as_ref() {
Some(path) => match File::create(path) {
Ok(mut file) => {
let img = gl::draw_img(gl, rt_info, width, height);
let img = gl::draw_img(
gl,
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
);
let dynamic_image = DynamicImage::ImageRgb8(img);
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG)
{
@@ -17,7 +17,8 @@ use profile_traits::time;
use script_traits::{AnimationState, ConstellationMsg, EventResult};
use std::fmt::{Debug, Error, Formatter};
use style_traits::viewport::ViewportConstraints;
use webrender_api::{self, DeviceIntPoint, DeviceIntSize};
use webrender_api;
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webvr_traits::WebVRMainThreadHeartbeat;

/// Sends messages to the compositor.
@@ -19,10 +19,9 @@ use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc;
use std::time::Duration;
use style_traits::DevicePixel;
use webrender_api::{
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint, FramebufferIntRect,
FramebufferIntSize, ScrollLocation,
};
use webrender_api::units::DevicePoint;
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use webrender_api::ScrollLocation;
use webvr::VRServiceManager;
use webvr_traits::WebVRMainThreadHeartbeat;

@@ -192,16 +191,16 @@ pub struct EmbedderCoordinates {
/// Size of the native window.
pub window: (DeviceIntSize, DeviceIntPoint),
/// Size of the GL buffer in the window.
pub framebuffer: FramebufferIntSize,
pub framebuffer: DeviceIntSize,
/// Coordinates of the document within the framebuffer.
pub viewport: DeviceIntRect,
}

impl EmbedderCoordinates {
pub fn get_flipped_viewport(&self) -> FramebufferIntRect {
pub fn get_flipped_viewport(&self) -> DeviceIntRect {
let fb_height = self.framebuffer.height;
let mut view = self.viewport.clone();
view.origin.y = fb_height - view.origin.y - view.size.height;
FramebufferIntRect::from_untyped(&view.to_untyped())
DeviceIntRect::from_untyped(&view.to_untyped())
}
}
@@ -19,7 +19,7 @@ use keyboard_types::KeyboardEvent;
use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId};
use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
use webrender_api::{DeviceIntPoint, DeviceIntSize};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};

/// A cursor for the window. This is different from a CSS cursor (see
/// `CursorKind`) in that it has no `Auto` value.
@@ -8,7 +8,7 @@ extern crate malloc_size_of_derive;
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::{Length, Point2D, Rect, Size2D};
use std::f32;
use webrender_api::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};
use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};

// Units for use with euclid::length and euclid::scale_factor.

@@ -60,5 +60,5 @@ servo-fontconfig = "0.4"
xml5ever = {version = "0.14"}

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.8"
dwrote = "0.9"
truetype = "0.26"
@@ -12,8 +12,8 @@ use style::values::computed::{BorderCornerRadius, BorderImageWidth};
use style::values::computed::{BorderImageSideWidth, NonNegativeLengthOrNumber};
use style::values::generics::rect::Rect as StyleRect;
use style::values::generics::NonNegative;
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF};
use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder};
use webrender_api::units::{LayoutSideOffsets, LayoutSize};
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder};

/// Computes a border radius size against the containing size.
///

0 comments on commit c6156be

Please sign in to comment.
You can’t perform that action at this time.