History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-4778
Type: Bug Bug
Status: Verified Verified
Resolution: Fixed
Priority: P0 P0
Assignee: Max Carlson
Reporter: André Bargull
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

"LzView#setX(..)" and "LzView#setY(..)" optimization breaks xoffset / yoffset

Created: 24/Sep/07 07:05 AM   Updated: 08/Oct/07 01:33 PM
Component/s: Laszlo Foundation Classes (LFC)
Affects Version/s: 4.0.5WaffleCone, RingDing, 4.0.6/Jujube
Fix Version/s: 4.0.6/Jujube

Time Tracking:
Not Specified

Severity: Critical
Fixed in Change#: 6,602
Runtime: N/A
Flags: Regression
Fix in hand: False


 Description  « Hide
bad optimizations for:
LzView#setX(..), LzView#setY(..)

this breaks LzView#setXOffset(..) and LzView#setYOffset(..).

see forum: "http://forum.openlaszlo.org/showthread.php?t=10550"


optimization was:
function setX ( v ){
    if (this._x != v) {//setXOffset calls this.setX(this.x) !!!
      [...]
    }
}

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
André Bargull - 24/Sep/07 07:18 AM
This bug also affects "LzView#setRotation(..)"

André Bargull - 24/Sep/07 07:31 AM
Was introduced by Max in wafflecone rev. #5888, therefore re-assign to Max:

Change 20070731-maxcarlson-r by maxcarlson@plastik on 2007-07-31 17:41:50 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: More null protection, cache view values

New Features:

Bugs Fixed: LPP-4414 - Improve startup performance (partial)

Technical Reviewer: promanik
QA Reviewer: ben
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
[...]
LaszloView.lzs - Send onresourcewidth/height events for error/timeout. Cache x, y, width and height values and don't reset.
[...]

Amy Muntz - 28/Sep/07 09:33 AM
Max - please merge to wafflecone for jujube.

Maynard Demmon - 28/Sep/07 12:06 PM
Seems like LPP-4693 might be a duplicate of this bug.

Max Carlson - 28/Sep/07 01:17 PM
Merged to wafflecone:
Author: max
Date: 2007-09-28 13:16:12 -0700 (Fri, 28 Sep 2007)
New Revision: 6674

Modified:
   openlaszlo/branches/wafflecone/
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs
   openlaszlo/branches/wafflecone/test/lztest/lztest-view.lzx
Log:
Merged revisions 6595-6602 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/trunk

.......
  r6595 | max | 2007-09-25 15:04:25 -0700 (Tue, 25 Sep 2007) | 26 lines
  
  Change 20070925-maxcarlson-7 by maxcarlson@plastik on 2007-09-25 13:55:11 PDT
      in /Users/maxcarlson/openlaszlo/trunk
      for http://svn.openlaszlo.org/openlaszlo/trunk
  
  Summary: Fix xoffset and yoffset
  
  New Features:
  
  Bugs Fixed: LPP-4778 - "LzView#setX(..)" and "LzView#setY(..)" optimization breaks xoffset / yoffset
  
  Technical Reviewer: promanik
  QA Reviewer: bargull
  Doc Reviewer: (pending)
  
  Documentation:
  
  Release Notes:
  
  Details: lztest-view.lzx - add test for x/yoffset and one with rotation.
  
  LaszloView.lzs - Add correct initial values for _x, _y, _width, _height. Add argument to setX/setY() to override cached values. setRotation/setXOffset/setYOffset() call setX/setY() with force set to true.
      
  
  Tests: Run updated lztest-view.lzx with and without the changes to LaszloView.lzs. You should see the test fail without the LaszloView changes. Tested in swf7/8/dhtml.
.......
  r6602 | max | 2007-09-25 17:22:21 -0700 (Tue, 25 Sep 2007) | 24 lines
  
  Change 20070925-maxcarlson-g by maxcarlson@plastik on 2007-09-25 15:42:07 PDT
      in /Users/maxcarlson/openlaszlo/trunk
      for http://svn.openlaszlo.org/openlaszlo/trunk
  
  Summary: Fix stretches
  
  New Features:
  
  Bugs Fixed: LPP-4778 - "LzView#setX(..)" and "LzView#setY(..)" optimization breaks xoffset / yoffset
  
  Technical Reviewer: promanik
  QA Reviewer: andrebargull@aol.com
  Doc Reviewer: (pending)
  
  Documentation:
  
  Release Notes:
  
  Details: Shouldn't have set defaults for _x/y/width/height.
      
  
  Tests: http://localhost:8080/trunk/examples/components/style_example.lzx runs correctly
.......



Property changes on: openlaszlo/branches/wafflecone
___________________________________________________________________
Name: svnmerge-integrated
   - /openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5819,5821-5860,5862-5890,5892-6065,6068-6177,6179-6228,6230-6236,6241-6266 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
   + /openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5819,5821-5860,5862-5890,5892-6065,6068-6177,6179-6228,6230-6236,6241-6266 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334,6595-6602

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-09-28 19:54:03 UTC (rev 6673)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-09-28 20:16:12 UTC (rev 6674)
@@ -1287,8 +1287,8 @@
   * Sets the <attribute>x</attribute> position of the view to the given value.
   * @param Number v: The new value for <attribute>x</attribute>.
   */
