What if a html page uses a iframe for images?
Koos Vriezen
koos.vriezen at xs4all.nl
Sat Aug 21 20:46:59 BST 2004
On Sat, Aug 14, 2004 at 10:39:28PM +0200, Koos Vriezen wrote:
> On Tue, Aug 10, 2004 at 12:38:34PM +0200, David Faure wrote:
> > Cool stuff. For after HEAD is open again, obviously (hard to make sure
> > this doesn't introduce any regressions).
>
> Thanks, commited!
> I think that KJS::WindowObject still needs fixing.
KJS::WindowQObject that is. Anyway, attached a fix for it. First I
thought that creating a WindowQObject for a KHTMLPart, like it is now,
would be enought. Looking closer, I see that KJSWindow::clear can't know
if the new KParts::ReadOnlyPart will be a KHTMLPart or not. So again use
a khtml::ChildFrame (actually it's only used for the QObject::destructed
signal, so can't hurt I think).
There is a change in the detection of the existance of jscript. It was
KJSProxy* proxy = part->jScript();
and I changed it to
KJSProxy* proxy = m_frame->m_jscript;
First case can create a new one and the second not. But I can't think of
an case that the KJS::Window does exist and this
khtml::ChildFrame::m_jscript field is NULL (other than explicit
disabling of javascript, but then the next test will fail like it
should). David, can you confirm this?
> Koos
-------------- next part --------------
Index: ecma/kjs_window.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.383
diff -u -3 -p -r1.383 kjs_window.cpp
--- ecma/kjs_window.cpp 17 Aug 2004 17:04:40 -0000 1.383
+++ ecma/kjs_window.cpp 21 Aug 2004 19:31:03 -0000
@@ -1140,9 +1140,8 @@ void Window::clear( ExecState *exec )
// Forget about the listeners (the DOM::NodeImpls will delete them)
jsEventListeners.clear();
- KHTMLPart *part = ::qt_cast<KHTMLPart *>(m_frame->m_part);
- if (part) {
- KJSProxy* proxy = part->jScript();
+ if (m_frame) {
+ KJSProxy* proxy = m_frame->m_jscript;
if (proxy) // i.e. JS not disabled
{
winq = new WindowQObject(this);
@@ -1795,11 +1794,11 @@ WindowQObject::WindowQObject(Window *w)
: parent(w)
{
//kdDebug(6070) << "WindowQObject::WindowQObject " << this << endl;
- part = ::qt_cast<KHTMLPart *>(parent->m_frame->m_part);
- if ( !part )
+ frame = parent->m_frame;
+ if ( !frame )
kdDebug(6070) << "WARNING: null part in " << k_funcinfo << endl;
else
- connect( part, SIGNAL( destroyed() ),
+ connect( frame, SIGNAL( destroyed() ),
this, SLOT( parentDestroyed() ) );
pausedTime = 0;
lastTimerId = 0;
Index: ecma/kjs_window.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_window.h,v
retrieving revision 1.106
diff -u -3 -p -r1.106 kjs_window.h
--- ecma/kjs_window.h 15 Aug 2004 00:00:12 -0000 1.106
+++ ecma/kjs_window.h 21 Aug 2004 19:31:03 -0000
@@ -212,7 +212,7 @@ namespace KJS {
void setNextTimer();
private:
Window *parent;
- KHTMLPart *part; // not guarded, may be dangling
+ khtml::ChildFrame *frame; // not guarded, may be dangling
QPtrList<ScheduledAction> scheduledActions;
int pausedTime;
int lastTimerId;
More information about the kfm-devel
mailing list