Revision: 3167
          http://vexi.svn.sourceforge.net/vexi/?rev=3167&view=rev
Author:   clrg
Date:     2008-11-03 11:36:48 +0000 (Mon, 03 Nov 2008)

Log Message:
-----------
Partially fix test failure

Modified Paths:
--------------
    trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp
    trunk/core/org.vexi.core/src_junit/test/core/box/childrentrap/exnInCascade.t

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2008-11-03 11:22:14 UTC 
(rev 3166)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2008-11-03 11:36:48 UTC 
(rev 3167)
@@ -1261,7 +1261,7 @@
             boolean display = JSU.toBoolean(value);
             if (test(DISPLAY) != display) {
                 // fire pre-cascade visible traps
-               VisibleCascade visitraps = get(SC_visible) == value ? null : 
fireVisibleTraps(display, null);
+                VisibleCascade visitraps = get(SC_visible) == value ? null : 
fireVisibleTraps(display, null);
                 if (display) {
                     set(DISPLAY);
                     requestReflow();
@@ -1344,12 +1344,12 @@
                 setPlace();
             }
         case "surface":
-               // return instead of throw an exception because in some corner 
cases
-               // a put is required because surface operates using a read 
trap, thus
-               // boxes inheriting a 'surface' box may need to initialize 
themselves
-               // using a surface put.
-               return;
-               // throw new JSExn("Attempt to put to read-only 
'"+JSU.toString(name)+"'");
+            // return instead of throw an exception because in some corner 
cases
+            // a put is required because surface operates using a read trap, 
thus
+            // boxes inheriting a 'surface' box may need to initialize 
themselves
+            // using a surface put.
+            return;
+            // throw new JSExn("Attempt to put to read-only 
'"+JSU.toString(name)+"'");
         // FIXME: the call to setMinimized()/setMaximized() will trigger 
another call of this code in the course of triggering write traps
         case "Minimized":   if (parent == null && getSurface() != null) 
getSurface().setMinimized(JSU.toBoolean(value));
         case "Maximized":   if (parent == null && getSurface() != null) 
getSurface().setMaximized(JSU.toBoolean(value));
@@ -1481,11 +1481,14 @@
     
     // firing surface traps
     final SurfaceCascade fireSurfaceTraps(JS val, SurfaceCascade trapchain) {
-        if (test(SURFACE_TRAP))
+        if (test(SURFACE_TRAP)) {
             trapchain = new SurfaceCascade(val, trapchain);
+            if (trapchain.exn!=null) return trapchain;
+        }
         for (int i=0; i<treeSize(); i++) {
             Box b = getChild(i);
             trapchain = b.fireSurfaceTraps(val, trapchain);
+            if (trapchain.exn!=null) return trapchain;
         }
         return trapchain;
     }
@@ -1501,27 +1504,31 @@
             next = trapchain;
         }
         
-        void finishTraps() {
+        public void finishTraps() { finishTraps(exn); }
+        private void finishTraps(JSExn exn) {
             postPutTriggerTrapsAndCatchExceptions(trap, SC_surface, exn);
-            if (next!=null) next.finishTraps();
+            if (next!=null) next.finishTraps(exn);
         }
     }
     
     // firing visible traps
     public final VisibleCascade fireVisibleTraps(boolean val, VisibleCascade 
trapchain) {
         if (test(VISIBLE_TRAP)) {
-               trapchain = new VisibleCascade(val, trapchain); 
+            trapchain = new VisibleCascade(val, trapchain);
+            if (trapchain.exn!=null) return trapchain; 
         }
         for (int i=0; i<treeSize(); i++) {
             Box b = getChild(i);
-            if (b.test(DISPLAY))
-               trapchain = b.fireVisibleTraps(val, trapchain);
+            if (b.test(DISPLAY)) {
+                trapchain = b.fireVisibleTraps(val, trapchain);
+                if (trapchain.exn!=null) return trapchain;
+            }
         }
         return trapchain;
     }
     
     public final class VisibleCascade {
-       VisibleCascade next;
+        VisibleCascade next;
         Trap trap;
         JSExn exn;
         
@@ -1531,9 +1538,10 @@
             next = trapchain;
         }
         
-        public void finishTraps() {
+        public void finishTraps() { finishTraps(exn); }
+        private void finishTraps(JSExn exn) {
             postPutTriggerTrapsAndCatchExceptions(trap, SC_visible, exn);
-            if (next!=null) next.finishTraps();
+            if (next!=null) next.finishTraps(exn);
         }
     }
 
@@ -1576,7 +1584,7 @@
         // call pre-cascade traps
         SurfaceCascade surftraps = oldsurface==newsurface ? null : 
fireSurfaceTraps(newsurface, null);
         VisibleCascade visitraps =
-               !test(DISPLAY) || (wasvisible == 
(newparent==null?false:newparent.isVisible()))
+            !test(DISPLAY) || (wasvisible == 
(newparent==null?false:newparent.isVisible()))
                 ? null : fireVisibleTraps(!wasvisible, null);
         // remove from old parent
         if (parent != null) {

Modified: 
trunk/core/org.vexi.core/src_junit/test/core/box/childrentrap/exnInCascade.t
===================================================================
--- 
trunk/core/org.vexi.core/src_junit/test/core/box/childrentrap/exnInCascade.t    
    2008-11-03 11:22:14 UTC (rev 3166)
+++ 
trunk/core/org.vexi.core/src_junit/test/core/box/childrentrap/exnInCascade.t    
    2008-11-03 11:36:48 UTC (rev 3167)
@@ -18,7 +18,7 @@
         var child = vexi.box;
         child.surface ++= function(v){
             cascade = v;
-               throw "xxx";
+            throw "xxx";
         };
         
         var exceptionHappened = true;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to