[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
rjw
rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:13:54 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 41f4ff52d8e82b39a387998ac76e658a8aa721d3
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon May 20 23:43:02 2002 +0000
Added support for onChange and window.location, i.e.:
http://javascript.internet.com/navigation/menu-automatic.html
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 55417c5..ed8c893 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-05-20 Richard J. Williamson <rjw at apple.com>
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSEventListener::handleEvent):
+ * khtml/khtml_part.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KHTMLPart::~KHTMLPart):
+ (KHTMLPart::scheduleRedirection):
+ (KHTMLPart::timerEvent):
+ (KHTMLPart::redirectJS):
+ (KHTMLPart::urlSelected):
+ * kwq/KWQVariant.mm:
+ (QVariant::asString):
+ * kwq/qt/qvariant.h:
+
2002-05-20 Kenneth Kocienda <kocienda at apple.com>
* kwq/kwqdebug.h: Now includes <sys/time.h> to prevent possible
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 55417c5..ed8c893 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2002-05-20 Richard J. Williamson <rjw at apple.com>
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSEventListener::handleEvent):
+ * khtml/khtml_part.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KHTMLPart::~KHTMLPart):
+ (KHTMLPart::scheduleRedirection):
+ (KHTMLPart::timerEvent):
+ (KHTMLPart::redirectJS):
+ (KHTMLPart::urlSelected):
+ * kwq/KWQVariant.mm:
+ (QVariant::asString):
+ * kwq/qt/qvariant.h:
+
2002-05-20 Kenneth Kocienda <kocienda at apple.com>
* kwq/kwqdebug.h: Now includes <sys/time.h> to prevent possible
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 55417c5..ed8c893 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2002-05-20 Richard J. Williamson <rjw at apple.com>
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSEventListener::handleEvent):
+ * khtml/khtml_part.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KHTMLPart::~KHTMLPart):
+ (KHTMLPart::scheduleRedirection):
+ (KHTMLPart::timerEvent):
+ (KHTMLPart::redirectJS):
+ (KHTMLPart::urlSelected):
+ * kwq/KWQVariant.mm:
+ (QVariant::asString):
+ * kwq/qt/qvariant.h:
+
2002-05-20 Kenneth Kocienda <kocienda at apple.com>
* kwq/kwqdebug.h: Now includes <sys/time.h> to prevent possible
diff --git a/WebCore/khtml/ecma/kjs_events.cpp b/WebCore/khtml/ecma/kjs_events.cpp
index 1a20c8a..e554b5c 100644
--- a/WebCore/khtml/ecma/kjs_events.cpp
+++ b/WebCore/khtml/ecma/kjs_events.cpp
@@ -84,6 +84,16 @@ void JSEventListener::handleEvent(DOM::Event &evt)
}
}
+#ifdef KWQ_DEBUG_JS
+ fprintf (stdout, "handleEvent() thisObj = %s\n", thisObj.toString(exec).qstring().latin1());
+ {
+ int i;
+
+ for (i = 0; i < args.size(); i++)
+ fprintf (stdout, "handleEvent() args[%d] = %s\n", i, args.at(i).toString(exec).qstring().latin1());
+ }
+#endif
+
Window *window = static_cast<Window*>(win.imp());
// Set the event we're handling in the Window object
window->setCurrentEvent( &evt );
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index c194c86..b04e932 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -1099,6 +1099,9 @@ private:
#ifdef APPLE_CHANGES
public:
+ void redirectJS();
+ void timerEvent ( QTimerEvent * );
+
// In the original KDE, these come from superclasses.
void ref() { _ref++; }
void deref() { if(_ref) _ref--; if(!_ref) delete this; }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 826f0f9..f720b5f 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -151,7 +151,11 @@ public:
QString m_referrer;
QString m_documentSource;
- bool m_bMousePressed;
+ QString m_redirectURL;
+ int m_delayRedirect;
+ int m_redirectionTimer;
+
+ bool m_bMousePressed;
DOM::Node m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
DOM::Node m_selectionStart;
long m_startOffset;
@@ -201,6 +205,9 @@ public:
m_decodingStarted = 0;
m_dataSource = 0;
+
+ m_redirectURL = QString::null;
+ m_delayRedirect = 0;
}
~KHTMLPartPrivate()
@@ -254,6 +261,8 @@ KHTMLPart::KHTMLPart( QWidget *, const char *, QObject *, const char *, GUIProfi
KHTMLPart::~KHTMLPart()
{
+ killTimers();
+
if ( d->m_doc != NULL ) {
d->m_doc->detach();
@@ -711,10 +720,54 @@ KURL KHTMLPart::completeURL(const QString &url)
void KHTMLPart::scheduleRedirection( int delay, const QString &url, bool )
{
- _logNeverImplemented();
+ if( d->m_redirectURL.isEmpty() || delay < d->m_delayRedirect )
+ {
+ d->m_delayRedirect = delay;
+ d->m_redirectURL = url;
+ killTimer(d->m_redirectionTimer);
+ d->m_redirectionTimer = startTimer( 1000 * d->m_delayRedirect);
+ }
+}
+
+void KHTMLPart::timerEvent ( QTimerEvent *e )
+{
+ if (e->timerId()==d->m_redirectionTimer)
+ {
+ redirectJS();
+ return;
+ }
+}
+
+void KHTMLPart::redirectJS()
+{
+ QString u = d->m_redirectURL;
+ d->m_delayRedirect = 0;
+ d->m_redirectURL = QString::null;
+ if ( u.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
+ {
+ QString script = KURL::decode_string( u.right( u.length() - 11 ) );
+ //kdDebug( 6050 ) << "KHTMLPart::slotRedirect script=" << script << endl;
+ QVariant res = executeScript( script );
+ if ( res.type() == QVariant::String ) {
+ begin( url() );
+ write( res.asString() );
+ end();
+ }
+ return;
+ }
+
+ KParts::URLArgs args;
+#ifndef APPLE_CHANGES
+ if ( urlcmp( u, m_url.url(), true, true ) )
+ args.reload = true;
+
+ args.setLockHistory( true );
+#endif
+ urlSelected( u, 0, 0, QString::null, args );
}
+
bool KHTMLPart::setEncoding( const QString &name, bool override )
{
d->m_encoding = name;
@@ -831,7 +884,33 @@ void KHTMLPart::setSelection( const DOM::Range & )
void KHTMLPart::urlSelected( const QString &url, int button, int state, const QString &_target, KParts::URLArgs )
{
- _logNeverImplemented();
+ IFWebDataSource *oldDataSource, *newDataSource;
+ KURL clickedURL(completeURL( url));
+ IFWebFrame *frame;
+ KURL refLess(clickedURL);
+
+ d->m_url.setRef ("");
+ refLess.setRef ("");
+ if (refLess.url() == d->m_url.url()){
+ d->m_url = clickedURL;
+ gotoAnchor (clickedURL.ref());
+ return;
+ }
+
+ if (_target.isEmpty()){
+ oldDataSource = getDataSource();
+ frame = [oldDataSource webFrame];
+ }
+ else {
+ frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(_target)];
+ oldDataSource = [frame dataSource];
+ }
+
+ newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
+ [newDataSource _setParent: [oldDataSource parent]];
+
+ [frame setProvisionalDataSource: newDataSource];
+ [frame startLoading];
}
bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
@@ -1378,34 +1457,7 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
- IFWebDataSource *oldDataSource, *newDataSource;
- QString target = event->target().string();
- KURL clickedURL(completeURL( d->m_strSelectedURL));
- IFWebFrame *frame;
- KURL refLess(clickedURL);
-
- d->m_url.setRef ("");
- refLess.setRef ("");
- if (refLess.url() == d->m_url.url()){
- d->m_url = clickedURL;
- gotoAnchor (clickedURL.ref());
- return;
- }
-
- if (target.isEmpty()){
- oldDataSource = getDataSource();
- frame = [oldDataSource webFrame];
- }
- else {
- frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(target)];
- oldDataSource = [frame dataSource];
- }
-
- newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
- [newDataSource _setParent: [oldDataSource parent]];
-
- [frame setProvisionalDataSource: newDataSource];
- [frame startLoading];
+ urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
}
#ifndef _KWQ_
@@ -1517,6 +1569,8 @@ DOM::EventListener *KHTMLPart::createHTMLEventListener( QString code )
if (!proxy)
return 0;
+ //fprintf (stdout, "Creating event listener w/ code %s\n", code.latin1());
+
return proxy->createHTMLEventHandler( d->m_url.url(), code );
}
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 826f0f9..f720b5f 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -151,7 +151,11 @@ public:
QString m_referrer;
QString m_documentSource;
- bool m_bMousePressed;
+ QString m_redirectURL;
+ int m_delayRedirect;
+ int m_redirectionTimer;
+
+ bool m_bMousePressed;
DOM::Node m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
DOM::Node m_selectionStart;
long m_startOffset;
@@ -201,6 +205,9 @@ public:
m_decodingStarted = 0;
m_dataSource = 0;
+
+ m_redirectURL = QString::null;
+ m_delayRedirect = 0;
}
~KHTMLPartPrivate()
@@ -254,6 +261,8 @@ KHTMLPart::KHTMLPart( QWidget *, const char *, QObject *, const char *, GUIProfi
KHTMLPart::~KHTMLPart()
{
+ killTimers();
+
if ( d->m_doc != NULL ) {
d->m_doc->detach();
@@ -711,10 +720,54 @@ KURL KHTMLPart::completeURL(const QString &url)
void KHTMLPart::scheduleRedirection( int delay, const QString &url, bool )
{
- _logNeverImplemented();
+ if( d->m_redirectURL.isEmpty() || delay < d->m_delayRedirect )
+ {
+ d->m_delayRedirect = delay;
+ d->m_redirectURL = url;
+ killTimer(d->m_redirectionTimer);
+ d->m_redirectionTimer = startTimer( 1000 * d->m_delayRedirect);
+ }
+}
+
+void KHTMLPart::timerEvent ( QTimerEvent *e )
+{
+ if (e->timerId()==d->m_redirectionTimer)
+ {
+ redirectJS();
+ return;
+ }
+}
+
+void KHTMLPart::redirectJS()
+{
+ QString u = d->m_redirectURL;
+ d->m_delayRedirect = 0;
+ d->m_redirectURL = QString::null;
+ if ( u.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
+ {
+ QString script = KURL::decode_string( u.right( u.length() - 11 ) );
+ //kdDebug( 6050 ) << "KHTMLPart::slotRedirect script=" << script << endl;
+ QVariant res = executeScript( script );
+ if ( res.type() == QVariant::String ) {
+ begin( url() );
+ write( res.asString() );
+ end();
+ }
+ return;
+ }
+
+ KParts::URLArgs args;
+#ifndef APPLE_CHANGES
+ if ( urlcmp( u, m_url.url(), true, true ) )
+ args.reload = true;
+
+ args.setLockHistory( true );
+#endif
+ urlSelected( u, 0, 0, QString::null, args );
}
+
bool KHTMLPart::setEncoding( const QString &name, bool override )
{
d->m_encoding = name;
@@ -831,7 +884,33 @@ void KHTMLPart::setSelection( const DOM::Range & )
void KHTMLPart::urlSelected( const QString &url, int button, int state, const QString &_target, KParts::URLArgs )
{
- _logNeverImplemented();
+ IFWebDataSource *oldDataSource, *newDataSource;
+ KURL clickedURL(completeURL( url));
+ IFWebFrame *frame;
+ KURL refLess(clickedURL);
+
+ d->m_url.setRef ("");
+ refLess.setRef ("");
+ if (refLess.url() == d->m_url.url()){
+ d->m_url = clickedURL;
+ gotoAnchor (clickedURL.ref());
+ return;
+ }
+
+ if (_target.isEmpty()){
+ oldDataSource = getDataSource();
+ frame = [oldDataSource webFrame];
+ }
+ else {
+ frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(_target)];
+ oldDataSource = [frame dataSource];
+ }
+
+ newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
+ [newDataSource _setParent: [oldDataSource parent]];
+
+ [frame setProvisionalDataSource: newDataSource];
+ [frame startLoading];
}
bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
@@ -1378,34 +1457,7 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
// HACK! FIXME!
if (d->m_strSelectedURL != QString::null) {
- IFWebDataSource *oldDataSource, *newDataSource;
- QString target = event->target().string();
- KURL clickedURL(completeURL( d->m_strSelectedURL));
- IFWebFrame *frame;
- KURL refLess(clickedURL);
-
- d->m_url.setRef ("");
- refLess.setRef ("");
- if (refLess.url() == d->m_url.url()){
- d->m_url = clickedURL;
- gotoAnchor (clickedURL.ref());
- return;
- }
-
- if (target.isEmpty()){
- oldDataSource = getDataSource();
- frame = [oldDataSource webFrame];
- }
- else {
- frame = [[getDataSource() controller] frameNamed: QSTRING_TO_NSSTRING(target)];
- oldDataSource = [frame dataSource];
- }
-
- newDataSource = WCIFWebDataSourceMake(clickedURL.getNSURL(), nil, 0);
- [newDataSource _setParent: [oldDataSource parent]];
-
- [frame setProvisionalDataSource: newDataSource];
- [frame startLoading];
+ urlSelected(d->m_strSelectedURL, 0,0, event->target().string());
}
#ifndef _KWQ_
@@ -1517,6 +1569,8 @@ DOM::EventListener *KHTMLPart::createHTMLEventListener( QString code )
if (!proxy)
return 0;
+ //fprintf (stdout, "Creating event listener w/ code %s\n", code.latin1());
+
return proxy->createHTMLEventHandler( d->m_url.url(), code );
}
diff --git a/WebCore/kwq/KWQVariant.h b/WebCore/kwq/KWQVariant.h
index 2458bae..571f572 100644
--- a/WebCore/kwq/KWQVariant.h
+++ b/WebCore/kwq/KWQVariant.h
@@ -69,6 +69,7 @@ public:
Type type() const;
bool toBool() const;
uint toUInt() const;
+ QString asString() const;
// operators ---------------------------------------------------------------
diff --git a/WebCore/kwq/KWQVariant.mm b/WebCore/kwq/KWQVariant.mm
index 37bd0f5..f1d65be 100644
--- a/WebCore/kwq/KWQVariant.mm
+++ b/WebCore/kwq/KWQVariant.mm
@@ -141,6 +141,12 @@ uint QVariant::toUInt() const
}
+QString QVariant::asString() const
+{
+ return *((QString *)d->value.p);
+}
+
+
QVariant &QVariant::operator=(const QVariant &other)
{
d = other.d;
diff --git a/WebCore/kwq/qt/qvariant.h b/WebCore/kwq/qt/qvariant.h
index 2458bae..571f572 100644
--- a/WebCore/kwq/qt/qvariant.h
+++ b/WebCore/kwq/qt/qvariant.h
@@ -69,6 +69,7 @@ public:
Type type() const;
bool toBool() const;
uint toUInt() const;
+ QString asString() const;
// operators ---------------------------------------------------------------
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list