New issue
Advanced search Search tips
Starred by 10 users
Status: New
Area: ----
Priority: Low
Type: Defect

Sign in to add a comment
Canvas maximum size >32767px
Reported by, Feb 3 2014 Back to list
[ Repost from chromium bug tracker ]

What steps will reproduce the problem?
1. Set the size of canvas more 15bits width or length (>32767px)
2. Draw anything
3. Check result: white canvas

What is the expected output?
The colored picture.
According to W3 standarts:

interface HTMLCanvasElement : HTMLElement {
           attribute unsigned long width;
           attribute unsigned long height;

Canvas can be any size from 0...4 294 967 295 px.

What do you see instead?
White list of canvas and lags, sometimes the page is crashed.

What version of the product are you using? On what operating system?
Chrome Version       : 32.0.1700.76 (Официальная сборка 244343) m
OS                   : Windows 7 Pro

Please provide any additional information below.
<!DOCTYPE html>
<meta charset=utf-8 />
<script type="text/javascript">
function test1(){
    var x = document.getElementById('board');
    x.height = 16383;
    x.width = 16383;
    var ctx = x.getContext('2d');
    ctx.fillStyle = 'royalblue';
    ctx.fillRect(0, 0, x.width, x.height);
    console.log( x.width +' x '+ x.height );

function test2(){
    var x = document.getElementById('board');
    x.height = 32768;
    x.width = 32768;
    var ctx = x.getContext('2d');
    ctx.fillStyle = 'orangered';
    ctx.fillRect(0, 0, x.width, x.height);
    console.log( x.width +' x '+ x.height );
  <button onclick="test1()">Test 1 royalblue 16383px</button>
  <button onclick="test2()">Test 2 orangered 32767px</button>
  <canvas id="board" width="300" height="300"/>

Project Member Comment 1 by, Feb 4 2014
Assign to Mike to take a look and see if you think there is something we can do about this issue.. 

Stephen noted in the Chromium bug that it is a known limitation of Skia's design that we may not fix, but voidvolker opened here for our consideration.
Project Member Comment 2 by, Oct 14 2014
Labels: -Priority-Medium Priority-Low
Project Member Comment 3 by, Dec 7 2015
Labels: Hotlist-Fixit
Project Member Comment 4 by, Mar 2 2016
Given that Chrome draws to tiles, wouldn't it be reasonable to attack this at that level rather than in Skia? Florin, do you think there is any interest in limiting the SkCanvas to something < 32K in Chrome, and then tiling additional SkCanvas to make the width specified the as described above?
Project Member Comment 5 by, Mar 2 2016
I think canvas2d is not (always?) tiled - junov, would it make sense to limit the size in Blink?
Project Member Comment 6 by, Mar 7 2016
Correct, canvases are never tiled in the current implementation. No need to have a limit that is explicitly known to blink since blink knows when the canvas is to big by the fact of skia failing to allocate it.  That being said, Houdini's custom paint feature is going to offer a very reasonable workaround for drawing arbitrarily large things using a write-only subset of the Canvas API. That will leverage tiling.
This issue is causing chrome://tracing to not display large traces ( Are there any plans to address it in the near future?
Sign in to add a comment