My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 207: Doing transform on image dynamically throws exception
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  grick23
Closed:  Sep 30
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by bradneuberg, Aug 05, 2009
The following unit test fails:

// do transforms on an image while in a suspendRedraw
  svg = getRoot('svg11242');
  image = getDoc('svg11242').createElementNS(svgns, 'image');
  image.setAttributeNS(xlinkns, 'xlink:href', 'balloon.jpg');
  image.setAttribute('x', 0);
  image.setAttribute('y', 0);
  image.setAttribute('width', '100px');
  image.setAttribute('height', '100px');
  image.style.opacity = 0.8;
  svg.appendChild(image);
  image.setAttribute('transform', 'translate(450, 100) rotate(90)');
  console.log('SECOND IMAGE: You should see an image of balloons rotated 90 '
              + 'degrees near the end of the sword');

The line that fails is the setAttribute('transform') call on the image near
the end; I just get a generic Flash error.

This test is inside tests/browser-tests/test_js.js inside of testRedraw().
I have commented it out; uncomment when this bug is addressed.
Comment 1 by grick23, Aug 13, 2009
Taking ownership on this one. Its definitely on the flash side. SVGImageNode handles
tranforms/viewBox a bit differently. It calls applyViewBox _after_ the image is
loaded and its bitmap created. 

However, calling setAttribute on the transform bypasses the normal drawing flow and
calls transformNode and applyViewBox directly from setAttribute (as an optimization
to avoid full redraw). In the test scenario, the image has not yet loaded and the
bitmap is not yet created. Yet, the code assumes these things have already happened. 

The solution is probably just to ignore the applyViewBox call if the image is still
loading. It will get applied properly once the image is loaded.

For those in need of a workaround, try calling the setAttribute call before appending
the element with appendChild.

Owner: grick23
Comment 2 by grick23, Sep 30, 2009
Fixed in r918.
Status: Fixed
Sign in to add a comment

Hosted by Google Code