Bug 1454507. Avoid asserting that we don't end up with an empty result. r=mstange
This adds a crash test that would previously trigger the assert.
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -233,17 +233,19 @@ fn dump_blob_index(blob: &[u8], dirty_re
""
}
);
}
}
fn check_result(result: &[u8]) -> () {
let mut index = BlobReader::new(result);
- assert!(index.reader.has_more(), "Unexpectedly empty result. This blob should just have been deleted");
+ // we might get an empty result here because sub groups are not tightly bound
+ // and we'll sometimes have display items that end up with empty bounds in
+ // the blob image.
while index.reader.has_more() {
let e = index.read_entry();
dlog!("result bounds: {} {} {:?}", e.end, e.extra_end, e.bounds);
}
}
// We use a BTree as a kind of multi-map, by appending an integer "cache_order" to the key.
// This lets us use multiple items with matching bounds in the map and allows
--- a/layout/svg/crashtests/crashtests.list
+++ b/layout/svg/crashtests/crashtests.list
@@ -202,8 +202,9 @@ load 1322537-2.html
load 1322852.html
load 1348564.svg
load 1402109.html
load 1402124.html
load 1402486.html
load conditional-outer-svg-nondirty-reflow-assert.xhtml
load extref-test-1.xhtml
load blob-merging-and-retained-display-list.html
+load grouping-empty-bounds.html
new file mode 100644
--- /dev/null
+++ b/layout/svg/crashtests/grouping-empty-bounds.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html lang="en" class='reftest-wait'>
+<meta charset="utf-8">
+<title>This testcase might create a non-empty display list with an empty set of drawing commands / items in the EventRecorder</title>
+
+<style>
+
+body {
+ margin: 0;
+}
+
+.animated-opacity {
+ animation: opacity-animation 1s linear alternate infinite;
+}
+
+@keyframes opacity-animation {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+</style>
+
+<svg style="width: 100px; height: 100px;">
+ <rect class="animated-opacity" x="0" y="0" width="100" height="100"/>
+ <rect x="0" y="0" width="10" height="10" id="toremove"/>
+ <g transform="translate(10 10)"><rect x="120" y="0" width="1" height="1"/></g>
+</svg>
+
+<script>
+
+window.addEventListener("MozReftestInvalidate", () => {
+ var elem = document.getElementById("toremove");
+ elem.parentNode.removeChild(elem);
+ document.documentElement.removeAttribute('class');
+});
+
+</script>