Patch let applets/objects/embeds behave alike

Koos Vriezen koos.vriezen at xs4all.nl
Fri Nov 21 22:33:37 GMT 2003


Hi,

This patch makes window.xxx or document.xxx work for
applets/objects/embeds
Inspired by http://www.n-tv.de/5195516.html, that does
document.video.DoPlay() on an embed element. (unfortunately it doesn't
work with kmplayer because the link is a SMIL file, which is currently
only poorly supported by the players - best bet is Xine, but seems to
hang on 2% cache load)

Koos
-------------- next part --------------
Index: html/html_miscimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_miscimpl.cpp,v
retrieving revision 1.37
diff -u -3 -p -r1.37 html_miscimpl.cpp
--- html/html_miscimpl.cpp	27 Aug 2003 23:59:46 -0000	1.37
+++ html/html_miscimpl.cpp	21 Nov 2003 22:23:17 -0000
@@ -109,7 +109,7 @@ unsigned long HTMLCollectionImpl::calcLe
                     len++;
                 break;
             case DOC_APPLETS:   // all OBJECT and APPLET elements
-                if(e->id() == ID_OBJECT || e->id() == ID_APPLET)
+                if(e->id() == ID_OBJECT || e->id() == ID_APPLET || e->id() == ID_EMBED)
                     len++;
                 break;
             case DOC_LINKS:     // all A _and_ AREA elements with a value for href
@@ -194,7 +194,7 @@ NodeImpl *HTMLCollectionImpl::getItem(No
                     len++;
                 break;
             case DOC_APPLETS:   // all OBJECT and APPLET elements
-                if(e->id() == ID_OBJECT || e->id() == ID_APPLET)
+                if(e->id() == ID_OBJECT || e->id() == ID_APPLET || e->id() == ID_EMBED)
                     len++;
                 break;
             case DOC_LINKS:     // all A _and_ AREA elements with a value for href
@@ -319,7 +319,7 @@ NodeImpl *HTMLCollectionImpl::getNamedIt
                     check = true;
                 break;
             case DOC_APPLETS:   // all OBJECT and APPLET elements
-                if(e->id() == ID_OBJECT || e->id() == ID_APPLET)
+                if(e->id() == ID_OBJECT || e->id() == ID_APPLET || e->id() == ID_EMBED)
                     check = true;
                 break;
             case DOC_LINKS:     // all A _and_ AREA elements with a value for href
@@ -335,10 +335,12 @@ NodeImpl *HTMLCollectionImpl::getNamedIt
                 break;
             case DOC_ALL:
                 // all['foo'] accepts all elements with id='foo' and
-                // images, forms and applets with name='foo'.
+                // images, forms and applets/objects/embeds with name='foo'.
                 if ( attr_id == ATTR_ID ||
                      (attr_id == ATTR_NAME &&
-                      ( e->id() == ID_IMG || e->id() == ID_FORM || e->id() == ID_APPLET ) ) )
+                      ( e->id() == ID_IMG || e->id() == ID_FORM ||
+                        e->id() == ID_APPLET || e->id() == ID_OBJECT ||
+                        e->id() == ID_EMBED) ) )
                     check = true;
                 break;
             case NODE_CHILDREN:


More information about the kfm-devel mailing list