Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 392810

Summary: Text with border and size (1,1) crashes IE
Product: [RT] RAP Reporter: Matthias Kempka <mkempka>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: tbuschto
Version: 1.4   
Target Milestone: 2.0 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard: sr152

Description Matthias Kempka CLA 2012-10-25 05:55:06 EDT
It is not totally clear how to reproduce this, but we found this in the error message from the IE. I cut down the error message to the part where Tim already has isolated the problem.


Error: Could not post layout child [object org.eclipse.rwt.widgets.Text] Ungültiges Argument.
[...]
var w = new org.eclipse.rwt.widgets.Text( true );
wm.add( w, "w244", true );
wm.setParent( w, "w107" );
org.eclipse.swt.TextUtil.initialize( w );
w.addState( "rwt_BORDER" );
w.addState( "rwt_MULTI" );
.setWrap( true );
w.setSpace( 10, 1, 5, 1 );
w.setZIndex( 300 );w.setTabIndex( -1 );
wm.setToolTip( w, "Tooltip Text" );
w.setEnabled( false );
w.setBackgroundGradient( null );
w.setBackgroundColor( null );
[...]
Comment 1 Tim Buschtoens CLA 2012-10-25 06:06:45 EDT
Since [1,1] would be a valid size at least from a client p.o.v., it should not crash. We whould check this is the case for 1.5.1 and 2.0M2.

This bug might have been fixed for 2.0M1 with Bug 386815 - [Text] JavaScript test failes in Chrome 21. In that case we only need to backport this to 1.5.2.
Comment 2 Tim Buschtoens CLA 2012-11-07 10:34:19 EST
I did some investigation, and it seems this error occours on different RAP versions for different reasons.

First of all, i did all tests in IE9(32bit) in IE8-Quirksmode. To make things simple, i hacked Text#computeSize to always return 1,1. Not sure how to make this happen without this hack, but obviously its possible.

In RAP 1.4 the problem is in TextField.js, specifically the line:
this._inputElement.style.height = (this.getInnerHeight() - 2) + "px";
For some reason this only crashes on "MULTI" Text fields. The height does not seem to have the same problem, at least not with a 1x1 pixel widget.

In RAP 1.5/2.0M2 the line (now in BasicText.js) has been fixed already:
this._inputElement.style.height = Math.max( 0, this.getInnerHeight() - 2 ) + "px";
However, if the message text of Text has been set, the client still crashes. The problematic code is in Text.js:

        style.width = (   this.getBoxWidth() 
                        - this._cachedBorderLeft 
                        - this._cachedBorderRight 
                        - styleMap.paddingLeft 
                        - styleMap.paddingRight ) + "px";
Comment 3 Tim Buschtoens CLA 2012-11-07 11:13:46 EST
Fixed with commit 0e6b1e4b2aa00c99d30cc29424ac1d02aa011522.
Comment 4 Ralf Sternberg CLA 2013-01-14 11:11:25 EST
+1 to backport this fix to 1.5.2
Comment 5 Ivan Furnadjiev CLA 2013-01-18 09:51:16 EST
Backported to 1.5-maintenance branch with commit 154c353ea82b7b9dd8899c2f14a9ceaaea176107.