зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1171755 - Update web-platform-tests to revision 0fbf63dbe6f6b8b0dccee76d96ec4b7d50c3fff6, a=testonly
This commit is contained in:
Родитель
77bc735a23
Коммит
710659af66
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1 +1 @@
|
|||
36bf12e75b3d8fc5ac90187f21d50a3eed5a0442
|
||||
cc6c963e2ccda75a4879bb9e8f945f270250ec37
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 770 KiB |
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_1_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
// 2 arguments, the dest origin is 0,0
|
||||
// The source canvas will copied to the 0,0 position of the destination canvas
|
||||
destCtx.drawImage(sourceCanvas, 0, 0);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_10_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The destination rectangle is larger than the destination canvas
|
||||
// When the destination rectangle is outside the destination image (the scratch bitmap),
|
||||
// the pixels that land outside the scratch bitmap are discarded,
|
||||
// as if the destination was an infinite canvas whose rendering was
|
||||
// clipped to the dimensions of the scratch bitmap.
|
||||
destCtx.drawImage(sourceCanvas, 0, 0, 50, 50, 0, 0, 200, 200);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, 100, 100);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(20, 20, 80, 80);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_11_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source rectangle is larger than the source canvas
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination are is clipped in the same proportion
|
||||
destCtx.drawImage(sourceCanvas, 0, 0, 100, 100, 0, 0, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, 25, 25);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(2, 2, 20, 20);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_12_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// Negative coordinates of the source rectangle
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination area is clipped in the same proportion
|
||||
destCtx.drawImage(sourceCanvas, -25, -25, 50, 50, 0, 0, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, 25, 25);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(5, 5, 20, 20);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(5, 5, 40, 40);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_2_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 2 arguments, the dest origin is not 0,0
|
||||
// The source canvas will copied to the 25, 25 position of the destination canvas
|
||||
destCtx.drawImage(sourceCanvas, 25, 25);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(25, 25, sourceWidth, sourceHeight);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(30, 30, 40, 40);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_3_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 4 arguments, the source origin is not 0,0, the dest size is provided
|
||||
// The source canvas will copied to the 50, 50 position of the destination canvas and
|
||||
// on an area of 50x50 pixels
|
||||
destCtx.drawImage(sourceCanvas, 50, 50, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(50, 50, sourceWidth, sourceHeight);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(55, 55, 40, 40);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_4_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 4 arguments, the dest origin is not 0,0 and the dest size is provided but
|
||||
// does not match the size of the source. The image will be distorted
|
||||
// The source canvas will copied to the 50,50 position of the destination canvas
|
||||
// and it will be shrunk to a and area of 20x20
|
||||
destCtx.drawImage(sourceCanvas, 50, 50, 20, 20);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(50, 50, 20, 20);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(52, 52, 16, 16);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_5_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source canvas will copied to the 50,50 position of the destination canvas
|
||||
// over an area of 50x25 pixels
|
||||
// The copied image will be distorted along the x axis
|
||||
destCtx.drawImage(sourceCanvas, 50, 50, 50, 20);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(50, 50, 50, 20);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(55, 52, 40, 16);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_6_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 8 arguments, both destination and source origins are 0, 0
|
||||
// An area of 25x25 pixels of the source image will be copied to
|
||||
// an area of 25x25 pixels of the destination canvas
|
||||
destCtx.drawImage(sourceCanvas, 0, 0, 25, 25, 0, 0, 25, 25);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, 25, 25);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(5, 5, 20, 20);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_7_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 8 arguments the destination origin is not 0,0
|
||||
// An area of 25x25 pixels of the source image will be copied to
|
||||
// an area of 25x25 pixels of the destination canvas in the position 25,25
|
||||
destCtx.drawImage(sourceCanvas, 0, 0, 25, 25, 25, 25, 25, 25);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(25, 25, 25, 25);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(30, 30, 20, 20);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_8_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source rectangle overflows the source image
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination are is clipped in the same proportion
|
||||
destCtx.drawImage(sourceCanvas, 25, 25, 50, 50, 0, 0, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.fillStyle = "#00FFFF";
|
||||
destCtx.fillRect(0, 0, 25, 25);
|
||||
destCtx.fillStyle = "#000000";
|
||||
destCtx.fillRect(0, 0, 20, 20);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_canvas_9_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 50;
|
||||
var sourceHeight = 50;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceCanvas = document.createElement('canvas');
|
||||
sourceCanvas.width = sourceWidth;
|
||||
sourceCanvas.height = sourceHeight;
|
||||
|
||||
var sourceCtx = sourceCanvas.getContext('2d');
|
||||
sourceCtx.fillStyle = "#00FFFF";
|
||||
sourceCtx.fillRect(0, 0, sourceWidth, sourceHeight);
|
||||
sourceCtx.fillStyle = "#000000";
|
||||
sourceCtx.fillRect(5,5,40,40);
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The destination rectangle has negative width and height
|
||||
// An exception is raised and nothing is drawn
|
||||
try {
|
||||
destCtx.drawImage(sourceCanvas, 25, 50, 50, 0, 0, -100, -100);
|
||||
// It makes the test fail if the exception is not thrown
|
||||
destCtx.fillStyle = "#0000FF";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
}
|
||||
catch(err) {
|
||||
console.err("Exception Thrown");
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_1_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
// 2 arguments, the dest origin is 0,0
|
||||
// The source canvas will copied to the 0,0 position of the destination canvas
|
||||
destCtx.drawImage(sourceImg, 0, 0);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_10_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 128;
|
||||
var sourceHeight = 128;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The destination rectangle is larger than the destination canvas.
|
||||
// When the destination rectangle is outside the destination image (the scratch bitmap),
|
||||
// the pixels that land outside the scratch bitmap are discarded,
|
||||
// as if the destination was an infinite canvas
|
||||
// whose rendering was clipped to the dimensions of the scratch bitmap.
|
||||
destCtx.drawImage(sourceImg, 0, 0, 512, 512, 0, 0, 256, 256);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url("../2x2.png");
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_11_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 128;
|
||||
var sourceHeight = 128;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source rectangle is larger than the source canvas
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination are is clipped in the same proportion
|
||||
destCtx.drawImage(sourceImg, 0, 0, 2048, 2048, 0, 0, 800, 800);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: #FA6FF2;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination" height="100" width="100"></canvas>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_12_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 128;
|
||||
var sourceHeight = 128;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// Negative coordinates of the source rectangle
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination area is clipped in the same proportion
|
||||
destCtx.drawImage(sourceImg, -25, -25, 50, 50, 0, 0, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#img {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
background-color: #FA6FF2;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination">
|
||||
<div id="img"><div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_13_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 128;
|
||||
var sourceHeight = 128;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source Image doesn't have a src url defined
|
||||
// It should throw an exception because the HTMLImageElement is
|
||||
// in the broken state
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#check-the-usability-of-the-image-argument
|
||||
try {
|
||||
destCtx.drawImage(sourceImg, 0, 0);
|
||||
// It makes the test fail if the exception is not thrown
|
||||
destCtx.fillStyle = "#0000FF";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
}
|
||||
catch(err) {
|
||||
console.log("Exception: " + err.message);
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url("../2x2.png");
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_2_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 2 arguments, the dest origin is not 0,0
|
||||
// The source image will copied to the 25, 25 position of the destination canvas
|
||||
destCtx.drawImage(sourceImg, 25, 25);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
background-image: url("../2x2.png");
|
||||
background-position: 25px 25px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_3_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = true;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
// 4 arguments, the source origin is not 0,0, the dest size is provided
|
||||
// The source canvas will copied to the 50, 50 position of the destination canvas and
|
||||
// on an area of 50x50 pixels
|
||||
destCtx.drawImage(sourceImg, 50, 50, 50, 50);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
background-image: url("../2x2.png");
|
||||
background-position: 50px 50px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 50px 50px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_4_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
// 4 arguments, the dest origin is not 0,0 and the dest size is provided but
|
||||
// does not match the size of the source. The image will be distorted
|
||||
// The source canvas will copied to the 50,50 position of the destination canvas
|
||||
// and it will be shrunk to a and area of 16x16
|
||||
destCtx.drawImage(sourceImg, 50, 50, 16, 16);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#destination img{
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 50px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination">
|
||||
<img src="../2x2.png" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_5_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
// The source canvas will copied to the 50,50 position of the destination canvas
|
||||
// over an area of 64x32 pixels
|
||||
// The copied image will be distorted along the x axis
|
||||
destCtx.drawImage(sourceImg, 50, 50, 64, 32);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#destination .img{
|
||||
position: relative;
|
||||
top: 50px;
|
||||
left: 50px;
|
||||
width: 64px;
|
||||
height: 32px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#destination .img img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination">
|
||||
<div class="img">
|
||||
<img src="../2x2.png" />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_6_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 8 arguments, both destination and source origins are 0, 0
|
||||
// An area of 32x32 pixels of the source image will be copied to
|
||||
// an area of 32x32 pixels of the destination canvas
|
||||
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 0, 0, 32, 32);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
background-color: red;
|
||||
background-image: url("../2x2.png");
|
||||
background-position: -32px -32px;
|
||||
background-size: 64px 64px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_7_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// 8 arguments the destination origin is not 0,0
|
||||
// An area of 32x32 pixels of the source image will be copied to
|
||||
// an area of 32x32 pixels of the destination canvas in the position 32,32
|
||||
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 32, 32, 32, 32);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#img {
|
||||
position: relative;
|
||||
top: 32px;
|
||||
left: 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-image: url("../2x2.png");
|
||||
background-position: -32px -32px;
|
||||
background-size: 64px 64px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination">
|
||||
<div id="img"><div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_8_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The source rectangle overflows the source image
|
||||
// The source area is clipped to fit the source image
|
||||
// and the destination are is clipped in the same proportion
|
||||
destCtx.drawImage(sourceImg, 32, 32, 32, 32, 0, 0, 32, 32);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#img {
|
||||
position: relative;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-image: url("../2x2.png");
|
||||
background-position: -32px -32px;
|
||||
background-size: 64px 64px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination">
|
||||
<div id="img"><div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel=match href=drawimage_html_image_9_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="dest" height="100" width="100"></canvas>
|
||||
<script>
|
||||
|
||||
var sourceWidth = 100;
|
||||
var sourceHeight = 100;
|
||||
var smoothingEnabled = false;
|
||||
var destCanvas = document.getElementById('dest');
|
||||
var sourceImg = document.createElement('img');
|
||||
sourceImg.src = '../2x2.png'
|
||||
sourceImg.width = sourceWidth;
|
||||
sourceImg.height = sourceHeight;
|
||||
|
||||
var destCtx = destCanvas.getContext('2d');
|
||||
destCtx.fillStyle = "#FF0000";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
destCtx.imageSmoothingEnabled = smoothingEnabled;
|
||||
|
||||
// The destination rectangle has negative width and height
|
||||
// An exception is raised and nothing is drawn
|
||||
try {
|
||||
destCtx.drawImage(sourceImg, 25, 50, 50, 0, 0, -100, -100);
|
||||
// It makes the test fail if the exception is not thrown
|
||||
destCtx.fillStyle = "#0000FF";
|
||||
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
|
||||
}
|
||||
catch(err) {
|
||||
console.err("Exception Thrown");
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#destination {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="destination"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<link rel=match href=lineto_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="c" width="150" height="150" >
|
||||
Your browser does not support the HTML5 canvas tag.</canvas>
|
||||
|
||||
<script>
|
||||
var c = document.getElementById("c");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(20, 20);
|
||||
ctx.lineTo(20, 130);
|
||||
ctx.lineTo(130, 130);
|
||||
ctx.lineTo(130, 20);
|
||||
ctx.closePath();
|
||||
|
||||
ctx.fillStyle = '#90EE90';
|
||||
ctx.fill();
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div {
|
||||
background: #90EE90;
|
||||
width: 110px;
|
||||
height: 110px;
|
||||
margin: 20px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
html, body, div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div style="background-color:red"></div>
|
||||
<div style="clear:left"></div>
|
||||
<div style="background-color:blue"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="match" href="canvas_transformations_reset_001-ref.htm">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id="c" width="150" height="150"></canvas>
|
||||
<script>
|
||||
var c = document.getElementById("c");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
ctx.translate(75, 75);
|
||||
ctx.fillStyle = 'blue';
|
||||
ctx.fillRect(0, 0, 75, 75);
|
||||
|
||||
ctx.resetTransform();
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillRect(0, 0, 75, 75);
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<link rel=match href=transform_ref.html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<canvas id=c width=400 height=300></canvas>
|
||||
<script>
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.scale(3, 3);
|
||||
ctx.fillStyle = 'rgb(255, 0, 0)';
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(10, 10);
|
||||
ctx.bezierCurveTo(10, 10, 20, 10, 20, 10);
|
||||
ctx.bezierCurveTo(20, 10, 20, 20, 20, 20);
|
||||
ctx.bezierCurveTo(20, 20, 10, 20, 10, 20);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
section {
|
||||
position: absolute;
|
||||
background: rgb(255, 0, 0);
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
top: 30px;
|
||||
left: 30px;
|
||||
}
|
||||
</style>
|
||||
<section></section>
|
|
@ -21,7 +21,7 @@ should_throw(-0.5)
|
|||
should_throw(0)
|
||||
should_throw(0.5)
|
||||
should_throw(0.8)
|
||||
should_throw(0x20000000000000)
|
||||
should_throw(0x20000000000000) // Number.MAX_SAFE_INTEGER + 1
|
||||
should_throw(NaN)
|
||||
should_throw(Infinity)
|
||||
should_throw(-Infinity)
|
||||
|
@ -43,10 +43,12 @@ should_throw({
|
|||
valueOf: function() { return {}; },
|
||||
}, 'object (third)')
|
||||
|
||||
|
||||
/* Valid */
|
||||
|
||||
function should_work(val) {
|
||||
var t = async_test("Calling open() with version argument 1.5 should not throw.")
|
||||
var name = format_value(val);
|
||||
var t = async_test("Calling open() with version argument " + name + " should not throw.")
|
||||
var rq = createdb(t, val)
|
||||
rq.onupgradeneeded = function() {
|
||||
t.done()
|
||||
|
@ -54,6 +56,7 @@ function should_work(val) {
|
|||
}
|
||||
|
||||
should_work(1.5)
|
||||
should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ Running the Tests
|
|||
|
||||
The tests are designed to be run from your local computer. The test
|
||||
environment requires Python 2.7+ (but not Python 3.x). You will also
|
||||
need a copy of OpenSSL. For users on Windows this is available from
|
||||
[the openssl website](https://www.openssl.org/related/binaries.html).
|
||||
need a copy of OpenSSL. Users on Windows should read the
|
||||
[Windows Notes](#windows-notes) section below.
|
||||
|
||||
To get the tests running, you need to set up the test domains in your
|
||||
[`hosts` file](http://en.wikipedia.org/wiki/Hosts_%28file%29%23Location_in_the_file_system). The
|
||||
|
@ -71,6 +71,26 @@ like:
|
|||
"ssl": {"openssl": {"binary": "/path/to/openssl"}}
|
||||
```
|
||||
|
||||
<span id="windows-notes">Windows Notes</span>
|
||||
=============================================
|
||||
|
||||
Running wptserve with SSL enabled on Windows typically requires
|
||||
installing an OpenSSL distribution.
|
||||
[Shining Light](http://slproweb.com/products/Win32OpenSSL.html)
|
||||
provide a convenient installer that is known to work, but requires a
|
||||
little extra setup.
|
||||
|
||||
After installation ensure that the path to OpenSSL is on your `%Path%`
|
||||
environment variable.
|
||||
|
||||
Then set the path to the default OpenSSL configuration file (usually
|
||||
something like `C:\OpenSSL-Win32\bin\openssl.cfg` in the server
|
||||
configuration. To do this copy `config.default.json` in the
|
||||
web-platform-tests root to `config.json`. Then edit the JSON so that
|
||||
the key `ssl/openssl/base_conf_path` has a value that is the path to
|
||||
the OpenSSL config file.
|
||||
|
||||
|
||||
Test Runner
|
||||
===========
|
||||
|
||||
|
|
|
@ -23,7 +23,13 @@
|
|||
client.upload.addEventListener('loadstart', logEvt)
|
||||
client.addEventListener('loadend', function(){
|
||||
test.step(function(){
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
|
||||
if (method === "HEAD") {
|
||||
// Fetch 4.4.3 --- Set Content-Length to 0 if method is HEAD and
|
||||
// request's body is null.
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
|
||||
} else {
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
|
||||
}
|
||||
assert_equals(client.getResponseHeader("x-request-method"), method)
|
||||
assert_equals(client.responseText, "")
|
||||
assert_array_equals(events, [])
|
||||
|
|
|
@ -22,7 +22,14 @@
|
|||
client.upload.addEventListener('progress', logEvt)
|
||||
client.upload.addEventListener('loadend', logEvt)
|
||||
client.upload.addEventListener('loadstart', logEvt)
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
|
||||
|
||||
if (method === "HEAD") {
|
||||
// Fetch 4.4.3 --- Set Content-Length to 0 if method is HEAD and
|
||||
// request's body is null.
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
|
||||
} else {
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
|
||||
}
|
||||
assert_equals(client.getResponseHeader("x-request-method"), method)
|
||||
assert_equals(client.responseText, "")
|
||||
assert_array_equals(events, [])
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/testharnessreport.js");
|
||||
importScripts("send-usp.js");
|
||||
run_test();
|
||||
done();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<div id="log"></div>
|
||||
|
||||
<pre id="untested_idl">
|
||||
[PrimaryGlobal]
|
||||
interface Window {
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<p>This test validates the WebIDL included in the Timing control for script-based animations specification.</p>
|
||||
|
||||
<pre id='untested_idl' style='display:none'>
|
||||
[PrimaryGlobal]
|
||||
interface Window {
|
||||
};
|
||||
</pre>
|
||||
|
|
|
@ -95,17 +95,6 @@
|
|||
onlevelchange_test.done();
|
||||
};
|
||||
|
||||
// compute primes to deplete the battery faster
|
||||
var w = new Worker('prime.js');
|
||||
w.postMessage('compute');
|
||||
w.onmessage = function (e) {
|
||||
document.querySelector('#prime').textContent = e.data;
|
||||
};
|
||||
|
||||
add_completion_callback(function () {
|
||||
w.terminate();
|
||||
});
|
||||
|
||||
navigator.getBattery().then(batterySuccess, batteryFailure);
|
||||
|
||||
})();
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
// adapted from http://html5demos.com/worker
|
||||
|
||||
var running = false;
|
||||
|
||||
onmessage = function (event) {
|
||||
// doesn't matter what the message is, just toggle the worker
|
||||
if (running == false) {
|
||||
running = true;
|
||||
run(1);
|
||||
} else {
|
||||
running = false;
|
||||
}
|
||||
};
|
||||
|
||||
function run(n) {
|
||||
// split the task into 20k chunks
|
||||
var limit = n + 20000;
|
||||
search: while (running && n < limit) {
|
||||
n += 1;
|
||||
for (var i = 2; i <= Math.sqrt(n); i += 1) {
|
||||
if (n % i == 0) {
|
||||
continue search;
|
||||
}
|
||||
}
|
||||
// found a prime!
|
||||
postMessage(n);
|
||||
}
|
||||
if (n === limit) {
|
||||
// wait for the UI thread to update itself
|
||||
setTimeout(function(start_time) {
|
||||
// resume prime computation at n
|
||||
run(n);
|
||||
}, 150);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
{"host": "web-platform.test",
|
||||
"doc_root": null,
|
||||
"ws_doc_root": null,
|
||||
"external_host": null,
|
||||
"ports":{"http":[8000, "auto"],
|
||||
"https":[8443],
|
||||
"ws":["auto"]},
|
||||
"ws":["auto"],
|
||||
"wss":["auto"]},
|
||||
"check_subdomains": true,
|
||||
"log_level":"debug",
|
||||
"bind_hostname": true,
|
||||
|
@ -11,7 +14,8 @@
|
|||
"openssl": {
|
||||
"openssl_binary": "openssl",
|
||||
"base_path": "_certs",
|
||||
"force_regenerate": false
|
||||
"force_regenerate": false,
|
||||
"base_conf_path": null
|
||||
},
|
||||
"pregenerated": {
|
||||
"host_key_path": null,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
(function () {
|
||||
scriptsrc1.step(function() { assert_unreached('Unsafe inline script ran.') });
|
||||
})();
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>default-src should cascade to img-src directive</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='../support/siblingPath.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>default-src should cascade to img-src directive</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var imgsrc = async_test("Verify cascading of default-src to img-src policy");
|
||||
var onerrorFired = false;
|
||||
</script>
|
||||
|
||||
<img id='imgfail' src=''
|
||||
onload='imgsrc.step(function() { assert_unreached("Image load was not blocked."); });'
|
||||
onerror='onerrorFired = true;'>
|
||||
<img src='../support/pass.png'
|
||||
onload='imgsrc.step(function() { assert_true(true, "Image load was blocked."); });'>
|
||||
|
||||
<script>
|
||||
document.getElementById('imgfail').src = buildSiblingPath('www1', '../support/fail.png');
|
||||
onload = function() {
|
||||
imgsrc.step(function() { assert_true(onerrorFired, "onerror handler for blocked img didn't fire");});
|
||||
imgsrc.done();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: generic-0_1-img-src={{$id:uuid()}}; Path=/content-security-policy/generic/
|
||||
Content-Security-Policy: default-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>default-src should cascade to script-src directive</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='../support/siblingPath.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>default-src should cascade to script-src directive</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var scriptsrc1 = async_test("Verify cascading of default-src to script-src policy: block");
|
||||
var scriptsrc2 = async_test("Verify cascading of default-src to script-src policy: allow");
|
||||
var allowedScriptRan = false;
|
||||
</script>
|
||||
|
||||
<script src='pass-0_1.js'></script>
|
||||
|
||||
<script>
|
||||
var inlineScript = document.createElement('script');
|
||||
inlineScript.src = buildSiblingPath('www1', 'fail-0_1.js');
|
||||
document.getElementById('log').appendChild(inlineScript);
|
||||
onload = function() {
|
||||
scriptsrc1.done();
|
||||
scriptsrc2.step( function() { assert_true(allowedScriptRan, "allowed script didn't run") });
|
||||
scriptsrc2.done();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: generic-0_1-script-src={{$id:uuid()}}; Path=/content-security-policy/generic/
|
||||
Content-Security-Policy: default-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,3 @@
|
|||
(function () {
|
||||
allowedScriptRan = true;
|
||||
})();
|
|
@ -7,7 +7,7 @@
|
|||
<script src='inlineTests.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive.</h1>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive, even for script-src 'self'.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Inline script should not run without 'unsafe-inline' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script src='inlineTests.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Inline script should not run without 'unsafe-inline' script-src directive, even for script-src *.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
t1.step(function() {assert_unreached('Unsafe inline script ran.');});
|
||||
</script>
|
||||
|
||||
<img src='doesnotexist.jpg' onerror='t2.step(function() { assert_unreached("Unsafe inline event handler ran.") });'>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_2={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src *; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>setTimeout() and setInterval() should not run without 'unsafe-eval' script-src directive.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("window.setTimeout()");
|
||||
var t2 = async_test("window.setInterval()");
|
||||
|
||||
onload = function() {t1.done(); t2.done()}
|
||||
|
||||
window.setTimeout('t1.step(function() {assert_unreached("window.setTimeout() ran without unsafe-eval.")})',0);
|
||||
window.setInterval('t2.step(function() {assert_unreached("window.setInterval() ran without unsafe-eval.")})',0);
|
||||
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27+%27unsafe-eval%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_4_1={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Function() called as a constructor should throw without 'unsafe-eval' script-src directive.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Function() called as a constructor should throw without 'unsafe-eval' script-src directive.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
assert_throws(
|
||||
new EvalError(),
|
||||
function() {
|
||||
var funq = new Function('');
|
||||
funq();
|
||||
})}, "Unsafe eval ran in Function() constructor.");
|
||||
|
||||
</script>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27+%27unsafe-inline%27'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
||||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Set-Cookie: script-src-1_4_2={{$id:uuid()}}; Path=/content-security-policy/script-src/
|
||||
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,5 @@
|
|||
buildSiblingPath = function(hostPrefix, relativePath, newPort) {
|
||||
var port = newPort ? newPort : document.location.port;
|
||||
var path = document.location.pathname.substring(0, document.location.pathname.lastIndexOf('/') + 1);
|
||||
return (document.location.protocol + '//' + hostPrefix + "." + document.location.hostname + ':' + port + path + relativePath);
|
||||
};
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>CharacterData.data</title>
|
||||
<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-data">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(create, type) {
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
assert_equals(node.length, 4)
|
||||
}, type + ".data initial value")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = null;
|
||||
assert_equals(node.data, "")
|
||||
assert_equals(node.length, 0)
|
||||
}, type + ".data = null")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = undefined;
|
||||
assert_equals(node.data, "undefined")
|
||||
assert_equals(node.length, 9)
|
||||
}, type + ".data = undefined")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = 0;
|
||||
assert_equals(node.data, "0")
|
||||
assert_equals(node.length, 1)
|
||||
}, type + ".data = 0")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "";
|
||||
assert_equals(node.data, "")
|
||||
assert_equals(node.length, 0)
|
||||
}, type + ".data = ''")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "--";
|
||||
assert_equals(node.data, "--")
|
||||
assert_equals(node.length, 2)
|
||||
}, type + ".data = '--'")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "資料";
|
||||
assert_equals(node.data, "資料")
|
||||
assert_equals(node.length, 2)
|
||||
}, type + ".data = '資料'")
|
||||
}
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
|
@ -7,24 +7,147 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testNode(node) {
|
||||
function testNode(create, type) {
|
||||
// Step 2.
|
||||
test(function() {
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.replaceData(5, 1, "x") })
|
||||
assert_throws("INDEX_SIZE_ERR", function() { node.replaceData(5, 0, "") })
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(5, 1, "x") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(5, 0, "") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(-1, 1, "x") })
|
||||
assert_throws("IndexSizeError", function() { node.replaceData(-1, 0, "") })
|
||||
assert_equals(node.data, "test")
|
||||
}, type + ".replaceData() with invalid offset")
|
||||
|
||||
// Step 3.
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, 10, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
})
|
||||
}, type + ".replaceData() with clamped count")
|
||||
|
||||
test(function() {
|
||||
node.data = "test"
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, -1, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
}, type + ".replaceData() with negative clamped count")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 0, "yo")
|
||||
assert_equals(node.data, "yotest")
|
||||
}, type + ".replaceData() before the start")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "y")
|
||||
assert_equals(node.data, "yst")
|
||||
}, type + ".replaceData() at the start (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "yo")
|
||||
assert_equals(node.data, "yost")
|
||||
}, type + ".replaceData() at the start (equal length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 2, "yoa")
|
||||
assert_equals(node.data, "yoast")
|
||||
}, type + ".replaceData() at the start (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 2, "o")
|
||||
assert_equals(node.data, "tot")
|
||||
}, type + ".replaceData() in the middle (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 2, "yo")
|
||||
assert_equals(node.data, "tyot")
|
||||
}, type + ".replaceData() in the middle (equal length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 1, "waddup")
|
||||
assert_equals(node.data, "twaddupst")
|
||||
node.replaceData(1, 1, "yup")
|
||||
assert_equals(node.data, "tyupaddupst")
|
||||
})
|
||||
}, type + ".replaceData() in the middle (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(1, 20, "yo")
|
||||
assert_equals(node.data, "tyo")
|
||||
}, type + ".replaceData() at the end (shorter)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(2, 20, "yo")
|
||||
assert_equals(node.data, "teyo")
|
||||
}, type + ".replaceData() at the end (same length)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(4, 20, "yo")
|
||||
assert_equals(node.data, "testyo")
|
||||
}, type + ".replaceData() at the end (longer)")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 4, "quux")
|
||||
assert_equals(node.data, "quux")
|
||||
}, type + ".replaceData() the whole string")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.replaceData(0, 4, "")
|
||||
assert_equals(node.data, "")
|
||||
}, type + ".replaceData() with the empty string")
|
||||
|
||||
test(function() {
|
||||
var node = create()
|
||||
assert_equals(node.data, "test")
|
||||
|
||||
node.data = "This is the character data test, append 資料,更多資料";
|
||||
|
||||
node.replaceData(33, 6, "other");
|
||||
assert_equals(node.data, "This is the character data test, other 資料,更多資料");
|
||||
node.replaceData(44, 2, "文字");
|
||||
assert_equals(node.data, "This is the character data test, other 資料,更多文字");
|
||||
}, type + ".replaceData() with non-ASCII data")
|
||||
}
|
||||
test(function() {
|
||||
testNode(document.createTextNode("test"))
|
||||
testNode(document.createComment("test"))
|
||||
})
|
||||
|
||||
testNode(function() { return document.createTextNode("test") }, "Text")
|
||||
testNode(function() { return document.createComment("test") }, "Comment")
|
||||
</script>
|
||||
|
|
|
@ -27,6 +27,22 @@
|
|||
assert_equals(document.getElementById(""), null);
|
||||
}, "Calling document.getElementById with an empty string argument.");
|
||||
|
||||
test(function() {
|
||||
var element = document.createElement("div");
|
||||
element.setAttribute("id", "null");
|
||||
document.body.appendChild(element);
|
||||
this.add_cleanup(function() { document.body.removeChild(element) });
|
||||
assert_equals(document.getElementById(null), element);
|
||||
}, "Calling document.getElementById with a null argument.");
|
||||
|
||||
test(function() {
|
||||
var element = document.createElement("div");
|
||||
element.setAttribute("id", "undefined");
|
||||
document.body.appendChild(element);
|
||||
this.add_cleanup(function() { document.body.removeChild(element) });
|
||||
assert_equals(document.getElementById(undefined), element);
|
||||
}, "Calling document.getElementById with an undefined argument.");
|
||||
|
||||
|
||||
test(function() {
|
||||
var bar = document.getElementById("test1");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: invalid label</title>
|
||||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
|
|
|
@ -8,38 +8,25 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test = async_test(null, {timeout: 5000});
|
||||
var url = "resources/message.py?sleep=1000&message=" + encodeURIComponent("retry:1000\ndata:abc\n\n");
|
||||
var es = new EventSource(url);
|
||||
var lastEventTime = 0;
|
||||
var lastEventType = "";
|
||||
var readyStateAtLastEvent = -1;
|
||||
es.onmessage =
|
||||
es.onerror =
|
||||
es.onopen = function (event) {
|
||||
lastEventTime = (new Date()).getTime();
|
||||
lastEventType = event.type;
|
||||
readyStateAtLastEvent = es.readyState;
|
||||
};
|
||||
setTimeout(function () {
|
||||
if (typeof window.stop === "function") {
|
||||
window.stop();
|
||||
}
|
||||
}, 100);
|
||||
setTimeout(function () {
|
||||
test.step(function () {
|
||||
var isActive = ((new Date()).getTime() - lastEventTime) < 2500;
|
||||
if (es.readyState === EventSource.CLOSED) {
|
||||
assert_true(!isActive, "In case EventSource was stopped, it should not be active");
|
||||
assert_equals(lastEventType, "error", "In case EventSource was stopped, the last event should be an error event");
|
||||
assert_equals(readyStateAtLastEvent, EventSource.CLOSED, "In case EventSource was stopped, readyState at last event should be closed");
|
||||
} else {
|
||||
assert_true(isActive, "EventSource is active, but readyState is not EventSource.CLOSED.");
|
||||
}
|
||||
var t = async_test();
|
||||
onload = t.step_func(function() {
|
||||
var url = "resources/message.py?sleep=1000&message=" + encodeURIComponent("retry:1000\ndata:abc\n\n");
|
||||
var es = new EventSource(url);
|
||||
es.onerror = t.step_func(function() {
|
||||
assert_equals(es.readyState, EventSource.CLOSED)
|
||||
setTimeout(t.step_func(function () {
|
||||
assert_equals(es.readyState, EventSource.CLOSED,
|
||||
"After stopping the eventsource readyState should be CLOSED")
|
||||
t.done();
|
||||
}), 1000);
|
||||
});
|
||||
es.close();
|
||||
test.done();
|
||||
}, 4000);
|
||||
|
||||
setTimeout(t.step_func(function() {
|
||||
window.stop()
|
||||
es.onopen = t.unreached_func("Got open event");
|
||||
es.onmessage = t.unreached_func("Got message after closing source");
|
||||
}), 0);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -39,20 +39,20 @@ typedef EventHandlerNonNull? EventHandler;
|
|||
"use strict";
|
||||
var idlArray;
|
||||
setup(function() {
|
||||
idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
}, {explicit_done:true});
|
||||
window.onload = function() {
|
||||
idlArray.add_objects({
|
||||
EventSource: ['new EventSource("http://foo")'],
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
idlArray.add_objects({
|
||||
EventSource: ['new EventSource("http://foo")'],
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -2247,6 +2247,10 @@ dictionary DragEventInit : MouseEventInit {
|
|||
DataTransfer? dataTransfer;
|
||||
};
|
||||
|
||||
// For purposes of this test, just treat WindowProxy as the same thing as
|
||||
// Window.
|
||||
typedef Window WindowProxy;
|
||||
|
||||
[PrimaryGlobal]
|
||||
/*sealed*/ interface Window : EventTarget {
|
||||
// the current browsing context
|
||||
|
@ -2274,7 +2278,7 @@ dictionary DragEventInit : MouseEventInit {
|
|||
[Replaceable] readonly attribute unsigned long length;
|
||||
[Unforgeable] readonly attribute WindowProxy top;
|
||||
attribute any opener;
|
||||
readonly attribute WindowProxy parent;
|
||||
[Replaceable] readonly attribute WindowProxy parent;
|
||||
readonly attribute Element? frameElement;
|
||||
WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
|
||||
getter WindowProxy (unsigned long index);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Josh Matthews" href="mailto:josh@joshmatthews.net">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test"></link>
|
||||
<script>
|
||||
var saw_link_onload = false;
|
||||
var t = async_test("Check if the stylesheet's load event blocks the document load event");
|
||||
document.getElementById('style_test').onload = t.step_func(function() {
|
||||
saw_link_onload = true;
|
||||
});
|
||||
window.addEventListener('load', function() {
|
||||
t.step_func(function() {
|
||||
assert_true(saw_link_onload);
|
||||
});
|
||||
t.done();
|
||||
}, false);
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background-color: white;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ýäè {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div#box.ÜÀÚ {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ÜÀÚ {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@charset "utf-8";
|
||||
.test div.ýäè {
|
||||
width: 100px;
|
||||
}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ function mark_diffs(expected, actual) {
|
|||
var max_length = Math.max(expected_lines.length, actual_lines.length);
|
||||
|
||||
var expected_diff = ["code", {}];
|
||||
var actual_diff = ["code", {}];
|
||||
var actual_diff = ["code", {}];
|
||||
|
||||
for (var i=0; i<max_length; i++) {
|
||||
if (expected_lines[i] === actual_lines[i]) {
|
||||
|
@ -13,12 +13,12 @@ function mark_diffs(expected, actual) {
|
|||
actual_diff.push(actual_lines[i] + "\n");
|
||||
} else {
|
||||
if (expected_lines[i]) {
|
||||
expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
|
||||
expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
|
||||
}
|
||||
if (actual_lines[i]) {
|
||||
actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
|
||||
if (actual_lines[i]) {
|
||||
actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [expected_diff, actual_diff];
|
||||
}
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -8,29 +8,29 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=named-character-references-data.js></script>
|
||||
<script>
|
||||
(function() {
|
||||
(function() {
|
||||
|
||||
function pad(string, totalCharacters) {
|
||||
return totalCharacters < string.length ? string : (Array(totalCharacters + 1).join('0') + string).slice(-totalCharacters);
|
||||
}
|
||||
function pad(string, totalCharacters) {
|
||||
return totalCharacters < string.length ? string : (Array(totalCharacters + 1).join('0') + string).slice(-totalCharacters);
|
||||
}
|
||||
|
||||
var dummy = document.createElement('p');
|
||||
var dummy = document.createElement('p');
|
||||
|
||||
Object.keys(data).forEach(function(entity) {
|
||||
var object = data[entity];
|
||||
dummy.innerHTML = entity;
|
||||
test(
|
||||
function() {
|
||||
assert_equals(
|
||||
dummy.textContent,
|
||||
object.characters
|
||||
);
|
||||
},
|
||||
entity + ' should match ' + object.codepoints.map(function(codePoint) {
|
||||
return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5);
|
||||
}).join(' ')
|
||||
);
|
||||
});
|
||||
Object.keys(data).forEach(function(entity) {
|
||||
var object = data[entity];
|
||||
dummy.innerHTML = entity;
|
||||
test(
|
||||
function() {
|
||||
assert_equals(
|
||||
dummy.textContent,
|
||||
object.characters
|
||||
);
|
||||
},
|
||||
entity + ' should match ' + object.codepoints.map(function(codePoint) {
|
||||
return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5);
|
||||
}).join(' ')
|
||||
);
|
||||
});
|
||||
|
||||
}());
|
||||
</script>
|
||||
}());
|
||||
</script>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var namespaces = {
|
||||
"html":"http://www.w3.org/1999/xhtml",
|
||||
"mathml":"http://www.w3.org/1998/Math/MathML",
|
||||
"svg":"http://www.w3.org/2000/svg",
|
||||
"xlink":"http://www.w3.org/1999/xlink",
|
||||
"xml":"http://www.w3.org/XML/1998/namespace",
|
||||
"xmlns":"http://www.w3.org/2000/xmlns/"
|
||||
"html":"http://www.w3.org/1999/xhtml",
|
||||
"mathml":"http://www.w3.org/1998/Math/MathML",
|
||||
"svg":"http://www.w3.org/2000/svg",
|
||||
"xlink":"http://www.w3.org/1999/xlink",
|
||||
"xml":"http://www.w3.org/XML/1998/namespace",
|
||||
"xmlns":"http://www.w3.org/2000/xmlns/"
|
||||
};
|
||||
|
||||
var prefixes = {};
|
||||
|
@ -73,24 +73,24 @@ function test_serializer(element) {
|
|||
lines.push(format("|%s<%s>", indent_spaces, name));
|
||||
|
||||
var attributes = Array.prototype.map.call(
|
||||
element.attributes,
|
||||
function(attr) {
|
||||
var name = (attr.namespaceURI ? prefixes[attr.namespaceURI] + " " : "") +
|
||||
attr.localName;
|
||||
return [name, attr.value];
|
||||
});
|
||||
element.attributes,
|
||||
function(attr) {
|
||||
var name = (attr.namespaceURI ? prefixes[attr.namespaceURI] + " " : "") +
|
||||
attr.localName;
|
||||
return [name, attr.value];
|
||||
});
|
||||
attributes.sort(function (a, b) {
|
||||
var x = a[0];
|
||||
var y = b[0];
|
||||
if (x === y) {
|
||||
return 0;
|
||||
}
|
||||
return x > y ? 1 : -1;
|
||||
});
|
||||
var x = a[0];
|
||||
var y = b[0];
|
||||
if (x === y) {
|
||||
return 0;
|
||||
}
|
||||
return x > y ? 1 : -1;
|
||||
});
|
||||
|
||||
attributes.forEach(
|
||||
function(attr) {
|
||||
var indent_spaces = (new Array(indent + 2)).join(" ");
|
||||
var indent_spaces = (new Array(indent + 2)).join(" ");
|
||||
lines.push(format("|%s%s=\"%s\"", indent_spaces, attr[0], attr[1]));
|
||||
}
|
||||
);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче