[Laszlo-checkins] r13111 - openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler

ptw@openlaszlo.org ptw at openlaszlo.org
Sun Mar 1 11:01:47 PST 2009


Author: ptw
Date: 2009-03-01 11:01:40 -0800 (Sun, 01 Mar 2009)
New Revision: 13111

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
Log:
Change 20090301-ptw-c by ptw at dueling-banjos.home on 2009-03-01 13:39:42 EST
    in /Users/ptw/OpenLaszlo/trunk-3
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix nodePath to actually go all the way to the root of the document

Bugs Fixed:
LPP-7833 onmousedragin / onmousedragout not working in swf8, swf9 or DHTML (partial)
LPP-7750 Many warnings and errors with LZOs

Technical Reviewer: a.bargull at intensis.de (pending)
QA Reviewer: mdemmon (pending)
Doc Reviewer: (pending)

Details:
    nodePath was not counting duplicate tags at document root

Tests:
    inspection of compiler output for bug test case



Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2009-03-01 18:49:48 UTC (rev 13110)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2009-03-01 19:01:40 UTC (rev 13111)
@@ -156,7 +156,7 @@
 
     // Path of node from root.  This follows the same psuedo-xpath
     // system used in LzNode._dbg_name.  It provides a basis for
-    // giving anonymous classes unuqu names.
+    // giving anonymous classes unique names.
     private static String computeNodePath(NodeModel node, ViewSchema schema, CompilationEnvironment env) {
         if (node.id != null) {
             return "#" + node.id;
@@ -166,8 +166,14 @@
         }
         String nn = node.localName;
         String path = "";
-        org.jdom.Parent parentElement = node.element.getParent();
-        if ((parentElement == null) || (! (parentElement instanceof ElementWithLocationInfo))) {
+        org.jdom.Parent parentDOMNode = node.element.getParent();
+        Element parentElement;
+        if (parentDOMNode instanceof org.jdom.Document) {
+          parentElement = ((org.jdom.Document)parentDOMNode).getRootElement();
+        } else {
+          parentElement = (Element)parentDOMNode;
+        }
+        if (parentElement == node.element) {
             // Must be at the root, in not linking, create a UID
             // placeholder for root
           if (! "false".equals(env.getProperty(CompilationEnvironment.LINK_PROPERTY))) {
@@ -185,13 +191,11 @@
         } else {
             String tn = path = node.tagName;
             int count = 0, index = -1;
-            for (Iterator iter = parent.children.iterator(); iter.hasNext(); ) {
-                NodeModel sibling = (NodeModel) iter.next();
-                if (tn.equals(sibling.tagName)) {
-                    count++;
-                    if (index != -1) break;
-                }
-                if (node.element == sibling.element) { index = count; }
+            for (Iterator iter = parentElement.getChildren(tn, parentElement.getNamespace()).iterator(); iter.hasNext(); ) {
+                Element sibling = (Element) iter.next();
+                count++;
+                if (index != -1) break;
+                if (node.element == sibling) { index = count; }
             }
             if (count > 1) {
                 path += "[" + index + "]";



More information about the Laszlo-checkins mailing list