[Laszlo-checkins] r12350 - in openlaszlo/trunk/WEB-INF/lps/lfc: compiler core services

max@openlaszlo.org max at openlaszlo.org
Wed Jan 7 16:44:04 PST 2009


Author: max
Date: 2009-01-07 16:43:59 -0800 (Wed, 07 Jan 2009)
New Revision: 12350

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/core/PresentationTypes.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
Log:
Change 20090107-maxcarlson-t by maxcarlson at Bank.lan on 2009-01-07 08:27:05 PST
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix mousewheel in swf9

Bugs Fixed: LPP-7575 - swf9: mousewheel not working in OS X

Technical Reviewer: ptw
QA Reviewer: hminsky

Details: LzUtils.lzs - Add null arg to __unpackList() so it works with swf9.  Use globalValue() to look up classes instead of __findClass().

PresentationTypes.lzs - Use globalValue() to look up classes instead of lz.Utils.__findClass() in GenericPresentationType.

LzRuntime.lzs - Add special case for 'lz' to ensure it's found - fixes the mouse wheel.

Tests: test/lfc/legals/keyboardandmouse.lzx runs in swf9 and in other runtimes.  Testcase from LPP-2610 runs consistenty across runtimes.



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs	2009-01-07 22:17:17 UTC (rev 12349)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs	2009-01-08 00:43:59 UTC (rev 12350)
@@ -163,6 +163,8 @@
  * of the LFCApplication.
  */
 var globalValue = function (name:String) {
+  // remove this when LPP-7574 is fixed
+  if (name == 'lz') return lz;
   // Semi-kludge:  We name our tag classes <tagname>.  Since <> are
   // not valid symbol constituents, there is no confusion here
   if (name.charAt(0) == '<' && name.charAt(name.length-1) == '>') {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/PresentationTypes.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/PresentationTypes.lzs	2009-01-07 22:17:17 UTC (rev 12349)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/PresentationTypes.lzs	2009-01-08 00:43:59 UTC (rev 12350)
@@ -1,5 +1,5 @@
 /**
-  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @access public
@@ -30,11 +30,11 @@
 class GenericPresentationType extends PresentationType {
   static function accept(value, type) {
     // Look for class as-is
-    var obj = lz.Utils.__findClass(type);
+    var obj = globalValue(type);
     if (! obj) {
         // Convert to upper case
         var uppertype = type.substring(0, 1).toUpperCase() + type.substring(1);
-        obj = lz.Utils.__findClass(uppertype);
+        obj = globalValue(uppertype);
         if (! obj) return value;
     }
     return new obj(value);

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs	2009-01-07 22:17:17 UTC (rev 12349)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs	2009-01-08 00:43:59 UTC (rev 12350)
@@ -1,7 +1,7 @@
 /**
   * LzUtils.lzs
   *
-  * @copyright Copyright 2007-2008 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2007-2009 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Services
@@ -247,7 +247,7 @@
     var colornames = lz.colors;
 
     // Unpack a javascript list from a string, giving each item the appropriate type 
-    function __unpackList(argstr, scope) {
+    function __unpackList(argstr, scope = null) {
         if (scope == null) scope = canvas;
         var args = argstr.split(',');
         // cast arguments to type
@@ -315,21 +315,6 @@
         return result;
     }
 
-    // Flash needs help referencing global classes :(
-    var __as2globalclasses = {Number: Number, String: String, Boolean: Boolean, Date: Date, Array: Array, Object: Object, Function: Function};
-
-    function __findClass(classname) {
-        // short-circuting || would be much better - see LPP- 
-        var obj = lz.Utils.__as2globalclasses[classname];
-        if (obj) return obj;
-        obj = global[classname];
-        if (obj) return obj;
-        obj = canvas[classname];
-        if (obj) return obj;
-        obj = lz[classname];
-        if (obj) return obj;
-    }
-
     // 'new' an object from a javascript string.  Must begin with 'new '.
     function safeNew(js, arglist = null) {
         var orig = js;
@@ -346,7 +331,7 @@
             js = js.substring(0, s);
         }
 
-        var obj = lz.Utils.__findClass(js);
+        var obj = globalValue(js);
         if (! obj) return;
 
         var args = arglist == null ? lz.Utils.__unpackList(args) : arglist;



More information about the Laszlo-checkins mailing list