Auto merge of #26065 - dralley:fix-motionmark, r=cbrewster,SimonSapin

Don't send empty canvases to WebRender

If any dimension of a canvas is 0, don't try to display it as it causes
problems inside webrender.

Minimal test case available here: https://github.com/servo/servo/issues/21411#issuecomment-605226547

---
<!-- 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
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-04-03 13:57:33 -04:00 committed by GitHub
commit f7d3d4a447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 0 deletions

View file

@ -14591,6 +14591,13 @@
null,
{}
]
],
"zero_size_canvas_crash.html": [
"45eb9b559e8d6105baca5ab4d336de520d33b36b",
[
null,
{}
]
]
},
"webxr": {

View file

@ -0,0 +1,13 @@
<!doctype html>
<meta charset="utf-8">
<title>Test for #21411: Panic when putting a zero-sized canvas on the display list.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<canvas id="myCanvas" width="0" height="0" style="width:10px; height:10px;"></canvas>
<script>
test(function () {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.clearRect(0, 0, c.width, c.height);
}, "Doesn't crash when the page has a canvas with a zero-dimension");
</script>