Comment 38 for bug 171117

Revision history for this message
Robin Battey (zanfur) wrote :

I couldn't leave well enough alone, so I added the clip-path transform tracking. Now it ungroups without any visual change whatsoever. It's a little slower when there are many nested clip-paths because I have it set up an inverted tree of nested clip-path references, but it's still pretty fast. The big issue is that when you apply a clip-path to an element with a transform, the transform applies to the clip-path as well...so when you hit that scenario you need to make a copy of the clip-path you want to apply, calculate the inverse transform to offset the transform of the target node, apply that inverse to your copy of the clip-path, intersect it with any current clip-path of the target node, and then apply your transformed and intersected clip-path to the target node. To make matters worse, you can't just set the transform on the clipPath element itself, but you have to apply it to all the children. :-/ Anyway, it's done. 4 hours for what ends up being about 35 lines of additional code.

Something similar probably needs to be done to track masks as well, but I'll leave that to someone else -- it's likely pretty close to the exact same code .