diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
commit | 512d332d21860b1d08e86d6de96b80ce12d742bf (patch) | |
tree | 339a6f5962b587b198f2ed21bf9f64ac338b66eb /src/3rdparty/webkit/WebCore/xml | |
parent | cb89aab6b29fd5761f3b9d41354abcde11e103dc (diff) | |
download | Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.zip Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.gz Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.bz2 |
Updated WebKit from /home/joce/dev/qtwebkit3/ to qtwebkit-4.6-snapshot-24092009 ( 75c44947a340d74a9e0098a3dfffabce0c9512ef )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2009-09-24 Martin Smith <msmith@trolltech.com>
Reviewed by Simon Hausmann.
qdoc: Added \brief texts to all the since 4.6 functions.
* Api/qwebhistory.cpp:
2009-09-23 J-P Nurmi <jpnurmi@gmail.com>
Reviewed by Simon Hausmann.
Prevent QWebPage::setView() from changing the viewport size on the fly
in case the view doesn't actually change. QWebPage::setView() is
called upon every QWebGraphicsItem::hoverMoveEvent(), which forced
the viewport size to be equal to the size of the whole graphics view.
https://bugs.webkit.org/show_bug.cgi?id=29676
* Api/qwebpage.cpp:
(QWebPage::setView):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Crash fix in QWebHistory back and forward methods.
QWebHistory::back() and QWebHistory::forward() were crashing on
ASSERT in WebCore::BackForwardList. The methods should check
canGoBack() and canGoForward() at the beginning.
https://bugs.webkit.org/show_bug.cgi?id=29675
* Api/qwebhistory.cpp:
(QWebHistory::back):
(QWebHistory::forward):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions
In QWebHistory's methods that change item count or current item call
to QWebPage::updateNavigationActions should be executed.
QWebHistory::clear() and QWebHistory::restorState() were changed.
New helper method, QWebPagePrivate accesor, were created in
QWebHistoryPrivate class.
Two autotest were developed.
https://bugs.webkit.org/show_bug.cgi?id=29246
* Api/qwebhistory.cpp:
(QWebHistory::clear):
(QWebHistory::restoreState):
(QWebHistoryPrivate::page):
* Api/qwebhistory_p.h:
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::saveAndRestore_1):
(tst_QWebHistory::clear):
2009-09-23 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Tor Arne Vestbø.
Need to guard QX11Info include with Q_WS_X11.
That class may not be available (in QT 4.5 for Symbian, for instance).
Completes fixes in r48627 and r48604.
* Api/qwebgraphicsitem.cpp:
* Api/qwebview.cpp:
2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add default timeout while waiting for signals in QWebPage auto
tests.
https://bugs.webkit.org/show_bug.cgi?id=29637
* tests/qwebpage/tst_qwebpage.cpp:
(waitForSignal):
2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reivewed by Simon Hausmann.
Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class)
There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget()
takes a QWidget*, not a QWebPageClient*
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::screenNumber):
* Api/qwebview.cpp:
(QWebViewPrivate::screenNumber):
2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
For Qt, platformPageClient() will now return a class derived from
the QWebPageClient, so the patch adapts our Qt hooks to go though
this class and not depend on the QWebView.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::scroll):
(QWebGraphicsItemPrivate::update):
(QWebGraphicsItemPrivate::cursor):
(QWebGraphicsItemPrivate::updateCursor):
(QWebGraphicsItemPrivate::screenNumber):
(QWebGraphicsItemPrivate::winId):
(QWebGraphicsItem::event):
(QWebGraphicsItem::setPage):
* Api/qwebgraphicsitem.h:
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebViewPrivate::scroll):
(QWebViewPrivate::update):
(QWebViewPrivate::cursor):
(QWebViewPrivate::updateCursor):
(QWebViewPrivate::screenNumber):
(QWebViewPrivate::winId):
(QWebView::setPage):
(QWebView::event):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::repaint):
(WebCore::ChromeClientQt::scroll):
(WebCore::ChromeClientQt::platformPageClient):
2009-09-21 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29609
Build fix for windows when using Qt 4.5.0.
* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):
2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29345
The tests of QWebFrame did not use QTRY_VERIFY for
tests involving the event loop.
* tests/qwebframe/tst_qwebframe.cpp:
* tests/util.h: Added. Copy of tests/shared/util.h of Qt
2009-09-19 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
[Qt] Add an autotest stub for QWebGraphicsItem.
It just calls all the functions and makes sure they don't crash.
* tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added.
* tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added.
(tst_QWebGraphicsItem::qwebgraphicsitem):
* tests/tests.pro:
2009-09-18 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Eric Seidel.
Corrected the Symbian specific UID3 values to be assigned
from the "unprotected" pool that permits self-signing of
those test and demo executables. (Added new UID3 values
where they were missing for new components.)
* QGVLauncher/QGVLauncher.pro:
* QtLauncher/QtLauncher.pro:
* tests/benchmarks/loading/tst_loading.pro:
* tests/benchmarks/painting/tst_painting.pro:
* tests/qwebelement/qwebelement.pro:
* tests/qwebframe/qwebframe.pro:
* tests/qwebhistory/qwebhistory.pro:
* tests/qwebhistoryinterface/qwebhistoryinterface.pro:
* tests/qwebpage/qwebpage.pro:
* tests/qwebplugindatabase/qwebplugindatabase.pro:
* tests/qwebview/qwebview.pro:
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Make PlatformWindow return something else than PlatformWidget
https://bugs.webkit.org/show_bug.cgi?id=29085
Reflect the rename of platformWindow and it's return type.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::platformPageClient):
* WebCoreSupport/ChromeClientQt.h:
2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add persistence support for configuration options in the
inspector.
* Api/qwebinspector.cpp:
* QtLauncher/main.cpp:
(main):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::populateSetting):
(WebCore::InspectorClientQt::storeSetting):
(WebCore::variantToSetting):
(WebCore::settingToVariant):
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Improve documentation for Page Cache.
* Api/qwebsettings.cpp:
2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test
https://bugs.webkit.org/show_bug.cgi?id=29081
The documentation now specifies that the URL has to be a local file
or a a data-URL (with utf-8 and base64-encoded data), as these are the
only two schemes that the current code path accepts.
The auto-test has been updated to reflect this limitation.
At a later point we should concider adding API for the new way of
doing both user defined stylesheets and scripts.
* Api/qwebsettings.cpp:
* tests/qwebpage/tst_qwebpage.cpp:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/xml')
9 files changed, 77 insertions, 305 deletions
diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp index e8df36d..798ae00 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp @@ -235,56 +235,6 @@ XMLHttpRequestUpload* XMLHttpRequest::upload() return m_upload.get(); } -void XMLHttpRequest::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (**listenerIter == *eventListener) - return; - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void XMLHttpRequest::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } -} - -bool XMLHttpRequest::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec) -{ - // FIXME: check for other error conditions enumerated in the spec. - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(evt->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listenerIter->get()->handleEvent(evt.get(), false); - } - - return !evt->defaultPrevented(); -} - void XMLHttpRequest::changeState(State newState) { if (m_state != newState) { @@ -298,10 +248,10 @@ void XMLHttpRequest::callReadyStateChangeListener() if (!scriptExecutionContext()) return; - dispatchReadyStateChangeEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent)); if (m_state == DONE && !m_error) - dispatchLoadEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); } void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec) @@ -479,10 +429,10 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) // Also, only async requests support upload progress events. bool forcePreflight = false; if (m_async) { - dispatchLoadStartEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { - forcePreflight = m_upload->hasListeners(); - m_upload->dispatchLoadStartEvent(); + forcePreflight = m_upload->hasEventListeners(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); } } @@ -556,6 +506,10 @@ void XMLHttpRequest::abort() internalAbort(); + m_responseText = ""; + m_createdDocument = false; + m_responseXML = 0; + // Clear headers as required by the spec m_requestHeaders.clear(); @@ -567,11 +521,11 @@ void XMLHttpRequest::abort() m_state = UNSENT; } - dispatchAbortEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchAbortEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } } @@ -621,11 +575,11 @@ void XMLHttpRequest::genericError() void XMLHttpRequest::networkError() { genericError(); - dispatchErrorEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchErrorEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().errorEvent)); } internalAbort(); } @@ -633,11 +587,11 @@ void XMLHttpRequest::networkError() void XMLHttpRequest::abortError() { genericError(); - dispatchAbortEvent(); + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) - m_upload->dispatchAbortEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } } @@ -885,12 +839,12 @@ void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long lon return; if (m_uploadEventsAllowed) - m_upload->dispatchProgressEvent(bytesSent, totalBytesToBeSent); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, static_cast<unsigned>(bytesSent), static_cast<unsigned>(totalBytesToBeSent))); if (bytesSent == totalBytesToBeSent && !m_uploadComplete) { m_uploadComplete = true; if (m_uploadEventsAllowed) - m_upload->dispatchLoadEvent(); + m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent)); } } @@ -938,7 +892,12 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) m_responseText += m_decoder->decode(data, len); if (!m_error) { - updateAndDispatchOnProgress(len); + long long expectedLength = m_response.expectedContentLength(); + m_receivedLength += len; + + // FIXME: the spec requires that we dispatch the event according to the least + // frequent method between every 350ms (+/-200ms) and for every byte received. + dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength))); if (m_state != LOADING) changeState(LOADING); @@ -948,70 +907,6 @@ void XMLHttpRequest::didReceiveData(const char* data, int len) } } -void XMLHttpRequest::updateAndDispatchOnProgress(unsigned int len) -{ - long long expectedLength = m_response.expectedContentLength(); - m_receivedLength += len; - - // FIXME: the spec requires that we dispatch the event according to the least - // frequent method between every 350ms (+/-200ms) and for every byte received. - dispatchProgressEvent(expectedLength); -} - -void XMLHttpRequest::dispatchReadyStateChangeEvent() -{ - RefPtr<Event> evt = Event::create(eventNames().readystatechangeEvent, false, false); - if (m_onReadyStateChangeListener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onReadyStateChangeListener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequest::dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) -{ - RefPtr<XMLHttpRequestProgressEvent> evt = XMLHttpRequestProgressEvent::create(type, lengthComputable, loaded, total); - if (listener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequest::dispatchAbortEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onAbortListener.get(), eventNames().abortEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchErrorEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onErrorListener.get(), eventNames().errorEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchLoadEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadListener.get(), eventNames().loadEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchLoadStartEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadStartListener.get(), eventNames().loadstartEvent, false, 0, 0); -} - -void XMLHttpRequest::dispatchProgressEvent(long long expectedLength) -{ - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, - static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); -} - bool XMLHttpRequest::canSuspend() const { return !m_loader; @@ -1033,4 +928,14 @@ ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } +EventTargetData* XMLHttpRequest::eventTargetData() +{ + return &m_eventTargetData; +} + +EventTargetData* XMLHttpRequest::ensureEventTargetData() +{ + return &m_eventTargetData; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h index aa33b8b..30744a0 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h @@ -23,6 +23,7 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include "FormData.h" #include "ResourceResponse.h" @@ -85,32 +86,12 @@ public: XMLHttpRequestUpload* upload(); XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); } - void setOnreadystatechange(PassRefPtr<EventListener> eventListener) { m_onReadyStateChangeListener = eventListener; } - EventListener* onreadystatechange() const { return m_onReadyStateChangeListener.get(); } - - void setOnabort(PassRefPtr<EventListener> eventListener) { m_onAbortListener = eventListener; } - EventListener* onabort() const { return m_onAbortListener.get(); } - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } - EventListener* onerror() const { return m_onErrorListener.get(); } - - void setOnload(PassRefPtr<EventListener> eventListener) { m_onLoadListener = eventListener; } - EventListener* onload() const { return m_onLoadListener.get(); } - - void setOnloadstart(PassRefPtr<EventListener> eventListener) { m_onLoadStartListener = eventListener; } - EventListener* onloadstart() const { return m_onLoadStartListener.get(); } - - void setOnprogress(PassRefPtr<EventListener> eventListener) { m_onProgressListener = eventListener; } - EventListener* onprogress() const { return m_onProgressListener.get(); } - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - // useCapture is not used, even for add/remove pairing (for Firefox compatibility). - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); using RefCounted<XMLHttpRequest>::ref; using RefCounted<XMLHttpRequest>::deref; @@ -120,6 +101,8 @@ private: virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); Document* document() const; @@ -135,8 +118,6 @@ private: virtual void didFailRedirectCheck(); virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); - void updateAndDispatchOnProgress(unsigned int len); - String responseMIMEType() const; bool responseIsXML() const; @@ -159,22 +140,6 @@ private: void networkError(); void abortError(); - void dispatchReadyStateChangeEvent(); - void dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total); - void dispatchAbortEvent(); - void dispatchErrorEvent(); - void dispatchLoadEvent(); - void dispatchLoadStartEvent(); - void dispatchProgressEvent(long long expectedLength); - - RefPtr<EventListener> m_onReadyStateChangeListener; - RefPtr<EventListener> m_onAbortListener; - RefPtr<EventListener> m_onErrorListener; - RefPtr<EventListener> m_onLoadListener; - RefPtr<EventListener> m_onLoadStartListener; - RefPtr<EventListener> m_onProgressListener; - EventListenersMap m_eventListeners; - RefPtr<XMLHttpRequestUpload> m_upload; KURL m_url; @@ -217,6 +182,8 @@ private: unsigned m_lastSendLineNumber; String m_lastSendURL; ExceptionCode m_exceptionCode; + + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl index 79005e2..89d9c7f 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl @@ -30,6 +30,7 @@ module xml { interface [ CustomMarkFunction, + EventTarget, NoStaticTables ] XMLHttpRequest { // From XMLHttpRequestEventTarget diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h index 02bfdea..27f3b8c 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestProgressEvent.h @@ -37,7 +37,7 @@ namespace WebCore { { return adoptRef(new XMLHttpRequestProgressEvent); } - static PassRefPtr<XMLHttpRequestProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) + static PassRefPtr<XMLHttpRequestProgressEvent> create(const AtomicString& type, bool lengthComputable = false, unsigned loaded = 0, unsigned total = 0) { return adoptRef(new XMLHttpRequestProgressEvent(type, lengthComputable, loaded, total)); } diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp index 0fe329d..9d0fafc 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.cpp @@ -41,11 +41,6 @@ XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) { } -bool XMLHttpRequestUpload::hasListeners() const -{ - return m_onAbortListener || m_onErrorListener || m_onLoadListener || m_onLoadStartListener || m_onProgressListener || !m_eventListeners.isEmpty(); -} - ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const { XMLHttpRequest* xmlHttpRequest = associatedXMLHttpRequest(); @@ -54,95 +49,14 @@ ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const return xmlHttpRequest->scriptExecutionContext(); } -void XMLHttpRequestUpload::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) { - ListenerVector listeners; - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } else { - ListenerVector& listeners = iter->second; - for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) - return; - } - - listeners.append(eventListener); - m_eventListeners.add(eventType, listeners); - } -} - -void XMLHttpRequestUpload::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) -{ - EventListenersMap::iterator iter = m_eventListeners.find(eventType); - if (iter == m_eventListeners.end()) - return; - - ListenerVector& listeners = iter->second; - for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { - if (**listenerIter == *eventListener) { - listeners.remove(listenerIter - listeners.begin()); - return; - } - } -} - -bool XMLHttpRequestUpload::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec) -{ - // FIXME: check for other error conditions enumerated in the spec. - if (!evt || evt->type().isEmpty()) { - ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; - return true; - } - - ListenerVector listenersCopy = m_eventListeners.get(evt->type()); - for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listenerIter->get()->handleEvent(evt.get(), false); - } - - return !evt->defaultPrevented(); -} - -void XMLHttpRequestUpload::dispatchXMLHttpRequestProgressEvent(EventListener* listener, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total) -{ - RefPtr<XMLHttpRequestProgressEvent> evt = XMLHttpRequestProgressEvent::create(type, lengthComputable, loaded, total); - if (listener) { - evt->setTarget(this); - evt->setCurrentTarget(this); - listener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); -} - -void XMLHttpRequestUpload::dispatchAbortEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onAbortListener.get(), eventNames().abortEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchErrorEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onErrorListener.get(), eventNames().errorEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchLoadEvent() -{ - dispatchXMLHttpRequestProgressEvent(m_onLoadListener.get(), eventNames().loadEvent, false, 0, 0); -} - -void XMLHttpRequestUpload::dispatchLoadStartEvent() +EventTargetData* XMLHttpRequestUpload::eventTargetData() { - dispatchXMLHttpRequestProgressEvent(m_onLoadStartListener.get(), eventNames().loadstartEvent, false, 0, 0); + return &m_eventTargetData; } -void XMLHttpRequestUpload::dispatchProgressEvent(long long bytesSent, long long totalBytesToBeSent) +EventTargetData* XMLHttpRequestUpload::ensureEventTargetData() { - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, true, static_cast<unsigned>(bytesSent), static_cast<unsigned>(totalBytesToBeSent)); + return &m_eventTargetData; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h index b4f40e0..7640643 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.h @@ -28,6 +28,7 @@ #include "AtomicStringHash.h" #include "EventListener.h" +#include "EventNames.h" #include "EventTarget.h" #include <wtf/HashMap.h> #include <wtf/RefCounted.h> @@ -48,8 +49,6 @@ namespace WebCore { return adoptRef(new XMLHttpRequestUpload(xmlHttpRequest)); } - bool hasListeners() const; - virtual XMLHttpRequestUpload* toXMLHttpRequestUpload() { return this; } XMLHttpRequest* associatedXMLHttpRequest() const { return m_xmlHttpRequest; } @@ -57,34 +56,11 @@ namespace WebCore { ScriptExecutionContext* scriptExecutionContext() const; - void dispatchAbortEvent(); - void dispatchErrorEvent(); - void dispatchLoadEvent(); - void dispatchLoadStartEvent(); - void dispatchProgressEvent(long long bytesSent, long long totalBytesToBeSent); - - void setOnabort(PassRefPtr<EventListener> eventListener) { m_onAbortListener = eventListener; } - EventListener* onabort() const { return m_onAbortListener.get(); } - - void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } - EventListener* onerror() const { return m_onErrorListener.get(); } - - void setOnload(PassRefPtr<EventListener> eventListener) { m_onLoadListener = eventListener; } - EventListener* onload() const { return m_onLoadListener.get(); } - - void setOnloadstart(PassRefPtr<EventListener> eventListener) { m_onLoadStartListener = eventListener; } - EventListener* onloadstart() const { return m_onLoadStartListener.get(); } - - void setOnprogress(PassRefPtr<EventListener> eventListener) { m_onProgressListener = eventListener; } - EventListener* onprogress() const { return m_onProgressListener.get(); } - - typedef Vector<RefPtr<EventListener> > ListenerVector; - typedef HashMap<AtomicString, ListenerVector> EventListenersMap; - - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); - EventListenersMap& eventListeners() { return m_eventListeners; } + DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(error); + DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); using RefCounted<XMLHttpRequestUpload>::ref; using RefCounted<XMLHttpRequestUpload>::deref; @@ -92,19 +68,13 @@ namespace WebCore { private: XMLHttpRequestUpload(XMLHttpRequest*); - void dispatchXMLHttpRequestProgressEvent(EventListener*, const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total); - virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - - RefPtr<EventListener> m_onAbortListener; - RefPtr<EventListener> m_onErrorListener; - RefPtr<EventListener> m_onLoadListener; - RefPtr<EventListener> m_onLoadStartListener; - RefPtr<EventListener> m_onProgressListener; - EventListenersMap m_eventListeners; + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); XMLHttpRequest* m_xmlHttpRequest; + EventTargetData m_eventTargetData; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl index 3172f68..901b47c 100644 --- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl +++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequestUpload.idl @@ -29,8 +29,9 @@ module xml { interface [ - GenerateConstructor, CustomMarkFunction, + EventTarget, + GenerateConstructor, NoStaticTables ] XMLHttpRequestUpload { // From XMLHttpRequestEventTarget diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp index 29e211e..f5acb38 100644 --- a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp +++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp @@ -68,7 +68,12 @@ NodeSet& Value::modifiableNodeSet() return m_data->m_nodeSet; } +#if COMPILER(WINSCW) +// FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int) +unsigned int Value::toBoolean() const +#else bool Value::toBoolean() const +#endif { switch (m_type) { case NodeSetValue: diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.h b/src/3rdparty/webkit/WebCore/xml/XPathValue.h index a0cd24d..bd44c91 100644 --- a/src/3rdparty/webkit/WebCore/xml/XPathValue.h +++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.h @@ -66,8 +66,11 @@ namespace WebCore { Value(Node* value) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { m_data->m_nodeSet.append(value); } // This is needed to safely implement constructing from bool - with normal function overloading, any pointer type would match. +#if COMPILER(WINSCW) + Value(bool); +#else template<typename T> Value(T); - +#endif static const struct AdoptTag {} adopt; Value(NodeSet& value, const AdoptTag&) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { value.swap(m_data->m_nodeSet); } @@ -80,7 +83,12 @@ namespace WebCore { const NodeSet& toNodeSet() const; NodeSet& modifiableNodeSet(); +#if COMPILER(WINSCW) + // FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int) + unsigned int toBoolean() const; +#else bool toBoolean() const; +#endif double toNumber() const; String toString() const; @@ -90,8 +98,9 @@ namespace WebCore { double m_number; RefPtr<ValueData> m_data; }; - +#if !COMPILER(WINSCW) template<> +#endif inline Value::Value(bool value) : m_type(BooleanValue) , m_bool(value) |