blob: f58f7c31c9c0bb2ca38f851c36760cc9ffcb232d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
canvas {
width: 100px;
height: 100px;
background-color: red;
}
</style>
</head>
<body>
<canvas id="canvas1"></canvas>
<canvas id="canvas2"></canvas>
<script>
if (window.testRunner)
window.testRunner.dumpAsText();
var iOSPlatform = navigator.userAgent.search(/\biPhone OS\b/) != -1;
var OSXYosemiteOrOlder = navigator.userAgent.search(/\bMac OS X 10_(8|9|10)(_[0-9]+)?\b/) != -1;
var MAX_WIDTH = iOSPlatform ? Math.pow(2, 12) : (OSXYosemiteOrOlder ? Math.pow(2, 13) : Math.pow(2, 14));
var MAX_HEIGHT = MAX_WIDTH;
function fillCanvas(id, width, height) {
var canvas = document.getElementById(id);
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.fillStyle = "lime";
ctx.fillRect(0, 0, width, height);
}
fillCanvas("canvas1", MAX_WIDTH, MAX_HEIGHT);
fillCanvas("canvas2", MAX_WIDTH + 1, MAX_HEIGHT);
</script>
</body>
</html>