intrinsic size of object (br33903)

Koos Vriezen koos.vriezen at xs4all.nl
Fri Feb 11 12:29:05 GMT 2005


Hi,

I stumbled against a (probably) copy/paste bug in kjas for requesting
a resize of an applet (see attachment). Other than that, code that
should perform the resize is broken too. Now quickly fixed using the
liveconnect way, which is a bit of a hack (otoh, khtml is scriptable,
so why not use it internally too?).
Anyway, some time ago Stephan add me to the CC list of br33903. So I
guess to fix this for all kinds of kparts and w/o using the liveconnect
extension, a signal in BrowserExtension is needed, where to the KHTMLPart
is connected and doing something like the javascript does. Of course I
can fix that. I something like that acceptable for khtml?

Koos
-------------- next part --------------
? .kjavaapplet.cpp.swp
? .kjavaappletviewer.cpp.swp
? .kjavaappletwidget.cpp.swp
? .kjavadownloader.cpp.swp
? .kjavaprocess.cpp.swp
? .swp
? kjas_cert.diff
? org/kde/kjas/server/.KJASSwingConsole.java.swp
Index: kjava.jar
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/kjava.jar,v
retrieving revision 1.96
diff -u -3 -p -r1.96 kjava.jar
Binary files /tmp/cvs.Tw3Eza and kjava.jar differ
Index: kjavaapplet.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/kjavaapplet.cpp,v
retrieving revision 1.32
diff -u -3 -p -r1.32 kjavaapplet.cpp
--- kjavaapplet.cpp	9 May 2003 22:05:03 -0000	1.32
+++ kjavaapplet.cpp	11 Feb 2005 12:13:10 -0000
@@ -24,6 +24,7 @@
 
 #include <klocale.h>
 #include <kdebug.h>
+#include <kparts/browserextension.h>
 
 
 
@@ -149,8 +150,12 @@ void KJavaApplet::resizeAppletWidget( in
 {
     kdDebug(6100) << "KJavaApplet, id = " << id << ", ::resizeAppletWidget to " << width << ", " << height << endl;
 
-    if( d->UIwidget )
-        d->UIwidget->resize( width, height );
+    QStringList sl;
+    sl.push_back( QString::number( 0 ) ); // applet itself has id 0
+    sl.push_back( QString( "eval" ) );    // evaluate next script
+    sl.push_back( QString::number( KParts::LiveConnectExtension::TypeString ) );
+    sl.push_back( QString( "this.setAttribute('WIDTH',%1);this.setAttribute('HEIGHT',%2)" ).arg( width ).arg( height ) );
+    jsData( sl );
 }
 
 void KJavaApplet::setAppletName( const QString& name )
Index: org/kde/kjas/server/KJASProtocolHandler.java
===================================================================
RCS file: /home/kde/kdelibs/khtml/java/org/kde/kjas/server/KJASProtocolHandler.java,v
retrieving revision 1.57
diff -u -3 -p -r1.57 KJASProtocolHandler.java
--- org/kde/kjas/server/KJASProtocolHandler.java	30 Jan 2005 17:08:16 -0000	1.57
+++ org/kde/kjas/server/KJASProtocolHandler.java	11 Feb 2005 12:13:10 -0000
@@ -623,7 +623,7 @@ public class KJASProtocolHandler
 
         System.arraycopy( tmp_bytes, 0, bytes, index, tmp_bytes.length );
         index += tmp_bytes.length;
-        bytes[index++] = (byte) ShowStatusCode;
+        bytes[index++] = (byte) ResizeAppletCode;
         bytes[index++] = sep;
 
         tmp_bytes = contextID.getBytes();


More information about the kfm-devel mailing list