-function setX ( v ){
- if (this._x != v) {
+function setX ( v, force ){
+ if (force || this._x != v) {
         this._x = v;
         this.x = v;
         if ( this.__LZhasoffset ){
@@ -1314,8 +1314,8 @@
   * Sets the <attribute>y</attribute> position for the view to the given value.
   * @param Number v: The new value for <attribute>y</attribute>.
   */
-function setY ( v ){
- if (this._y != v) {
+function setY ( v, force ){
+ if (force || this._y != v) {
         this._y = v;
         this.y = v;
         if ( this.__LZhasoffset ){
@@ -1353,8 +1353,8 @@
     if (this.onrotation.ready) this.onrotation.sendEvent( v );
 
     if ( this.__LZhasoffset ){
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
     }
 
     if (this.immediateparent.__LZcheckwidth)
@@ -1396,8 +1396,8 @@
 function setXOffset ( o ){
     this.__LZhasoffset = o != 0;
     this.xoffset = o;
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
     if (this.onxoffset.ready) this.onxoffset.sendEvent( o );
 }
 
@@ -1408,8 +1408,8 @@
 function setYOffset ( o ){
     this.__LZhasoffset = o != 0;
     this.yoffset = o;
- this.setX( this.x );
- this.setY( this.y );
+ this.setX( this.x, true );
+ this.setY( this.y, true );
     if (this.onyoffset.ready) this.onyoffset.sendEvent( o );
 }
 

Modified: openlaszlo/branches/wafflecone/test/lztest/lztest-view.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/lztest/lztest-view.lzx 2007-09-28 19:54:03 UTC (rev 6673)
+++ openlaszlo/branches/wafflecone/test/lztest/lztest-view.lzx 2007-09-28 20:16:12 UTC (rev 6674)
@@ -143,13 +143,12 @@
   </view>
 
 
-<!-- viewN: rotations, around the center -->
-<!-- leave for later
- <view name="view5" bgcolor="yellow">
+<!-- view14: rotations, around the center -->
+ <view name="view14" bgcolor="yellow">
+ <simplelayout/>
     <view name="v1" bgcolor="green" width="20" height="10" xoffset="10" yoffset="5" rotation="45"/>
- <simpleboundslayout name="layout" axis="x"/>
+ <view name="v2" bgcolor="red" width="20" height="10" xoffset="10" yoffset="5"/>
   </view>
--->
 
 
 
@@ -180,10 +179,10 @@
 // Inspect [x,y,width,height] and compare with the specified view
 function loctest(msg,view,exp)
 {
- LzTestManager.assertEquals (exp[0], view.x, msg + ": x failure");
- LzTestManager.assertEquals (exp[1], view.y, msg + ": y failure");
- LzTestManager.assertEquals (exp[2], view.width, msg + ": width failure");
- LzTestManager.assertEquals (exp[3], view.height, msg + ": height failure");
+ LzTestManager.assertWithin (exp[0], view.sprite.x, .1, msg + ": x failure");
+ LzTestManager.assertWithin (exp[1], view.sprite.y, .1, msg + ": y failure");
+ LzTestManager.assertWithin (exp[2], view.sprite.width, .1, msg + ": width failure");
+ LzTestManager.assertWithin (exp[3], view.sprite.height, .1, msg + ": height failure");
 }
 
 
@@ -463,6 +462,10 @@
   // Built-into object view14
 }
 
+suite.test14 = function() {
+ if (view14.capabilities.rotation) loctest ('view14', view14.v1, [-3.53553390593274,-10.6066017177982,20,10]);
+ loctest ('view14', view14.v2, [-10,5,20,10]);
+}
 /* Leave for last
 suite.testN = function() {
   var b = view5.v1.getBounds();
@@ -484,6 +487,7 @@
 suite.addTest(suite.test11);
 suite.addTest(suite.test12);
 suite.addTest(suite.test13);
+suite.addTest(suite.test14);
 
 
 


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Steve O'Sullivan - 08/Oct/07 12:22 PM
According to my understanding of what Max has told me about this bug:
The problem is that
1. lztest-view.lzx did not catch a failure in the application of xoffset and yoffset.
2. The problem that occurs is that xoffset or yoffset will not be applied if the x or y is not specifically set in the view that has xoffset or yoffset set.

In regards to the test, Max has updated it in build 6602, and you will need to copy the test from that branch to your older branch to run and receive assertion failures that are triggered by this behavior.

Steve O'Sullivan - 08/Oct/07 01:33 PM
Bug reproduced in build r6600. The assertion failures in question are:
ERROR: In suite LzView Test Suite, test 13, failed assertion: view14: x failureWithin-3.53553390593274±0.1 -7.07106781186547
ERROR: In suite LzView Test Suite, test 13, failed assertion: view14: y failureWithin-10.6066017177982±0.1 -7.07106781186548

They are no longer triggered in wafflecone build 6714.