Bug 45259

Summary: SVG drawing freeze
Product: WebKit Reporter: Armin Mueller <A.Mueller>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: A.Mueller, zimmermann
Priority: P2    
Version: 525.x (Safari 3.2)   
Hardware: PC   
OS: Windows 7   
URL: http://www.mappetizer.de/en/examples/schlatterbach/index.html
Bug Depends on: 45389    
Bug Blocks:    

Description Armin Mueller 2010-09-06 05:18:15 PDT
The problem occurs in Safari and in Chrome

If you check and uncheck layers in the legend, then you see that the legend part is changing and the layer is visible/unvisible in the map.
If you now change the tab to tools and then go back to legend you still see the legend. But if you check/uncheck a layer only the map part is updated but the legend part is not updated it is freezed

For the Tab we use Dojo Dijits. The handling is fine with Firefox, Opera and IE (with Adobe SVGViewer)

Thank you for looking at this problem

Armin
Comment 1 Nikolas Zimmermann 2010-09-08 08:21:39 PDT
I investigated a bit using WebInspector.

It seems to me that there's a variable in mappetizer, that points to the SVGDocument contained in the <embed> object. When switching tabs the renderer is destroyed, and recreated as soon as you switch back to the "legend" tab again. But the variable in JS still references the "old" document from the first load.

When constructing the renderer, it will requiest the embedded SVG, parse the DOM, and attach to our render tree - that means a new document is created - and your JS still points to the old one.

If Dojo would use visibility instead of display, I guess you wouldn't see any bugs.
Comment 2 Nikolas Zimmermann 2010-09-08 08:27:01 PDT
function mv_testEmbedLegend() {
    try {
        //Problem, wenn Legende in Tab und erster Tab ist nicht Legende(also nicht sichtbar),
        //dann kommt Opera, Safari.... nicht an das SVGDocument
        var svgDoc = dojo.byId("MVlegendDoc").getSVGDocument();
        if (svgDoc == null) {
            // Endlosschleife
            if (dojo.byId("MVtabContainer")) {
                dijit.byId("MVtabContainer").selectChild("MVlegend");
            }
            mv_checkLegendLoaded();
        }
        else {
            mv_Map.Legend = svgDoc;
...

This is the culprit. The mv_Map.Legend is only cached once.
Which is perfectly fine, but as WebKit recreates the embedded document, upon switching tabs, you're doomed.