2008-10-12 Pamela Greene <pam@chromium.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Oct 2008 01:15:01 +0000 (01:15 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Oct 2008 01:15:01 +0000 (01:15 +0000)
        Fix a race condition by waiting for all create functions to be called
        before terminating.
        See https://bugs.webkit.org/show_bug.cgi?id=21531

        Reviewed by Darin Adler.
        Landed by Adam Barth.

        * platform/mac/svg/carto.net/window-expected.checksum:
        * platform/mac/svg/carto.net/window-expected.png:
        * platform/mac/svg/carto.net/window-expected.txt:
        * svg/carto.net/window.svg:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/carto.net/window-expected.checksum
LayoutTests/platform/mac/svg/carto.net/window-expected.txt
LayoutTests/svg/carto.net/window.svg

index 9b6e3d2..9414a9f 100644 (file)
@@ -1,5 +1,19 @@
 2008-10-12  Pamela Greene  <pam@chromium.org>
 
 2008-10-12  Pamela Greene  <pam@chromium.org>
 
+        Fix a race condition by waiting for all create functions to be called
+        before terminating.
+        See https://bugs.webkit.org/show_bug.cgi?id=21531
+
+        Reviewed by Darin Adler.
+        Landed by Adam Barth.
+
+        * platform/mac/svg/carto.net/window-expected.checksum:
+        * platform/mac/svg/carto.net/window-expected.png:
+        * platform/mac/svg/carto.net/window-expected.txt:
+        * svg/carto.net/window.svg:
+
+2008-10-12  Pamela Greene  <pam@chromium.org>
+
         Remove inadvertent const redefinition, and add specific test for it.
         See https://bugs.webkit.org/show_bug.cgi?id=21532
 
         Remove inadvertent const redefinition, and add specific test for it.
         See https://bugs.webkit.org/show_bug.cgi?id=21532
 
index ef5ed4a..c099012 100644 (file)
@@ -1 +1 @@
-54f6c45d1687791dc1b2f2d636dca66d
\ No newline at end of file
+7a99e81f49b0b0878a2a132fd3d583f6
\ No newline at end of file
index d7343bc..1bc7527 100644 (file)
@@ -56,8 +56,8 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (415,55) size 130x12 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-10) size 130x12
         chunk 1 (middle anchor) text run 1 at (415.50,55.00) startOffset 0 endOffset 24 width 129.00: "Resize Navigation Window"
     RenderSVGText {text} at (415,55) size 130x12 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-10) size 130x12
         chunk 1 (middle anchor) text run 1 at (415.50,55.00) startOffset 0 endOffset 24 width 129.00: "Resize Navigation Window"
-    RenderSVGContainer {g} at (38.67,92.58) size 758.59x442.19
-      RenderSVGContainer {g} at (624.61,92.58) size 172.66x157.03 [transform={m=((1.00,0.00)(0.00,1.00)) t=(800.00,85.00)}]
+    RenderSVGContainer {g} at (38.67,81.25) size 758.98x453.52
+      RenderSVGContainer {g} at (613.28,81.25) size 184.38x168.36 [transform={m=((1.00,0.00)(0.00,1.00)) t=(800.00,85.00)}]
         RenderSVGContainer {g} at (624.61,92.58) size 172.66x157.03
           RenderPath {rect} at (624.61,92.58) size 172.66x157.03 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#F0F8FF]}] [data="M0.00,0.00 L220.00,0.00 L220.00,200.00 L0.00,200.00"]
           RenderSVGContainer {g} at (632.81,102.34) size 161.72x96.88
         RenderSVGContainer {g} at (624.61,92.58) size 172.66x157.03
           RenderPath {rect} at (624.61,92.58) size 172.66x157.03 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#F0F8FF]}] [data="M0.00,0.00 L220.00,0.00 L220.00,200.00 L0.00,200.00"]
           RenderSVGContainer {g} at (632.81,102.34) size 161.72x96.88
@@ -86,22 +86,28 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (3,197) size 45x11 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,-9) size 45x11
               chunk 1 text run 1 at (3.00,197.00) startOffset 0 endOffset 9 width 45.00: "Statusbar"
           RenderSVGText {text} at (3,197) size 45x11 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,-9) size 45x11
               chunk 1 text run 1 at (3.00,197.00) startOffset 0 endOffset 9 width 45.00: "Statusbar"
