Skip to content

canvas context property changes ignored (fillStyle, etc.) in polymer, dart2js in chrome #14565

Closed
@DartBot

Description

@DartBot

This issue was originally filed by @hpoul


What steps will reproduce the problem?

  1. create a polymer element with an embedded <canvas></canvas> tag
  2. in dart code retrieve canvas: _canvas = this.getShadowRoot('...').querySelector('canvas'); and context: _context = _canvas.getContext('2d');
  3. try to draw on canvas and change fillStyle, strokeStyle, etc.
  4. run dart2js and view in chrome stable (30.0.1599.101) or safari

example:
    _context.beginPath();
    _context.clearRect(0, 0, _width, _height);
    _context.fillStyle = '#ffffff';
    _context.strokeStyle = 'rgb(255,0,0)';
    _context.lineWidth = 2;
    
    var circleRadius = 100;
    _context.arc(_width/2, _height/2, circleRadius, 0, degreeToRadians(360));

    _context.stroke();
    _context.fill();

What is the expected output? What do you see instead?

i expect white fill color, red stroke color - instead only a black circle is rendered.

What version of the product are you using? On what operating system?
the problem first appeared in dart/polymer 0.8.5 and reproduced in 0.8.7
it works in dartium with dart.. but after dart2js it doesn't work in chrome (stable) and safari, but it works in firefox..
(attached screenshot from left to right: dartium, chrome 30 (stable), firefox 24

Please provide any additional information below.

i've tried debugging a bit the generated dart2js in 0.8.5 but didn't get too far:
https://groups.google.com/a/dartlang.org/d/msg/web-ui/8YmGCAPBh14/pfAE22rIEaIJ

if this is not enough information i can create a running polymer element example if required..


Attachment:
dartium-chrome30-firefox.png (57.27 KB)

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failures

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions