[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/unity/WebKit/WebCore
From: Nikolas Zimmermann <wildfox () kde ! org>
Date: 2006-08-24 14:10:47
Message-ID: 1156428647.618021.17575.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 576654 by wildfox:
Implemented mimetype detection, and setting the correct mimetype
in the ResourceRequest, _before_ calling begin(). The approriate
documents (either for SVG/HTML/XHTML) will be created now! :-)
Finally we can enable SVG_SUPPORT by default!
M +1 -1 CMakeLists.txt
M +1 -0 platform/TransferJobInternal.h
M +24 -11 platform/qt/FrameQt.cpp
M +1 -1 platform/qt/FrameQt.h
M +23 -7 platform/qt/TransferJobManager.cpp
M +0 -2 platform/qt/TransferJobManager.h
M +0 -3 platform/qt/TransferJobQt.cpp
--- branches/work/unity/WebKit/WebCore/CMakeLists.txt #576653:576654
@@ -2,7 +2,7 @@
project( WebCore )
# Global switch for SVG support
-SET (USE_WEBKIT_SVG_SUPPORT 0)
+SET (USE_WEBKIT_SVG_SUPPORT 1)
include (CheckCXXCompilerFlag)
--- branches/work/unity/WebKit/WebCore/platform/TransferJobInternal.h #576653:576654
@@ -143,6 +143,7 @@
#endif
#if PLATFORM(QT)
QString m_response;
+ QString m_mimetype;
#endif
};
--- branches/work/unity/WebKit/WebCore/platform/qt/FrameQt.cpp #576653:576654
@@ -48,6 +48,7 @@
#include "GraphicsContext.h"
#include "HTMLDocument.h"
#include "TransferJob.h"
+#include "TransferJobInternal.h"
#include "PlatformMouseEvent.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformWheelEvent.h"
@@ -150,14 +151,10 @@
{
qDebug("openURL(%s)", url.url().latin1());
didOpenURL(url);
-
- // ResourceRequest request(resourceRequest());
- // request.m_responseMIMEType = "image/svg+xml";
- // setResourceRequest(request);
+ m_beginCalled = false;
- begin(url);
TransferJob* job = new TransferJob(this, "GET", url);
- job->start(document()->docLoader());
+ job->start(0);
return true;
}
@@ -176,10 +173,10 @@
m_client->submitForm(request.doPost() ? "POST" : "GET", request.url(), \
&request.postData);
*/
- begin(request.url());
+ m_beginCalled = false;
TransferJob* job = new TransferJob(this, request.doPost() ? "POST" : "GET", \
request.url(), request.postData);
- job->start(document()->docLoader());
+ job->start(0);
clearRecordedFormValues();
}
@@ -188,11 +185,12 @@
{
//need to potentially updateLocationBar(str.ascii()); or notify sys of new url \
mybe event or callback const KURL url = request.url();
- printf("------------------> LOADING NEW URL %s \n", url.url().ascii());
+
didOpenURL(url);
- begin(url);
+ m_beginCalled = false;
+
TransferJob* job = new TransferJob(this, "GET", url);
- job->start(document()->docLoader());
+ job->start(0);
}
String FrameQt::userAgent() const
@@ -537,12 +535,27 @@
void FrameQt::receivedData(TransferJob* job, const char* data, int length)
{
+ if (!m_beginCalled) {
+ m_beginCalled = true;
+
+ // Assign correct mimetype _before_ calling begin()!
+ TransferJobInternal* d = job->getInternal();
+ if (d) {
+ ResourceRequest request(resourceRequest());
+ request.m_responseMIMEType = fromQString(d->m_mimetype);
+ setResourceRequest(request);
+ }
+
+ begin(job->url());
+ }
+
write(data, length);
}
void FrameQt::receivedAllData(TransferJob* job, PlatformData data)
{
end();
+ m_beginCalled = false;
}
void FrameQt::setFrameGeometry(const IntRect &r)
--- branches/work/unity/WebKit/WebCore/platform/qt/FrameQt.h #576653:576654
@@ -143,7 +143,7 @@
void init();
virtual bool passMouseDownEventToWidget(Widget*);
FrameQtClient* m_client;
-
+ bool m_beginCalled : 1;
};
inline FrameQt* Win(Frame* frame) { return static_cast<FrameQt*>(frame); }
--- branches/work/unity/WebKit/WebCore/platform/qt/TransferJobManager.cpp \
#576653:576654 @@ -25,10 +25,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
#include <QDebug>
#include <kio/job.h>
-#include "config.h"
+#include "FrameQt.h"
#include "HelperQt.h"
#include "TransferJobManager.h"
#include "TransferJobInternal.h"
@@ -76,12 +78,28 @@
d->client->receivedData(job, data.data(), data.size());
}
-void TransferJobManager::slotMimetype(KIO::Job* job, const QString& type)
+void TransferJobManager::slotMimetype(KIO::Job* kioJob, const QString& type)
{
- qDebug("TransferJobManager::slotMimetype(), job=%p, type=%s", job, \
qPrintable(type)); + qDebug("TransferJobManager::slotMimetype(), kioJob=%p, \
type=%s", kioJob, qPrintable(type)); +
+ TransferJob* job = 0;
+
+ // Check if we know about 'kioJob'...
+ QMap<KIO::Job*, TransferJob*>::const_iterator it = m_kioToJobMap.find(kioJob);
+ if (it != m_kioToJobMap.end())
+ job = it.value();
+
+ if (!job)
+ return;
+
+ TransferJobInternal* d = job->getInternal();
+ if (!d || !d->client)
+ return;
+
+ d->m_mimetype = type;
}
-void TransferJobManager::slotResult(KJob *kjob)
+void TransferJobManager::slotResult(KJob* kjob)
{
qDebug("TransferJobManager::slotResult(), kjob=%p", kjob);
@@ -149,7 +167,7 @@
else if (job->method() == "POST") {
DeprecatedString postData = job->postData().flattenToString();
QByteArray postDataArray(postData.ascii(), postData.length());
-
+
kioJob = KIO::http_post(KUrl(toQString(url)), postDataArray, false);
kioJob->addMetaData("PropagateHttpHeader", "true");
kioJob->addMetaData("content-type", "Content-Type: \
application/x-www-form-urlencoded"); @@ -176,5 +194,3 @@
} // namespace WebCore
#include "TransferJobManager.moc"
-
-// vim: ts=4 sw=4 et
--- branches/work/unity/WebKit/WebCore/platform/qt/TransferJobManager.h \
#576653:576654 @@ -64,5 +64,3 @@
}
#endif
-
-// vim: ts=4 sw=4 et
--- branches/work/unity/WebKit/WebCore/platform/qt/TransferJobQt.cpp #576653:576654
@@ -28,7 +28,6 @@
#include "config.h"
#include "HelperQt.h"
-#include <QDebug>
#include <kio/job.h>
#include "DocLoader.h"
@@ -101,5 +100,3 @@
}
} // namespace WebCore
-
-// vim: ts=4 sw=4 et
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic