Bug 1500233 - Update webrender to commit c72754d72ddd0e9e198bb1edefe13f77d9a38f07. r=kats
authorWR Updater Bot <graphics-team@mozilla.staktrace.com>
Fri, 19 Oct 2018 15:57:32 +0000
changeset 490521 3fd071cc143477b440eec25e856613ae906e3c6b
parent 490520 23321e0768f092b7247cc14c8c54e7a0b27b13ae
child 490522 9788a3095675249e279b46b1dfee0246aec4fcc3
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerskats
bugs1500233
milestone64.0a1
Bug 1500233 - Update webrender to commit c72754d72ddd0e9e198bb1edefe13f77d9a38f07. r=kats Differential Revision: https://phabricator.services.mozilla.com/D9268
gfx/webrender/Cargo.toml
gfx/webrender/src/batch.rs
gfx/webrender/src/capture.rs
gfx/webrender/src/clip.rs
gfx/webrender/src/glyph_rasterizer/mod.rs
gfx/webrender/src/hit_test.rs
gfx/webrender/src/platform/windows/font.rs
gfx/webrender_api/Cargo.toml
gfx/webrender_bindings/Cargo.toml
gfx/webrender_bindings/revision.txt
gfx/wrench/Cargo.toml
--- a/gfx/webrender/Cargo.toml
+++ b/gfx/webrender/Cargo.toml
@@ -68,14 +68,14 @@ optional = true
 
 [dev-dependencies]
 mozangle = "0.1"
 
 [target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]
 freetype = { version = "0.4", default-features = false }
 
 [target.'cfg(target_os = "windows")'.dependencies]
-dwrote = "0.5.1"
+dwrote = "0.5.2"
 
 [target.'cfg(target_os = "macos")'.dependencies]
 core-foundation = "0.6"
 core-graphics = "0.17.1"
 core-text = { version = "13", default-features = false }
--- a/gfx/webrender/src/batch.rs
+++ b/gfx/webrender/src/batch.rs
@@ -2013,35 +2013,40 @@ impl ClipBatcher {
                 segment: 0,
                 clip_data_address: GpuCacheAddress::invalid(),
                 resource_address: GpuCacheAddress::invalid(),
             };
 
             let gpu_address = gpu_cache.get_address(&clip_node.gpu_cache_handle);
 
             match clip_node.item {
-                ClipItem::Image(ref mask) => {
-                    if let Ok(cache_item) = resource_cache.get_cached_image(
-                        ImageRequest {
-                            key: mask.image,
-                            rendering: ImageRendering::Auto,
-                            tile: None,
+                ClipItem::Image(ref mask, is_valid) => {
+                    if is_valid {
+                        if let Ok(cache_item) = resource_cache.get_cached_image(
+                            ImageRequest {
+                                key: mask.image,
+                                rendering: ImageRendering::Auto,
+                                tile: None,
+                            }
+                        ) {
+                            self.images
+                                .entry(cache_item.texture_id)
+                                .or_insert(Vec::new())
+                                .push(ClipMaskInstance {
+                                    clip_data_address: gpu_address,
+                                    resource_address: gpu_cache.get_address(&cache_item.uv_rect_handle),
+                                    ..instance
+                                });
+                        } else {
+                            warn!("Warnings: skip a image mask");
+                            debug!("Key:{:?} Rect::{:?}", mask.image, mask.rect);
+                            continue;
                         }
-                    ) {
-                        self.images
-                            .entry(cache_item.texture_id)
-                            .or_insert(Vec::new())
-                            .push(ClipMaskInstance {
-                                clip_data_address: gpu_address,
-                                resource_address: gpu_cache.get_address(&cache_item.uv_rect_handle),
-                                ..instance
-                            });
                     } else {
-                        warn!("Warnings: skip a image mask");
-                        debug!("Key:{:?} Rect::{:?}", mask.image, mask.rect);
+                        warn!("Warnings: clip masks that are tiled blobs are not yet supported (#2852)");
                         continue;
                     }
                 }
                 ClipItem::BoxShadow(ref info) => {
                     let rt_handle = info
                         .cache_handle
                         .as_ref()
                         .expect("bug: render task handle not allocated");
--- a/gfx/webrender/src/capture.rs
+++ b/gfx/webrender/src/capture.rs
@@ -58,24 +58,26 @@ impl CaptureConfig {
     where
         T: for<'a> serde::Deserialize<'a>,
         P: AsRef<Path>,
     {
         use std::io::Read;
 
         let mut string = String::new();
         let path = root
-            .join(name)
+            .join(name.as_ref())
             .with_extension("ron");
         File::open(path)
             .ok()?
             .read_to_string(&mut string)
             .unwrap();
-        Some(ron::de::from_str(&string)
-            .unwrap())
+        match ron::de::from_str(&string) {
+            Ok(out) => Some(out),
+            Err(e) => panic!("File {:?} deserialization failed: {:?}", name.as_ref(), e),
+        }
     }
 
     #[cfg(feature = "png")]
     pub fn save_png(
         path: PathBuf, size: (u32, u32), format: ReadPixelsFormat, data: &[u8],
     ) {
         use api::ImageFormat;
         use png::{BitDepth, ColorType, Encoder, HasParameters};
--- a/gfx/webrender/src/clip.rs
+++ b/gfx/webrender/src/clip.rs
@@ -140,21 +140,24 @@ impl From<ClipItemKey> for ClipNode {
             ClipItemKey::RoundedRectangle(rect, radius, mode) => {
                 ClipItem::RoundedRectangle(
                     LayoutRect::from_au(rect),
                     radius.into(),
                     mode,
                 )
             }
             ClipItemKey::ImageMask(rect, image, repeat) => {
-                ClipItem::Image(ImageMask {
-                    image,
-                    rect: LayoutRect::from_au(rect),
-                    repeat,
-                })
+                ClipItem::Image(
+                    ImageMask {
+                        image,
+                        rect: LayoutRect::from_au(rect),
+                        repeat,
+                    },
+                    true,
+                )
             }
             ClipItemKey::BoxShadow(shadow_rect, shadow_radius, prim_shadow_rect, blur_radius, clip_mode) => {
                 ClipItem::new_box_shadow(
                     LayoutRect::from_au(shadow_rect),
                     shadow_radius.into(),
                     LayoutRect::from_au(prim_shadow_rect),
                     blur_radius.to_f32_px(),
                     clip_mode,
@@ -258,17 +261,17 @@ impl ClipNode {
     pub fn update(
         &mut self,
         gpu_cache: &mut GpuCache,
         resource_cache: &mut ResourceCache,
         device_pixel_scale: DevicePixelScale,
     ) {
         if let Some(mut request) = gpu_cache.request(&mut self.gpu_cache_handle) {
             match self.item {
-                ClipItem::Image(ref mask) => {
+                ClipItem::Image(ref mask, ..) => {
                     let data = ImageMaskData { local_rect: mask.rect };
                     data.write_gpu_blocks(request);
                 }
                 ClipItem::BoxShadow(ref info) => {
                     request.push([
                         info.shadow_rect_alloc_size.width,
                         info.shadow_rect_alloc_size.height,
                         info.clip_mode as i32 as f32,
@@ -289,25 +292,35 @@ impl ClipNode {
                 ClipItem::RoundedRectangle(ref rect, ref radius, mode) => {
                     let data = ClipData::rounded_rect(rect, radius, mode);
                     data.write(&mut request);
                 }
             }
         }
 
         match self.item {
-            ClipItem::Image(ref mask) => {
-                resource_cache.request_image(
-                    ImageRequest {
-                        key: mask.image,
-                        rendering: ImageRendering::Auto,
-                        tile: None,
-                    },
-                    gpu_cache,
-                );
+            ClipItem::Image(ref mask, ref mut is_valid) => {
+                if let Some(properties) = resource_cache.get_image_properties(mask.image) {
+                    // Clip masks with tiled blob images are not currently supported.
+                    // This results in them being ignored, which is not ideal, but
+                    // is better than crashing in resource cache!
+                    // See https://github.com/servo/webrender/issues/2852.
+                    *is_valid = properties.tiling.is_none();
+                }
+
+                if *is_valid {
+                    resource_cache.request_image(
+                        ImageRequest {
+                            key: mask.image,
+                            rendering: ImageRendering::Auto,
+                            tile: None,
+                        },
+                        gpu_cache,
+                    );
+                }
             }
             ClipItem::BoxShadow(ref mut info) => {
                 // Quote from https://drafts.csswg.org/css-backgrounds-3/#shadow-blur
                 // "the image that would be generated by applying to the shadow a
                 // Gaussian blur with a standard deviation equal to half the blur radius."
                 let blur_radius_dp = (info.blur_radius * 0.5 * device_pixel_scale.0).round();
 
                 // Create the cache key for this box-shadow render task.
@@ -755,17 +768,19 @@ impl ClipItemKey {
 }
 
 #[derive(Debug, Clone)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
 #[cfg_attr(feature = "replay", derive(Deserialize))]
 pub enum ClipItem {
     Rectangle(LayoutRect, ClipMode),
     RoundedRectangle(LayoutRect, BorderRadius, ClipMode),
-    Image(ImageMask),
+    /// The boolean below is a crash workaround for #2852, will be true unless
+    /// the mask is a tiled blob.
+    Image(ImageMask, bool),
     BoxShadow(BoxShadowClipSource),
 }
 
 impl ClipItem {
     pub fn new_box_shadow(
         shadow_rect: LayoutRect,
         mut shadow_radius: BorderRadius,
         prim_shadow_rect: LayoutRect,
@@ -868,18 +883,18 @@ impl ClipItem {
     // used to eliminate redundant clips, and reduce the size of
     // any clip mask that eventually gets drawn.
     fn get_local_clip_rect(&self) -> Option<LayoutRect> {
         match *self {
             ClipItem::Rectangle(clip_rect, ClipMode::Clip) => Some(clip_rect),
             ClipItem::Rectangle(_, ClipMode::ClipOut) => None,
             ClipItem::RoundedRectangle(clip_rect, _, ClipMode::Clip) => Some(clip_rect),
             ClipItem::RoundedRectangle(_, _, ClipMode::ClipOut) => None,
-            ClipItem::Image(ref mask) if mask.repeat => None,
-            ClipItem::Image(ref mask) => Some(mask.rect),
+            ClipItem::Image(ref mask, ..) if mask.repeat => None,
+            ClipItem::Image(ref mask, ..) => Some(mask.rect),
             ClipItem::BoxShadow(..) => None,
         }
     }
 
     fn get_clip_result_complex(
         &self,
         transform: &LayoutToWorldTransform,
         prim_world_rect: &WorldRect,
@@ -1001,17 +1016,17 @@ impl ClipItem {
                     Some(_) => {
                         ClipResult::Partial
                     }
                     None => {
                         ClipResult::Accept
                     }
                 }
             }
-            ClipItem::Image(ref mask) => {
+            ClipItem::Image(ref mask, ..) => {
                 if mask.repeat {
                     ClipResult::Partial
                 } else {
                     match mask.rect.intersection(prim_rect) {
                         Some(..) => {
                             ClipResult::Partial
                         }
                         None => {
--- a/gfx/webrender/src/glyph_rasterizer/mod.rs
+++ b/gfx/webrender/src/glyph_rasterizer/mod.rs
@@ -173,16 +173,17 @@ pub struct FontInstance {
     // TODO(gw): Perhaps consider having LogicalAu and DeviceAu
     //           or something similar to that.
     pub size: Au,
     pub color: ColorU,
     pub bg_color: ColorU,
     pub render_mode: FontRenderMode,
     pub flags: FontInstanceFlags,
     pub synthetic_italics: SyntheticItalics,
+    #[cfg_attr(any(feature = "capture", feature = "replay"), serde(skip))]
     pub platform_options: Option<FontInstancePlatformOptions>,
     pub variations: Vec<FontVariation>,
     pub transform: FontTransform,
 }
 
 impl FontInstance {
     pub fn new(
         font_key: FontKey,
--- a/gfx/webrender/src/hit_test.rs
+++ b/gfx/webrender/src/hit_test.rs
@@ -34,17 +34,17 @@ pub struct HitTestClipNode {
 }
 
 impl HitTestClipNode {
     fn new(node: &ClipNode) -> Self {
         let region = match node.item {
             ClipItem::Rectangle(ref rect, mode) => HitTestRegion::Rectangle(*rect, mode),
             ClipItem::RoundedRectangle(ref rect, ref radii, ref mode) =>
                 HitTestRegion::RoundedRectangle(*rect, *radii, *mode),
-            ClipItem::Image(ref mask) => HitTestRegion::Rectangle(mask.rect, ClipMode::Clip),
+            ClipItem::Image(ref mask, ..) => HitTestRegion::Rectangle(mask.rect, ClipMode::Clip),
             ClipItem::BoxShadow(_) => HitTestRegion::Invalid,
         };
 
         HitTestClipNode {
             region,
         }
     }
 }
--- a/gfx/webrender/src/platform/windows/font.rs
+++ b/gfx/webrender/src/platform/windows/font.rs
@@ -110,17 +110,17 @@ impl FontContext {
         self.fonts.contains_key(font_key)
     }
 
     pub fn add_raw_font(&mut self, font_key: &FontKey, data: Arc<Vec<u8>>, index: u32) {
         if self.fonts.contains_key(font_key) {
             return;
         }
 
-        if let Some(font_file) = dwrote::FontFile::new_from_data(&**data) {
+        if let Some(font_file) = dwrote::FontFile::new_from_data(data) {
             let face = font_file.create_face(index, dwrote::DWRITE_FONT_SIMULATIONS_NONE);
             self.fonts.insert(*font_key, face);
         } else {
             // XXX add_raw_font needs to have a way to return an error
             debug!("DWrite WR failed to load font from data, using Arial instead");
             self.add_native_font(font_key, DEFAULT_FONT_DESCRIPTOR.clone());
         }
     }
--- a/gfx/webrender_api/Cargo.toml
+++ b/gfx/webrender_api/Cargo.toml
@@ -24,9 +24,9 @@ serde_derive = { version = "=1.0.66", fe
 serde_bytes = "0.10"
 time = "0.1"
 
 [target.'cfg(target_os = "macos")'.dependencies]
 core-foundation = "0.6"
 core-graphics = "0.17.1"
 
 [target.'cfg(target_os = "windows")'.dependencies]
-dwrote = "0.5.1"
+dwrote = "0.5.2"
--- a/gfx/webrender_bindings/Cargo.toml
+++ b/gfx/webrender_bindings/Cargo.toml
@@ -18,15 +18,15 @@ fxhash = "0.2.1"
 
 [dependencies.webrender]
 path = "../webrender"
 version = "0.57.2"
 default-features = false
 features = ["capture", "serialize_program"]
 
 [target.'cfg(target_os = "windows")'.dependencies]
-dwrote = "0.5.1"
+dwrote = "0.5.2"
 
 [target.'cfg(target_os = "macos")'.dependencies]
 core-foundation = "0.6"
 core-graphics = "0.17.1"
 foreign-types = "0.3.0"
 
--- a/gfx/webrender_bindings/revision.txt
+++ b/gfx/webrender_bindings/revision.txt
@@ -1,1 +1,1 @@
-b648c76e2dc2cbcbd635322cdf94ab9d5320e0c1
+c72754d72ddd0e9e198bb1edefe13f77d9a38f07
--- a/gfx/wrench/Cargo.toml
+++ b/gfx/wrench/Cargo.toml
@@ -34,13 +34,13 @@ serde = {version = "1.0", features = ["d
 core-graphics = "0.17.1"
 core-foundation = "0.6"
 
 [features]
 headless = [ "osmesa-sys", "osmesa-src" ]
 pathfinder = [ "webrender/pathfinder" ]
 
 [target.'cfg(target_os = "windows")'.dependencies]
-dwrote = "0.5.1"
+dwrote = "0.5.2"
 mozangle = {version = "0.1.5", features = ["egl"]}
 
 [target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
 font-loader = "0.7"