-        RenderSVGContainer {g} at (757.03,94.92) size 35.43x9.38
-          RenderSVGContainer {use} at (783.32,95.04) size 9.15x9.15
-            RenderSVGContainer {g} at (783.32,95.04) size 9.15x9.15 [transform={m=((1.00,0.00)(0.00,1.00)) t=(208.50,8.50)}]
-              RenderSVGViewportContainer {svg} at (783.32,95.04) size 9.15x9.15
-                RenderPath {rect} at (783.59,95.31) size 8.59x8.59 [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
-                RenderPath {line} at (783.32,95.04) size 9.15x9.15 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M-5.50,-5.50 L5.50,5.50"]
-                RenderPath {line} at (783.32,95.04) size 9.15x9.15 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M5.50,-5.50 L-5.50,5.50"]
-          RenderSVGContainer {use} at (769.92,94.92) size 9.38x9.38
-            RenderSVGContainer {g} at (769.92,94.92) size 9.38x9.38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(191.50,8.50)}]
-              RenderSVGViewportContainer {svg} at (769.92,94.92) size 9.38x9.38
-                RenderPath {rect} at (769.92,94.92) size 9.38x9.38 [stroke={[type=SOLID] [color=#696969]}] [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
-          RenderSVGContainer {use} at (757.03,95.31) size 8.59x8.98
-            RenderSVGContainer {g} at (757.03,95.31) size 8.59x8.98 [transform={m=((1.00,0.00)(0.00,1.00)) t=(174.50,8.50)}]
-              RenderSVGViewportContainer {svg} at (757.03,95.31) size 8.59x8.98
-                RenderPath {rect} at (757.03,95.31) size 8.59x8.59 [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
-                RenderPath {line} at (757.03,103.52) size 8.59x0.78 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M5.50,5.50 L-5.50,5.50"]
+        RenderSVGContainer {g} at (613.28,81.25) size 184.38x157.81
+          RenderSVGContainer {g} at (613.28,81.25) size 184.38x157.81
+            RenderPath {rect} at (613.28,81.25) size 15.62x157.81 [fill={[type=SOLID] [color=#B0C4DE]}] [data="M-15.00,-15.00 L5.00,-15.00 L5.00,187.00 L-15.00,187.00"]
+            RenderPath {rect} at (613.28,81.25) size 184.38x15.62 [fill={[type=SOLID] [color=#B0C4DE]}] [data="M-15.00,-15.00 L221.00,-15.00 L221.00,5.00 L-15.00,5.00"]
+            RenderSVGText {text} at (0,180) size 106x14 contains 1 chunk(s)
+              RenderSVGInlineText {#text} at (0,-11) size 106x14
+                chunk 1 text run 1 at (0.00,180.00) startOffset 0 endOffset 17 width 106.00: "Navigation Window"
+          RenderSVGContainer {use} at (616.52,84.49) size 9.15x9.15
+            RenderSVGContainer {g} at (616.52,84.49) size 9.15x9.15 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-5.00,-5.00)}]
+              RenderSVGViewportContainer {svg} at (616.52,84.49) size 9.15x9.15
+                RenderPath {rect} at (616.80,84.77) size 8.59x8.59 [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
+                RenderPath {line} at (616.52,84.49) size 9.15x9.15 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M-5.50,-5.50 L5.50,5.50"]
+                RenderPath {line} at (616.52,84.49) size 9.15x9.15 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M5.50,-5.50 L-5.50,5.50"]
+          RenderSVGContainer {use} at (616.41,100) size 9.38x9.38
+            RenderSVGContainer {g} at (616.41,100) size 9.38x9.38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-5.00,15.00)}]
+              RenderSVGViewportContainer {svg} at (616.41,100) size 9.38x9.38
+                RenderPath {rect} at (616.41,100) size 9.38x9.38 [stroke={[type=SOLID] [color=#696969]}] [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
+          RenderSVGContainer {use} at (616.80,116.02) size 8.59x8.98
+            RenderSVGContainer {g} at (616.80,116.02) size 8.59x8.98 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-5.00,35.00)}]
+              RenderSVGViewportContainer {svg} at (616.80,116.02) size 8.59x8.98
+                RenderPath {rect} at (616.80,116.02) size 8.59x8.59 [data="M-5.50,-5.50 L5.50,-5.50 L5.50,5.50 L-5.50,5.50"]
+                RenderPath {line} at (616.80,124.22) size 8.59x0.78 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#000000]}] [data="M5.50,5.50 L-5.50,5.50"]
       RenderSVGContainer {g} at (38.67,143.36) size 547.66x391.41 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,150.00)}]
         RenderSVGContainer {g} at (38.67,143.36) size 547.66x391.41
           RenderPath {rect} at (38.67,143.36) size 547.66x391.41 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#F0F8FF]}] [data="M0.00,0.00 L700.00,0.00 L700.00,500.00 L0.00,500.00"]
       RenderSVGContainer {g} at (38.67,143.36) size 547.66x391.41 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,150.00)}]
         RenderSVGContainer {g} at (38.67,143.36) size 547.66x391.41
           RenderPath {rect} at (38.67,143.36) size 547.66x391.41 [stroke={[type=SOLID] [color=#696969]}] [fill={[type=SOLID] [color=#F0F8FF]}] [data="M0.00,0.00 L700.00,0.00 L700.00,500.00 L0.00,500.00"]
index d8b8b8b..f24ddac 100644 (file)
         <script type="text/ecmascript" xlink:href="resources/timer.js"/>
         <script type="text/ecmascript" xlink:href="resources/window.js"/>
         <script type="text/ecmascript"><![CDATA[
         <script type="text/ecmascript" xlink:href="resources/timer.js"/>
         <script type="text/ecmascript" xlink:href="resources/window.js"/>
         <script type="text/ecmascript"><![CDATA[
-               //global variables for map application and navigation
-               var myMapApp = new mapApp(false,undefined);
+        // WebKit modification: do not terminate before all create functions
+        // have been called. This call, the notifyDone() below, and all calls
+        // to createCalled() were added to prevent a race in which the test may
+        // terminate before the final window decoration is added.
+        // See <https://bugs.webkit.org/show_bug.cgi?id=21531>.
+        if (window.layoutTestController) 
+            layoutTestController.waitUntilDone();
+
+        var numberOfWindows = 7;
+        var createCalls = 0;
+
+        function createCalled() {
+            if (++createCalls == numberOfWindows && window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+
+           //global variables for map application and navigation
+           var myMapApp = new mapApp(false,undefined);
         function init(evt) {
         function init(evt) {
-                       //start a new window array in myMapApp
-                       myMapApp.Windows = new Array();
-                       //first a few styles
-                       var winPlaceholderStyles = {"fill":"none","stroke":"dimgray","stroke-width":1.5};
-                       var windowStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
-                       var titlebarStyles = {"fill":"gainsboro","stroke":"dimgray","stroke-width":1};
-                       var statusbarStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
-                       var titletextStyles = {"font-family":"Arial,Helvetica","font-size":14,"fill":"dimgray"};
-                       var statustextStyles = {"font-family":"Arial,Helvetica","font-size":10,"fill":"dimgray"};
-                       var buttonStyles = {"fill":"none","stroke":"dimgray","stroke-width":1};
-                       var titlebarHeight = 17;
-                       var statusbarHeight = 13;
-                       //create new window instance and add it to the Windows array with the windowId as a key
-                       myMapApp.Windows["navWindow"] = new Window("navWindow","Windows",220,200,800,85,true,0,80,1024,700,true,winPlaceholderStyles,windowStyles,3,false,true,"Navigation Window","Statusbar",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
-                       myMapApp.Windows["bigWindow"] = new Window("bigWindow","Windows",700,500,50,150,true,0,80,1024,700,false,winPlaceholderStyles,windowStyles,3,true,true,"Big Window","This is a big movable window",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
-                       myMapApp.Windows["nestedWindow"] = new Window("nestedWindow","windowMainGroupbigWindow",400,300,50,50,true,0,17,700,487,false,winPlaceholderStyles,windowStyles,3,true,true,"Nested middlesize Window","This window contains other windows",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
-                       myMapApp.Windows["smallWindow"] = new Window("smallWindow","windowMainGroupbigWindow",200,180,350,300,true,0,17,700,487,true,winPlaceholderStyles,windowStyles,3,true,true,"Small Window","Callback function is active",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,windowEvents);
-                       myMapApp.Windows["colourPickerWindow"] = new Window("colourPickerWindow","windowMainGroupnestedWindow",220,180,0,17,true,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,true,"Colour Picker","Changing a colour changes background",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
-                       myMapApp.Windows["statusWindow"] = new Window("statusWindow","windowMainGroupnestedWindow",180,80,220,207,false,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,false,"Status Window","This window is non-moveable",false,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,undefined);
-                       myMapApp.Windows["minimalWindow"] = new Window("minimalWindow","windowMainGroupbigWindow",150,60,1,426,false,0,0,700,500,true,winPlaceholderStyles,windowStyles,3,false,false,"","",false,false,false,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,undefined);
-                       myMapApp.Windows["navWindow"].appendContent("textNavWindow",true);
-                       myMapApp.Windows["statusWindow"].appendContent("textStatusWindow",true);
-                       myMapApp.Windows["smallWindow"].appendContent("textSmallWindow",true);
-                       myMapApp.Windows["minimalWindow"].appendContent("textMinimalWindow",true);
+            //start a new window array in myMapApp
+            myMapApp.Windows = new Array();
+            //first a few styles
+            var winPlaceholderStyles = {"fill":"none","stroke":"dimgray","stroke-width":1.5};
+            var windowStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
+            var titlebarStyles = {"fill":"gainsboro","stroke":"dimgray","stroke-width":1};
+            var statusbarStyles = {"fill":"aliceblue","stroke":"dimgray","stroke-width":1};
+            var titletextStyles = {"font-family":"Arial,Helvetica","font-size":14,"fill":"dimgray"};
+            var statustextStyles = {"font-family":"Arial,Helvetica","font-size":10,"fill":"dimgray"};
+            var buttonStyles = {"fill":"none","stroke":"dimgray","stroke-width":1};
+            var titlebarHeight = 17;
+            var statusbarHeight = 13;
+            //create new window instance and add it to the Windows array with the windowId as a key
+            myMapApp.Windows["navWindow"] = new Window("navWindow","Windows",220,200,800,85,true,0,80,1024,700,true,winPlaceholderStyles,windowStyles,3,false,true,"Navigation Window","Statusbar",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
+            myMapApp.Windows["bigWindow"] = new Window("bigWindow","Windows",700,500,50,150,true,0,80,1024,700,false,winPlaceholderStyles,windowStyles,3,true,true,"Big Window","This is a big movable window",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
+            myMapApp.Windows["nestedWindow"] = new Window("nestedWindow","windowMainGroupbigWindow",400,300,50,50,true,0,17,700,487,false,winPlaceholderStyles,windowStyles,3,true,true,"Nested middlesize Window","This window contains other windows",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
+            myMapApp.Windows["smallWindow"] = new Window("smallWindow","windowMainGroupbigWindow",200,180,350,300,true,0,17,700,487,true,winPlaceholderStyles,windowStyles,3,true,true,"Small Window","Callback function is active",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,windowEvents);
+            myMapApp.Windows["colourPickerWindow"] = new Window("colourPickerWindow","windowMainGroupnestedWindow",220,180,0,17,true,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,true,"Colour Picker","Changing a colour changes background",true,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,buttonTextChange);
+            myMapApp.Windows["statusWindow"] = new Window("statusWindow","windowMainGroupnestedWindow",180,80,220,207,false,0,17,400,287,true,winPlaceholderStyles,windowStyles,3,true,false,"Status Window","This window is non-moveable",false,true,true,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,createCalled);
+            myMapApp.Windows["minimalWindow"] = new Window("minimalWindow","windowMainGroupbigWindow",150,60,1,426,false,0,0,700,500,true,winPlaceholderStyles,windowStyles,3,false,false,"","",false,false,false,titlebarStyles,titlebarHeight,statusbarStyles,statusbarHeight,titletextStyles,statustextStyles,buttonStyles,createCalled);
+            myMapApp.Windows["navWindow"].appendContent("textNavWindow",true);
+            myMapApp.Windows["statusWindow"].appendContent("textStatusWindow",true);
+            myMapApp.Windows["smallWindow"].appendContent("textSmallWindow",true);
+            myMapApp.Windows["minimalWindow"].appendContent("textMinimalWindow",true);
         }
 
         }
 
-               function windowEvents(id,evtType) {
-                       if (evtType == "removed") {
-                               alert("window with id " + id + " was removed");
-                       }
-                       if (evtType == "closed") {
-                               buttonTextChange(id,evtType);
-                               alert("window with id " + id + " was closed");
-                       }
-                       if (evtType == "opened") {
-                               buttonTextChange(id,evtType);
-                               alert("window with id " + id + " was opened");
-                       }
-                       if (evtType == "minimized") {
-                               alert("window with id " + id + " was minimized");
-                       }
-                       if (evtType == "maximized") {
-                               alert("window with id " + id + " was maximized");
-                       }
-                       if (evtType == "movedTo") {
-                               alert("window with id " + id + " was moved to a new position");
-                       }
-                       if (evtType == "moved") {
-                               statusChange("window with id " + id + " was moved to "+Math.round(myMapApp.Windows[id].transX) + ", " + Math.round(myMapApp.Windows[id].transY));
-                       }
-                       if (evtType == "moveStart") {
-                               statusChange("window with id " + id + " just started movement");
-                       }
-                       if (evtType == "moveEnd") {
-                               statusChange("window with id " + id + " just stopped movement");
-                       }
-               }
-               function openCloseWindow(id) {
-                       if (myMapApp.Windows[id].closed) {
-                               myMapApp.Windows[id].open(true);
-                       }
-                       else {
-                               myMapApp.Windows[id].close(true);
-                       }
-               }
-               function buttonTextChange(id,status) {
-                       if (status == "closed" || status == "opened") {
-                               var buttonText = document.getElementById("buttonText"+id);
-                               butText = buttonText.getAttributeNS(attribNS,"buttonText");
-                               if (myMapApp.Windows[id].closed) {
-                                       buttonText.firstChild.nodeValue = "Open " + butText;
-                               }
-                               else {
-                                       buttonText.firstChild.nodeValue = "Close " + butText;
-                               }
-                       }
-               if (id == "navWindow") {
-                       if (status == "created" || status == "resized") {
-                               addOrUpdateWindowDecoration(id);
-                       }
-               }
-               }
-               function resizeNavWindow() {
-                       var width = 220 + Math.round(Math.random() * 100);
-                       var height = 220 + Math.round(Math.random() * 100);
-                       myMapApp.Windows["navWindow"].resize(width,height,true);
-               }
+        function windowEvents(id,evtType) {
+            if (evtType == "removed") {
+                alert("window with id " + id + " was removed");
+            }
+            if (evtType == "closed") {
+                buttonTextChange(id,evtType);
+                alert("window with id " + id + " was closed");
+            }
+            if (evtType == "opened") {
+                buttonTextChange(id,evtType);
+                alert("window with id " + id + " was opened");
+            }
+            if (evtType == "minimized") {
+                alert("window with id " + id + " was minimized");
+            }
+            if (evtType == "maximized") {
+                alert("window with id " + id + " was maximized");
+            }
+            if (evtType == "movedTo") {
+                alert("window with id " + id + " was moved to a new position");
+            }
+            if (evtType == "moved") {
+                statusChange("window with id " + id + " was moved to "+Math.round(myMapApp.Windows[id].transX) + ", " + Math.round(myMapApp.Windows[id].transY));
+            }
+            if (evtType == "moveStart") {
+                statusChange("window with id " + id + " just started movement");
+            }
+            if (evtType == "moveEnd") {
+                statusChange("window with id " + id + " just stopped movement");
+            }
+                        if (evtType == "created") {
+                                createCalled();
+                        }
+        }
+        function openCloseWindow(id) {
+            if (myMapApp.Windows[id].closed) {
+                myMapApp.Windows[id].open(true);
+            }
+            else {
+                myMapApp.Windows[id].close(true);
+            }
+        }
+        function buttonTextChange(id,status) {
+            if (status == "closed" || status == "opened") {
+                var buttonText = document.getElementById("buttonText"+id);
+                butText = buttonText.getAttributeNS(attribNS,"buttonText");
+                if (myMapApp.Windows[id].closed) {
+                    buttonText.firstChild.nodeValue = "Open " + butText;
+                }
+                else {
+                    buttonText.firstChild.nodeValue = "Close " + butText;
+                }
+            }
+                        if (id == "navWindow") {
+                        if (status == "created" || status == "resized") {
+                            addOrUpdateWindowDecoration(id);
+                        }
+                        }
+                        if (status == "created") {
+                                createCalled();
+                        }
+        }
+        function resizeNavWindow() {
+            var width = 220 + Math.round(Math.random() * 100);
+            var height = 220 + Math.round(Math.random() * 100);
+            myMapApp.Windows["navWindow"].resize(width,height,true);
+        }
         function addOrUpdateWindowDecoration(id) {
         function addOrUpdateWindowDecoration(id) {
-               var myWindow =  myMapApp.Windows[id];
-               var group = document.createElementNS(svgNS,"g");
-               var rect1 = document.createElementNS(svgNS,"rect");
-               rect1.setAttributeNS(null,"x",-15);
-               rect1.setAttributeNS(null,"y",-15);
-               rect1.setAttributeNS(null,"width",20);
-               rect1.setAttributeNS(null,"height",(myWindow.height+2));
-               rect1.setAttributeNS(null,"fill","lightsteelblue");
-               rect1.setAttributeNS(null,"stroke","none");
-               group.appendChild(rect1);
-               var rect2 = document.createElementNS(svgNS,"rect");
-               rect2.setAttributeNS(null,"x",-15);
-               rect2.setAttributeNS(null,"y",-15);
-               rect2.setAttributeNS(null,"width",(myWindow.width + 16));
-               rect2.setAttributeNS(null,"height",20);
-               rect2.setAttributeNS(null,"fill","lightsteelblue");
-               rect2.setAttributeNS(null,"stroke","none");
-               rect2.setAttributeNS(null,"id","decoGroupMinimized"+myWindow.id);
-               group.appendChild(rect2);
-               var text = document.createElementNS(svgNS,"text");
-               text.setAttributeNS(null,"x",0);
-               text.setAttributeNS(null,"y",myWindow.height-20);
-               text.setAttributeNS(null,"font-family","Arial,Helvetica");
-               text.setAttributeNS(null,"font-size",12);
-               text.setAttributeNS(null,"fill","dimgray");
-               text.setAttributeNS(null,"transform","rotate(-90,0,"+(myWindow.height-20)+")");
-               text.setAttributeNS(null,"pointer-events","none");              
-               var textNode = document.createTextNode(myWindow.titleText);
-               text.appendChild(textNode);
-               group.appendChild(text);
-               //move buttons
-               var x = -5;
-               var curY = -5;
-               if (myWindow.closeButton) {
-                       myWindow.closeButtonInstance.setAttributeNS(null,"x",x);
-                       myWindow.closeButtonInstance.setAttributeNS(null,"y",curY);
-                       curY += 20;
-               }
-               if (myWindow.maximizeButton) {
-                       myWindow.maximizeButtonInstance.setAttributeNS(null,"x",x);
-                       myWindow.maximizeButtonInstance.setAttributeNS(null,"y",curY);
-                       curY += 20;
-               }
-                       if (myWindow.minimizeButton) {
-                       myWindow.minimizeButtonInstance.setAttributeNS(null,"x",x);
-                       myWindow.minimizeButtonInstance.setAttributeNS(null,"y",curY);
-               }
-               myWindow.addWindowDecoration(group,true,"top");
+            var myWindow =     myMapApp.Windows[id];
+            var group = document.createElementNS(svgNS,"g");
+            var rect1 = document.createElementNS(svgNS,"rect");
+            rect1.setAttributeNS(null,"x",-15);
+            rect1.setAttributeNS(null,"y",-15);
+            rect1.setAttributeNS(null,"width",20);
+            rect1.setAttributeNS(null,"height",(myWindow.height+2));
+            rect1.setAttributeNS(null,"fill","lightsteelblue");
+            rect1.setAttributeNS(null,"stroke","none");
+            group.appendChild(rect1);
+            var rect2 = document.createElementNS(svgNS,"rect");
+            rect2.setAttributeNS(null,"x",-15);
+            rect2.setAttributeNS(null,"y",-15);
+            rect2.setAttributeNS(null,"width",(myWindow.width + 16));
+            rect2.setAttributeNS(null,"height",20);
+            rect2.setAttributeNS(null,"fill","lightsteelblue");
+            rect2.setAttributeNS(null,"stroke","none");
+            rect2.setAttributeNS(null,"id","decoGroupMinimized"+myWindow.id);
+            group.appendChild(rect2);
+            var text = document.createElementNS(svgNS,"text");
+            text.setAttributeNS(null,"x",0);
+            text.setAttributeNS(null,"y",myWindow.height-20);
+            text.setAttributeNS(null,"font-family","Arial,Helvetica");
+            text.setAttributeNS(null,"font-size",12);
+            text.setAttributeNS(null,"fill","dimgray");
+            text.setAttributeNS(null,"transform","rotate(-90,0,"+(myWindow.height-20)+")");
+            text.setAttributeNS(null,"pointer-events","none");           
+            var textNode = document.createTextNode(myWindow.titleText);
+            text.appendChild(textNode);
+            group.appendChild(text);
+            //move buttons
+            var x = -5;
+            var curY = -5;
+             if (myWindow.closeButton) {
+                myWindow.closeButtonInstance.setAttributeNS(null,"x",x);
+                myWindow.closeButtonInstance.setAttributeNS(null,"y",curY);
+                curY += 20;
+            }
+            if (myWindow.maximizeButton) {
+                myWindow.maximizeButtonInstance.setAttributeNS(null,"x",x);
+                myWindow.maximizeButtonInstance.setAttributeNS(null,"y",curY);
+                curY += 20;
+            }
+               if (myWindow.minimizeButton) {
+                myWindow.minimizeButtonInstance.setAttributeNS(null,"x",x);
+                myWindow.minimizeButtonInstance.setAttributeNS(null,"y",curY);
+            }
+            myWindow.addWindowDecoration(group,true,"top");
         }
         }
-       ]]></script>
-       <defs>
-               <!-- this symbol is used for the primitive button widgets -->
-               <symbol id="buttonRect" overflow="visible">
-                       <rect x="-70" y="-10" width="140" height="20" fill="gainsboro" stroke="dimgray" stroke-width="1" />
-               </symbol>
-       </defs>
-       <rect id="background" fill="lightgray" stroke="none" x="-5000" y="-5000" width="15000" height="15000" />
-       <rect id="titlerect" fill="white" stroke="none" x="-5000" y="0" width="15000" height="80" />
-       <!-- rects for indicating boundaries -->
-       <rect fill="white" stroke="none" x="-5000" y="-5000" width="5000" height="15000" />
-       <rect fill="white" stroke="none" x="1024" y="-5000" width="5000" height="15000" />
-       <rect fill="white" stroke="none" x="-5000" y="700" width="15000" height="5000" />
-       <text id="titleText" font-family="Arial,Helvetica" fill="dimgray" font-size="20px" x="10" y="30">Demonstration of the Window object</text>
-       <text id="statusText" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" x="10" y="50">Statustext</text>
-       <text id="textNavWindow" x="10" y="25" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window should<tspan x="10" dy="16">contain navigation tools</tspan><tspan x="10" dy="22">Click on button</tspan><tspan x="10" dy="16">'Resize Navigation Window' for a</tspan><tspan x="10" dy="16">random resize of this Window</tspan><tspan x="10" dy="22">Note that this window also</tspan><tspan x="10" dy="16">features a window decoration</tspan></text>
-       <text id="textStatusWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This is a none-moveable<tspan x="10" dy="16">none-closeable status</tspan><tspan x="10" dy="16">window</tspan></text>
-       <text id="textSmallWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window has a callback<tspan x="10" dy="16">function indicating mouse</tspan><tspan x="10" dy="16">movements in the statusbar</tspan><tspan x="10" dy="16">and alerting window</tspan><tspan x="10" dy="16">events</tspan></text>
-       <text id="textMinimalWindow" x="5" y="16" font-family="Arial,Helvetica" fill="dimgray" font-size="12px" pointer-events="none" display="none">This is a minimal window<tspan x="5" dy="16">without title and status bar.</tspan><tspan x="5" dy="16">it is also not moveable</tspan></text>
-       <!-- primitive buttons for opening and closing windows -->
-       <use x="480" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('navWindow')"/>
-       <text id="buttonTextnavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Navigation Window" x="480" y="25" pointer-events="none">Close Navigation Window</text>
-       <use x="630" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('bigWindow')"/>
-       <text id="buttonTextbigWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Big Window" x="630" y="25" pointer-events="none">Close Big Window</text>
-       <use x="780" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('nestedWindow')"/>
-       <text id="buttonTextnestedWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Middlesize Window" x="780" y="25" pointer-events="none">Close Middlesize Window</text>
-       <use x="930" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('colourPickerWindow')"/>
-       <text id="buttonTextcolourPickerWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Colour Picker" x="930" y="25" pointer-events="none">Close Colour Picker</text>
-       <use x="930" y="50" xlink:href="#buttonRect" onclick="openCloseWindow('smallWindow')"/>
-       <text id="buttonTextsmallWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Small Window" x="930" y="55" pointer-events="none">Close Small Window</text>
-       <use x="480" y="50" xlink:href="#buttonRect" onclick="resizeNavWindow()"/>
-       <text id="buttonTextResizeNavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Resize Navigation Window" x="480" y="55" pointer-events="none">Resize Navigation Window</text>
+    ]]></script>
+    <defs>
+        <!-- this symbol is used for the primitive button widgets -->
+        <symbol id="buttonRect" overflow="visible">
+            <rect x="-70" y="-10" width="140" height="20" fill="gainsboro" stroke="dimgray" stroke-width="1" />
+        </symbol>
+    </defs>
+    <rect id="background" fill="lightgray" stroke="none" x="-5000" y="-5000" width="15000" height="15000" />
+    <rect id="titlerect" fill="white" stroke="none" x="-5000" y="0" width="15000" height="80" />
+    <!-- rects for indicating boundaries -->
+    <rect fill="white" stroke="none" x="-5000" y="-5000" width="5000" height="15000" />
+    <rect fill="white" stroke="none" x="1024" y="-5000" width="5000" height="15000" />
+    <rect fill="white" stroke="none" x="-5000" y="700" width="15000" height="5000" />
+    <text id="titleText" font-family="Arial,Helvetica" fill="dimgray" font-size="20px" x="10" y="30">Demonstration of the Window object</text>
+    <text id="statusText" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" x="10" y="50">Statustext</text>
+    <text id="textNavWindow" x="10" y="25" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window should<tspan x="10" dy="16">contain navigation tools</tspan><tspan x="10" dy="22">Click on button</tspan><tspan x="10" dy="16">'Resize Navigation Window' for a</tspan><tspan x="10" dy="16">random resize of this Window</tspan><tspan x="10" dy="22">Note that this window also</tspan><tspan x="10" dy="16">features a window decoration</tspan></text>
+    <text id="textStatusWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This is a none-moveable<tspan x="10" dy="16">none-closeable status</tspan><tspan x="10" dy="16">window</tspan></text>
+    <text id="textSmallWindow" x="10" y="40" font-family="Arial,Helvetica" fill="dimgray" font-size="14px" pointer-events="none" display="none">This window has a callback<tspan x="10" dy="16">function indicating mouse</tspan><tspan x="10" dy="16">movements in the statusbar</tspan><tspan x="10" dy="16">and alerting window</tspan><tspan x="10" dy="16">events</tspan></text>
+    <text id="textMinimalWindow" x="5" y="16" font-family="Arial,Helvetica" fill="dimgray" font-size="12px" pointer-events="none" display="none">This is a minimal window<tspan x="5" dy="16">without title and status bar.</tspan><tspan x="5" dy="16">it is also not moveable</tspan></text>
+    <!-- primitive buttons for opening and closing windows -->
+    <use x="480" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('navWindow')"/>
+    <text id="buttonTextnavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Navigation Window" x="480" y="25" pointer-events="none">Close Navigation Window</text>
+    <use x="630" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('bigWindow')"/>
+    <text id="buttonTextbigWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Big Window" x="630" y="25" pointer-events="none">Close Big Window</text>
+    <use x="780" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('nestedWindow')"/>
+    <text id="buttonTextnestedWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Middlesize Window" x="780" y="25" pointer-events="none">Close Middlesize Window</text>
+    <use x="930" y="20" xlink:href="#buttonRect" onclick="openCloseWindow('colourPickerWindow')"/>
+    <text id="buttonTextcolourPickerWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Colour Picker" x="930" y="25" pointer-events="none">Close Colour Picker</text>
+    <use x="930" y="50" xlink:href="#buttonRect" onclick="openCloseWindow('smallWindow')"/>
+    <text id="buttonTextsmallWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Small Window" x="930" y="55" pointer-events="none">Close Small Window</text>
+    <use x="480" y="50" xlink:href="#buttonRect" onclick="resizeNavWindow()"/>
+    <text id="buttonTextResizeNavWindow" font-family="Arial,Helvetica" fill="dimgray" text-anchor="middle" font-size="11px" attrib:buttonText="Resize Navigation Window" x="480" y="55" pointer-events="none">Resize Navigation Window</text>
 </svg>
 </svg>