Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#7856 closed defect (fixed)

[CLA] IE: Removing a shape with a gradient fill throws an error

Reported by: benschell Owned by: Eugene Lazutkin
Priority: high Milestone: 1.3
Component: DojoX GFX Version: 1.2.0
Keywords: Cc:
Blocked By: Blocking:

Description

The attached test file creates a surface, then a shape, then fills it with a gradient. Attempting to remove the shape from the surface throws an error on IE only: "colors is null or not an object" (I think that's the correct text), in this case debugged to line 63 of vml.js. I think this defect is valid for all types of gradients though, as similar code is reused on line 106.

A simple solution would be to change line 33 of vml.js from

if(!fill){

to

if(!fill || !this.rawNode.fill){

However, there seems to be a larger issue here, that the shape is attempting to be filled when it's supposed to be removed. I don't see any other way to remove/destroy an element.

I traced this down a bit. Removing a shape goes through the following steps:
1) Find the shape in the list of children
2) Call _setParent(null, null) on the shape
2a) Set the shape's parent to null
2b) Call _updateParentMatrix
2ba) Set the shape's parentMatrix
2bb) call _applyTransform() on the shape *
3) Remove the shape from the list of children

The issue lies in the * step. At this point, the node is attempted to be redrawn (which includes filling it). It seems that, in the case of removing a shape, _applyTransform() shouldn't be called.

The patch attached seems to fix the issue and still allows the add/remove test case (test_group2.html) to work properly.

Attachments (2)

test_removeShapeWGradient.html (2.0 KB) - added by benschell 11 years ago.
shape.patch (380 bytes) - added by benschell 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by benschell

Changed 11 years ago by benschell

Attachment: shape.patch added

comment:1 Changed 11 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

The trac is acting up --- this ticket was fixed.

comment:2 Changed 10 years ago by Adam Peller

Milestone: tbd1.3

batch move of tickets marked 'tbd' fixed in the 1.3 timeframe

Note: See TracTickets for help on using tickets.