Opened 7 years ago

Closed 5 years ago

Last modified 5 years ago

#16830 closed defect (fixed)

[PATCH][CLA] VML Renderer generates invalid path definitions during fill settings on closed path

Reported by: Jared Jurkiewicz Owned by: Jared Jurkiewicz
Priority: undecided Milestone: 1.7.6
Component: DojoX GFX Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

The VML renderer seems to generate bogus path definitions for the GFX shape Path. This becomes apparent when you use the utils.serialize(surface) API on a VML-drawn area. You end up getting a Path like:

}, {

"shape": {

"type": "path", "path": "M 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150ZM 342 150L 342 38A 112 112 0 0 1 453.3865 161.7072L 342 150Z"

}, "stroke": {

"type": "stroke", "color": {

"b": 0, "g": 0, "r": 153

}, "style": "solid", "width": 1, "cap": "butt", "join": 4

}, "fill": {

"type": "linear", "x1": 342, "y1": 38, "x2": 342, "y2": 161.7071878859772, "colors": [{

"offset": 0, "color": "#d93838"

}, {

"offset": 1, "color": "#990000"

}]

}

}, {

Notice that the path: value seems to have a repeating value in it. Basically, it duplicates the path N times (where N is the number of times setFill is called after the path is created). What happens is basically this:

gfx/vml.setFill -> gfx/path._getRealBBox -> gfx/path.updateWithSegment -> Updates shape by re-interating over th segments again and adding them a second time, which duplicates the path data into the GFX shape object.

I've worked around this by tweaking gfx/vml to have its vml.Path define its own _getRealBBox() that does this:

_getRealBBox: function(){

summary: returns an array of four points or null This is called by setFill, which actually creates the path, so we want to avoid duping the path repeatedly in the shape by clearing the path before re-add. this._confirmSegmented(); if(this.tbbox){

return this.tbbox; Array

} if(typeof this.shape.path == "string"){

this.shape.path = "";

} return this.inherited(arguments);

}

And that seems to work.

Additionally, I found cases where doing toSvg() on the VML surface would generate stroke-opacity="undefined" in the SVG. This is invalid. I tweaked the toSvg() api to also remove those (and let it default to 1, as per SVG spec).

If there are better ways to fix this, I would love to know. But as it stands this is how I've figured out how to fix the issues.

Attachments (1)

16830.patch (3.2 KB) - added by Jared Jurkiewicz 7 years ago.
Possible solution for this issue.

Download all attachments as: .zip

Change History (16)

Changed 7 years ago by Jared Jurkiewicz

Attachment: 16830.patch added

Possible solution for this issue.

comment:1 Changed 7 years ago by Colin Snover

Summary: VML Renderer generates invalid path definitions during fill settings on closed path[patch] VML Renderer generates invalid path definitions during fill settings on closed path

comment:2 Changed 5 years ago by Jared Jurkiewicz

Summary: [patch] VML Renderer generates invalid path definitions during fill settings on closed path[PATCH][CLA] VML Renderer generates invalid path definitions during fill settings on closed path

comment:5 Changed 5 years ago by Jared Jurkiewicz

Owner: changed from Eugene Lazutkin to Jared Jurkiewicz
Status: newassigned

comment:6 Changed 5 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

comment:7 Changed 5 years ago by Jared Jurkiewicz

Milestone: tbd1.11

comment:8 Changed 5 years ago by Colin Snover

If this is a defect could you please backport? Thank you.

comment:9 Changed 5 years ago by Jared Jurkiewicz <jared.jurkiewicz@…>

In 99ad45340f02b09b95d0b6a17c91e6c72fc674bc/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:10 Changed 5 years ago by Jared Jurkiewicz <jared.jurkiewicz@…>

In 25e0aada06ea9fbf9ce9e6f41d630c4eb9fe91bd/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:11 Changed 5 years ago by Jared Jurkiewicz <jared.jurkiewicz@…>

In d73338e0700a1704c1ee670c2daa28f45b6c8255/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:12 Changed 5 years ago by Jared Jurkiewicz <jared.jurkiewicz@…>

In 9e9aaf1a56eb8b8a12d78bdeb448e73a60036a82/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:13 Changed 5 years ago by Jared Jurkiewicz

Backported to 1.10, 1.9, 1.8, 1.7.

comment:14 Changed 5 years ago by Jared Jurkiewicz

Milestone: 1.111.7.6

comment:15 Changed 5 years ago by Colin Snover

Thanks!

Note: See TracTickets for help on using tickets.