[Laszlo-checkins] r10902 - in openlaszlo/trunk/WEB-INF/lps: lfc/kernel/dhtml lfc/views templates
max@openlaszlo.org
max at openlaszlo.org
Fri Sep 5 16:04:15 PDT 2008
Author: max
Date: 2008-09-05 16:04:05 -0700 (Fri, 05 Sep 2008)
New Revision: 10902
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
openlaszlo/trunk/WEB-INF/lps/templates/html-response.xslt
Log:
Change 20080905-maxcarlson-K by maxcarlson at Bank on 2008-09-05 11:52:02 PDT
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Make fixed-size canvases work on the iPhone, fix scaling
Bugs Fixed: LPP-6933 - iphone dhtml: apps not clickable unless percentage values are used for canvas width/height
Technical Reviewer: ptw
QA Reviewer: promanik
Details: LzSprite.js - For iPhone, leave the default values for the activate_on_mouseover and listen_for_mouseover_out quirks, and turn on the canvas_div_cannot_be_clipped quirk.
LaszloCanvas.lzs - Clean up arg processing in construct(), clean out cruft.
html-response.xslt - Set iPhone viewport width to device-width to prevent warnings, allow users to scale apps like other pages in safari.
Tests: See LPP-6933
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-09-05 22:14:15 UTC (rev 10901)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-09-05 23:04:05 UTC (rev 10902)
@@ -40,8 +40,7 @@
div.style.width = width;
var widthispercentage = width.indexOf('%') != -1;
var w = widthispercentage ? width : parseInt(width);
- this._w = w;
- this.width = w;
+ this._w = this.width = w;
}
var height = p.height;
if (height) {
@@ -49,8 +48,7 @@
div.style.height = height;
var heightispercentage = height.indexOf('%') != -1;
var h = heightispercentage ? height : parseInt(height);
- this._h = h;
- this.height = h;
+ this._h = this.height = h;
}
if (p.id) {
this._id = p.id;
@@ -434,8 +432,9 @@
// turn off mouseover activation for iphone
if (browser.isIphone) {
- quirks['activate_on_mouseover'] = false;
- quirks['listen_for_mouseover_out'] = false;
+ //quirks['activate_on_mouseover'] = false;
+ //quirks['listen_for_mouseover_out'] = false;
+ quirks['canvas_div_cannot_be_clipped'] = true;
}
} else if (browser.isOpera) {
// Fix bug in where if any parent of an image is hidden the size is 0
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2008-09-05 22:14:15 UTC (rev 10901)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2008-09-05 23:04:05 UTC (rev 10902)
@@ -240,36 +240,44 @@
delete args.proxied;
+ // Default to arg values
+ var width = args.width;
+ var height = args.height;
+ var bgcolor = args.bgcolor;
+ delete args.width;
+ delete args.height;
+ delete args.bgcolor;
+
if (capabilities.readcanvassizefromsprite == true) {
if (this.sprite.width) {
- args.width = this.sprite.width;
+ width = this.sprite.width;
}
if (this.sprite.height) {
- args.height = this.sprite.height;
+ height = this.sprite.height;
}
if (this.sprite.bgcolor) {
- args.bgcolor = this.sprite.bgcolor;
+ bgcolor = this.sprite.bgcolor;
}
} else {
// read from init args
if (lz.Browser.getInitArg('width') != null) {
- args.width = lz.Browser.getInitArg('width');
+ width = lz.Browser.getInitArg('width');
}
if (lz.Browser.getInitArg('height') != null) {
- args.height = lz.Browser.getInitArg('height');
+ height = lz.Browser.getInitArg('height');
}
if (lz.Browser.getInitArg('bgcolor') != null) {
- args.bgcolor = lz.Browser.getInitArg('bgcolor');
+ bgcolor = lz.Browser.getInitArg('bgcolor');
}
}
this.__canvaswidthratio = null;
- this.width = Number(args.width);
+ this.width = Number(width);
if (isNaN(this.width)) {
- if (args.width.charAt(args.width.length-1) == '%') {
- var percent = Number(args.width.substr(0, args.width.length-1));
+ if (width.charAt(width.length-1) == '%') {
+ var percent = Number(width.substr(0, width.length-1));
this.__canvaswidthratio = percent/100;
if (capabilities.scalecanvastopercentage != true) {
// some runtimes already scale the viewport size, so take the reported size literally to avoid scaling twice
@@ -277,18 +285,17 @@
}
} else {
if ( $debug ){
- Debug.warn('ignored bad value %#w for canvas width', args.width);
+ Debug.warn('ignored bad value %#w for canvas width', width);
}
this.width = 400;
}
}
- delete args.width;
this.__canvasheightratio = null;
- this.height = Number(args.height);
+ this.height = Number(height);
if (isNaN(this.height)) {
- if (args.height.charAt(args.height.length-1) == '%') {
- var percent = Number(args.height.substr(0, args.height.length-1));
+ if (height.charAt(height.length-1) == '%') {
+ var percent = Number(height.substr(0, height.length-1));
this.__canvasheightratio = percent/100;
if (capabilities.scalecanvastopercentage != true) {
// some runtimes already scale the viewport size, so take the reported size literally to avoid scaling twice
@@ -296,12 +303,11 @@
}
} else {
if ( $debug ){
- Debug.warn('ignored bad value %#w for canvas height', args.height);
+ Debug.warn('ignored bad value %#w for canvas height', height);
}
this.height = 400;
}
}
- delete args.height;
if ($swf9) {
// Set the canvas width/height to good initial values.
@@ -314,8 +320,7 @@
LzScreenKernel.setCallback(this, '__windowResize');
}
- this.bgcolor = lz.Utils.hextoint(args.bgcolor);
- delete args.bgcolor;
+ this.bgcolor = lz.Utils.hextoint(bgcolor);
this.lpsversion = args.lpsversion + "." + this.__LZlfcversion;
delete args.lpsversion;
@@ -347,14 +352,6 @@
LzPlatform.initCanvas(this);
this.id = lz.Browser.getInitArg('id');
-
- if ($swf9) {
- ////////////////////////////////////////////////////////////////
- //DEBUG
- ////////////////////////////////////////////////////////////////
- //trace('canvas.sprite.width = ', this.sprite.width, this.sprite);
- //trace('canvas.sprite.height = ', this.sprite.height);
- }
}
/**
Modified: openlaszlo/trunk/WEB-INF/lps/templates/html-response.xslt
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/templates/html-response.xslt 2008-09-05 22:14:15 UTC (rev 10901)
+++ openlaszlo/trunk/WEB-INF/lps/templates/html-response.xslt 2008-09-05 23:04:05 UTC (rev 10902)
@@ -60,8 +60,8 @@
<html>
<head>
<link rel="SHORTCUT ICON" href="http://www.laszlosystems.com/favicon.ico"/>
- <!-- this tag helps laszlo apps look good on the iPhone. It prevents user scaling. [bshine] -->
- <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+ <!-- this tag helps laszlo apps look good on the iPhone. -->
+ <meta name="viewport" content="width=device-width; initial-scale=1.0;"/>
<title>
<xsl:value-of select="/canvas/@title"/>
</title>
More information about the Laszlo-checkins
mailing list