Bug 1908969 part 2: Add some rendering tests for mozPrintCallback, with scale applied. r=layout-reviewers,jfkthame
These tests fail if we incorrectly flatten to rasterized output when printing. In particular, they fail on macOS, in the absense of the patches that recently landed on bug 1908587. Differential Revision: https://phabricator.services.mozilla.com/D217154
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
.reference {
|
||||
background: yellow;
|
||||
transform: scale(4);
|
||||
transform-origin: 0 0;
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
}
|
||||
.inner {
|
||||
background: cyan;
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
}
|
||||
</style>
|
||||
<div class="reference">
|
||||
<div class="inner"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1908969">
|
||||
<link rel="match" href="mozPrintCallback-rect-002-print-ref.html">
|
||||
<style>
|
||||
canvas {
|
||||
background: yellow;
|
||||
transform: scale(4);
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="myCanvas" width="80" height="80"></canvas>
|
||||
<script>
|
||||
myCanvas.mozPrintCallback = function (obj) {
|
||||
let ctx = obj.context;
|
||||
ctx.fillStyle = "cyan";
|
||||
ctx.fillRect(0, 0, 60, 60);
|
||||
obj.done();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="/fonts/ahem.css">
|
||||
<style>
|
||||
.reference {
|
||||
background: yellow;
|
||||
transform: scale(4);
|
||||
transform-origin: 0 0;
|
||||
font: 60px/1 Ahem;
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
<div class="reference">X</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1908969">
|
||||
<link rel="match" href="mozPrintCallback-text-002-print-ref.html">
|
||||
<link rel="stylesheet" href="/fonts/ahem.css">
|
||||
<style>
|
||||
canvas {
|
||||
background: yellow;
|
||||
transform: scale(4);
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="myCanvas" width="80" height="80"></canvas>
|
||||
<script>
|
||||
myCanvas.mozPrintCallback = function (obj) {
|
||||
let ctx = obj.context;
|
||||
ctx.font = "60px Ahem";
|
||||
// Draw the glyph using 'actualBoundingBoxAscent' as the y-position so that
|
||||
// its top-edge is flush with the top of the canvas. (This makes it easier
|
||||
// to position the glyph consistently between this testcase and the
|
||||
// reference case.)
|
||||
let yPos = ctx.measureText("X").actualBoundingBoxAscent;
|
||||
ctx.fillText("X", 0, yPos);
|
||||
obj.done();
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user