[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
laszlo.1.gombos at nokia.com
laszlo.1.gombos at nokia.com
Thu Dec 3 13:40:01 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit f56702025535498cc469955320040fa720eee1d1
Author: laszlo.1.gombos at nokia.com <laszlo.1.gombos at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 19 06:03:01 2009 +0000
2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Remove support for Qt v4.3 or older versions
https://bugs.webkit.org/show_bug.cgi?id=29469
* JavaScriptCore.pro:
* jsc.pro:
* wtf/unicode/qt4/UnicodeQt4.h:
2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Remove support for Qt v4.3 or older versions
https://bugs.webkit.org/show_bug.cgi?id=29469
* Api/qcookiejar.cpp: Removed.
* Api/qcookiejar.h: Removed.
* Api/qgraphicswebview.cpp:
(QGraphicsWebView::event):
* Api/qwebframe.cpp:
(QWebFrame::load):
* Api/qwebframe.h:
* Api/qwebkitglobal.h:
* Api/qwebnetworkinterface.cpp: Removed.
* Api/qwebnetworkinterface.h: Removed.
* Api/qwebnetworkinterface_p.h: Removed.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
(QWebPagePrivate::acceptNavigationRequest):
(QWebPage::acceptNavigationRequest):
(QWebPage::action):
(QWebPage::userAgentForUrl):
* Api/qwebpage.h:
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebView::load):
(QWebView::event):
* Api/qwebview.h:
* QtLauncher/main.cpp:
(MainWindow::print):
(MainWindow::setupUI):
(main):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::download):
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
(WebCore::FrameLoaderClientQt::startDownload):
(WebCore::FrameLoaderClientQt::createPlugin):
2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Remove support for Qt v4.3 or older versions
https://bugs.webkit.org/show_bug.cgi?id=29469
No new tests as there is no change if compiled with
Qt v4.4 or later version.
* WebCore.pro:
* dom/XMLTokenizerQt.cpp:
(WebCore::EntityResolver::resolveUndeclaredEntity):
(WebCore::XMLTokenizer::XMLTokenizer):
(WebCore::XMLTokenizer::~XMLTokenizer):
(WebCore::XMLTokenizer::doWrite):
(WebCore::XMLTokenizer::startDocument):
(WebCore::XMLTokenizer::parseDtd):
* platform/graphics/qt/FontQt.cpp:
* platform/graphics/qt/FontQt43.cpp: Removed.
* platform/graphics/qt/ImageQt.cpp:
* platform/network/ResourceHandleInternal.h:
* platform/network/qt/QNetworkReplyHandler.cpp:
* platform/network/qt/QNetworkReplyHandler.h:
* platform/network/qt/ResourceHandleQt.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::cancel):
(WebCore::ResourceHandle::loadResourceSynchronously):
(WebCore::ResourceHandle::setDefersLoading):
* platform/network/qt/ResourceRequest.h:
* platform/network/qt/ResourceRequestQt.cpp:
* platform/qt/ClipboardQt.cpp:
(WebCore::ClipboardQt::clearData):
* platform/qt/CookieJarQt.cpp:
(WebCore::cookieJar):
(WebCore::setCookies):
(WebCore::cookies):
(WebCore::cookiesEnabled):
* platform/qt/PlatformKeyboardEventQt.cpp:
(WebCore::keyIdentifierForQtKeyCode):
(WebCore::windowsKeyCodeForKeyEvent):
* platform/text/qt/TextBoundaries.cpp:
* platform/text/qt/TextBreakIteratorQt.cpp:
* plugins/qt/PluginDataQt.cpp:
(WebCore::PluginData::initPlugins):
2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Remove support for Qt v4.3 or older versions
https://bugs.webkit.org/show_bug.cgi?id=29469
* DumpRenderTree/qt/DumpRenderTree.pro:
* DumpRenderTree/qt/ImageDiff.pro:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51174 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 8261127..2a28727 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
+2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove support for Qt v4.3 or older versions
+ https://bugs.webkit.org/show_bug.cgi?id=29469
+
+ * JavaScriptCore.pro:
+ * jsc.pro:
+ * wtf/unicode/qt4/UnicodeQt4.h:
+
2009-11-18 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
diff --git a/JavaScriptCore/JavaScriptCore.pro b/JavaScriptCore/JavaScriptCore.pro
index 83e30ff..0d6becb 100644
--- a/JavaScriptCore/JavaScriptCore.pro
+++ b/JavaScriptCore/JavaScriptCore.pro
@@ -58,9 +58,5 @@ include(JavaScriptCore.pri)
QMAKE_EXTRA_TARGETS += generated_files
-lessThan(QT_MINOR_VERSION, 4) {
- DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
-}
-
*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
diff --git a/JavaScriptCore/jsc.pro b/JavaScriptCore/jsc.pro
index 4e6ca5f..9bcf08b 100644
--- a/JavaScriptCore/jsc.pro
+++ b/JavaScriptCore/jsc.pro
@@ -23,10 +23,6 @@ CONFIG(debug, debug|release) {
OBJECTS_DIR_WTR = $$OBJECTS_DIR$${QMAKE_DIR_SEP}
include($$PWD/JavaScriptCore.pri)
-lessThan(QT_MINOR_VERSION, 4) {
- DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
-}
-
*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
index bdf2028..cfd482d 100644
--- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
+++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
@@ -30,7 +30,6 @@
#include <stdint.h>
-#if QT_VERSION >= 0x040300
QT_BEGIN_NAMESPACE
namespace QUnicodeTables {
struct Properties {
@@ -55,7 +54,6 @@ namespace QUnicodeTables {
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);
}
QT_END_NAMESPACE
-#endif
// ugly hack to make UChar compatible with JSChar in API/JSStringRef.h
#if defined(Q_OS_WIN) || COMPILER(WINSCW)
@@ -186,8 +184,6 @@ enum CharCategory {
};
-#if QT_VERSION >= 0x040300
-
// FIXME: handle surrogates correctly in all methods
inline UChar32 toLower(UChar32 ch)
@@ -406,138 +402,6 @@ inline CharCategory category(UChar32 c)
return (CharCategory) U_MASK(QChar::category(c));
}
-#else
-
-inline UChar32 toLower(UChar32 ch)
-{
- if (ch > 0xffff)
- return ch;
- return QChar((unsigned short)ch).toLower().unicode();
-}
-
-inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- *error = false;
- if (resultLength < srcLength) {
- *error = true;
- return srcLength;
- }
- for (int i = 0; i < srcLength; ++i)
- result[i] = QChar(src[i]).toLower().unicode();
- return srcLength;
-}
-
-inline UChar32 toUpper(UChar32 ch)
-{
- if (ch > 0xffff)
- return ch;
- return QChar((unsigned short)ch).toUpper().unicode();
-}
-
-inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- *error = false;
- if (resultLength < srcLength) {
- *error = true;
- return srcLength;
- }
- for (int i = 0; i < srcLength; ++i)
- result[i] = QChar(src[i]).toUpper().unicode();
- return srcLength;
-}
-
-inline int toTitleCase(UChar32 c)
-{
- if (c > 0xffff)
- return c;
- return QChar((unsigned short)c).toUpper().unicode();
-}
-
-inline UChar32 foldCase(UChar32 c)
-{
- if (c > 0xffff)
- return c;
- return QChar((unsigned short)c).toLower().unicode();
-}
-
-inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
-{
- return toLower(result, resultLength, src, srcLength, error);
-}
-
-inline bool isPrintableChar(UChar32 c)
-{
- return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint();
-}
-
-inline bool isArabicChar(UChar32 c)
-{
- return c >= 0x0600 && c <= 0x06FF;
-}
-
-inline bool isSeparatorSpace(UChar32 c)
-{
- return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Separator_Space;
-}
-
-inline bool isPunct(UChar32 c)
-{
- return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPunct();
-}
-
-inline bool isLower(UChar32 c)
-{
- return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase;
-}
-
-inline UChar32 mirroredChar(UChar32 c)
-{
- if (c > 0xffff)
- return c;
- return QChar(c).mirroredChar().unicode();
-}
-
-inline uint8_t combiningClass(UChar32 c)
-{
- if (c > 0xffff)
- return 0;
- return QChar((unsigned short)c).combiningClass();
-}
-
-inline DecompositionType decompositionType(UChar32 c)
-{
- if (c > 0xffff)
- return DecompositionNone;
- return (DecompositionType)QChar(c).decompositionTag();
-}
-
-inline int umemcasecmp(const UChar* a, const UChar* b, int len)
-{
- for (int i = 0; i < len; ++i) {
- QChar c1 = QChar(a[i]).toLower();
- QChar c2 = QChar(b[i]).toLower();
- if (c1 != c2)
- return c1.unicode() - c2.unicode();
- }
- return 0;
-}
-
-inline Direction direction(UChar32 c)
-{
- if (c > 0xffff)
- return LeftToRight;
- return (Direction)QChar(c).direction();
-}
-
-inline CharCategory category(UChar32 c)
-{
- if (c > 0xffff)
- return NoCategory;
- return (CharCategory) U_MASK(QChar(c).category());
-}
-
-#endif
-
} }
#endif // WTF_UNICODE_QT4_H
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 881153c..3ff7145 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove support for Qt v4.3 or older versions
+ https://bugs.webkit.org/show_bug.cgi?id=29469
+
+ No new tests as there is no change if compiled with
+ Qt v4.4 or later version.
+
+ * WebCore.pro:
+ * dom/XMLTokenizerQt.cpp:
+ (WebCore::EntityResolver::resolveUndeclaredEntity):
+ (WebCore::XMLTokenizer::XMLTokenizer):
+ (WebCore::XMLTokenizer::~XMLTokenizer):
+ (WebCore::XMLTokenizer::doWrite):
+ (WebCore::XMLTokenizer::startDocument):
+ (WebCore::XMLTokenizer::parseDtd):
+ * platform/graphics/qt/FontQt.cpp:
+ * platform/graphics/qt/FontQt43.cpp: Removed.
+ * platform/graphics/qt/ImageQt.cpp:
+ * platform/network/ResourceHandleInternal.h:
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ * platform/network/qt/QNetworkReplyHandler.h:
+ * platform/network/qt/ResourceHandleQt.cpp:
+ (WebCore::ResourceHandle::start):
+ (WebCore::ResourceHandle::cancel):
+ (WebCore::ResourceHandle::loadResourceSynchronously):
+ (WebCore::ResourceHandle::setDefersLoading):
+ * platform/network/qt/ResourceRequest.h:
+ * platform/network/qt/ResourceRequestQt.cpp:
+ * platform/qt/ClipboardQt.cpp:
+ (WebCore::ClipboardQt::clearData):
+ * platform/qt/CookieJarQt.cpp:
+ (WebCore::cookieJar):
+ (WebCore::setCookies):
+ (WebCore::cookies):
+ (WebCore::cookiesEnabled):
+ * platform/qt/PlatformKeyboardEventQt.cpp:
+ (WebCore::keyIdentifierForQtKeyCode):
+ (WebCore::windowsKeyCodeForKeyEvent):
+ * platform/text/qt/TextBoundaries.cpp:
+ * platform/text/qt/TextBreakIteratorQt.cpp:
+ * plugins/qt/PluginDataQt.cpp:
+ (WebCore::PluginData::initPlugins):
+
2009-11-18 Michelangelo De Simone <micdesim at gmail.com>
Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 5f70fcd..de9d5f9 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -50,7 +50,6 @@ GENERATED_SOURCES_DIR_SLASH = $$GENERATED_SOURCES_DIR${QMAKE_DIR_SEP}
unix {
QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
- lessThan(QT_MINOR_VERSION, 4): QMAKE_PKGCONFIG_REQUIRES += QtXml
}
unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
@@ -253,7 +252,6 @@ INCLUDEPATH = \
$$INCLUDEPATH
QT += network
-lessThan(QT_MINOR_VERSION, 4): QT += xml
QMAKE_EXTRA_TARGETS += generated_files
@@ -2352,7 +2350,6 @@ SOURCES += \
platform/graphics/qt/TransformationMatrixQt.cpp \
platform/graphics/qt/ColorQt.cpp \
platform/graphics/qt/FontQt.cpp \
- platform/graphics/qt/FontQt43.cpp \
platform/graphics/qt/FontPlatformDataQt.cpp \
platform/graphics/qt/FloatPointQt.cpp \
platform/graphics/qt/FloatRectQt.cpp \
@@ -2455,20 +2452,6 @@ SOURCES += \
}
wince*: LIBS += -lmmtimer
- # Files belonging to the Qt 4.3 build
- lessThan(QT_MINOR_VERSION, 4) {
- HEADERS += \
- $$PWD/../WebKit/qt/Api/qwebnetworkinterface.h \
- $$PWD/../WebKit/qt/Api/qwebnetworkinterface_p.h \
- $$PWD/../WebKit/qt/Api/qcookiejar.h
-
- SOURCES += \
- ../WebKit/qt/Api/qwebnetworkinterface.cpp \
- ../WebKit/qt/Api/qcookiejar.cpp
-
- DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
- }
-
contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
SOURCES += plugins/npapi.cpp
diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp
index 79fc51e..4e61715 100644
--- a/WebCore/dom/XMLTokenizerQt.cpp
+++ b/WebCore/dom/XMLTokenizerQt.cpp
@@ -66,7 +66,6 @@ using namespace std;
namespace WebCore {
-#if QT_VERSION >= 0x040400
class EntityResolver : public QXmlStreamEntityResolver {
virtual QString resolveUndeclaredEntity(const QString &name);
};
@@ -76,7 +75,6 @@ QString EntityResolver::resolveUndeclaredEntity(const QString &name)
UChar c = decodeNamedEntity(name.toUtf8().constData());
return QString(c);
}
-#endif
// --------------------------------
@@ -103,9 +101,7 @@ XMLTokenizer::XMLTokenizer(Document* _doc, FrameView* _view)
, m_scriptStartLine(0)
, m_parsingFragment(false)
{
-#if QT_VERSION >= 0x040400
m_stream.setEntityResolver(new EntityResolver);
-#endif
}
XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement)
@@ -149,19 +145,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement)
if (elemStack.isEmpty())
return;
-#if QT_VERSION < 0x040400
- for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) {
- if (NamedNodeMap* attrs = element->attributes()) {
- for (unsigned i = 0; i < attrs->length(); i++) {
- Attribute* attr = attrs->attributeItem(i);
- if (attr->localName() == "xmlns")
- m_defaultNamespaceURI = attr->value();
- else if (attr->prefix() == "xmlns")
- m_prefixToNamespaceMap.set(attr->localName(), attr->value());
- }
- }
- }
-#else
QXmlStreamNamespaceDeclarations namespaces;
for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) {
if (NamedNodeMap* attrs = element->attributes()) {
@@ -176,7 +159,6 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement)
}
m_stream.addExtraNamespaceDeclarations(namespaces);
m_stream.setEntityResolver(new EntityResolver);
-#endif
// If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace.
if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
@@ -190,9 +172,7 @@ XMLTokenizer::~XMLTokenizer()
m_doc->deref();
if (m_pendingScript)
m_pendingScript->removeClient(this);
-#if QT_VERSION >= 0x040400
delete m_stream.entityResolver();
-#endif
}
void XMLTokenizer::doWrite(const String& parseString)
@@ -207,27 +187,6 @@ void XMLTokenizer::doWrite(const String& parseString)
QString data(parseString);
if (!data.isEmpty()) {
-#if QT_VERSION < 0x040400
- if (!m_sawFirstElement) {
- int idx = data.indexOf(QLatin1String("<?xml"));
- if (idx != -1) {
- int start = idx + 5;
- int end = data.indexOf(QLatin1String("?>"), start);
- QString content = data.mid(start, end-start);
- bool ok = true;
- HashMap<String, String> attrs = parseAttributes(content, ok);
- String version = attrs.get("version");
- String encoding = attrs.get("encoding");
- ExceptionCode ec = 0;
- if (!m_parsingFragment) {
- if (!version.isEmpty())
- m_doc->setXMLVersion(version, ec);
- if (!encoding.isEmpty())
- m_doc->setXMLEncoding(encoding);
- }
- }
- }
-#endif
m_stream.addData(data);
parse();
}
@@ -485,14 +444,12 @@ void XMLTokenizer::startDocument()
if (!m_parsingFragment) {
m_doc->setXMLStandalone(m_stream.isStandaloneDocument(), ec);
-#if QT_VERSION >= 0x040400
QStringRef version = m_stream.documentVersion();
if (!version.isEmpty())
m_doc->setXMLVersion(version, ec);
QStringRef encoding = m_stream.documentEncoding();
if (!encoding.isEmpty())
m_doc->setXMLEncoding(encoding);
-#endif
}
}
@@ -702,83 +659,11 @@ bool XMLTokenizer::hasError() const
return m_stream.hasError();
}
-#if QT_VERSION < 0x040400
-static QString parseId(const QString &dtd, int *pos, bool *ok)
-{
- *ok = true;
- int start = *pos + 1;
- int end = start;
- if (dtd.at(*pos) == QLatin1Char('\''))
- while (start < dtd.length() && dtd.at(end) != QLatin1Char('\''))
- ++end;
- else if (dtd.at(*pos) == QLatin1Char('\"'))
- while (start < dtd.length() && dtd.at(end) != QLatin1Char('\"'))
- ++end;
- else {
- *ok = false;
- return QString();
- }
- *pos = end + 1;
- return dtd.mid(start, end - start);
-}
-#endif
-
void XMLTokenizer::parseDtd()
{
-#if QT_VERSION >= 0x040400
QStringRef name = m_stream.dtdName();
QStringRef publicId = m_stream.dtdPublicId();
QStringRef systemId = m_stream.dtdSystemId();
-#else
- QString dtd = m_stream.text().toString();
-
- int start = dtd.indexOf("<!DOCTYPE ") + 10;
- while (start < dtd.length() && dtd.at(start).isSpace())
- ++start;
- int end = start;
- while (start < dtd.length() && !dtd.at(end).isSpace())
- ++end;
- QString name = dtd.mid(start, end - start);
-
- start = end;
- while (start < dtd.length() && dtd.at(start).isSpace())
- ++start;
- end = start;
- while (start < dtd.length() && !dtd.at(end).isSpace())
- ++end;
- QString id = dtd.mid(start, end - start);
- start = end;
- while (start < dtd.length() && dtd.at(start).isSpace())
- ++start;
- QString publicId;
- QString systemId;
- if (id == QLatin1String("PUBLIC")) {
- bool ok;
- publicId = parseId(dtd, &start, &ok);
- if (!ok) {
- handleError(fatal, "Invalid DOCTYPE", lineNumber(), columnNumber());
- return;
- }
- while (start < dtd.length() && dtd.at(start).isSpace())
- ++start;
- systemId = parseId(dtd, &start, &ok);
- if (!ok) {
- handleError(fatal, "Invalid DOCTYPE", lineNumber(), columnNumber());
- return;
- }
- } else if (id == QLatin1String("SYSTEM")) {
- bool ok;
- systemId = parseId(dtd, &start, &ok);
- if (!ok) {
- handleError(fatal, "Invalid DOCTYPE", lineNumber(), columnNumber());
- return;
- }
- } else if (id == QLatin1String("[") || id == QLatin1String(">")) {
- } else {
- handleError(fatal, "Invalid DOCTYPE", lineNumber(), columnNumber());
- return;
- }
-#endif
//qDebug() << dtd << name << publicId << systemId;
if ((publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Transitional//EN"))
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index c5960ac..1e44626 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -42,7 +42,6 @@
#include <limits.h>
-#if QT_VERSION >= 0x040400
namespace WebCore {
static const QString qstring(const TextRun& run)
@@ -229,5 +228,3 @@ QFont Font::font() const
}
-#endif
-
diff --git a/WebCore/platform/graphics/qt/FontQt43.cpp b/WebCore/platform/graphics/qt/FontQt43.cpp
deleted file mode 100644
index 45bf05d..0000000
--- a/WebCore/platform/graphics/qt/FontQt43.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2008 Holger Hans Peter Freyther
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "Font.h"
-#include "FontDescription.h"
-#include "FontFallbackList.h"
-#include "FontSelector.h"
-
-#include "GraphicsContext.h"
-#include <QTextLayout>
-#include <QPainter>
-#include <QFontMetrics>
-#include <QFontInfo>
-#include <qalgorithms.h>
-#include <qdebug.h>
-
-#include <limits.h>
-
-#if QT_VERSION < 0x040400
-
-namespace WebCore {
-
-struct TextRunComponent {
- TextRunComponent() : font(0) {}
- TextRunComponent(const UChar *start, int length, bool rtl, const QFont *font, int offset, bool sc = false);
- TextRunComponent(int spaces, bool rtl, const QFont *font, int offset);
-
- inline bool isSpace() const { return spaces != 0; }
-
- QString string;
- const QFont *font;
- int width;
- int offset;
- int spaces;
-};
-
-TextRunComponent::TextRunComponent(const UChar *start, int length, bool rtl, const QFont *f, int o, bool sc)
- : string(reinterpret_cast<const QChar*>(start), length)
- , font(f)
- , offset(o)
- , spaces(0)
-{
- if (sc)
- string = string.toUpper();
- string.prepend(rtl ? QChar(0x202e) : QChar(0x202d));
- width = QFontMetrics(*font).width(string);
-}
-
-TextRunComponent::TextRunComponent(int s, bool rtl, const QFont *f, int o)
- : string(s, QLatin1Char(' '))
- , font(f)
- , offset(o)
- , spaces(s)
-{
- string.prepend(rtl ? QChar(0x202e) : QChar(0x202d));
- width = spaces * QFontMetrics(*font).width(QLatin1Char(' '));
-}
-
-
-static int generateComponents(Vector<TextRunComponent, 1024>* components, const Font &font, const TextRun &run)
-{
-// qDebug() << "generateComponents" << QString((const QChar *)run.characters(), run.length());
- int letterSpacing = font.letterSpacing();
- int wordSpacing = font.wordSpacing();
- bool smallCaps = font.fontDescription().smallCaps();
- int padding = run.padding();
- int numSpaces = 0;
- if (padding) {
- for (int i = 0; i < run.length(); i++)
- if (Font::treatAsSpace(run[i]))
- ++numSpaces;
- }
-
- int offset = 0;
- const QFont *f = &font.font();
- if (letterSpacing || smallCaps) {
- // need to draw every letter on it's own
- int start = 0;
- if (Font::treatAsSpace(run[0])) {
- int add = 0;
- if (numSpaces) {
- add = padding/numSpaces;
- padding -= add;
- --numSpaces;
- }
- components->append(TextRunComponent(1, run.rtl(), &font.font(), offset));
- offset += add + letterSpacing + components->last().width;
- start = 1;
-// qDebug() << "space at 0" << offset;
- } else if (smallCaps)
- f = (QChar::category(run[0]) == QChar::Letter_Lowercase ? &font.scFont() : &font.font());
-
- for (int i = 1; i < run.length(); ++i) {
- uint ch = run[i];
- if (QChar(ch).isHighSurrogate() && QChar(run[i-1]).isLowSurrogate())
- ch = QChar::surrogateToUcs4(ch, run[i-1]);
- if (QChar(ch).isLowSurrogate() || QChar::category(ch) == QChar::Mark_NonSpacing)
- continue;
- if (Font::treatAsSpace(run[i])) {
- int add = 0;
-// qDebug() << " treatAsSpace:" << i << start;
- if (i - start > 0) {
- components->append(TextRunComponent(run.characters() + start, i - start,
- run.rtl(),
- f, offset, f == &font.scFont()));
- offset += components->last().width + letterSpacing;
-// qDebug() << " appending(1) " << components->last().string << components->last().width;
- }
- if (numSpaces) {
- add = padding/numSpaces;
- padding -= add;
- --numSpaces;
- }
- components->append(TextRunComponent(1, run.rtl(), &font.font(), offset));
- offset += wordSpacing + add + components->last().width + letterSpacing;
- start = i + 1;
- continue;
- } else if (!letterSpacing) {
-// qDebug() << i << char(run[i]) << (QChar::category(ch) == QChar::Letter_Lowercase) <<
-// QFontInfo(*f).pointSizeF();
- if (QChar::category(ch) == QChar::Letter_Lowercase) {
- if (f == &font.scFont())
- continue;
- } else {
- if (f == &font.font())
- continue;
- }
- }
- if (i - start > 0) {
- components->append(TextRunComponent(run.characters() + start, i - start,
- run.rtl(),
- f, offset, f == &font.scFont()));
- offset += components->last().width + letterSpacing;
-// qDebug() << " appending(2) " << components->last().string << components->last().width;
- }
- if (smallCaps)
- f = (QChar::category(ch) == QChar::Letter_Lowercase ? &font.scFont() : &font.font());
- start = i;
- }
- if (run.length() - start > 0) {
- components->append(TextRunComponent(run.characters() + start, run.length() - start,
- run.rtl(),
- f, offset, f == &font.scFont()));
- offset += components->last().width;
-// qDebug() << " appending(3) " << components->last().string << components->last().width;
- }
- offset += letterSpacing;
- } else {
- int start = 0;
- for (int i = 0; i < run.length(); ++i) {
- if (Font::treatAsSpace(run[i])) {
- if (i - start > 0) {
- components->append(TextRunComponent(run.characters() + start, i - start,
- run.rtl(),
- f, offset));
- offset += components->last().width;
- }
- int add = 0;
- if (numSpaces) {
- add = padding/numSpaces;
- padding -= add;
- --numSpaces;
- }
- components->append(TextRunComponent(1, run.rtl(), &font.font(), offset));
- offset += add + components->last().width;
- if (i)
- offset += wordSpacing;
- start = i + 1;
- }
- }
- if (run.length() - start > 0) {
- components->append(TextRunComponent(run.characters() + start, run.length() - start,
- run.rtl(),
- f, offset));
- offset += components->last().width;
- }
- }
- return offset;
-}
-
-void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
-{
- if (to < 0)
- to = run.length();
-
- QPainter *p = ctx->platformContext();
- Color color = ctx->fillColor();
- p->setPen(QColor(color));
-
- Vector<TextRunComponent, 1024> components;
- int w = generateComponents(&components, *this, run);
-
- if (from > 0 || to < run.length()) {
- FloatRect clip = selectionRectForComplexText(run,
- IntPoint(qRound(point.x()), qRound(point.y())),
- QFontMetrics(font()).height(), from, to);
- QRectF rect(clip.x(), clip.y() - ascent(), clip.width(), clip.height());
- p->save();
- p->setClipRect(rect.toRect());
- }
-
- if (run.rtl()) {
- for (int i = 0; i < components.size(); ++i) {
- if (!components.at(i).isSpace()) {
- p->setFont(*components.at(i).font);
- QPointF pt(point.x() + w - components.at(i).offset - components.at(i).width, point.y());
- p->drawText(pt, components.at(i).string);
- }
- }
- } else {
- for (int i = 0; i < components.size(); ++i) {
- if (!components.at(i).isSpace()) {
- p->setFont(*components.at(i).font);
- QPointF pt(point.x() + components.at(i).offset, point.y());
- p->drawText(pt, components.at(i).string);
- }
- }
- }
- if (from > 0 || to < run.length())
- p->restore();
-}
-
-float Font::floatWidthForComplexText(const TextRun& run) const
-{
- Vector<TextRunComponent, 1024> components;
- int w = generateComponents(&components, *this, run);
-
- return w;
-}
-
-int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool includePartialGlyphs) const
-{
- Vector<TextRunComponent, 1024> components;
- int w = generateComponents(&components, *this, run);
-
- int offset = 0;
- if (run.rtl()) {
- for (int i = 0; i < components.size(); ++i) {
- int xe = w - components.at(i).offset;
- int xs = xe - components.at(i).width;
- if (position >= xs) {
- QTextLayout layout(components.at(i).string, *components.at(i).font);
- layout.beginLayout();
- QTextLine l = layout.createLine();
- if (!l.isValid())
- return offset;
-
- l.setLineWidth(INT_MAX / 256);
- layout.endLayout();
-
- if (position - xs >= l.width())
- return offset;
- int cursor = l.xToCursor(position - xs);
- if (cursor > 1)
- --cursor;
- return offset + cursor;
- } else
- offset += components.at(i).string.length() - 1;
- }
- } else {
- for (int i = 0; i < components.size(); ++i) {
- int xs = components.at(i).offset;
- int xe = xs + components.at(i).width;
- if (position <= xe) {
- QTextLayout layout(components.at(i).string, *components.at(i).font);
- layout.beginLayout();
- QTextLine l = layout.createLine();
- if (!l.isValid())
- return offset;
-
- l.setLineWidth(INT_MAX / 256);
- layout.endLayout();
-
- if (position - xs >= l.width())
- return offset + components.at(i).string.length() - 1;
- int cursor = l.xToCursor(position - xs);
- if (cursor > 1)
- --cursor;
- return offset + cursor;
- } else
- offset += components.at(i).string.length() - 1;
- }
- }
- return run.length();
-}
-
-static float cursorToX(const Vector<TextRunComponent, 1024>& components, int width, bool rtl, int cursor)
-{
- int start = 0;
- for (int i = 0; i < components.size(); ++i) {
- if (start + components.at(i).string.length() - 1 < cursor) {
- start += components.at(i).string.length() - 1;
- continue;
- }
- int xs = components.at(i).offset;
- if (rtl)
- xs = width - xs - components.at(i).width;
- QTextLayout layout(components.at(i).string, *components.at(i).font);
- layout.beginLayout();
- QTextLine l = layout.createLine();
- if (!l.isValid())
- return 0;
-
- l.setLineWidth(INT_MAX / 256);
- layout.endLayout();
-
- return xs + l.cursorToX(cursor - start + 1);
- }
- return width;
-}
-
-FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt,
- int h, int from, int to) const
-{
- Vector<TextRunComponent, 1024> components;
- int w = generateComponents(&components, *this, run);
-
- if (from == 0 && to == run.length())
- return FloatRect(pt.x(), pt.y(), w, h);
-
- float x1 = cursorToX(components, w, run.rtl(), from);
- float x2 = cursorToX(components, w, run.rtl(), to);
- if (x2 < x1)
- qSwap(x1, x2);
-
- return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h);
-}
-
-int Font::lineGap() const
-{
- return QFontMetrics(m_font).leading();
-}
-
-}
-
-#endif
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index aa0a4c3..d8fd66a 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -44,9 +44,7 @@
#include <QPainter>
#include <QImage>
#include <QImageReader>
-#if QT_VERSION >= 0x040300
#include <QTransform>
-#endif
#include <QDebug>
diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h
index cec4ff7..bc07ca1 100644
--- a/WebCore/platform/network/ResourceHandleInternal.h
+++ b/WebCore/platform/network/ResourceHandleInternal.h
@@ -202,11 +202,7 @@ namespace WebCore {
Frame* m_frame;
#endif
#if PLATFORM(QT)
-#if QT_VERSION < 0x040400
- QWebNetworkJob* m_job;
-#else
QNetworkReplyHandler* m_job;
-#endif
QWebFrame* m_frame;
#endif
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 2f4722f..32f5e30 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -21,8 +21,6 @@
#include "config.h"
#include "QNetworkReplyHandler.h"
-#if QT_VERSION >= 0x040400
-
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
#include "ResourceHandle.h"
@@ -466,5 +464,3 @@ void QNetworkReplyHandler::sendQueuedItems()
}
#include "moc_QNetworkReplyHandler.cpp"
-
-#endif
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.h b/WebCore/platform/network/qt/QNetworkReplyHandler.h
index fccc4a6..2171083 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.h
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.h
@@ -21,8 +21,6 @@
#include <QObject>
-#if QT_VERSION >= 0x040400
-
#include <QNetworkRequest>
#include <QNetworkAccessManager>
@@ -113,6 +111,4 @@ private:
}
-#endif
-
#endif // QNETWORKREPLYHANDLER_H
diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp
index b3844bf..09cdefd 100644
--- a/WebCore/platform/network/qt/ResourceHandleQt.cpp
+++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp
@@ -48,13 +48,9 @@
#endif
#include <QCoreApplication>
#include <QUrl>
-#if QT_VERSION >= 0x040400
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
-#else
-#include "qwebnetworkinterface_p.h"
-#endif
namespace WebCore {
@@ -141,23 +137,15 @@ bool ResourceHandle::start(Frame* frame)
}
getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
-#if QT_VERSION < 0x040400
- return QWebNetworkManager::self()->add(this, getInternal()->m_frame->page()->d->networkInterface);
-#else
ResourceHandleInternal *d = getInternal();
d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::LoadMode(d->m_defersLoading));
return true;
-#endif
}
void ResourceHandle::cancel()
{
-#if QT_VERSION < 0x040400
- QWebNetworkManager::self()->cancel(this);
-#else
if (d->m_job)
d->m_job->abort();
-#endif
}
bool ResourceHandle::loadsBlocked()
@@ -205,13 +193,6 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
WebCoreSynchronousLoader syncLoader;
ResourceHandle handle(request, &syncLoader, true, false, true);
-#if QT_VERSION < 0x040400
- if (!QWebNetworkManager::self()->add(&handle, QWebNetworkInterface::defaultInterface(), QWebNetworkManager::SynchronousJob)) {
- // FIXME Create a sane ResourceError
- error = ResourceError(String(), -1, String(), String());
- return;
- }
-#else
ResourceHandleInternal *d = handle.getInternal();
if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
// If credentials were specified for this request, add them to the url,
@@ -223,7 +204,6 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
}
d->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
d->m_job = new QNetworkReplyHandler(&handle, QNetworkReplyHandler::LoadNormal);
-#endif
syncLoader.waitForCompletion();
error = syncLoader.resourceError();
@@ -236,10 +216,8 @@ void ResourceHandle::setDefersLoading(bool defers)
{
d->m_defersLoading = defers;
-#if QT_VERSION >= 0x040400
if (d->m_job)
d->m_job->setLoadMode(QNetworkReplyHandler::LoadMode(defers));
-#endif
}
} // namespace WebCore
diff --git a/WebCore/platform/network/qt/ResourceRequest.h b/WebCore/platform/network/qt/ResourceRequest.h
index eeab94b..fb69326 100644
--- a/WebCore/platform/network/qt/ResourceRequest.h
+++ b/WebCore/platform/network/qt/ResourceRequest.h
@@ -59,9 +59,7 @@ namespace WebCore {
{
}
-#if QT_VERSION >= 0x040400
QNetworkRequest toNetworkRequest(QObject* originatingObject) const;
-#endif
private:
friend class ResourceRequestBase;
diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp
index a183c40..752abfe 100644
--- a/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -21,7 +21,6 @@
#include "ResourceRequest.h"
#include <qglobal.h>
-#if QT_VERSION >= 0x040400
#include <QNetworkRequest>
#include <QUrl>
@@ -70,4 +69,3 @@ QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) con
}
-#endif
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp
index 9d2c452..f9940a6 100644
--- a/WebCore/platform/qt/ClipboardQt.cpp
+++ b/WebCore/platform/qt/ClipboardQt.cpp
@@ -95,21 +95,7 @@ void ClipboardQt::clearData(const String& type)
return;
if (m_writableData) {
-#if QT_VERSION >= 0x040400
m_writableData->removeFormat(type);
-#else
- const QString toClearType = type;
- QMap<QString, QByteArray> formats;
- foreach (QString format, m_writableData->formats()) {
- if (format != toClearType)
- formats[format] = m_writableData->data(format);
- }
-
- m_writableData->clear();
- QMap<QString, QByteArray>::const_iterator it, end = formats.constEnd();
- for (it = formats.begin(); it != end; ++it)
- m_writableData->setData(it.key(), it.value());
-#endif
if (m_writableData->formats().isEmpty()) {
if (isForDragging())
delete m_writableData;
diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp
index a27a06e..b621e7e 100644
--- a/WebCore/platform/qt/CookieJarQt.cpp
+++ b/WebCore/platform/qt/CookieJarQt.cpp
@@ -33,19 +33,14 @@
#include "KURL.h"
#include "PlatformString.h"
-#if QT_VERSION >= 0x040400
#include "qwebpage.h"
#include "qwebframe.h"
#include "FrameLoaderClientQt.h"
#include <QNetworkAccessManager>
#include <QNetworkCookie>
-#else
-#include <qcookiejar.h>
-#endif
namespace WebCore {
-#if QT_VERSION >= 0x040400
static QNetworkCookieJar *cookieJar(const Document *document)
{
if (!document)
@@ -62,13 +57,11 @@ static QNetworkCookieJar *cookieJar(const Document *document)
QNetworkCookieJar* jar = manager->cookieJar();
return jar;
}
-#endif
void setCookies(Document* document, const KURL& url, const String& value)
{
QUrl u(url);
QUrl p(document->firstPartyForCookies());
-#if QT_VERSION >= 0x040400
QNetworkCookieJar* jar = cookieJar(document);
if (!jar)
return;
@@ -84,15 +77,11 @@ void setCookies(Document* document, const KURL& url, const String& value)
}
#endif
jar->setCookiesFromUrl(cookies, u);
-#else
- QCookieJar::cookieJar()->setCookies(u, p, (QString)value);
-#endif
}
String cookies(const Document* document, const KURL& url)
{
QUrl u(url);
-#if QT_VERSION >= 0x040400
QNetworkCookieJar* jar = cookieJar(document);
if (!jar)
return String();
@@ -112,23 +101,12 @@ String cookies(const Document* document, const KURL& url)
}
return resultCookies.join(QLatin1String("; "));
-#else
- QString cookies = QCookieJar::cookieJar()->cookies(u);
- int idx = cookies.indexOf(QLatin1Char(';'));
- if (idx > 0)
- cookies = cookies.left(idx);
- return cookies;
-#endif
}
bool cookiesEnabled(const Document* document)
{
-#if QT_VERSION >= 0x040400
QNetworkCookieJar* jar = cookieJar(document);
return (jar != 0);
-#else
- return QCookieJar::cookieJar()->isEnabled();
-#endif
}
bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies)
diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
index 37ea681..f78c7d7 100644
--- a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
+++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -52,10 +52,8 @@ static String keyIdentifierForQtKeyCode(int keyCode)
case Qt::Key_Return:
case Qt::Key_Enter:
return "Enter";
-#if QT_VERSION >= 0x040200
case Qt::Key_Execute:
return "Execute";
-#endif
case Qt::Key_F1:
return "F1";
case Qt::Key_F2:
@@ -290,10 +288,8 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false
return VK_SELECT; // (29) SELECT key
case Qt::Key_Print:
return VK_PRINT; // (2A) PRINT key
-#if QT_VERSION >= 0x040200
case Qt::Key_Execute:
return VK_EXECUTE;// (2B) EXECUTE key
-#endif
//dunno on this
//case Qt::Key_PrintScreen:
// return VK_SNAPSHOT; // (2C) PRINT SCREEN key
diff --git a/WebCore/platform/text/qt/TextBoundaries.cpp b/WebCore/platform/text/qt/TextBoundaries.cpp
index ffc4c44..a354ca6 100644
--- a/WebCore/platform/text/qt/TextBoundaries.cpp
+++ b/WebCore/platform/text/qt/TextBoundaries.cpp
@@ -36,7 +36,6 @@
#include <QDebug>
#include <stdio.h>
-#if QT_VERSION >= 0x040400
#include <qtextboundaryfinder.h>
namespace WebCore {
@@ -76,48 +75,3 @@ void findWordBoundary(UChar const* buffer, int len, int position, int* start, in
}
-#else
-namespace WebCore {
-
-int findNextWordFromIndex(UChar const* buffer, int len, int position, bool forward)
-{
- QString str(reinterpret_cast<QChar const*>(buffer), len);
- notImplemented();
- return 0;
-}
-
-void findWordBoundary(UChar const* buffer, int len, int position, int* start, int* end)
-{
- QString str(reinterpret_cast<QChar const*>(buffer), len);
-
- if (position > str.length()) {
- *start = 0;
- *end = 0;
- return;
- }
-
- int currentPosition = position - 1;
- QString foundWord;
- while (currentPosition >= 0 &&
- str[currentPosition].isLetter()) {
- foundWord.prepend(str[currentPosition]);
- --currentPosition;
- }
-
- // currentPosition == 0 means the first char is not letter
- // currentPosition == -1 means we reached the beginning
- int startPos = (currentPosition < 0) ? 0 : ++currentPosition;
- currentPosition = position;
- if (str[currentPosition].isLetter()) {
- while (str[currentPosition].isLetter()) {
- foundWord.append(str[currentPosition]);
- ++currentPosition;
- }
- }
-
- *start = startPos;
- *end = currentPosition;
-}
-
-}
-#endif
diff --git a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
index 92542f9..101947c 100644
--- a/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
+++ b/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
@@ -21,7 +21,6 @@
#include "config.h"
#include "TextBreakIterator.h"
-#if QT_VERSION >= 0x040400
#include <QtCore/qtextboundaryfinder.h>
#include <qdebug.h>
@@ -130,183 +129,3 @@ namespace WebCore {
}
}
-#else
-#include <qtextlayout.h>
-
-namespace WebCore {
-
- class TextBreakIterator {
- public:
- virtual int first() = 0;
- virtual int next() = 0;
- virtual int previous() = 0;
- inline int following(int pos)
- {
- currentPos = pos;
- return next();
- }
- inline int preceding(int pos)
- {
- currentPos = pos;
- return previous();
- }
- int currentPos;
- const UChar *string;
- int length;
- };
-
- class WordBreakIteratorQt : public TextBreakIterator {
- public:
- virtual int first();
- virtual int next();
- virtual int previous();
- };
-
- class CharBreakIteratorQt : public TextBreakIterator {
- public:
- virtual int first();
- virtual int next();
- virtual int previous();
- QTextLayout layout;
- };
-
- int WordBreakIteratorQt::first()
- {
- currentPos = 0;
- return currentPos;
- }
-
- int WordBreakIteratorQt::next()
- {
- if (currentPos >= length) {
- currentPos = -1;
- return currentPos;
- }
- bool haveSpace = false;
- while (currentPos < length) {
- if (haveSpace && !QChar(string[currentPos]).isSpace())
- break;
- if (QChar(string[currentPos]).isSpace())
- haveSpace = true;
- ++currentPos;
- }
- return currentPos;
- }
-
- int WordBreakIteratorQt::previous()
- {
- if (currentPos <= 0) {
- currentPos = -1;
- return currentPos;
- }
- bool haveSpace = false;
- while (currentPos > 0) {
- if (haveSpace && !QChar(string[currentPos]).isSpace())
- break;
- if (QChar(string[currentPos]).isSpace())
- haveSpace = true;
- --currentPos;
- }
- return currentPos;
- }
-
- int CharBreakIteratorQt::first()
- {
- currentPos = 0;
- return currentPos;
- }
-
- int CharBreakIteratorQt::next()
- {
- if (currentPos >= length)
- return -1;
- currentPos = layout.nextCursorPosition(currentPos);
- return currentPos;
- }
-
- int CharBreakIteratorQt::previous()
- {
- if (currentPos <= 0)
- return -1;
- currentPos = layout.previousCursorPosition(currentPos);
- return currentPos;
- }
-
-
-TextBreakIterator* wordBreakIterator(const UChar* string, int length)
-{
- static WordBreakIteratorQt *iterator = 0;
- if (!iterator)
- iterator = new WordBreakIteratorQt;
-
- iterator->string = string;
- iterator->length = length;
- iterator->currentPos = 0;
-
- return iterator;
-}
-
-TextBreakIterator* characterBreakIterator(const UChar* string, int length)
-{
- static CharBreakIteratorQt *iterator = 0;
- if (!iterator)
- iterator = new CharBreakIteratorQt;
-
- iterator->string = string;
- iterator->length = length;
- iterator->currentPos = 0;
- iterator->layout.setText(QString(reinterpret_cast<const QChar*>(string), length));
-
- return iterator;
-}
-
-TextBreakIterator* cursorMovementIterator(const UChar* string, int length)
-{
- return characterBreakIterator(string, length);
-}
-
-TextBreakIterator* lineBreakIterator(const UChar*, int)
-{
- // not yet implemented
- return 0;
-}
-
-TextBreakIterator* sentenceBreakIterator(const UChar*, int)
-{
- // not yet implemented
- return 0;
-}
-
-int textBreakFirst(TextBreakIterator* bi)
-{
- return bi->first();
-}
-
-int textBreakNext(TextBreakIterator* bi)
-{
- return bi->next();
-}
-
-int textBreakPreceding(TextBreakIterator* bi, int pos)
-{
- return bi->preceding(pos);
-}
-
-int textBreakFollowing(TextBreakIterator* bi, int pos)
-{
- return bi->following(pos);
-}
-
-int textBreakCurrent(TextBreakIterator* bi)
-{
- return bi->currentPos;
-}
-
-bool isTextBreak(TextBreakIterator*, int)
-{
- return true;
-}
-
-}
-
-#endif
diff --git a/WebCore/plugins/qt/PluginDataQt.cpp b/WebCore/plugins/qt/PluginDataQt.cpp
index 5478d38..a836937 100644
--- a/WebCore/plugins/qt/PluginDataQt.cpp
+++ b/WebCore/plugins/qt/PluginDataQt.cpp
@@ -24,18 +24,15 @@
#include "PluginDatabase.h"
#include "PluginPackage.h"
-#if QT_VERSION >= 0x040400
#include "ChromeClientQt.h"
#include "Page.h"
#include <qwebpage.h>
#include <qwebpluginfactory.h>
-#endif
namespace WebCore {
void PluginData::initPlugins()
{
-#if QT_VERSION >= 0x040400
QWebPage* webPage = static_cast<ChromeClientQt*>(m_page->chrome()->client())->m_webPage;
QWebPluginFactory* factory = webPage->pluginFactory();
if (factory) {
@@ -62,7 +59,6 @@ void PluginData::initPlugins()
m_plugins.append(info);
}
}
-#endif
PluginDatabase *db = PluginDatabase::installedPlugins();
const Vector<PluginPackage*> &plugins = db->plugins();
diff --git a/WebKit/qt/Api/qcookiejar.cpp b/WebKit/qt/Api/qcookiejar.cpp
deleted file mode 100644
index a02fe78..0000000
--- a/WebKit/qt/Api/qcookiejar.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- Copyright (C) 2007 Staikos Computing Services Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "qcookiejar.h"
-#include <QCoreApplication>
-uint qHash(const QUrl&);
-#include <QHash>
-#include <QPointer>
-
-class QCookieJarPrivate {
- public:
- QCookieJarPrivate()
- {
- enabled = true;
- }
- bool enabled;
- QHash<QUrl, QString> jar;
-};
-
-
-uint qHash(const QUrl& url)
-{
- return qHash(url.toString());
-}
-
-
-QCookieJar::QCookieJar()
-: QObject(), d(new QCookieJarPrivate)
-{
-}
-
-
-QCookieJar::~QCookieJar()
-{
- delete d;
-}
-
-
-void QCookieJar::setCookies(const QUrl& url, const QUrl& policyUrl, const QString& value)
-{
- Q_UNUSED(policyUrl)
- d->jar.insert(url, value);
-}
-
-
-QString QCookieJar::cookies(const QUrl& url)
-{
- return d->jar.value(url);
-}
-
-
-bool QCookieJar::isEnabled() const
-{
- return d->enabled;
-}
-
-
-void QCookieJar::setEnabled(bool enabled)
-{
- d->enabled = enabled;
-}
-
-
-static QPointer<QCookieJar> gJar;
-static bool gRoutineAdded = false;
-
-static void gCleanupJar()
-{
- delete gJar;
-}
-
-
-void QCookieJar::setCookieJar(QCookieJar* jar)
-{
- if (!gRoutineAdded) {
- qAddPostRoutine(gCleanupJar);
- gRoutineAdded = true;
- }
- delete gJar;
- gJar = jar;
-}
-
-
-QCookieJar* QCookieJar::cookieJar()
-{
- if (!gJar)
- setCookieJar(new QCookieJar);
-
- return gJar;
-}
diff --git a/WebKit/qt/Api/qcookiejar.h b/WebKit/qt/Api/qcookiejar.h
deleted file mode 100644
index 7885cc1..0000000
--- a/WebKit/qt/Api/qcookiejar.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Copyright (C) 2007 Staikos Computing Services Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef QCOOKIEJAR_H
-#define QCOOKIEJAR_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include "qwebkitglobal.h"
-
-class QCookieJarPrivate;
-
-class QWEBKIT_EXPORT QCookieJar : public QObject {
- Q_OBJECT
-
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
-public:
- QCookieJar();
- ~QCookieJar();
-
- virtual void setCookies(const QUrl& url, const QUrl& policyUrl, const QString& value);
- virtual QString cookies(const QUrl& url);
-
- bool isEnabled() const;
-
- static void setCookieJar(QCookieJar* jar);
- static QCookieJar* cookieJar();
-
-public slots:
- virtual void setEnabled(bool enabled);
-
-private:
- friend class QCookieJarPrivate;
- QCookieJarPrivate* d;
-};
-
-
-#endif
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index f46ee96..0226a23 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -368,7 +368,6 @@ bool QGraphicsWebView::event(QEvent* event)
#endif // QT_NO_CONTEXTMENU
{
#ifndef QT_NO_CURSOR
-#if QT_VERSION >= 0x040400
if (event->type() == QEvent::CursorChange) {
// An unsetCursor will set the cursor to Qt::ArrowCursor.
// Thus this cursor change might be a QWidget::unsetCursor()
@@ -382,7 +381,6 @@ bool QGraphicsWebView::event(QEvent* event)
d->resetCursor();
}
#endif
-#endif
}
}
return QGraphicsWidget::event(event);
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index 07b3a8e..a51f89d 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -77,14 +77,7 @@
#include <qpainter.h>
#include <qprinter.h>
#include <qregion.h>
-
-#if QT_VERSION < 0x040400
-#include "qwebnetworkinterface.h"
-#endif
-
-#if QT_VERSION >= 0x040400
#include <qnetworkrequest.h>
-#endif
using namespace WebCore;
@@ -675,51 +668,9 @@ QWebPage *QWebFrame::page() const
*/
void QWebFrame::load(const QUrl &url)
{
-#if QT_VERSION < 0x040400
- load(QWebNetworkRequest(ensureAbsoluteUrl(url)));
-#else
load(QNetworkRequest(ensureAbsoluteUrl(url)));
-#endif
-}
-
-#if QT_VERSION < 0x040400
-/*!
- Loads a network request, \a req, into this frame.
-
- \note The view remains the same until enough data has arrived to display the new url.
-*/
-void QWebFrame::load(const QWebNetworkRequest &req)
-{
- if (d->parentFrame())
- d->page->d->insideOpenCall = true;
-
- QUrl url = ensureAbsoluteUrl(req.url());
- QHttpRequestHeader httpHeader = req.httpHeader();
- QByteArray postData = req.postData();
-
- WebCore::ResourceRequest request(url);
-
- QString method = httpHeader.method();
- if (!method.isEmpty())
- request.setHTTPMethod(method);
-
- QList<QPair<QString, QString> > values = httpHeader.values();
- for (int i = 0; i < values.size(); ++i) {
- const QPair<QString, QString> &val = values.at(i);
- request.addHTTPHeaderField(val.first, val.second);
- }
-
- if (!postData.isEmpty())
- request.setHTTPBody(WebCore::FormData::create(postData.constData(), postData.size()));
-
- d->frame->loader()->load(request, false);
-
- if (d->parentFrame())
- d->page->d->insideOpenCall = false;
}
-#else
-
/*!
Loads a network request, \a req, into this frame, using the method specified in \a
operation.
@@ -778,7 +729,6 @@ void QWebFrame::load(const QNetworkRequest &req,
if (d->parentFrame())
d->page->d->insideOpenCall = false;
}
-#endif
/*!
Sets the content of this frame to \a html. \a baseUrl is optional and used to resolve relative
diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h
index 08285f8..c2a6e9b 100644
--- a/WebKit/qt/Api/qwebframe.h
+++ b/WebKit/qt/Api/qwebframe.h
@@ -26,9 +26,7 @@
#include <QtCore/qvariant.h>
#include <QtGui/qicon.h>
#include <QtScript/qscriptengine.h>
-#if QT_VERSION >= 0x040400
#include <QtNetwork/qnetworkaccessmanager.h>
-#endif
#include "qwebkitglobal.h"
QT_BEGIN_NAMESPACE
@@ -123,13 +121,9 @@ public:
QWebPage *page() const;
void load(const QUrl &url);
-#if QT_VERSION < 0x040400
- void load(const QWebNetworkRequest &request);
-#else
void load(const QNetworkRequest &request,
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
const QByteArray &body = QByteArray());
-#endif
void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl());
diff --git a/WebKit/qt/Api/qwebkitglobal.h b/WebKit/qt/Api/qwebkitglobal.h
index 0885bdc..9e8979f 100644
--- a/WebKit/qt/Api/qwebkitglobal.h
+++ b/WebKit/qt/Api/qwebkitglobal.h
@@ -40,15 +40,4 @@
# endif
#endif
-#if QT_VERSION < 0x040400
- #ifndef QT_BEGIN_NAMESPACE
- #define QT_BEGIN_NAMESPACE
- #endif
-
- #ifndef QT_END_NAMESPACE
- #define QT_END_NAMESPACE
- #endif
-#endif
-
-
#endif // QWEBKITGLOBAL_H
diff --git a/WebKit/qt/Api/qwebnetworkinterface.cpp b/WebKit/qt/Api/qwebnetworkinterface.cpp
deleted file mode 100644
index cf99183..0000000
--- a/WebKit/qt/Api/qwebnetworkinterface.cpp
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- Copyright (C) 2006 Enrico Ros <enrico.ros at m31engineering.it>
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2007 Staikos Computing Services Inc. <info at staikos.net>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include <qglobal.h>
-#if QT_VERSION < 0x040400
-#include "qwebframe.h"
-#include "qwebnetworkinterface.h"
-#include "qwebnetworkinterface_p.h"
-#include "qwebpage.h"
-#include "qcookiejar.h"
-#include <qdebug.h>
-#include <qfile.h>
-#include <qnetworkproxy.h>
-#include <qurl.h>
-#include <QAuthenticator>
-#include <QCoreApplication>
-#include <QSslError>
-
-#include "ResourceHandle.h"
-#include "ResourceHandleClient.h"
-#include "ResourceHandleInternal.h"
-#include "MIMETypeRegistry.h"
-#include "CookieJar.h"
-
-#if 0
-#define DEBUG qDebug
-#else
-#define DEBUG if (1) {} else qDebug
-#endif
-
-static QWebNetworkInterface *s_default_interface = 0;
-static QWebNetworkManager *s_manager = 0;
-
-using namespace WebCore;
-
-uint qHash(const HostInfo &info)
-{
- return qHash(info.host) + info.port;
-}
-
-static bool operator==(const HostInfo &i1, const HostInfo &i2)
-{
- return i1.port == i2.port && i1.host == i2.host;
-}
-
-enum ParserState {
- State_Begin,
- State_FirstChar,
- State_SecondChar
-};
-
-/*
- * Decode URLs without doing any charset conversion.
- *
- * Most simple approach to do it without any lookahead.
- */
-static QByteArray decodePercentEncoding(const QByteArray& input)
-{
- int actualLength = 0;
- QByteArray tmpVal;
- QByteArray output;
- ParserState state = State_Begin;
-
- output.resize(input.length());
- tmpVal.resize(2);
-
- for (int i = 0; i < input.length(); ++i)
- if (state == State_Begin) {
- if (input.at(i) == '%')
- state = State_FirstChar;
- else
- output[actualLength++] = input[i];
- } else if (state == State_FirstChar) {
- state = State_SecondChar;
- tmpVal[0] = input[i];
- } else if (state == State_SecondChar) {
- state = State_Begin;
- tmpVal[1] = input[i];
- output[actualLength++] = tmpVal.toShort(0, 16);
- }
-
- output.resize(actualLength);
- return output;
-}
-
-void QWebNetworkRequestPrivate::init(const WebCore::ResourceRequest &resourceRequest)
-{
- KURL url = resourceRequest.url();
- QUrl qurl = QString(url.string());
- init(resourceRequest.httpMethod(), qurl, &resourceRequest);
-}
-
-void QWebNetworkRequestPrivate::init(const QString& method, const QUrl& url, const WebCore::ResourceRequest* resourceRequest)
-{
- httpHeader = QHttpRequestHeader(method, url.toString(QUrl::RemoveScheme|QUrl::RemoveAuthority));
- httpHeader.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- setURL(url);
-
- if (resourceRequest) {
- httpHeader.setValue(QLatin1String("User-Agent"), resourceRequest->httpUserAgent());
- const QString scheme = url.scheme().toLower();
- if (scheme == QLatin1String("http") || scheme == QLatin1String("https")) {
- QString cookies = QCookieJar::cookieJar()->cookies(resourceRequest->url());
- if (!cookies.isEmpty())
- httpHeader.setValue(QLatin1String("Cookie"), cookies);
- }
-
-
- const HTTPHeaderMap& loaderHeaders = resourceRequest->httpHeaderFields();
- HTTPHeaderMap::const_iterator end = loaderHeaders.end();
- for (HTTPHeaderMap::const_iterator it = loaderHeaders.begin(); it != end; ++it)
- httpHeader.setValue(it->first, it->second);
-
- // handle and perform a 'POST' request
- if (method == "POST") {
- Vector<char> data;
- resourceRequest->httpBody()->flatten(data);
- postData = QByteArray(data.data(), data.size());
- httpHeader.setValue(QLatin1String("content-length"), QString::number(postData.size()));
- }
- }
-}
-
-void QWebNetworkRequestPrivate::setURL(const QUrl& u)
-{
- url = u;
- int port = url.port();
- const QString scheme = u.scheme();
- if (port > 0 && (port != 80 || scheme != "http") && (port != 443 || scheme != "https"))
- httpHeader.setValue(QLatin1String("Host"), url.host() + QLatin1Char(':') + QString::number(port));
- else
- httpHeader.setValue(QLatin1String("Host"), url.host());
-}
-
-/*!
- \class QWebNetworkRequest
- \internal
-
- The QWebNetworkRequest class represents a request for data from the network with all the
- necessary information needed for retrieval. This includes the url, extra HTTP header fields
- as well as data for a HTTP POST request.
-*/
-
-QWebNetworkRequest::QWebNetworkRequest()
- : d(new QWebNetworkRequestPrivate)
-{
-}
-
-QWebNetworkRequest::QWebNetworkRequest(const QUrl& url, Method method, const QByteArray& postData)
- : d(new QWebNetworkRequestPrivate)
-{
- d->init(method == Get ? "GET" : "POST", url);
- d->postData = postData;
-}
-
-QWebNetworkRequest::QWebNetworkRequest(const QWebNetworkRequest &other)
- : d(new QWebNetworkRequestPrivate(*other.d))
-{
-}
-
-QWebNetworkRequest &QWebNetworkRequest::operator=(const QWebNetworkRequest& other)
-{
- *d = *other.d;
- return *this;
-}
-
-/*!
- \internal
-*/
-QWebNetworkRequest::QWebNetworkRequest(const QWebNetworkRequestPrivate& priv)
- : d(new QWebNetworkRequestPrivate(priv))
-{
-}
-
-/*!
- \internal
-*/
-QWebNetworkRequest::QWebNetworkRequest(const WebCore::ResourceRequest& request)
- : d(new QWebNetworkRequestPrivate)
-{
- d->init(request);
-}
-
-QWebNetworkRequest::~QWebNetworkRequest()
-{
- delete d;
-}
-
-/*!
- \internal
- The requested URL
-*/
-QUrl QWebNetworkRequest::url() const
-{
- return d->url;
-}
-
-/*!
- \internal
- Sets the URL to request.
-
- Note that setting the URL also sets the "Host" field in the HTTP header.
-*/
-void QWebNetworkRequest::setUrl(const QUrl& url)
-{
- d->setURL(url);
-}
-
-/*!
- \internal
- The http request header information.
-*/
-QHttpRequestHeader QWebNetworkRequest::httpHeader() const
-{
- return d->httpHeader;
-}
-
-void QWebNetworkRequest::setHttpHeader(const QHttpRequestHeader& header) const
-{
- d->httpHeader = header;
-}
-
-QString QWebNetworkRequest::httpHeaderField(const QString& key) const
-{
- return d->httpHeader.value(key);
-}
-
-void QWebNetworkRequest::setHttpHeaderField(const QString& key, const QString& value)
-{
- d->httpHeader.setValue(key, value);
-}
-
-/*!
- \internal
- Post data sent with HTTP POST requests.
-*/
-QByteArray QWebNetworkRequest::postData() const
-{
- return d->postData;
-}
-
-void QWebNetworkRequest::setPostData(const QByteArray& data)
-{
- d->postData = data;
-}
-
-/*!
- \class QWebNetworkJob
- \internal
-
- The QWebNetworkJob class represents a network job, that needs to be
- processed by the QWebNetworkInterface.
-
- This class is only required when implementing a new network layer (or
- support for a special protocol) using QWebNetworkInterface.
-
- QWebNetworkJob objects are created and owned by the QtWebKit library.
- Most of it's properties are read-only.
-
- The job is reference counted. This can be used to ensure that the job doesn't
- get deleted while it's still stored in some data structure.
-*/
-
-/*!
- \internal
-*/
-QWebNetworkJob::QWebNetworkJob()
- : d(new QWebNetworkJobPrivate)
-{
-}
-
-/*!
- \internal
-*/
-QWebNetworkJob::~QWebNetworkJob()
-{
- delete d;
- d = 0;
-}
-
-/*!
- \internal
- The requested URL
-*/
-QUrl QWebNetworkJob::url() const
-{
- return d->request.url;
-}
-
-/*!
- \internal
- Post data associated with the job
-*/
-QByteArray QWebNetworkJob::postData() const
-{
- return d->request.postData;
-}
-
-/*!
- \internal
- The HTTP request header that should be used to download the job.
-*/
-QHttpRequestHeader QWebNetworkJob::httpHeader() const
-{
- return d->request.httpHeader;
-}
-
-/*!
- \internal
- The complete network request that should be used to download the job.
-*/
-QWebNetworkRequest QWebNetworkJob::request() const
-{
- return QWebNetworkRequest(d->request);
-}
-
-/*!
- \internal
- The HTTP response header received from the network.
-*/
-QHttpResponseHeader QWebNetworkJob::response() const
-{
- return d->response;
-}
-
-/*!
- \internal
- The last error of the Job.
-*/
-QString QWebNetworkJob::errorString() const
-{
- return d->errorString;
-}
-
-/*!
- \internal
- Sets the HTTP reponse header. The response header has to be called before
- emitting QWebNetworkInterface::started.
-*/
-void QWebNetworkJob::setResponse(const QHttpResponseHeader& response)
-{
- d->response = response;
-}
-
-void QWebNetworkJob::setErrorString(const QString& errorString)
-{
- d->errorString = errorString;
-}
-
-/*!
- \internal
- returns true if the job has been cancelled by the WebKit framework
-*/
-bool QWebNetworkJob::cancelled() const
-{
- return !d->resourceHandle;
-}
-
-/*!
- \internal
- reference the job.
-*/
-void QWebNetworkJob::ref()
-{
- ++d->ref;
-}
-
-/*!
- \internal
- derefence the job.
-
- If the reference count drops to 0 this method also deletes the job.
-
- Returns false if the reference count has dropped to 0.
-*/
-bool QWebNetworkJob::deref()
-{
- if (!--d->ref) {
- delete this;
- return false;
- }
- return true;
-}
-
-/*!
- \internal
- Returns the network interface that is associated with this job.
-*/
-QWebNetworkInterface *QWebNetworkJob::networkInterface() const
-{
- return d->interface;
-}
-
-/*!
- \internal
- Returns the network interface that is associated with this job.
-*/
-QWebFrame *QWebNetworkJob::frame() const
-{
- if (!d->resourceHandle) {
- ResourceHandleInternal *rhi = d->resourceHandle->getInternal();
- if (rhi)
- return rhi->m_frame;
- }
- return 0;
-}
-
-QWebNetworkJob::JobStatus QWebNetworkJob::status() const
-{
- return d->jobStatus;
-}
-
-void QWebNetworkJob::setStatus(const JobStatus& status)
-{
- d->jobStatus = status;
-}
-
-/*!
- \class QWebNetworkManager
- \internal
-*/
-QWebNetworkManager::QWebNetworkManager()
- : QObject(0)
- , m_scheduledWork(false)
-{
- connect(this, SIGNAL(scheduleWork()), SLOT(doWork()), Qt::QueuedConnection);
-}
-
-QWebNetworkManager *QWebNetworkManager::self()
-{
- // ensure everything's constructed and connected
- QWebNetworkInterface::defaultInterface();
-
- return s_manager;
-}
-
-bool QWebNetworkManager::add(ResourceHandle* handle, QWebNetworkInterface* interface, JobMode jobMode)
-{
- if (!interface)
- interface = s_default_interface;
-
- ASSERT(interface);
-
- QWebNetworkJob *job = new QWebNetworkJob();
- handle->getInternal()->m_job = job;
- job->d->resourceHandle = handle;
- job->d->interface = interface;
-
- job->d->request.init(handle->request());
-
- const QString method = handle->getInternal()->m_request.httpMethod();
- if (method != "POST" && method != "GET" && method != "HEAD") {
- qWarning("REQUEST: [%s]\n", qPrintable(job->d->request.httpHeader.toString()));
- return false;
- }
-
- DEBUG() << "QWebNetworkManager::add:" << job->d->request.httpHeader.toString();
-
- if (jobMode == SynchronousJob) {
- Q_ASSERT(!m_synchronousJobs.contains(job));
- m_synchronousJobs[job] = 1;
- }
-
- interface->addJob(job);
-
- return true;
-}
-
-void QWebNetworkManager::cancel(ResourceHandle* handle)
-{
- QWebNetworkJob *job = handle->getInternal()->m_job;
- if (!job)
- return;
- DEBUG() << "QWebNetworkManager::cancel:" << job->d->request.httpHeader.toString();
- job->d->resourceHandle = 0;
- job->d->interface->cancelJob(job);
- handle->getInternal()->m_job = 0;
-}
-
-/*!
- \internal
-*/
-void QWebNetworkManager::started(QWebNetworkJob* job)
-{
- Q_ASSERT(job->d);
- Q_ASSERT(job->status() == QWebNetworkJob::JobCreated ||
- job->status() == QWebNetworkJob::JobRecreated);
-
- job->setStatus(QWebNetworkJob::JobStarted);
- ResourceHandleClient* client = 0;
-
- if (!job->d->resourceHandle)
- return;
-
- client = job->d->resourceHandle->client();
- if (!client)
- return;
-
- DEBUG() << "ResourceHandleManager::receivedResponse:";
- DEBUG() << job->d->response.toString();
-
- QStringList cookies = job->d->response.allValues("Set-Cookie");
- KURL url(job->url());
-
- foreach (QString c, cookies)
- QCookieJar::cookieJar()->setCookies(url, url, c);
-
- QString contentType = job->d->response.value("Content-Type");
- QString encoding;
- int idx = contentType.indexOf(QLatin1Char(';'));
- if (idx > 0) {
- QString remainder = contentType.mid(idx + 1).toLower();
- contentType = contentType.left(idx).trimmed();
-
- idx = remainder.indexOf("charset");
- if (idx >= 0) {
- idx = remainder.indexOf(QLatin1Char('='), idx);
- if (idx >= 0)
- encoding = remainder.mid(idx + 1).trimmed();
- }
- }
- if (contentType.isEmpty()) {
- // let's try to guess from the extension
- QString extension = job->d->request.url.path();
- int index = extension.lastIndexOf(QLatin1Char('.'));
- if (index > 0) {
- extension = extension.mid(index + 1);
- contentType = MIMETypeRegistry::getMIMETypeForExtension(extension);
- }
- }
-// qDebug() << "Content-Type=" << contentType;
-// qDebug() << "Encoding=" << encoding;
-
-
- ResourceResponse response(url, contentType,
- 0 /* FIXME */,
- encoding,
- String() /* FIXME */);
-
- int statusCode = job->d->response.statusCode();
- if (job->url().scheme() != QLatin1String("file"))
- response.setHTTPStatusCode(statusCode);
- else if (statusCode == 404)
- response.setHTTPStatusCode(statusCode);
-
- /* Fill in the other fields */
-
- if (statusCode >= 300 && statusCode < 400) {
- // we're on a redirect page! if the 'Location:' field is valid, we redirect
- QString location = job->d->response.value("location");
- DEBUG() << "Redirection";
- if (!location.isEmpty()) {
- QUrl newUrl = job->d->request.url.resolved(location);
- if (job->d->resourceHandle) {
- ResourceRequest newRequest = job->d->resourceHandle->request();
- newRequest.setURL(KURL(newUrl));
- if (client)
- client->willSendRequest(job->d->resourceHandle, newRequest, response);
- }
-
- QString method;
- if (statusCode == 302 || statusCode == 303) {
- // this is standard-correct for 303 and practically-correct (no standard-correct) for 302
- // also, it's required for Yahoo's login process for flickr.com which responds to a POST
- // with a 302 which must be GET'ed
- method = "GET";
- job->d->request.httpHeader.setContentLength(0);
- } else
- method = job->d->request.httpHeader.method();
-
- job->d->request.httpHeader.setRequest(method,
- newUrl.toString(QUrl::RemoveScheme|QUrl::RemoveAuthority));
- job->d->request.setURL(newUrl);
- job->d->redirected = true;
- return;
- }
- }
-
- if (client)
- client->didReceiveResponse(job->d->resourceHandle, response);
-
-}
-
-void QWebNetworkManager::data(QWebNetworkJob* job, const QByteArray& data)
-{
- Q_ASSERT(job->status() == QWebNetworkJob::JobStarted ||
- job->status() == QWebNetworkJob::JobReceivingData);
-
- job->setStatus(QWebNetworkJob::JobReceivingData);
- ResourceHandleClient* client = 0;
-
- if (!job->d->resourceHandle)
- return;
-
- client = job->d->resourceHandle->client();
- if (!client)
- return;
-
- if (job->d->redirected)
- return; // don't emit the "Document has moved here" type of HTML
-
- DEBUG() << "receivedData" << job->d->request.url.path();
- client->didReceiveData(job->d->resourceHandle, data.constData(), data.length(), data.length() /*FixMe*/);
-}
-
-void QWebNetworkManager::finished(QWebNetworkJob* job, int errorCode)
-{
- Q_ASSERT(errorCode == 1 ||
- job->status() == QWebNetworkJob::JobStarted ||
- job->status() == QWebNetworkJob::JobReceivingData);
-
- if (m_synchronousJobs.contains(job))
- m_synchronousJobs.remove(job);
-
- job->setStatus(QWebNetworkJob::JobFinished);
- ResourceHandleClient* client = 0;
- if (job->d->resourceHandle) {
- client = job->d->resourceHandle->client();
- if (!client)
- return;
- } else {
- job->deref();
- return;
- }
-
- DEBUG() << "receivedFinished" << errorCode << job->url();
-
- if (job->d->redirected) {
- job->d->redirected = false;
- job->setStatus(QWebNetworkJob::JobRecreated);
- job->d->interface->addJob(job);
- return;
- }
-
- if (job->d->resourceHandle)
- job->d->resourceHandle->getInternal()->m_job = 0;
-
- if (client) {
- if (errorCode) {
- //FIXME: error setting error was removed from ResourceHandle
- client->didFail(job->d->resourceHandle,
- ResourceError(job->d->request.url.host(), job->d->response.statusCode(),
- job->d->request.url.toString(), job->d->errorString));
- } else
- client->didFinishLoading(job->d->resourceHandle);
- }
-
- DEBUG() << "receivedFinished done" << job->d->request.url;
-
- job->deref();
-}
-
-void QWebNetworkManager::addHttpJob(QWebNetworkJob* job)
-{
- HostInfo hostInfo(job->url());
- WebCoreHttp *httpConnection = m_hostMapping.value(hostInfo);
- if (!httpConnection) {
- // #### fix custom ports
- DEBUG() << " new connection to" << hostInfo.host << hostInfo.port;
- httpConnection = new WebCoreHttp(this, hostInfo);
- QObject::connect(httpConnection, SIGNAL(connectionClosed(const WebCore::HostInfo&)),
- this, SLOT(httpConnectionClosed(const WebCore::HostInfo&)));
-
- m_hostMapping[hostInfo] = httpConnection;
- }
- httpConnection->request(job);
-}
-
-void QWebNetworkManager::cancelHttpJob(QWebNetworkJob* job)
-{
- WebCoreHttp *httpConnection = m_hostMapping.value(job->url());
- if (httpConnection)
- httpConnection->cancel(job);
-}
-
-void QWebNetworkManager::httpConnectionClosed(const WebCore::HostInfo& info)
-{
- WebCoreHttp *connection = m_hostMapping.take(info);
- connection->deleteLater();
-}
-
-void QWebNetworkInterfacePrivate::sendFileData(QWebNetworkJob* job, int statusCode, const QByteArray& data)
-{
- int error = statusCode >= 400 ? 1 : 0;
- if (!job->cancelled()) {
- QHttpResponseHeader response;
- response.setStatusLine(statusCode);
- response.setContentLength(data.length());
- job->setResponse(response);
- q->started(job);
- if (!data.isEmpty())
- q->data(job, data);
- }
- q->finished(job, error);
-}
-
-void QWebNetworkInterfacePrivate::parseDataUrl(QWebNetworkJob* job)
-{
- QByteArray data = job->url().toString().toLatin1();
- //qDebug() << "handling data url:" << data;
-
- ASSERT(data.startsWith("data:"));
-
- // Here's the syntax of data URLs:
- // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
- // mediatype := [ type "/" subtype ] *( ";" parameter )
- // data := *urlchar
- // parameter := attribute "=" value
- QByteArray header;
- bool base64 = false;
-
- int index = data.indexOf(',');
- if (index != -1) {
- header = data.mid(5, index - 5).toLower();
- //qDebug() << "header=" << header;
- data = data.mid(index+1);
- //qDebug() << "data=" << data;
-
- if (header.endsWith(";base64")) {
- //qDebug() << "base64";
- base64 = true;
- header = header.left(header.length() - 7);
- //qDebug() << "mime=" << header;
- }
- } else
- data = QByteArray();
-
- if (base64)
- data = QByteArray::fromBase64(data);
- else
- data = decodePercentEncoding(data);
-
- if (header.isEmpty())
- header = "text/plain;charset=US-ASCII";
- int statusCode = 200;
- QHttpResponseHeader response;
- response.setContentType(header);
- response.setContentLength(data.size());
- job->setResponse(response);
-
- int error = statusCode >= 400 ? 1 : 0;
- q->started(job);
- if (!data.isEmpty())
- q->data(job, data);
- q->finished(job, error);
-}
-
-void QWebNetworkManager::queueStart(QWebNetworkJob* job)
-{
- Q_ASSERT(job->d);
-
- QMutexLocker locker(&m_queueMutex);
- job->ref();
- m_pendingWork.append(new JobWork(job));
- doScheduleWork();
-}
-
-void QWebNetworkManager::queueData(QWebNetworkJob* job, const QByteArray& data)
-{
- ASSERT(job->d);
-
- QMutexLocker locker(&m_queueMutex);
- job->ref();
- m_pendingWork.append(new JobWork(job, data));
- doScheduleWork();
-}
-
-void QWebNetworkManager::queueFinished(QWebNetworkJob* job, int errorCode)
-{
- Q_ASSERT(job->d);
-
- QMutexLocker locker(&m_queueMutex);
- job->ref();
- m_pendingWork.append(new JobWork(job, errorCode));
- doScheduleWork();
-}
-
-void QWebNetworkManager::doScheduleWork()
-{
- if (!m_scheduledWork) {
- m_scheduledWork = true;
- emit scheduleWork();
- }
-}
-
-
-/*
- * We will work on a copy of m_pendingWork. While dispatching m_pendingWork
- * new work will be added that will be handled at a later doWork call. doWork
- * will be called we set m_scheduledWork to false early in this method.
- */
-void QWebNetworkManager::doWork()
-{
- m_queueMutex.lock();
- m_scheduledWork = false;
- bool hasSyncJobs = m_synchronousJobs.size();
- const QHash<QWebNetworkJob*, int> syncJobs = m_synchronousJobs;
- m_queueMutex.unlock();
-
- foreach (JobWork* work, m_pendingWork) {
- if (hasSyncJobs && !syncJobs.contains(work->job))
- continue;
-
- if (work->workType == JobWork::JobStarted)
- started(work->job);
- else if (work->workType == JobWork::JobData) {
- // This job was not yet started
- if (static_cast<int>(work->job->status()) < QWebNetworkJob::JobStarted)
- continue;
-
- data(work->job, work->data);
- } else if (work->workType == JobWork::JobFinished) {
- // This job was not yet started... we have no idea if data comes by...
- // and it won't start in case of errors
- if (static_cast<int>(work->job->status()) < QWebNetworkJob::JobStarted && work->errorCode != 1)
- continue;
-
- finished(work->job, work->errorCode);
- }
-
- m_queueMutex.lock();
- m_pendingWork.removeAll(work);
- m_queueMutex.unlock();
-
- work->job->deref();
- delete work;
- }
-
- m_queueMutex.lock();
- if (hasSyncJobs && !m_synchronousJobs.size())
- doScheduleWork();
- m_queueMutex.unlock();
-}
-
-/*!
- \class QWebNetworkInterface
- \internal
-
- The QWebNetworkInterface class provides an abstraction layer for
- WebKit's network interface. It allows to completely replace or
- extend the builtin network layer.
-
- QWebNetworkInterface contains two virtual methods, addJob and
- cancelJob that have to be reimplemented when implementing your own
- networking layer.
-
- QWebNetworkInterface can by default handle the http, https, file and
- data URI protocols.
-
-*/
-
-static bool gRoutineAdded = false;
-
-static void gCleanupInterface()
-{
- delete s_default_interface;
- s_default_interface = 0;
-}
-
-/*!
- \internal
- Sets a new default interface that will be used by all of WebKit
- for downloading data from the internet.
-*/
-void QWebNetworkInterface::setDefaultInterface(QWebNetworkInterface* defaultInterface)
-{
- if (s_default_interface == defaultInterface)
- return;
- if (s_default_interface)
- delete s_default_interface;
- s_default_interface = defaultInterface;
- if (!gRoutineAdded) {
- qAddPostRoutine(gCleanupInterface);
- gRoutineAdded = true;
- }
-}
-
-/*!
- \internal
- Returns the default interface that will be used by WebKit. If no
- default interface has been set, QtWebkit will create an instance of
- QWebNetworkInterface to do the work.
-*/
-QWebNetworkInterface *QWebNetworkInterface::defaultInterface()
-{
- if (!s_default_interface)
- setDefaultInterface(new QWebNetworkInterface);
-
- return s_default_interface;
-}
-
-
-/*!
- \internal
- Constructs a QWebNetworkInterface object.
-*/
-QWebNetworkInterface::QWebNetworkInterface(QObject* parent)
- : QObject(parent)
-{
- d = new QWebNetworkInterfacePrivate;
- d->q = this;
-
- if (!s_manager)
- s_manager = new QWebNetworkManager;
-}
-
-/*!
- \internal
- Destructs the QWebNetworkInterface object.
-*/
-QWebNetworkInterface::~QWebNetworkInterface()
-{
- delete d;
-}
-
-/*!
- \internal
- This virtual method gets called whenever QtWebkit needs to add a
- new job to download.
-
- The QWebNetworkInterface should process this job, by first emitting
- the started signal, then emitting data repeatedly as new data for
- the Job is available, and finally ending the job with emitting a
- finished signal.
-
- After the finished signal has been emitted, the QWebNetworkInterface
- is not allowed to access the job anymore.
-*/
-void QWebNetworkInterface::addJob(QWebNetworkJob* job)
-{
- QString protocol = job->url().scheme();
- if (protocol == QLatin1String("http") || protocol == QLatin1String("https")) {
- QWebNetworkManager::self()->addHttpJob(job);
- return;
- }
-
- // "file", "data" and all unhandled stuff go through here
- //DEBUG() << "fileRequest";
- DEBUG() << "FileLoader::request" << job->url();
-
- if (job->cancelled()) {
- d->sendFileData(job, 400, QByteArray());
- return;
- }
-
- QUrl url = job->url();
- if (protocol == QLatin1String("data")) {
- d->parseDataUrl(job);
- return;
- }
-
- int statusCode = 200;
- QByteArray data;
- QString path = url.path();
- if (protocol == QLatin1String("qrc")) {
- protocol = "file";
- path.prepend(QLatin1Char(':'));
- }
-
- if (!(protocol.isEmpty() || protocol == QLatin1String("file"))) {
- statusCode = 404;
- } else {
- // we simply ignore post data here.
- QFile f(path);
- DEBUG() << "opening" << QString(url.path());
-
- if (f.open(QIODevice::ReadOnly)) {
- QHttpResponseHeader response;
- response.setStatusLine(200);
- job->setResponse(response);
- data = f.readAll();
- } else
- statusCode = 404;
- }
-
- if (statusCode == 404) {
- QHttpResponseHeader response;
- response.setStatusLine(404);
- job->setResponse(response);
- }
-
- d->sendFileData(job, statusCode, data);
-}
-
-/*!
- \internal
- This virtual method gets called whenever QtWebkit needs to cancel a
- new job.
-
- The QWebNetworkInterface acknowledge the canceling of the job, by
- emitting the finished signal with an error code of 1. After emitting
- the finished signal, the interface should not access the job
- anymore.
-*/
-void QWebNetworkInterface::cancelJob(QWebNetworkJob* job)
-{
- QString protocol = job->url().scheme();
- if (protocol == QLatin1String("http") || protocol == QLatin1String("https"))
- QWebNetworkManager::self()->cancelHttpJob(job);
-}
-
-/*!
- \internal
-*/
-void QWebNetworkInterface::started(QWebNetworkJob* job)
-{
- Q_ASSERT(s_manager);
- s_manager->queueStart(job);
-}
-
-/*!
- \internal
-*/
-void QWebNetworkInterface::data(QWebNetworkJob* job, const QByteArray& data)
-{
- Q_ASSERT(s_manager);
- s_manager->queueData(job, data);
-}
-
-/*!
- \internal
-*/
-void QWebNetworkInterface::finished(QWebNetworkJob* job, int errorCode)
-{
- Q_ASSERT(s_manager);
- s_manager->queueFinished(job, errorCode);
-}
-
-/*!
- \fn void QWebNetworkInterface::sslErrors(QWebFrame *frame, const QUrl& url, const QList<QSslError>& errors, bool *continueAnyway);
- \internal
-
- Signal is emitted when an SSL error occurs.
-*/
-
-/*!
- \fn void QWebNetworkInterface::authenticate(QWebFrame *frame, const QUrl& url, const QString& hostname, quint16 port, QAuthenticator *auth);
- \internal
-
- Signal is emitted when network authentication is required.
-*/
-
-/*!
- \fn void QWebNetworkInterface::authenticateProxy(QWebFrame *frame, const QUrl& url, const QNetworkProxy& proxy, QAuthenticator *auth);
- \internal
-
- Signal is emitted when proxy authentication is required.
-*/
-
-/////////////////////////////////////////////////////////////////////////////
-WebCoreHttp::WebCoreHttp(QObject* parent, const HostInfo& hi)
- : QObject(parent)
- , info(hi)
- , m_inCancel(false)
-{
- for (int i = 0; i < 2; ++i) {
- connection[i].http = new QHttp(info.host, (hi.protocol == QLatin1String("https")) ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp, info.port);
- connect(connection[i].http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader&)),
- this, SLOT(onResponseHeaderReceived(const QHttpResponseHeader&)));
- connect(connection[i].http, SIGNAL(readyRead(const QHttpResponseHeader&)),
- this, SLOT(onReadyRead()));
- connect(connection[i].http, SIGNAL(requestFinished(int, bool)),
- this, SLOT(onRequestFinished(int, bool)));
- connect(connection[i].http, SIGNAL(done(bool)),
- this, SLOT(onDone(bool)));
- connect(connection[i].http, SIGNAL(stateChanged(int)),
- this, SLOT(onStateChanged(int)));
- connect(connection[i].http, SIGNAL(authenticationRequired(const QString&, quint16, QAuthenticator*)),
- this, SLOT(onAuthenticationRequired(const QString&, quint16, QAuthenticator*)));
- connect(connection[i].http, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
- this, SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
- connect(connection[i].http, SIGNAL(sslErrors(const QList<QSslError>&)),
- this, SLOT(onSslErrors(const QList<QSslError>&)));
- }
-}
-
-WebCoreHttp::~WebCoreHttp()
-{
- connection[0].http->deleteLater();
- connection[1].http->deleteLater();
-}
-
-void WebCoreHttp::request(QWebNetworkJob* job)
-{
- m_pendingRequests.append(job);
- scheduleNextRequest();
-}
-
-void WebCoreHttp::scheduleNextRequest()
-{
- int c = 0;
- for (; c < 2; ++c) {
- if (!connection[c].current)
- break;
- }
- if (c >= 2)
- return;
-
- QWebNetworkJob *job = 0;
- while (!job && !m_pendingRequests.isEmpty()) {
- job = m_pendingRequests.takeFirst();
- if (job->cancelled()) {
- job->networkInterface()->finished(job, 1);
- job = 0;
- }
- }
- if (!job)
- return;
-
- QHttp* http = connection[c].http;
-
- connection[c].current = job;
- connection[c].id = -1;
-#ifndef QT_NO_NETWORKPROXY
- int proxyId = http->setProxy(job->frame()->page()->networkProxy());
-#endif
-
- QByteArray postData = job->postData();
- if (!postData.isEmpty())
- connection[c].id = http->request(job->httpHeader(), postData);
- else
- connection[c].id = http->request(job->httpHeader());
-
- DEBUG() << "WebCoreHttp::scheduleNextRequest: using connection" << c;
- DEBUG() << job->httpHeader().toString();
-// DEBUG() << job->request.toString();
-}
-
-int WebCoreHttp::getConnection()
-{
- QObject* o = sender();
- int c;
- if (o == connection[0].http) {
- c = 0;
- } else {
- Q_ASSERT(o == connection[1].http);
- c = 1;
- }
- Q_ASSERT(connection[c].current);
- return c;
-}
-
-void WebCoreHttp::onResponseHeaderReceived(const QHttpResponseHeader& resp)
-{
- QHttp* http = qobject_cast<QHttp*>(sender());
- if (!http->currentId()) {
- qDebug() << "ERROR! Invalid job id. Why?"; // foxnews.com triggers this
- return;
- }
- int c = getConnection();
- QWebNetworkJob* job = connection[c].current;
- DEBUG() << "WebCoreHttp::slotResponseHeaderReceived connection=" << c;
- DEBUG() << resp.toString();
-
- job->setResponse(resp);
-
- job->networkInterface()->started(job);
-}
-
-void WebCoreHttp::onReadyRead()
-{
- QHttp* http = qobject_cast<QHttp*>(sender());
- if (!http->currentId()) {
- qDebug() << "ERROR! Invalid job id. Why?"; // foxnews.com triggers this
- return;
- }
- int c = getConnection();
- QWebNetworkJob* job = connection[c].current;
- Q_ASSERT(http == connection[c].http);
- //DEBUG() << "WebCoreHttp::slotReadyRead connection=" << c;
-
- QByteArray data;
- data.resize(http->bytesAvailable());
- http->read(data.data(), data.length());
- job->networkInterface()->data(job, data);
-}
-
-void WebCoreHttp::onRequestFinished(int id, bool error)
-{
- int c = getConnection();
- if (connection[c].id != id)
- return;
-
- QWebNetworkJob* job = connection[c].current;
- if (!job) {
- scheduleNextRequest();
- return;
- }
-
- QHttp* http = connection[c].http;
- DEBUG() << "WebCoreHttp::slotFinished connection=" << c << error << job;
- if (error) {
- DEBUG() << " error: " << http->errorString();
- job->setErrorString(http->errorString());
- }
-
- if (!error && http->bytesAvailable()) {
- QByteArray data;
- data.resize(http->bytesAvailable());
- http->read(data.data(), data.length());
- job->networkInterface()->data(job, data);
- }
-
- job->networkInterface()->finished(job, error ? 1 : 0);
- connection[c].current = 0;
- connection[c].id = -1;
- scheduleNextRequest();
-}
-
-void WebCoreHttp::onDone(bool error)
-{
- DEBUG() << "WebCoreHttp::onDone" << error;
-}
-
-void WebCoreHttp::onStateChanged(int state)
-{
- DEBUG() << "State changed to" << state << "and connections are" << connection[0].current << connection[1].current;
- if (state == QHttp::Closing || state == QHttp::Unconnected) {
- if (!m_inCancel && m_pendingRequests.isEmpty()
- && !connection[0].current && !connection[1].current)
- emit connectionClosed(info);
- }
-}
-
-void WebCoreHttp::cancel(QWebNetworkJob* request)
-{
- bool doEmit = true;
- m_inCancel = true;
- for (int i = 0; i < 2; ++i) {
- if (request == connection[i].current) {
- connection[i].http->abort();
- doEmit = false;
- }
- }
- if (!m_pendingRequests.removeAll(request))
- doEmit = false;
- m_inCancel = false;
-
- if (doEmit)
- request->networkInterface()->finished(request, 1);
-
- if (m_pendingRequests.isEmpty()
- && !connection[0].current && !connection[1].current)
- emit connectionClosed(info);
-}
-
-void WebCoreHttp::onSslErrors(const QList<QSslError>& errors)
-{
- int c = getConnection();
- QWebNetworkJob *job = connection[c].current;
- if (job) {
- bool continueAnyway = false;
- emit job->networkInterface()->sslErrors(job->frame(), job->url(), errors, &continueAnyway);
-#ifndef QT_NO_OPENSSL
- if (continueAnyway)
- connection[c].http->ignoreSslErrors();
-#endif
- }
-}
-
-void WebCoreHttp::onAuthenticationRequired(const QString& hostname, quint16 port, QAuthenticator* auth)
-{
- int c = getConnection();
- QWebNetworkJob *job = connection[c].current;
- if (job) {
- emit job->networkInterface()->authenticate(job->frame(), job->url(), hostname, port, auth);
- if (auth->isNull())
- connection[c].http->abort();
- }
-}
-
-void WebCoreHttp::onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* auth)
-{
- int c = getConnection();
- QWebNetworkJob *job = connection[c].current;
- if (job) {
- emit job->networkInterface()->authenticateProxy(job->frame(), job->url(), proxy, auth);
- if (auth->isNull())
- connection[c].http->abort();
- }
-}
-
-HostInfo::HostInfo(const QUrl& url)
- : protocol(url.scheme())
- , host(url.host())
- , port(url.port())
-{
- if (port < 0) {
- if (protocol == QLatin1String("http"))
- port = 80;
- else if (protocol == QLatin1String("https"))
- port = 443;
- }
-}
-
-#endif
diff --git a/WebKit/qt/Api/qwebnetworkinterface.h b/WebKit/qt/Api/qwebnetworkinterface.h
deleted file mode 100644
index 7f96155..0000000
--- a/WebKit/qt/Api/qwebnetworkinterface.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef QWEBNETWORKINTERFACE_H
-#define QWEBNETWORKINTERFACE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtNetwork/qhttp.h>
-#include <QtCore/qbytearray.h>
-
-#include "qwebkitglobal.h"
-
-#if QT_VERSION < 0x040400
-
-class QAuthenticator;
-class QNetworkProxy;
-class QSslError;
-class QWebFrame;
-class QWebNetworkJobPrivate;
-class QWebNetworkInterface;
-class QWebObjectPluginConnector;
-
-namespace WebCore {
- class WebCoreHttp;
- class ResourceRequest;
- class FrameLoaderClientQt;
-}
-
-struct QWebNetworkRequestPrivate;
-class QWEBKIT_EXPORT QWebNetworkRequest {
-public:
- enum Method {
- Get,
- Post
- //Head
- };
-
- QWebNetworkRequest();
- explicit QWebNetworkRequest(const QUrl &url, Method method = Get, const QByteArray &postData = QByteArray());
- QWebNetworkRequest(const QWebNetworkRequest &other);
-
- QWebNetworkRequest &operator=(const QWebNetworkRequest &other);
- ~QWebNetworkRequest();
-
- QUrl url() const;
- void setUrl(const QUrl &url);
-
- QHttpRequestHeader httpHeader() const;
- void setHttpHeader(const QHttpRequestHeader &header) const;
-
- QString httpHeaderField(const QString &key) const;
- void setHttpHeaderField(const QString &key, const QString &value);
-
- QByteArray postData() const;
- void setPostData(const QByteArray &data);
-
-private:
- explicit QWebNetworkRequest(const QWebNetworkRequestPrivate &priv);
- explicit QWebNetworkRequest(const WebCore::ResourceRequest &request);
- friend class QWebNetworkJob;
- friend class WebCore::FrameLoaderClientQt;
-
- QWebNetworkRequestPrivate *d;
- friend class QWebObjectPluginConnector;
-};
-
-class QWEBKIT_EXPORT QWebNetworkJob {
-public:
-
- QUrl url() const;
- QByteArray postData() const;
- QHttpRequestHeader httpHeader() const;
- QWebNetworkRequest request() const;
- QString errorString() const;
-
- QHttpResponseHeader response() const;
- void setResponse(const QHttpResponseHeader &response);
- void setErrorString(const QString&);
-
- bool cancelled() const;
-
- void ref();
- bool deref();
-
- QWebNetworkInterface *networkInterface() const;
-
- QWebFrame *frame() const;
-
-protected:
- enum JobStatus {
- JobCreated,
- JobRecreated,
- JobStarted,
- JobReceivingData,
- JobFinished
- };
-
- JobStatus status() const;
- void setStatus(const JobStatus&);
-
-private:
- QWebNetworkJob();
- ~QWebNetworkJob();
-
- friend class QWebNetworkManager;
- friend class QWebObjectPluginConnector;
- friend class QWebNetworkJobPrivate;
-
- QWebNetworkJobPrivate *d;
-};
-
-class QWebNetworkInterfacePrivate;
-
-class QWEBKIT_EXPORT QWebNetworkInterface : public QObject {
- Q_OBJECT
-public:
- QWebNetworkInterface(QObject *parent = 0);
- ~QWebNetworkInterface();
-
- static void setDefaultInterface(QWebNetworkInterface *defaultInterface);
- static QWebNetworkInterface *defaultInterface();
-
- virtual void addJob(QWebNetworkJob *job);
- virtual void cancelJob(QWebNetworkJob *job);
-
-protected:
- void started(QWebNetworkJob*);
- void data(QWebNetworkJob*, const QByteArray &data);
- void finished(QWebNetworkJob*, int errorCode);
-
-signals:
- void sslErrors(QWebFrame *frame, const QUrl& url, const QList<QSslError>& errors, bool *continueAnyway);
- void authenticate(QWebFrame *frame, const QUrl& url, const QString& hostname, quint16 port, QAuthenticator *auth);
- void authenticateProxy(QWebFrame *frame, const QUrl& url, const QNetworkProxy& proxy, QAuthenticator *auth);
-
-private:
- friend class QWebNetworkInterfacePrivate;
- friend class WebCore::WebCoreHttp;
- QWebNetworkInterfacePrivate *d;
-};
-
-#endif
-
-#endif
diff --git a/WebKit/qt/Api/qwebnetworkinterface_p.h b/WebKit/qt/Api/qwebnetworkinterface_p.h
deleted file mode 100644
index aec104b..0000000
--- a/WebKit/qt/Api/qwebnetworkinterface_p.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef QWEBNETWORKINTERFACE_P_H
-#define QWEBNETWORKINTERFACE_P_H
-
-#include "qwebnetworkinterface.h"
-#if QT_VERSION < 0x040400
-#include <qthread.h>
-#include <qmutex.h>
-
-namespace WebCore {
- struct HostInfo;
- class ResourceRequest;
-};
-uint qHash(const WebCore::HostInfo &info);
-#include <qhash.h>
-
-namespace WebCore {
- class ResourceHandle;
-}
-
-struct QWebNetworkRequestPrivate {
- QUrl url;
- QHttpRequestHeader httpHeader;
- QByteArray postData;
-
- void init(const WebCore::ResourceRequest &resourceRequest);
- void init(const QString &method, const QUrl &url, const WebCore::ResourceRequest *resourceRequest = 0);
- void setURL(const QUrl &u);
-};
-
-class QWebNetworkJobPrivate {
-public:
- QWebNetworkJobPrivate()
- : ref(1)
- , resourceHandle(0)
- , redirected(false)
- , interface(0)
- , jobStatus(QWebNetworkJob::JobCreated)
- {}
- int ref;
-
- QWebNetworkRequestPrivate request;
- QHttpResponseHeader response;
-
- WebCore::ResourceHandle *resourceHandle;
- bool redirected;
-
- QWebNetworkInterface *interface;
- QWebNetworkJob::JobStatus jobStatus;
- QString errorString;
-};
-
-class QWebNetworkManager : public QObject {
- Q_OBJECT
-public:
- enum JobMode {
- AsynchronousJob,
- SynchronousJob
- };
-
- static QWebNetworkManager *self();
-
- bool add(WebCore::ResourceHandle *resourceHandle, QWebNetworkInterface *interface, JobMode = AsynchronousJob);
- void cancel(WebCore::ResourceHandle *resourceHandle);
-
- void addHttpJob(QWebNetworkJob *job);
- void cancelHttpJob(QWebNetworkJob *job);
-
-protected:
- void queueStart(QWebNetworkJob*);
- void queueData(QWebNetworkJob*, const QByteArray&);
- void queueFinished(QWebNetworkJob*, int errorCode);
-
-private:
- void started(QWebNetworkJob *);
- void data(QWebNetworkJob *, const QByteArray &data);
- void finished(QWebNetworkJob *, int errorCode);
- void doScheduleWork();
-
-signals:
- void fileRequest(QWebNetworkJob*);
- void scheduleWork();
-
-private slots:
- void httpConnectionClosed(const WebCore::HostInfo &);
- void doWork();
-
-private:
- friend class QWebNetworkInterface;
- QWebNetworkManager();
- QHash<WebCore::HostInfo, WebCore::WebCoreHttp *> m_hostMapping;
-
- struct JobWork {
- enum WorkType {
- JobStarted,
- JobData,
- JobFinished
- };
-
- explicit JobWork(QWebNetworkJob* _job)
- : workType(JobStarted)
- , errorCode(-1)
- , job(_job)
- {}
-
- explicit JobWork(QWebNetworkJob* _job, int _errorCode)
- : workType(JobFinished)
- , errorCode(_errorCode)
- , job(_job)
- {}
-
- explicit JobWork(QWebNetworkJob* _job, const QByteArray& _data)
- : workType(JobData)
- , errorCode(-1)
- , job(_job)
- , data(_data)
- {}
-
- const WorkType workType;
- int errorCode;
- QByteArray data;
- QWebNetworkJob* job;
- };
-
- QMutex m_queueMutex;
- bool m_scheduledWork;
- QList<JobWork*> m_pendingWork;
- QHash<QWebNetworkJob*, int> m_synchronousJobs;
-};
-
-
-namespace WebCore {
-
- class NetworkLoader;
-
- struct HostInfo {
- HostInfo() {}
- HostInfo(const QUrl& url);
- QString protocol;
- QString host;
- int port;
- };
-
- class WebCoreHttp : public QObject {
- Q_OBJECT
- public:
- WebCoreHttp(QObject* parent, const HostInfo&);
- ~WebCoreHttp();
-
- void request(QWebNetworkJob* resource);
- void cancel(QWebNetworkJob*);
-
- signals:
- void connectionClosed(const WebCore::HostInfo&);
-
- private slots:
- void onResponseHeaderReceived(const QHttpResponseHeader& resp);
- void onReadyRead();
- void onRequestFinished(int, bool);
- void onDone(bool);
- void onStateChanged(int);
- void onSslErrors(const QList<QSslError>&);
- void onAuthenticationRequired(const QString& hostname, quint16 port, QAuthenticator*);
- void onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator*);
-
- void scheduleNextRequest();
-
- int getConnection();
-
- public:
- HostInfo info;
- private:
- QList<QWebNetworkJob*> m_pendingRequests;
- struct HttpConnection {
- HttpConnection() : http(0), current(0), id(-1) {}
- QHttp* http;
- QWebNetworkJob* current;
- int id; // the QHttp id
- };
- HttpConnection connection[2];
- bool m_inCancel;
- };
-
-}
-
-class QWebNetworkInterfacePrivate {
-public:
- void sendFileData(QWebNetworkJob* job, int statusCode, const QByteArray& data);
- void parseDataUrl(QWebNetworkJob* job);
-
- QWebNetworkInterface* q;
-};
-
-#endif
-
-#endif
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 56cb4d4..9657cb1 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -102,12 +102,8 @@
#include <QStyle>
#include <QSysInfo>
#include <QTextCharFormat>
-#if QT_VERSION >= 0x040400
#include <QNetworkAccessManager>
#include <QNetworkRequest>
-#else
-#include "qwebnetworkinterface.h"
-#endif
#if defined(Q_WS_X11)
#include <QX11Info>
#endif
@@ -388,11 +384,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
undoStack = 0;
#endif
mainFrame = 0;
-#if QT_VERSION < 0x040400
- networkInterface = 0;
-#else
networkManager = 0;
-#endif
pluginFactory = 0;
insideOpenCall = false;
forwardUnsupportedContent = false;
@@ -421,15 +413,6 @@ QWebPagePrivate::~QWebPagePrivate()
delete page;
}
-#if QT_VERSION < 0x040400
-bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
-{
- if (insideOpenCall
- && frame == mainFrame)
- return true;
- return q->acceptNavigationRequest(frame, request, type);
-}
-#else
bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
{
if (insideOpenCall
@@ -437,7 +420,6 @@ bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRe
return true;
return q->acceptNavigationRequest(frame, request, type);
}
-#endif
void QWebPagePrivate::createMainFrame()
{
@@ -2122,11 +2104,7 @@ void QWebPage::setPreferredContentsSize(const QSize &size) const
\sa createWindow()
*/
-#if QT_VERSION >= 0x040400
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
-#else
-bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
-#endif
{
Q_UNUSED(frame)
if (type == NavigationTypeLinkClicked) {
@@ -2214,27 +2192,19 @@ QAction *QWebPage::action(WebAction action) const
case Back:
text = contextMenuItemTagGoBack();
-#if QT_VERSION >= 0x040400
icon = style->standardIcon(QStyle::SP_ArrowBack);
-#endif
break;
case Forward:
text = contextMenuItemTagGoForward();
-#if QT_VERSION >= 0x040400
icon = style->standardIcon(QStyle::SP_ArrowForward);
-#endif
break;
case Stop:
text = contextMenuItemTagStop();
-#if QT_VERSION >= 0x040400
icon = style->standardIcon(QStyle::SP_BrowserStop);
-#endif
break;
case Reload:
text = contextMenuItemTagReload();
-#if QT_VERSION >= 0x040400
icon = style->standardIcon(QStyle::SP_BrowserReload);
-#endif
break;
case Cut:
@@ -2964,35 +2934,6 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil
#endif
}
-#if QT_VERSION < 0x040400 && !defined qdoc
-
-void QWebPage::setNetworkInterface(QWebNetworkInterface *interface)
-{
- d->networkInterface = interface;
-}
-
-QWebNetworkInterface *QWebPage::networkInterface() const
-{
- if (d->networkInterface)
- return d->networkInterface;
- else
- return QWebNetworkInterface::defaultInterface();
-}
-
-#ifndef QT_NO_NETWORKPROXY
-void QWebPage::setNetworkProxy(const QNetworkProxy& proxy)
-{
- d->networkProxy = proxy;
-}
-
-QNetworkProxy QWebPage::networkProxy() const
-{
- return d->networkProxy;
-}
-#endif
-
-#else
-
/*!
Sets the QNetworkAccessManager \a manager responsible for serving network requests for this
QWebPage.
@@ -3026,8 +2967,6 @@ QNetworkAccessManager *QWebPage::networkAccessManager() const
return d->networkManager;
}
-#endif
-
/*!
Sets the QWebPluginFactory \a factory responsible for creating plugins embedded into this
QWebPage.
@@ -3236,11 +3175,9 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
QString appName = QCoreApplication::applicationName();
if (!appName.isEmpty()) {
ua.append(appName);
-#if QT_VERSION >= 0x040400
QString appVer = QCoreApplication::applicationVersion();
if (!appVer.isEmpty())
ua.append(QLatin1Char('/') + appVer);
-#endif
} else {
// Qt version
ua.append(QLatin1String("Qt/"));
diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h
index 8c455b1..4766cbd 100644
--- a/WebKit/qt/Api/qwebpage.h
+++ b/WebKit/qt/Api/qwebpage.h
@@ -208,20 +208,8 @@ public:
QUndoStack *undoStack() const;
#endif
-#if QT_VERSION < 0x040400 && !defined(qdoc)
- void setNetworkInterface(QWebNetworkInterface *interface);
- QWebNetworkInterface *networkInterface() const;
-
- // #### why is this in the page itself?
-#ifndef QT_NO_NETWORKPROXY
- void setNetworkProxy(const QNetworkProxy& proxy);
- QNetworkProxy networkProxy() const;
-#endif
-
-#else
void setNetworkAccessManager(QNetworkAccessManager *manager);
QNetworkAccessManager *networkAccessManager() const;
-#endif
void setPluginFactory(QWebPluginFactory *factory);
QWebPluginFactory *pluginFactory() const;
@@ -334,10 +322,8 @@ Q_SIGNALS:
void statusBarVisibilityChangeRequested(bool visible);
void menuBarVisibilityChangeRequested(bool visible);
-#if QT_VERSION >= 0x040400
void unsupportedContent(QNetworkReply *reply);
void downloadRequested(const QNetworkRequest &request);
-#endif
void microFocusChanged();
void contentsChanged();
@@ -350,11 +336,7 @@ protected:
virtual QWebPage *createWindow(WebWindowType type);
virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues);
-#if QT_VERSION >= 0x040400
virtual bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
-#else
- virtual bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, NavigationType type);
-#endif
virtual QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile);
virtual void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg);
virtual bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg);
diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index f0f842d..5d97da4 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -151,18 +151,8 @@ public:
bool clickCausedFocus;
-#if QT_VERSION < 0x040400
- bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
-
- QWebNetworkInterface *networkInterface;
-#ifndef QT_NO_NETWORKPROXY
- QNetworkProxy networkProxy;
-#endif
-
-#else
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
QNetworkAccessManager *networkManager;
-#endif
bool forwardUnsupportedContent;
QWebPage::LinkDelegationPolicy linkPolicy;
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index 8ee43a1..09f78d6 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -270,19 +270,11 @@ void QWebView::load(const QUrl &url)
\sa url(), urlChanged()
*/
-#if QT_VERSION < 0x040400 && !defined(qdoc)
-void QWebView::load(const QWebNetworkRequest &request)
-#else
void QWebView::load(const QNetworkRequest &request,
QNetworkAccessManager::Operation operation,
const QByteArray &body)
-#endif
{
- page()->mainFrame()->load(request
-#if QT_VERSION >= 0x040400
- , operation, body
-#endif
- );
+ page()->mainFrame()->load(request, operation, body);
}
/*!
@@ -636,7 +628,6 @@ bool QWebView::event(QEvent *e)
if (e->type() == QEvent::ShortcutOverride) {
d->page->event(e);
#ifndef QT_NO_CURSOR
-#if QT_VERSION >= 0x040400
} else if (e->type() == QEvent::CursorChange) {
// An unsetCursor will set the cursor to Qt::ArrowCursor.
// Thus this cursor change might be a QWidget::unsetCursor()
@@ -649,7 +640,6 @@ bool QWebView::event(QEvent *e)
if (cursor().shape() == Qt::ArrowCursor)
d->page->d->client->resetCursor();
#endif
-#endif
} else if (e->type() == QEvent::Leave)
d->page->event(e);
}
diff --git a/WebKit/qt/Api/qwebview.h b/WebKit/qt/Api/qwebview.h
index e9c1ec8..d7910d9 100644
--- a/WebKit/qt/Api/qwebview.h
+++ b/WebKit/qt/Api/qwebview.h
@@ -27,9 +27,7 @@
#include <QtGui/qicon.h>
#include <QtGui/qpainter.h>
#include <QtCore/qurl.h>
-#if QT_VERSION >= 0x040400
#include <QtNetwork/qnetworkaccessmanager.h>
-#endif
QT_BEGIN_NAMESPACE
class QNetworkRequest;
@@ -66,13 +64,9 @@ public:
void setPage(QWebPage* page);
void load(const QUrl& url);
-#if QT_VERSION < 0x040400 && !defined(qdoc)
- void load(const QWebNetworkRequest& request);
-#else
void load(const QNetworkRequest& request,
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
const QByteArray &body = QByteArray());
-#endif
void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 82447c5..bc052a4 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,44 @@
+2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove support for Qt v4.3 or older versions
+ https://bugs.webkit.org/show_bug.cgi?id=29469
+
+ * Api/qcookiejar.cpp: Removed.
+ * Api/qcookiejar.h: Removed.
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebView::event):
+ * Api/qwebframe.cpp:
+ (QWebFrame::load):
+ * Api/qwebframe.h:
+ * Api/qwebkitglobal.h:
+ * Api/qwebnetworkinterface.cpp: Removed.
+ * Api/qwebnetworkinterface.h: Removed.
+ * Api/qwebnetworkinterface_p.h: Removed.
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPagePrivate::acceptNavigationRequest):
+ (QWebPage::acceptNavigationRequest):
+ (QWebPage::action):
+ (QWebPage::userAgentForUrl):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ * Api/qwebview.cpp:
+ (QWebView::load):
+ (QWebView::event):
+ * Api/qwebview.h:
+ * QtLauncher/main.cpp:
+ (MainWindow::print):
+ (MainWindow::setupUI):
+ (main):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::download):
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
+ (WebCore::FrameLoaderClientQt::startDownload):
+ (WebCore::FrameLoaderClientQt::createPlugin):
+
2009-11-18 Shu Chang <Chang.Shu at nokia.com>
Reviewed by Eric Seidel.
diff --git a/WebKit/qt/QtLauncher/main.cpp b/WebKit/qt/QtLauncher/main.cpp
index eae6171..8ff01e9 100644
--- a/WebKit/qt/QtLauncher/main.cpp
+++ b/WebKit/qt/QtLauncher/main.cpp
@@ -41,7 +41,7 @@
#include <QDebug>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkRequest>
-#if QT_VERSION >= 0x040400 && !defined(QT_NO_PRINTER)
+#if !defined(QT_NO_PRINTER)
#include <QPrintPreviewDialog>
#endif
@@ -274,7 +274,7 @@ protected slots:
}
void print() {
-#if QT_VERSION >= 0x040400 && !defined(QT_NO_PRINTER)
+#if !defined(QT_NO_PRINTER)
QPrintPreviewDialog dlg(this);
connect(&dlg, SIGNAL(paintRequested(QPrinter *)),
view, SLOT(print(QPrinter *)));
@@ -374,9 +374,7 @@ private:
QMenu *fileMenu = menuBar()->addMenu("&File");
QAction *newWindow = fileMenu->addAction("New Window", this, SLOT(newWindow()));
-#if QT_VERSION >= 0x040400
fileMenu->addAction(tr("Print"), this, SLOT(print()), QKeySequence::Print);
-#endif
QAction* screenshot = fileMenu->addAction("Screenshot", this, SLOT(screenshot()));
fileMenu->addAction("Close", this, SLOT(close()));
@@ -569,9 +567,7 @@ int main(int argc, char **argv)
QWebSettings::setMaximumPagesInCache(4);
app.setApplicationName("QtLauncher");
-#if QT_VERSION >= 0x040400
app.setApplicationVersion("0.1");
-#endif
QWebSettings::setObjectCacheCapacities((16*1024*1024) / 8, (16*1024*1024) / 8, 16*1024*1024);
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 77eee7b..4756c04 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -69,14 +69,10 @@
#include <QCoreApplication>
#include <QDebug>
-#if QT_VERSION >= 0x040400
#include <QGraphicsScene>
#include <QGraphicsWidget>
#include <QNetworkRequest>
#include <QNetworkReply>
-#else
-#include "qwebnetworkinterface_p.h"
-#endif
#include "qwebhistory_p.h"
static bool dumpFrameLoaderCallbacks = false;
@@ -781,7 +777,6 @@ WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoad
void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&)
{
-#if QT_VERSION >= 0x040400
if (!m_webFrame)
return;
@@ -794,7 +789,6 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor
else
reply->abort();
}
-#endif
}
void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest& request)
@@ -947,11 +941,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu
void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>, const WebCore::String&)
{
Q_ASSERT(m_webFrame);
-#if QT_VERSION < 0x040400
- QWebNetworkRequest r(request);
-#else
QNetworkRequest r(request.toNetworkRequest(m_webFrame));
-#endif
QWebPage* page = m_webFrame->page();
if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) {
@@ -972,11 +962,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc
void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>)
{
Q_ASSERT(m_webFrame);
-#if QT_VERSION < 0x040400
- QWebNetworkRequest r(request);
-#else
QNetworkRequest r(request.toNetworkRequest(m_webFrame));
-#endif
QWebPage*page = m_webFrame->page();
if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) {
@@ -1001,12 +987,10 @@ void FrameLoaderClientQt::dispatchUnableToImplementPolicy(const WebCore::Resourc
void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request)
{
-#if QT_VERSION >= 0x040400
if (!m_webFrame)
return;
emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame));
-#endif
}
PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
@@ -1226,13 +1210,11 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
#endif // QT_NO_STYLE_STYLESHEET
}
-#if QT_VERSION >= 0x040400
if (!object) {
QWebPluginFactory* factory = m_webFrame->page()->pluginFactory();
if (factory)
object = factory->create(mimeType, qurl, params, values);
}
-#endif
if (object) {
QWidget* widget = qobject_cast<QWidget*>(object);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 33991f4..f795736 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,13 @@
+2009-11-18 Laszlo Gombos <laszlo.1.gombos at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Remove support for Qt v4.3 or older versions
+ https://bugs.webkit.org/show_bug.cgi?id=29469
+
+ * DumpRenderTree/qt/DumpRenderTree.pro:
+ * DumpRenderTree/qt/ImageDiff.pro:
+
2009-11-18 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Eric Seidel.
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
index 73b8639..56a43ea 100644
--- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
+++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
@@ -44,8 +44,4 @@ unix:!mac {
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
}
-lessThan(QT_MINOR_VERSION, 4) {
- DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
-}
-
DEFINES+=USE_SYSTEM_MALLOC
diff --git a/WebKitTools/DumpRenderTree/qt/ImageDiff.pro b/WebKitTools/DumpRenderTree/qt/ImageDiff.pro
index 11ee1fa..636835a 100644
--- a/WebKitTools/DumpRenderTree/qt/ImageDiff.pro
+++ b/WebKitTools/DumpRenderTree/qt/ImageDiff.pro
@@ -13,6 +13,3 @@ unix:!mac {
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
}
-lessThan(QT_MINOR_VERSION, 4) {
- DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE=""
-}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list