Revision: 3323
          http://vexi.svn.sourceforge.net/vexi/?rev=3323&view=rev
Author:   clrg
Date:     2008-12-23 02:43:26 +0000 (Tue, 23 Dec 2008)

Log Message:
-----------
Some trivial cleanup for Box.jpp

Modified Paths:
--------------
    trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2008-12-23 02:43:00 UTC 
(rev 3322)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Box.jpp  2008-12-23 02:43:26 UTC 
(rev 3323)
@@ -90,7 +90,7 @@
     private final int localToGlobalY(int y) { return parent==null ? y : 
parent.localToGlobalY(y + getYInParent()); }
 
     // useful debugging reflow problems
-    // unused - private final int depth() { int d=0; for (Box p = this.parent; 
p!=null; p = p.parent) d++; return d; }
+    private final int depth() { int d=0; for (Box p = this.parent; p!=null; p 
= p.parent) d++; return d; }
 
     private static final int min(int a, int b) { return (a<b) ? a : b; }
     private static final int max(int a, int b) { return (a>b) ? a : b; }
@@ -1175,11 +1175,7 @@
         */
 
         //#switch (JSU.toString(name))
-        case "__treedepth":
-            // FIXME: this is for debugging - move to devl?
-            int i=1;
-            for (Box b=parent; b!=null; b=b.parent) i++;
-            return JSU.N(i);
+        case "__treedepth": return JSU.N(depth()); // FIXME: this is for 
debugging - move to devl?
         case "surface": return getSurfaceObject();
         case "forcereflow": return METHOD;
         case "sendEvent": return METHOD;
@@ -1208,7 +1204,7 @@
         case "contentwidth": return JSU.N(contentwidth);
         case "contentheight": return JSU.N(contentheight);
         case "display": return JSU.B(test(DISPLAY));
-        case "visible": return JSU.B(test(DISPLAY) && isParentVisible());
+        case "visible": return JSU.B(test(DISPLAY) && (parent!=null ? 
parent.isVisible() : Surface.fromBox(this)!=null));
         case "cursor": return test(CURSOR) ? super.get(name) : null;
         case "mouse":
             if (getSurface() == null) return null;
@@ -1590,7 +1586,7 @@
         } while(true);
     }
     
-    /** for Surface to check it a root box is visible */
+    /** for Surface to check if a root box is visible */
     static final boolean testDisplay(Box b) { return b.test(DISPLAY); }
 
     /** establish visible, invoking read traps if required */
@@ -1606,12 +1602,6 @@
         return Surface.fromBox(b) != null;
     }
 
-    /** recursively invoke isVisible on box tree */
-    private final boolean isParentVisible() throws JSExn {
-        if (parent==null) return Surface.fromBox(this) != null;
-        return parent.isVisible();
-    }
-
     /** represents a chain of traps that may span multiple boxes */
     public static final class TrapChain {
         int chainlength = 0;


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

------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to