Skip to content

Instantly share code, notes, and snippets.

@bbandix
Created May 24, 2012 17:00
Show Gist options
  • Save bbandix/2782802 to your computer and use it in GitHub Desktop.
Save bbandix/2782802 to your computer and use it in GitHub Desktop.
Build fix for older Qt5
From 05bca125fcc24951da2c32f6659c92d6d1b66676 Mon Sep 17 00:00:00 2001
From: Andras Becsi <andras.becsi@nokia.com>
Date: Tue, 12 Jun 2012 19:02:14 +0200
Subject: [PATCH] reverts
---
Source/WTF/wtf/qt/StringQt.cpp | 23 ----
Source/WTF/wtf/text/StringImpl.cpp | 19 ---
Source/WTF/wtf/text/StringImpl.h | 42 -------
Source/WebCore/Target.pri | 7 +-
Source/WebCore/WebCore.pri | 1 -
Source/WebCore/bridge/qt/qt_class.cpp | 4 -
Source/WebCore/bridge/qt/qt_instance.cpp | 25 +----
Source/WebCore/bridge/qt/qt_runtime.cpp | 129 ++++++++------------
Source/WebCore/bridge/qt/qt_runtime.h | 5 -
.../platform/graphics/texmap/TextureMapperGL.cpp | 2 +-
Source/WebCore/plugins/qt/PluginViewQt.cpp | 2 +-
Source/WebKit/qt/Api/qgraphicswebview.h | 2 +-
Source/WebKit/qt/Api/qwebframe.h | 2 +-
Source/WebKit/qt/Api/qwebhistory.h | 2 +-
Source/WebKit/qt/Api/qwebsettings.h | 2 +-
Source/WebKit/qt/Api/qwebview.h | 2 +-
Source/WebKit/qt/declarative/plugin.cpp | 7 -
Source/WebKit/qt/declarative/public.pri | 2 -
.../WebKit2/Shared/qt/ProcessExecutablePathQt.cpp | 2 +-
Source/WebKit2/Target.pri | 2 +-
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | 126 ++++++++++---------
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h | 74 ++++++------
.../WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | 27 ++--
.../UIProcess/API/qt/qwebiconimageprovider.cpp | 45 ++------
.../UIProcess/API/qt/qwebiconimageprovider_p.h | 16 +--
.../API/qt/tests/publicapi/tst_publicapi.cpp | 4 -
.../qt/tests/qmltests/WebView/tst_favIconLoad.qml | 3 +-
.../API/qt/tests/qmltests/tst_qmltests.cpp | 2 +-
Source/WebKit2/UIProcess/qt/QtDialogRunner.h | 6 +-
.../UIProcess/qt/QtWebIconDatabaseClient.cpp | 51 +++++---
.../WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h | 8 +-
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h | 8 +-
Tools/MiniBrowser/qt/qml/BrowserWindow.qml | 2 +-
33 files changed, 238 insertions(+), 416 deletions(-)
diff --git a/Source/WTF/wtf/qt/StringQt.cpp b/Source/WTF/wtf/qt/StringQt.cpp
index 43c4f81..16dd439 100644
--- a/Source/WTF/wtf/qt/StringQt.cpp
+++ b/Source/WTF/wtf/qt/StringQt.cpp
@@ -37,11 +37,7 @@ String::String(const QString& qstr)
{
if (qstr.isNull())
return;
-#if HAVE(QT5)
- m_impl = StringImpl::adopt(const_cast<QString&>(qstr).data_ptr());
-#else
m_impl = StringImpl::create(reinterpret_cast_ptr<const UChar*>(qstr.constData()), qstr.length());
-#endif
}
String::String(const QStringRef& ref)
@@ -53,25 +49,6 @@ String::String(const QStringRef& ref)
String::operator QString() const
{
- if (!m_impl)
- return QString();
-
-#if HAVE(QT5)
- if (QStringData* qStringData = m_impl->qStringData()) {
- // The WTF string was adopted from a QString at some point, so we
- // can just adopt the QStringData like a regular QString copy.
- qStringData->ref.ref();
- QStringDataPtr qStringDataPointer = { qStringData };
- return QString(qStringDataPointer);
- }
-#endif
- if (is8Bit() && !m_impl->has16BitShadow()) {
- // Asking for characters() of an 8-bit string will make a 16-bit copy internally
- // in WTF::String. Since we're going to copy the data to QStringData anyways, we
- // can do the conversion ourselves and save one copy.
- return QString::fromLatin1(reinterpret_cast<const char*>(characters8()), length());
- }
-
return QString(reinterpret_cast<const QChar*>(characters()), length());
}
diff --git a/Source/WTF/wtf/text/StringImpl.cpp b/Source/WTF/wtf/text/StringImpl.cpp
index c4359c1..372db17 100644
--- a/Source/WTF/wtf/text/StringImpl.cpp
+++ b/Source/WTF/wtf/text/StringImpl.cpp
@@ -69,13 +69,6 @@ StringImpl::~StringImpl()
fastFree(const_cast<LChar*>(m_data8));
return;
}
-#if PLATFORM(QT) && HAVE(QT5)
- if (ownership == BufferAdoptedQString) {
- if (!m_qStringData->ref.deref())
- QStringData::deallocate(m_qStringData);
- return;
- }
-#endif
ASSERT(ownership == BufferSubstring);
ASSERT(m_substringBuffer);
@@ -1651,18 +1644,6 @@ PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<UChar>& buffer)
return adoptRef(new StringImpl(buffer.release(), length));
}
-#if PLATFORM(QT) && HAVE(QT5)
-PassRefPtr<StringImpl> StringImpl::adopt(QStringData* qStringData)
-{
- ASSERT(qStringData);
-
- if (!qStringData->size)
- return empty();
-
- return adoptRef(new StringImpl(qStringData, ConstructAdoptedQString));
-}
-#endif
-
PassRefPtr<StringImpl> StringImpl::createWithTerminatingNullCharacter(const StringImpl& string)
{
// Use createUninitialized instead of 'new StringImpl' so that the string and its buffer
diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h
index ec4493e..b8073b3 100644
--- a/Source/WTF/wtf/text/StringImpl.h
+++ b/Source/WTF/wtf/text/StringImpl.h
@@ -31,10 +31,6 @@
#include <wtf/Vector.h>
#include <wtf/unicode/Unicode.h>
-#if PLATFORM(QT) && HAVE(QT5)
-#include <QString>
-#endif
-
#if USE(CF)
typedef const struct __CFString * CFStringRef;
#endif
@@ -86,10 +82,6 @@ private:
BufferInternal,
BufferOwned,
BufferSubstring,
-#if PLATFORM(QT) && HAVE(QT5)
- BufferAdoptedQString
-#endif
- // NOTE: Adding more ownership types needs to extend m_hashAndFlags as we're at capacity
};
// Used to construct static strings, which have an special refCount that can never hit zero.
@@ -223,29 +215,6 @@ private:
m_hashAndFlags = hash | BufferInternal;
}
-#if PLATFORM(QT) && HAVE(QT5)
- // Used to create new strings that adopt an existing QString's data
- enum ConstructAdoptedQStringTag { ConstructAdoptedQString };
- StringImpl(QStringData* qStringData, ConstructAdoptedQStringTag)
- : m_refCount(s_refCountIncrement)
- , m_length(qStringData->size)
- , m_data16(0)
- , m_qStringData(qStringData)
- , m_hashAndFlags(BufferAdoptedQString)
- {
- ASSERT(m_length);
-
- // We ref the string-data to ensure it will be valid for the lifetime of
- // this string. We then deref it in the destructor, so that the string
- // data can eventually be freed.
- m_qStringData->ref.ref();
-
- // Now that we have a ref we can safely reference the string data
- m_data16 = reinterpret_cast_ptr<const UChar*>(qStringData->data());
- ASSERT(m_data16);
- }
-#endif
-
public:
WTF_EXPORT_PRIVATE ~StringImpl();
@@ -339,10 +308,6 @@ public:
static PassRefPtr<StringImpl> adopt(StringBuffer<LChar>& buffer);
WTF_EXPORT_PRIVATE static PassRefPtr<StringImpl> adopt(StringBuffer<UChar>& buffer);
-#if PLATFORM(QT) && HAVE(QT5)
- static PassRefPtr<StringImpl> adopt(QStringData*);
-#endif
-
unsigned length() const { return m_length; }
bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; }
@@ -402,10 +367,6 @@ public:
m_hashAndFlags &= ~s_hashFlagIsAtomic;
}
-#if PLATFORM(QT) && HAVE(QT5)
- QStringData* qStringData() { return bufferOwnership() == BufferAdoptedQString ? m_qStringData : 0; }
-#endif
-
private:
// The high bits of 'hash' are always empty, but we prefer to store our flags
// in the low bits because it makes them slightly more efficient to access.
@@ -630,9 +591,6 @@ private:
void* m_buffer;
StringImpl* m_substringBuffer;
mutable UChar* m_copyData16;
-#if PLATFORM(QT) && HAVE(QT5)
- QStringData* m_qStringData;
-#endif
};
mutable unsigned m_hashAndFlags;
};
diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri
index bcd00c1..093457c 100644
--- a/Source/WebCore/Target.pri
+++ b/Source/WebCore/Target.pri
@@ -398,17 +398,12 @@ v8 {
bridge/qt/qt_class.cpp \
bridge/qt/qt_instance.cpp \
bridge/qt/qt_pixmapruntime.cpp \
+ bridge/qt/qt_runtime.cpp \
bridge/runtime_array.cpp \
bridge/runtime_method.cpp \
bridge/runtime_object.cpp \
bridge/runtime_root.cpp \
testing/js/WebCoreTestSupport.cpp
-
- haveQt(5) {
- SOURCES += bridge/qt/qt_runtime.cpp
- } else {
- SOURCES += bridge/qt/qt_runtime_qt4.cpp
- }
}
SOURCES += \
diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri
index 3469db7..c90dcfc 100644
--- a/Source/WebCore/WebCore.pri
+++ b/Source/WebCore/WebCore.pri
@@ -13,7 +13,6 @@ SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebCore
CONFIG += texmap
QT *= network sql
-haveQt(5): QT *= gui-private
WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_SOURCES_DESTDIR}
diff --git a/Source/WebCore/bridge/qt/qt_class.cpp b/Source/WebCore/bridge/qt/qt_class.cpp
index 00cd1c4..bf97a01 100644
--- a/Source/WebCore/bridge/qt/qt_class.cpp
+++ b/Source/WebCore/bridge/qt/qt_class.cpp
@@ -99,16 +99,12 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, PropertyName id
if (m.access() == QMetaMethod::Private)
continue;
-#if !HAVE(QT5)
int iter = 0;
const char* signature = m.signature();
while (signature[iter] && signature[iter] != '(')
++iter;
if (normal == QByteArray::fromRawData(signature, iter)) {
-#else
- if (normal == m.name()) {
-#endif
QtRuntimeMetaMethod* val = QtRuntimeMetaMethod::create(exec, ustring, static_cast<QtInstance*>(inst), index, normal, false);
qtinst->m_methods.insert(name, val);
return val;
diff --git a/Source/WebCore/bridge/qt/qt_instance.cpp b/Source/WebCore/bridge/qt/qt_instance.cpp
index 9cf8d5e..716f72f 100644
--- a/Source/WebCore/bridge/qt/qt_instance.cpp
+++ b/Source/WebCore/bridge/qt/qt_instance.cpp
@@ -221,14 +221,8 @@ void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array)
const int methodCount = meta->methodCount();
for (i = 0; i < methodCount; i++) {
QMetaMethod method = meta->method(i);
- if (method.access() != QMetaMethod::Private) {
-#if HAVE(QT5)
- QByteArray sig = method.methodSignature();
- array.add(Identifier(exec, UString(sig.constData(), sig.length())));
-#else
+ if (method.access() != QMetaMethod::Private)
array.add(Identifier(exec, method.signature()));
-#endif
- }
}
}
}
@@ -274,18 +268,6 @@ JSValue QtInstance::stringValue(ExecState* exec) const
// Check to see how much we can call it
if (m.access() != QMetaMethod::Private
&& m.methodType() != QMetaMethod::Signal
-#if HAVE(QT5)
- && m.parameterCount() == 0
- && m.returnType() != QMetaType::Void) {
- QVariant ret(m.returnType(), (void*)0);
- void * qargs[1];
- qargs[0] = ret.data();
-
- if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, qargs) < 0) {
- if (ret.isValid() && ret.canConvert(QVariant::String)) {
- buf = ret.toString().toLatin1().constData(); // ### Latin 1? Ascii?
- useDefault = false;
-#else
&& m.parameterTypes().isEmpty()) {
const char* retsig = m.typeName();
if (retsig && *retsig) {
@@ -298,7 +280,6 @@ JSValue QtInstance::stringValue(ExecState* exec) const
buf = ret.toString().toLatin1().constData(); // ### Latin 1? Ascii?
useDefault = false;
}
-#endif
}
}
}
@@ -388,11 +369,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue
if (obj) {
QMetaType::Type argtype = QMetaType::Void;
if (m_type == MetaProperty)
-#if HAVE(QT5)
- argtype = (QMetaType::Type) m_property.userType();
-#else
argtype = (QMetaType::Type) QMetaType::type(m_property.typeName());
-#endif
// dynamic properties just get any QVariant
QVariant val = convertValueToQVariant(exec, aValue, argtype, 0);
diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp
index 04a9305..fd980ae 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.cpp
+++ b/Source/WebCore/bridge/qt/qt_runtime.cpp
@@ -1161,10 +1161,14 @@ static int findMethodIndex(ExecState* exec,
continue;
// try and find all matching named methods
- if (!overloads && m.methodSignature() == signature)
- matchingIndices.append(i);
- else if (overloads && m.name() == signature)
+ if (m.signature() == signature)
matchingIndices.append(i);
+ else if (overloads) {
+ QByteArray rawsignature = m.signature();
+ rawsignature.truncate(rawsignature.indexOf('('));
+ if (rawsignature == signature)
+ matchingIndices.append(i);
+ }
}
int chosenIndex = -1;
@@ -1185,9 +1189,11 @@ static int findMethodIndex(ExecState* exec,
// resolve return type
QByteArray returnTypeName = method.typeName();
- int rtype = method.returnType();
- if (rtype == QMetaType::UnknownType) {
- if (returnTypeName.endsWith('*')) {
+ int rtype = QMetaType::type(returnTypeName);
+ if ((rtype == 0) && !returnTypeName.isEmpty()) {
+ if (returnTypeName == "QVariant") {
+ types.append(QtMethodMatchType::variant());
+ } else if (returnTypeName.endsWith('*')) {
types.append(QtMethodMatchType::metaType(QMetaType::VoidStar, returnTypeName));
} else {
int enumIndex = indexOfMetaEnum(meta, returnTypeName);
@@ -1199,7 +1205,7 @@ static int findMethodIndex(ExecState* exec,
}
}
} else {
- if (rtype == QMetaType::QVariant)
+ if (returnTypeName == "QVariant")
types.append(QtMethodMatchType::variant());
else
types.append(QtMethodMatchType::metaType(rtype, returnTypeName));
@@ -1209,17 +1215,21 @@ static int findMethodIndex(ExecState* exec,
QList<QByteArray> parameterTypeNames = method.parameterTypes();
for (int i = 0; i < parameterTypeNames.count(); ++i) {
QByteArray argTypeName = parameterTypeNames.at(i);
- int atype = method.parameterType(i);
- if (atype == QMetaType::UnknownType) {
- int enumIndex = indexOfMetaEnum(meta, argTypeName);
- if (enumIndex != -1)
- types.append(QtMethodMatchType::metaEnum(enumIndex, argTypeName));
- else {
- unresolvedTypes = true;
- types.append(QtMethodMatchType::unresolved(argTypeName));
+ int atype = QMetaType::type(argTypeName);
+ if (atype == 0) {
+ if (argTypeName == "QVariant") {
+ types.append(QtMethodMatchType::variant());
+ } else {
+ int enumIndex = indexOfMetaEnum(meta, argTypeName);
+ if (enumIndex != -1)
+ types.append(QtMethodMatchType::metaEnum(enumIndex, argTypeName));
+ else {
+ unresolvedTypes = true;
+ types.append(QtMethodMatchType::unresolved(argTypeName));
+ }
}
} else {
- if (atype == QMetaType::QVariant)
+ if (argTypeName == "QVariant")
types.append(QtMethodMatchType::variant());
else
types.append(QtMethodMatchType::metaType(atype, argTypeName));
@@ -1228,13 +1238,13 @@ static int findMethodIndex(ExecState* exec,
// If the native method requires more arguments than what was passed from JavaScript
if (exec->argumentCount() + 1 < static_cast<unsigned>(types.count())) {
- qMatchDebug() << "Match:too few args for" << method.methodSignature();
+ qMatchDebug() << "Match:too few args for" << method.signature();
tooFewArgs.append(index);
continue;
}
if (unresolvedTypes) {
- qMatchDebug() << "Match:unresolved arg types for" << method.methodSignature();
+ qMatchDebug() << "Match:unresolved arg types for" << method.signature();
// remember it so we can give an error message later, if necessary
unresolved.append(QtMethodMatchData(/*matchDistance=*/INT_MAX, index,
types, QVarLengthArray<QVariant, 10>()));
@@ -1246,8 +1256,7 @@ static int findMethodIndex(ExecState* exec,
args.resize(types.count());
QtMethodMatchType retType = types[0];
- if (retType.typeId() != QMetaType::Void)
- args[0] = QVariant(retType.typeId(), (void *)0); // the return value
+ args[0] = QVariant(retType.typeId(), (void *)0); // the return value
bool converted = true;
int matchDistance = 0;
@@ -1265,7 +1274,7 @@ static int findMethodIndex(ExecState* exec,
}
}
- qMatchDebug() << "Match: " << method.methodSignature() << (converted ? "converted":"failed to convert") << "distance " << matchDistance;
+ qMatchDebug() << "Match: " << method.signature() << (converted ? "converted":"failed to convert") << "distance " << matchDistance;
if (converted) {
if ((exec->argumentCount() + 1 == static_cast<unsigned>(types.count()))
@@ -1300,12 +1309,12 @@ static int findMethodIndex(ExecState* exec,
// No valid functions at all - format an error message
if (!conversionFailed.isEmpty()) {
QString message = QString::fromLatin1("incompatible type of argument(s) in call to %0(); candidates were\n")
- .arg(QString::fromLatin1(signature));
+ .arg(QLatin1String(signature));
for (int i = 0; i < conversionFailed.size(); ++i) {
if (i > 0)
message += QLatin1String("\n");
QMetaMethod mtd = meta->method(conversionFailed.at(i));
- message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature()));
+ message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature()));
}
*pError = throwError(exec, createTypeError(exec, message.toLatin1().constData()));
} else if (!unresolved.isEmpty()) {
@@ -1319,12 +1328,12 @@ static int findMethodIndex(ExecState* exec,
*pError = throwError(exec, createTypeError(exec, message.toLatin1().constData()));
} else {
QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n")
- .arg(QString::fromLatin1(signature));
+ .arg(QLatin1String(signature));
for (int i = 0; i < tooFewArgs.size(); ++i) {
if (i > 0)
message += QLatin1String("\n");
QMetaMethod mtd = meta->method(tooFewArgs.at(i));
- message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature()));
+ message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature()));
}
*pError = throwError(exec, createSyntaxError(exec, message.toLatin1().constData()));
}
@@ -1345,7 +1354,7 @@ static int findMethodIndex(ExecState* exec,
if (i > 0)
message += QLatin1String("\n");
QMetaMethod mtd = meta->method(candidates.at(i).index);
- message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.methodSignature()));
+ message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature()));
}
}
*pError = throwError(exec, createTypeError(exec, message.toLatin1().constData()));
@@ -1760,64 +1769,29 @@ QtConnectionObject::~QtConnectionObject()
JSValueUnprotect(m_context, m_receiverFunction);
}
-// Begin moc-generated code -- modify with care! Check "HAND EDIT" parts
-struct qt_meta_stringdata_QtConnectionObject_t {
- QByteArrayData data[3];
- char stringdata[44];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) { \
- Q_REFCOUNT_INITIALIZE_STATIC, len, 0, 0, \
- offsetof(qt_meta_stringdata_QtConnectionObject_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- }
-static const qt_meta_stringdata_QtConnectionObject_t qt_meta_stringdata_QtConnectionObject = {
- {
-QT_MOC_LITERAL(0, 0, 33),
-QT_MOC_LITERAL(1, 34, 7),
-QT_MOC_LITERAL(2, 42, 0)
- },
- "JSC::Bindings::QtConnectionObject\0"
- "execute\0\0"
-};
-#undef QT_MOC_LITERAL
-
static const uint qt_meta_data_QtConnectionObject[] = {
// content:
- 7, // revision
+ 1, // revision
0, // classname
0, 0, // classinfo
- 1, 14, // methods
+ 1, 10, // methods
0, 0, // properties
0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 0, // signalCount
-
- // slots: name, argc, parameters, tag, flags
- 1, 0, 19, 2, 0x0a,
- // slots: parameters
- QMetaType::Void,
+ // slots: signature, parameters, type, tag, flags
+ 28, 27, 27, 27, 0x0a,
0 // eod
};
-void QtConnectionObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- Q_ASSERT(staticMetaObject.cast(_o));
- QtConnectionObject *_t = static_cast<QtConnectionObject *>(_o);
- switch (_id) {
- case 0: _t->execute(_a); break; // HAND EDIT: add _a parameter
- default: ;
- }
- }
-}
+static const char qt_meta_stringdata_QtConnectionObject[] = {
+ "JSC::Bindings::QtConnectionObject\0\0execute()\0"
+};
const QMetaObject QtConnectionObject::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_QtConnectionObject.data,
- qt_meta_data_QtConnectionObject, qt_static_metacall, 0, 0 }
+ { &QObject::staticMetaObject, qt_meta_stringdata_QtConnectionObject,
+ qt_meta_data_QtConnectionObject, 0 }
};
const QMetaObject *QtConnectionObject::metaObject() const
@@ -1828,24 +1802,25 @@ const QMetaObject *QtConnectionObject::metaObject() const
void *QtConnectionObject::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_QtConnectionObject.stringdata))
+ if (!strcmp(_clname, qt_meta_stringdata_QtConnectionObject))
return static_cast<void*>(const_cast<QtConnectionObject*>(this));
return QObject::qt_metacast(_clname);
}
+// This is what moc would generate except by the fact that we pass all arguments to our execute() slot.
int QtConnectionObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 1)
- qt_static_metacall(this, _c, _id, _a);
+ switch (_id) {
+ case 0: execute(_a); break;
+ }
_id -= 1;
}
return _id;
}
-// End of moc-generated code
static bool isJavaScriptFunction(JSObjectRef object)
{
@@ -1867,10 +1842,12 @@ void QtConnectionObject::execute(void** argv)
const QMetaObject* meta = sender->metaObject();
const QMetaMethod method = meta->method(m_signalIndex);
+ QList<QByteArray> parameterTypes = method.parameterTypes();
+
JSValueRef* ignoredException = 0;
JSRetainPtr<JSStringRef> lengthProperty(JSStringCreateWithUTF8CString("length"));
int receiverLength = int(JSValueToNumber(m_context, JSObjectGetProperty(m_context, m_receiverFunction, lengthProperty.get(), ignoredException), ignoredException));
- int argc = qMax(method.parameterCount(), receiverLength);
+ int argc = qMax(parameterTypes.count(), receiverLength);
WTF::Vector<JSValueRef> args(argc);
// TODO: remove once conversion functions use JSC API.
@@ -1878,7 +1855,7 @@ void QtConnectionObject::execute(void** argv)
RefPtr<RootObject> rootObject = m_senderInstance->rootObject();
for (int i = 0; i < argc; i++) {
- int argType = method.parameterType(i);
+ int argType = QMetaType::type(parameterTypes.at(i));
args[i] = ::toRef(exec, convertQVariantToValue(exec, rootObject, QVariant(argType, argv[i+1])));
}
diff --git a/Source/WebCore/bridge/qt/qt_runtime.h b/Source/WebCore/bridge/qt/qt_runtime.h
index 4d9afa4..11518a5 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.h
+++ b/Source/WebCore/bridge/qt/qt_runtime.h
@@ -238,20 +238,15 @@ private:
// with the appropriate signal of 'sender'. When execute() is called, it will call JS 'receiverFunction'.
class QtConnectionObject : public QObject
{
-#if HAVE(QT5)
- Q_OBJECT_FAKE
-#endif
public:
QtConnectionObject(JSContextRef, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction);
~QtConnectionObject();
-#if !HAVE(QT5)
// Explicitly define these because want a custom qt_metacall(), so we can't use Q_OBJECT macro.
static const QMetaObject staticMetaObject;
virtual const QMetaObject *metaObject() const;
virtual void *qt_metacast(const char *);
virtual int qt_metacall(QMetaObject::Call, int, void **argv);
-#endif
void execute(void **argv);
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
index 6b2aca0..e6de7ae 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
@@ -37,7 +37,7 @@
#if PLATFORM(QT)
#if QT_VERSION >= 0x050000
#include <QOpenGLContext>
-#include <qpa/qplatformpixmap.h>
+#include <QPlatformPixmap>
#else
#include <QGLContext>
#endif // QT_VERSION
diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
index eda0504..2579484 100644
--- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
@@ -82,7 +82,7 @@
#if HAVE(QT5)
#include "QtX11ImageConversion.h"
#include <QGuiApplication>
-#include <qpa/qplatformnativeinterface.h>
+#include <QPlatformNativeInterface>
#include <QWindow>
#else
#include "PluginContainerQt.h"
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h
index 15fe087..523a4d1 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.h
+++ b/Source/WebKit/qt/Api/qgraphicswebview.h
@@ -29,7 +29,7 @@
#include <QtGui/qgraphicswidget.h>
#endif
#include <QtGui/qevent.h>
-#include <QtGui/qicon.h>
+#include <qicon.h>
#include <QtGui/qpainter.h>
#include <QtNetwork/qnetworkaccessmanager.h>
diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/Api/qwebframe.h
index 0a8e6fc..b4ec812 100644
--- a/Source/WebKit/qt/Api/qwebframe.h
+++ b/Source/WebKit/qt/Api/qwebframe.h
@@ -24,7 +24,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
-#include <QtGui/qicon.h>
+#include <qicon.h>
#include <QtScript/qscriptengine.h>
#include <QtNetwork/qnetworkaccessmanager.h>
#include "qwebkitglobal.h"
diff --git a/Source/WebKit/qt/Api/qwebhistory.h b/Source/WebKit/qt/Api/qwebhistory.h
index 753eb63..b379745 100644
--- a/Source/WebKit/qt/Api/qwebhistory.h
+++ b/Source/WebKit/qt/Api/qwebhistory.h
@@ -24,7 +24,7 @@
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qshareddata.h>
-#include <QtGui/qicon.h>
+#include <qicon.h>
#include "qwebkitglobal.h"
diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h
index 0aee525..3f9ef65 100644
--- a/Source/WebKit/qt/Api/qwebsettings.h
+++ b/Source/WebKit/qt/Api/qwebsettings.h
@@ -24,7 +24,7 @@
#include <QtCore/qstring.h>
#include <QtGui/qpixmap.h>
-#include <QtGui/qicon.h>
+#include <qicon.h>
#include <QtCore/qshareddata.h>
namespace WebCore {
diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/Api/qwebview.h
index 90d0a8e..2d64647 100644
--- a/Source/WebKit/qt/Api/qwebview.h
+++ b/Source/WebKit/qt/Api/qwebview.h
@@ -28,7 +28,7 @@
#else
#include <QtGui/qwidget.h>
#endif
-#include <QtGui/qicon.h>
+#include <qicon.h>
#include <QtGui/qpainter.h>
#include <QtCore/qurl.h>
#include <QtNetwork/qnetworkaccessmanager.h>
diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp
index 988b36e..11fa33e 100644
--- a/Source/WebKit/qt/declarative/plugin.cpp
+++ b/Source/WebKit/qt/declarative/plugin.cpp
@@ -17,21 +17,14 @@
Boston, MA 02110-1301, USA.
*/
-#include "config.h"
-
#include "qglobal.h"
#if defined(HAVE_QQUICK1)
#include "qdeclarativewebview_p.h"
#endif
-#if (HAVE(QT5))
#include <QtQml/qqml.h>
#include <QtQml/qqmlextensionplugin.h>
-#else
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#endif
#if defined(HAVE_WEBKIT2)
#include "private/qquickwebpage_p.h"
diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri
index 576ce03..04b17b7 100644
--- a/Source/WebKit/qt/declarative/public.pri
+++ b/Source/WebKit/qt/declarative/public.pri
@@ -34,8 +34,6 @@ contains(DEFINES, HAVE_QQUICK1=1) {
HEADERS += qdeclarativewebview_p.h
}
-WEBKIT += wtf
-
DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}
CONFIG += rpath
diff --git a/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp b/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp
index 9cb29b3..4b4f824 100644
--- a/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp
+++ b/Source/WebKit2/Shared/qt/ProcessExecutablePathQt.cpp
@@ -33,7 +33,7 @@
namespace WebKit {
-static String executablePath(QString baseName)
+static String executablePath(QLatin1String baseName)
{
QString expectedPath = QCoreApplication::applicationDirPath() + QDir::separator() + baseName;
if (QFile::exists(expectedPath))
diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri
index 3cbe91f..cee7a20 100644
--- a/Source/WebKit2/Target.pri
+++ b/Source/WebKit2/Target.pri
@@ -12,7 +12,7 @@ load(features)
include(WebKit2.pri)
WEBKIT += wtf javascriptcore webcore
-QT += qml quick quick-private
+QT += declarative quick quick-private
CONFIG += staticlib
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 9bdd638..4cfbdd6 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -44,7 +44,6 @@
#include "qquickwebpage_p_p.h"
#include "qquickwebview_p_p.h"
#include "qwebdownloaditem_p_p.h"
-#include "qwebiconimageprovider_p.h"
#include "qwebkittest_p.h"
#include "qwebloadrequest_p.h"
#include "qwebnavigationhistory_p.h"
@@ -57,7 +56,6 @@
#include <QDateTime>
#include <QtCore/QFile>
#include <QtQml/QJSValue>
-#include <QtQuick/QQuickView>
#include <WKOpenPanelResultListener.h>
#include <WKSerializedScriptValue.h>
#include <WebCore/IntPoint.h>
@@ -307,7 +305,7 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
navigationHistory = adoptPtr(QWebNavigationHistoryPrivate::createHistory(toAPI(webPageProxy.get())));
QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
- QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QString)), q_ptr, SLOT(_q_onIconChangedForPageURL(QString)));
+ QObject::connect(iconDatabase, SIGNAL(iconChangedForPageURL(QUrl, QUrl)), q_ptr, SLOT(_q_onIconChangedForPageURL(QUrl, QUrl)));
// Any page setting should preferrable be set before creating the page.
webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
@@ -377,6 +375,9 @@ void QQuickWebViewPrivate::loadProgressDidChange(int loadProgress)
{
Q_Q(QQuickWebView);
+ if (!loadProgress)
+ setIcon(QUrl());
+
m_loadProgress = loadProgress;
emit q->loadProgressChanged();
@@ -419,6 +420,16 @@ void QQuickWebViewPrivate::setNeedsDisplay()
q->page()->update();
}
+void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL)
+{
+ Q_Q(QQuickWebView);
+
+ if (q->url() != pageURL)
+ return;
+
+ setIcon(iconURL);
+}
+
void QQuickWebViewPrivate::processDidCrash()
{
Q_Q(QQuickWebView);
@@ -472,38 +483,8 @@ void QQuickWebViewPrivate::_q_onVisibleChanged()
void QQuickWebViewPrivate::_q_onUrlChanged()
{
- updateIcon();
-}
-
-void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QString& pageUrl)
-{
- if (pageUrl != QString(m_currentUrl))
- return;
-
- updateIcon();
-}
-
-/* Called either when the url changes, or when the icon for the current page changes */
-void QQuickWebViewPrivate::updateIcon()
-{
Q_Q(QQuickWebView);
-
- QQuickView* view = qobject_cast<QQuickView*>(q->canvas());
- if (!view)
- return;
-
- QWebIconImageProvider* provider = static_cast<QWebIconImageProvider*>(
- view->engine()->imageProvider(QWebIconImageProvider::identifier()));
- if (!provider)
- return;
-
- WTF::String iconUrl = provider->iconURLForPageURLInContext(m_currentUrl, context.get());
-
- if (iconUrl == m_iconUrl)
- return;
-
- m_iconUrl = iconUrl;
- emit q->iconChanged();
+ context->iconDatabase()->requestIconForPageURL(q->url());
}
void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* downloadItem)
@@ -513,7 +494,7 @@ void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* d
return;
Q_Q(QQuickWebView);
- QQmlEngine::setObjectOwnership(downloadItem, QQmlEngine::JavaScriptOwnership);
+ QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::JavaScriptOwnership);
emit q->experimental()->downloadRequested(downloadItem);
}
@@ -663,6 +644,31 @@ void QQuickWebViewPrivate::addAttachedPropertyTo(QObject* object)
attached->setView(q);
}
+void QQuickWebViewPrivate::setIcon(const QUrl& iconURL)
+{
+ Q_Q(QQuickWebView);
+ if (m_iconURL == iconURL)
+ return;
+
+ if (!webPageProxy->mainFrame())
+ return;
+
+ String oldPageURL = QUrl::fromPercentEncoding(m_iconURL.encodedFragment());
+ String newPageURL = webPageProxy->mainFrame()->url();
+
+ if (oldPageURL != newPageURL) {
+ QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
+ if (!oldPageURL.isEmpty())
+ iconDatabase->releaseIconForPageURL(oldPageURL);
+
+ if (!newPageURL.isEmpty())
+ iconDatabase->retainIconForPageURL(newPageURL);
+ }
+
+ m_iconURL = iconURL;
+ emit q->iconChanged();
+}
+
bool QQuickWebViewPrivate::navigatorQtObjectEnabled() const
{
return m_navigatorQtObjectEnabled;
@@ -997,13 +1003,13 @@ void QQuickWebViewExperimental::postMessage(const QString& message)
d->context->postMessageToNavigatorQtObject(d->webPageProxy.get(), message);
}
-QQmlComponent* QQuickWebViewExperimental::alertDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::alertDialog() const
{
Q_D(const QQuickWebView);
return d->alertDialog;
}
-void QQuickWebViewExperimental::setAlertDialog(QQmlComponent* alertDialog)
+void QQuickWebViewExperimental::setAlertDialog(QDeclarativeComponent* alertDialog)
{
Q_D(QQuickWebView);
if (d->alertDialog == alertDialog)
@@ -1012,13 +1018,13 @@ void QQuickWebViewExperimental::setAlertDialog(QQmlComponent* alertDialog)
emit alertDialogChanged();
}
-QQmlComponent* QQuickWebViewExperimental::confirmDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::confirmDialog() const
{
Q_D(const QQuickWebView);
return d->confirmDialog;
}
-void QQuickWebViewExperimental::setConfirmDialog(QQmlComponent* confirmDialog)
+void QQuickWebViewExperimental::setConfirmDialog(QDeclarativeComponent* confirmDialog)
{
Q_D(QQuickWebView);
if (d->confirmDialog == confirmDialog)
@@ -1032,7 +1038,7 @@ QWebNavigationHistory* QQuickWebViewExperimental::navigationHistory() const
return d_ptr->navigationHistory.get();
}
-QQmlComponent* QQuickWebViewExperimental::promptDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::promptDialog() const
{
Q_D(const QQuickWebView);
return d->promptDialog;
@@ -1046,7 +1052,7 @@ QWebPreferences* QQuickWebViewExperimental::preferences() const
return d->preferences.get();
}
-void QQuickWebViewExperimental::setPromptDialog(QQmlComponent* promptDialog)
+void QQuickWebViewExperimental::setPromptDialog(QDeclarativeComponent* promptDialog)
{
Q_D(QQuickWebView);
if (d->promptDialog == promptDialog)
@@ -1055,13 +1061,13 @@ void QQuickWebViewExperimental::setPromptDialog(QQmlComponent* promptDialog)
emit promptDialogChanged();
}
-QQmlComponent* QQuickWebViewExperimental::authenticationDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::authenticationDialog() const
{
Q_D(const QQuickWebView);
return d->authenticationDialog;
}
-void QQuickWebViewExperimental::setAuthenticationDialog(QQmlComponent* authenticationDialog)
+void QQuickWebViewExperimental::setAuthenticationDialog(QDeclarativeComponent* authenticationDialog)
{
Q_D(QQuickWebView);
if (d->authenticationDialog == authenticationDialog)
@@ -1070,13 +1076,13 @@ void QQuickWebViewExperimental::setAuthenticationDialog(QQmlComponent* authentic
emit authenticationDialogChanged();
}
-QQmlComponent* QQuickWebViewExperimental::proxyAuthenticationDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::proxyAuthenticationDialog() const
{
Q_D(const QQuickWebView);
return d->proxyAuthenticationDialog;
}
-void QQuickWebViewExperimental::setProxyAuthenticationDialog(QQmlComponent* proxyAuthenticationDialog)
+void QQuickWebViewExperimental::setProxyAuthenticationDialog(QDeclarativeComponent* proxyAuthenticationDialog)
{
Q_D(QQuickWebView);
if (d->proxyAuthenticationDialog == proxyAuthenticationDialog)
@@ -1084,13 +1090,13 @@ void QQuickWebViewExperimental::setProxyAuthenticationDialog(QQmlComponent* prox
d->proxyAuthenticationDialog = proxyAuthenticationDialog;
emit proxyAuthenticationDialogChanged();
}
-QQmlComponent* QQuickWebViewExperimental::certificateVerificationDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::certificateVerificationDialog() const
{
Q_D(const QQuickWebView);
return d->certificateVerificationDialog;
}
-void QQuickWebViewExperimental::setCertificateVerificationDialog(QQmlComponent* certificateVerificationDialog)
+void QQuickWebViewExperimental::setCertificateVerificationDialog(QDeclarativeComponent* certificateVerificationDialog)
{
Q_D(QQuickWebView);
if (d->certificateVerificationDialog == certificateVerificationDialog)
@@ -1099,13 +1105,13 @@ void QQuickWebViewExperimental::setCertificateVerificationDialog(QQmlComponent*
emit certificateVerificationDialogChanged();
}
-QQmlComponent* QQuickWebViewExperimental::itemSelector() const
+QDeclarativeComponent* QQuickWebViewExperimental::itemSelector() const
{
Q_D(const QQuickWebView);
return d->itemSelector;
}
-void QQuickWebViewExperimental::setItemSelector(QQmlComponent* itemSelector)
+void QQuickWebViewExperimental::setItemSelector(QDeclarativeComponent* itemSelector)
{
Q_D(QQuickWebView);
if (d->itemSelector == itemSelector)
@@ -1114,13 +1120,13 @@ void QQuickWebViewExperimental::setItemSelector(QQmlComponent* itemSelector)
emit itemSelectorChanged();
}
-QQmlComponent* QQuickWebViewExperimental::filePicker() const
+QDeclarativeComponent* QQuickWebViewExperimental::filePicker() const
{
Q_D(const QQuickWebView);
return d->filePicker;
}
-void QQuickWebViewExperimental::setFilePicker(QQmlComponent* filePicker)
+void QQuickWebViewExperimental::setFilePicker(QDeclarativeComponent* filePicker)
{
Q_D(QQuickWebView);
if (d->filePicker == filePicker)
@@ -1129,13 +1135,13 @@ void QQuickWebViewExperimental::setFilePicker(QQmlComponent* filePicker)
emit filePickerChanged();
}
-QQmlComponent* QQuickWebViewExperimental::databaseQuotaDialog() const
+QDeclarativeComponent* QQuickWebViewExperimental::databaseQuotaDialog() const
{
Q_D(const QQuickWebView);
return d->databaseQuotaDialog;
}
-void QQuickWebViewExperimental::setDatabaseQuotaDialog(QQmlComponent* databaseQuotaDialog)
+void QQuickWebViewExperimental::setDatabaseQuotaDialog(QDeclarativeComponent* databaseQuotaDialog)
{
Q_D(QQuickWebView);
if (d->databaseQuotaDialog == databaseQuotaDialog)
@@ -1295,7 +1301,7 @@ void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts)
emit userScriptsChanged();
}
-QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index)
+QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property, int index)
{
const QObjectList children = property->object->children();
if (index < children.count())
@@ -1303,7 +1309,7 @@ QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListP
return 0;
}
-void QQuickWebViewExperimental::schemeDelegates_Append(QQmlListProperty<QQuickUrlSchemeDelegate>* property, QQuickUrlSchemeDelegate *scheme)
+void QQuickWebViewExperimental::schemeDelegates_Append(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property, QQuickUrlSchemeDelegate *scheme)
{
QObject* schemeParent = property->object;
scheme->setParent(schemeParent);
@@ -1315,12 +1321,12 @@ void QQuickWebViewExperimental::schemeDelegates_Append(QQmlListProperty<QQuickUr
d->webPageProxy->registerApplicationScheme(scheme->scheme());
}
-int QQuickWebViewExperimental::schemeDelegates_Count(QQmlListProperty<QQuickUrlSchemeDelegate>* property)
+int QQuickWebViewExperimental::schemeDelegates_Count(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property)
{
return property->object->children().count();
}
-void QQuickWebViewExperimental::schemeDelegates_Clear(QQmlListProperty<QQuickUrlSchemeDelegate>* property)
+void QQuickWebViewExperimental::schemeDelegates_Clear(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property)
{
const QObjectList children = property->object->children();
for (int index = 0; index < children.count(); index++) {
@@ -1330,9 +1336,9 @@ void QQuickWebViewExperimental::schemeDelegates_Clear(QQmlListProperty<QQuickUrl
}
}
-QQmlListProperty<QQuickUrlSchemeDelegate> QQuickWebViewExperimental::schemeDelegates()
+QDeclarativeListProperty<QQuickUrlSchemeDelegate> QQuickWebViewExperimental::schemeDelegates()
{
- return QQmlListProperty<QQuickUrlSchemeDelegate>(schemeParent, 0,
+ return QDeclarativeListProperty<QQuickUrlSchemeDelegate>(schemeParent, 0,
QQuickWebViewExperimental::schemeDelegates_Append,
QQuickWebViewExperimental::schemeDelegates_Count,
QQuickWebViewExperimental::schemeDelegates_At,
@@ -1493,7 +1499,7 @@ void QQuickWebView::emitUrlChangeIfNeeded()
QUrl QQuickWebView::icon() const
{
Q_D(const QQuickWebView);
- return QUrl(d->m_iconUrl);
+ return d->m_iconURL;
}
/*!
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
index 0f2ef42..03eb9f3 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
@@ -28,7 +28,7 @@
#include <private/qquickflickable_p.h>
class QWebNavigationRequest;
-class QQmlComponent;
+class QDeclarativeComponent;
class QQuickWebPage;
class QQuickWebViewAttached;
class QWebLoadRequest;
@@ -70,7 +70,7 @@ QT_END_NAMESPACE
// Instantiating the WebView in C++ is only possible by creating
-// a QQmlComponent as the initialization depends on the
+// a QDeclarativeComponent as the initialization depends on the
// componentComplete method being called.
class QWEBKIT_EXPORT QQuickWebView : public QQuickFlickable {
Q_OBJECT
@@ -208,7 +208,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged());
Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*));
- Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QString&));
+ Q_PRIVATE_SLOT(d_func(), void _q_onIconChangedForPageURL(const QUrl&, const QUrl&));
// Hides QObject::d_ptr allowing us to use the convenience macros.
QScopedPointer<QQuickWebViewPrivate> d_ptr;
QQuickWebViewExperimental* m_experimental;
@@ -256,19 +256,19 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
Q_PROPERTY(QWebNavigationHistory* navigationHistory READ navigationHistory CONSTANT FINAL)
- Q_PROPERTY(QQmlComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
- Q_PROPERTY(QQmlComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged)
- Q_PROPERTY(QQmlComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged)
- Q_PROPERTY(QQmlComponent* authenticationDialog READ authenticationDialog WRITE setAuthenticationDialog NOTIFY authenticationDialogChanged)
- Q_PROPERTY(QQmlComponent* proxyAuthenticationDialog READ proxyAuthenticationDialog WRITE setProxyAuthenticationDialog NOTIFY proxyAuthenticationDialogChanged)
- Q_PROPERTY(QQmlComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged)
- Q_PROPERTY(QQmlComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
- Q_PROPERTY(QQmlComponent* filePicker READ filePicker WRITE setFilePicker NOTIFY filePickerChanged)
- Q_PROPERTY(QQmlComponent* databaseQuotaDialog READ databaseQuotaDialog WRITE setDatabaseQuotaDialog NOTIFY databaseQuotaDialogChanged)
-
+ Q_PROPERTY(QDeclarativeComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* authenticationDialog READ authenticationDialog WRITE setAuthenticationDialog NOTIFY authenticationDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* proxyAuthenticationDialog READ proxyAuthenticationDialog WRITE setProxyAuthenticationDialog NOTIFY proxyAuthenticationDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged)
+ Q_PROPERTY(QDeclarativeComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
+ Q_PROPERTY(QDeclarativeComponent* filePicker READ filePicker WRITE setFilePicker NOTIFY filePickerChanged)
+ Q_PROPERTY(QDeclarativeComponent* databaseQuotaDialog READ databaseQuotaDialog WRITE setDatabaseQuotaDialog NOTIFY databaseQuotaDialogChanged)
Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
Q_PROPERTY(QWebKitTest* test READ test CONSTANT FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
+ Q_PROPERTY(QDeclarativeListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
+
Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged)
Q_PROPERTY(QList<QUrl> userScripts READ userScripts WRITE setUserScripts NOTIFY userScriptsChanged)
Q_ENUMS(NavigationRequestActionExperimental)
@@ -281,24 +281,24 @@ public:
QQuickWebViewExperimental(QQuickWebView* webView);
virtual ~QQuickWebViewExperimental();
- QQmlComponent* alertDialog() const;
- void setAlertDialog(QQmlComponent*);
- QQmlComponent* confirmDialog() const;
- void setConfirmDialog(QQmlComponent*);
- QQmlComponent* promptDialog() const;
- void setPromptDialog(QQmlComponent*);
- QQmlComponent* authenticationDialog() const;
- void setAuthenticationDialog(QQmlComponent*);
- QQmlComponent* certificateVerificationDialog() const;
- void setCertificateVerificationDialog(QQmlComponent*);
- QQmlComponent* itemSelector() const;
- void setItemSelector(QQmlComponent*);
- QQmlComponent* proxyAuthenticationDialog() const;
- void setProxyAuthenticationDialog(QQmlComponent*);
- QQmlComponent* filePicker() const;
- void setFilePicker(QQmlComponent*);
- QQmlComponent* databaseQuotaDialog() const;
- void setDatabaseQuotaDialog(QQmlComponent*);
+ QDeclarativeComponent* alertDialog() const;
+ void setAlertDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* confirmDialog() const;
+ void setConfirmDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* promptDialog() const;
+ void setPromptDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* authenticationDialog() const;
+ void setAuthenticationDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* certificateVerificationDialog() const;
+ void setCertificateVerificationDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* itemSelector() const;
+ void setItemSelector(QDeclarativeComponent*);
+ QDeclarativeComponent* proxyAuthenticationDialog() const;
+ void setProxyAuthenticationDialog(QDeclarativeComponent*);
+ QDeclarativeComponent* filePicker() const;
+ void setFilePicker(QDeclarativeComponent*);
+ QDeclarativeComponent* databaseQuotaDialog() const;
+ void setDatabaseQuotaDialog(QDeclarativeComponent*);
QString userAgent() const;
void setUserAgent(const QString& userAgent);
int deviceWidth() const;
@@ -316,11 +316,11 @@ public:
QWebNavigationHistory* navigationHistory() const;
QQuickWebPage* page();
- static QQuickUrlSchemeDelegate* schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>*, int index);
- static void schemeDelegates_Append(QQmlListProperty<QQuickUrlSchemeDelegate>*, QQuickUrlSchemeDelegate*);
- static int schemeDelegates_Count(QQmlListProperty<QQuickUrlSchemeDelegate>*);
- static void schemeDelegates_Clear(QQmlListProperty<QQuickUrlSchemeDelegate>*);
- QQmlListProperty<QQuickUrlSchemeDelegate> schemeDelegates();
+ static QQuickUrlSchemeDelegate* schemeDelegates_At(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*, int index);
+ static void schemeDelegates_Append(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*, QQuickUrlSchemeDelegate*);
+ static int schemeDelegates_Count(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*);
+ static void schemeDelegates_Clear(QDeclarativeListProperty<QQuickUrlSchemeDelegate>*);
+ QDeclarativeListProperty<QQuickUrlSchemeDelegate> schemeDelegates();
void invokeApplicationSchemeHandler(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData>);
void sendApplicationSchemeReply(QQuickNetworkReply*);
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
index c5535a3..b645b20 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
@@ -51,7 +51,7 @@ class QWebNavigationHistory;
class QWebKitTest;
QT_BEGIN_NAMESPACE
-class QQmlComponent;
+class QDeclarativeComponent;
QT_END_NAMESPACE
class QQuickWebViewPrivate {
@@ -99,7 +99,7 @@ public:
void _q_onVisibleChanged();
void _q_onUrlChanged();
void _q_onReceivedResponseFromDownload(QWebDownloadItem*);
- void _q_onIconChangedForPageURL(const QString&);
+ void _q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURLString);
void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtWebPageUIClient::FileChooserType);
quint64 exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage);
@@ -114,6 +114,7 @@ public:
void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; }
void setTransparentBackground(bool);
void addAttachedPropertyTo(QObject*);
+ void setIcon(const QUrl&);
bool navigatorQtObjectEnabled() const;
bool renderToOffscreenBuffer() const { return m_renderToOffscreenBuffer; }
@@ -126,8 +127,6 @@ public:
void setDialogActive(bool active) { m_dialogActive = active; }
- void updateIcon();
-
// PageClient.
WebCore::IntSize viewSize() const;
void didReceiveMessageFromNavigatorQtObject(const String& message);
@@ -176,15 +175,15 @@ protected:
FlickableAxisLocker axisLocker;
- QQmlComponent* alertDialog;
- QQmlComponent* confirmDialog;
- QQmlComponent* promptDialog;
- QQmlComponent* authenticationDialog;
- QQmlComponent* certificateVerificationDialog;
- QQmlComponent* itemSelector;
- QQmlComponent* proxyAuthenticationDialog;
- QQmlComponent* filePicker;
- QQmlComponent* databaseQuotaDialog;
+ QDeclarativeComponent* alertDialog;
+ QDeclarativeComponent* confirmDialog;
+ QDeclarativeComponent* promptDialog;
+ QDeclarativeComponent* authenticationDialog;
+ QDeclarativeComponent* certificateVerificationDialog;
+ QDeclarativeComponent* itemSelector;
+ QDeclarativeComponent* proxyAuthenticationDialog;
+ QDeclarativeComponent* filePicker;
+ QDeclarativeComponent* databaseQuotaDialog;
QList<QUrl> userScripts;
@@ -193,7 +192,7 @@ protected:
bool m_renderToOffscreenBuffer;
bool m_dialogActive;
bool m_allowAnyHTTPSCertificateForLocalHost;
- WTF::String m_iconUrl;
+ QUrl m_iconURL;
int m_loadProgress;
WTF::String m_currentUrl;
};
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
index 63dce28..dce6ee9 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider.cpp
@@ -24,13 +24,12 @@
#include "QtWebIconDatabaseClient.h"
#include <QtCore/QUrl>
#include <QtGui/QImage>
-#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
using namespace WebKit;
QWebIconImageProvider::QWebIconImageProvider()
- : QQuickImageProvider(QQuickImageProvider::Image)
+ : QDeclarativeImageProvider(QDeclarativeImageProvider::Image)
{
}
@@ -38,52 +37,24 @@ QWebIconImageProvider::~QWebIconImageProvider()
{
}
-WTF::String QWebIconImageProvider::iconURLForPageURLInContext(const WTF::String &pageURL, QtWebContext* context)
-{
- QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
- WTF::String iconURL = iconDatabase->iconForPageURL(pageURL);
-
- if (iconURL.isEmpty())
- return String();
-
- QUrl url;
- url.setScheme(QStringLiteral("image"));
- url.setHost(QWebIconImageProvider::identifier());
-
- QString path;
- path.append(QLatin1Char('/'));
- path.append(QString::number(context->contextID()));
- path.append(QLatin1Char('/'));
- path.append(QString::number(WTF::StringHash::hash(iconURL)));
- url.setPath(path);
-
- // FIXME: Use QUrl::DecodedMode when landed in Qt
- url.setFragment(QString::fromLatin1(QByteArray(QString(pageURL).toUtf8()).toBase64()));
-
- // FIXME: We can't know when the icon url is no longer in use,
- // so we never release these icons. At some point we might want
- // to introduce expiry of icons to elevate this issue.
- iconDatabase->retainIconForPageURL(pageURL);
-
- return url.toString(QUrl::FullyEncoded);
-}
-
QImage QWebIconImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize)
{
+ QString decodedIconUrl = id;
+ decodedIconUrl.remove(0, decodedIconUrl.indexOf('#') + 1);
+ String pageURL = QString::fromUtf8(QUrl(decodedIconUrl).toEncoded());
+
// The string identifier has the leading image://webicon/ already stripped, so we just
// need to truncate from the first slash to get the context id.
- QString contextIDString = id.left(id.indexOf(QLatin1Char('/')));
+ QString contextIDAsString = id;
+ contextIDAsString.truncate(contextIDAsString.indexOf(QLatin1Char('/')));
bool ok = false;
- uint64_t contextId = contextIDString.toUInt(&ok);
+ uint64_t contextId = contextIDAsString.toUInt(&ok);
if (!ok)
return QImage();
-
QtWebContext* context = QtWebContext::contextByID(contextId);
if (!context)
return QImage();
- QString pageURL = QString::fromUtf8(QByteArray::fromBase64(id.midRef(id.indexOf('#') + 1).toLatin1()));
-
QtWebIconDatabaseClient* iconDatabase = context->iconDatabase();
QImage icon = requestedSize.isValid() ? iconDatabase->iconImageForPageURL(pageURL, requestedSize) : iconDatabase->iconImageForPageURL(pageURL);
ASSERT(!icon.isNull());
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h
index 7efe21a..a5cbdec 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebiconimageprovider_p.h
@@ -21,23 +21,13 @@
#define qwebiconimageprovider_p_h
#include "qwebkitglobal.h"
-#include <QString>
-#include <QtQuick/QQuickImageProvider>
-#include <wtf/text/WTFString.h>
+#include <QQmlImageProvider>
-namespace WebKit {
- class QtWebContext;
-}
-
-class QWEBKIT_EXPORT QWebIconImageProvider : public QQuickImageProvider {
+class QWEBKIT_EXPORT QWebIconImageProvider : public QDeclarativeImageProvider {
public:
QWebIconImageProvider();
~QWebIconImageProvider();
-
- static QString identifier() { return QStringLiteral("webicon"); }
-
- WTF::String iconURLForPageURLInContext(const WTF::String& pageURL, WebKit::QtWebContext* context);
- virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize);
+ QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize);
};
#endif
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
index 0e3b33c..2848296 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp
@@ -144,11 +144,7 @@ static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringL
{
if (method.access() != QMetaMethod::Private) {
const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void";
-#if HAVE(QT5)
- *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName));
-#else
*output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName);
-#endif
checkKnownType(methodTypeName);
foreach (QByteArray paramType, method.parameterTypes())
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml
index f6ed4b2..8210040 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml
@@ -20,7 +20,6 @@ TestWebView {
TestCase {
id: test
name: "WebViewLoadFavIcon"
- when: windowShown
function init() {
if (webView.icon != '') {
@@ -37,6 +36,7 @@ TestWebView {
var url = Qt.resolvedUrl("../common/favicon.html")
webView.url = url
verify(webView.waitForLoadSucceeded())
+ expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133")
compare(spy.count, 1)
compare(favicon.width, 48)
compare(favicon.height, 48)
@@ -47,6 +47,7 @@ TestWebView {
var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!")
webView.url = url
verify(webView.waitForLoadSucceeded())
+ expectFail("", "https://bugs.webkit.org/show_bug.cgi?id=87133")
compare(spy.count, 1)
compare(favicon.width, 16)
compare(favicon.height, 16)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
index ab57556..782b041 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
@@ -48,5 +48,5 @@ int main(int argc, char** argv)
#ifdef DISABLE_FLICKABLE_VIEWPORT
QQuickWebViewExperimental::setFlickableViewportEnabled(false);
#endif
- return quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR);
+ return quick_test_main(argc, argv, "qmltests", 0, QUICK_TEST_SOURCE_DIR);
}
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
index c04043d..de576f2 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.h
@@ -28,8 +28,8 @@
#include <wtf/OwnPtr.h>
QT_BEGIN_NAMESPACE
-class QQmlComponent;
-class QQmlContext;
+class QDeclarativeComponent;
+class QDeclarativeContext;
class QQuickItem;
QT_END_NAMESPACE
@@ -75,7 +75,7 @@ private:
bool createDialog(QQmlComponent*, QObject* contextObject);
QQuickWebView* m_webView;
- OwnPtr<QQmlContext> m_dialogContext;
+ OwnPtr<QDeclarativeContext> m_dialogContext;
OwnPtr<QQuickItem> m_dialog;
QString m_result;
bool m_wasAccepted;
diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
index 5132c79..c769c8b 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp
@@ -62,29 +62,13 @@ QtWebIconDatabaseClient::~QtWebIconDatabaseClient()
WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), 0);
}
-void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo)
+void QtWebIconDatabaseClient::didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo)
{
- emit toQtWebIconDatabaseClient(clientInfo)->iconChangedForPageURL(toImpl(pageURL)->string());
+ QUrl qUrl = WKURLCopyQUrl(pageURL);
+ toQtWebIconDatabaseClient(clientInfo)->requestIconForPageURL(qUrl);
}
-WTF::String QtWebIconDatabaseClient::iconForPageURL(const WTF::String& pageURL)
-{
- String iconURL;
- m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
-
- if (iconURL.isEmpty())
- return String();
-
- // Verify that the image data is actually available before reporting back
- // a url, since clients assume that the url can be used directly.
- WebCore::Image* iconImage = m_iconDatabase->imageForPageURL(pageURL);
- if (!iconImage || iconImage->isNull())
- return String();
-
- return iconURL;
-}
-
-QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize)
+QImage QtWebIconDatabaseClient::iconImageForPageURL(const String& pageURL, const QSize& iconSize)
{
MutexLocker locker(m_imageLock);
@@ -100,6 +84,33 @@ QImage QtWebIconDatabaseClient::iconImageForPageURL(const WTF::String& pageURL,
return nativeImage->toImage();
}
+unsigned QtWebIconDatabaseClient::iconURLHashForPageURL(const String& pageURL)
+{
+ String iconURL;
+ m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
+ return StringHash::hash(iconURL);
+}
+
+void QtWebIconDatabaseClient::requestIconForPageURL(const QUrl& pageURL)
+{
+ String pageURLString = WebCore::KURL(pageURL).string();
+ if (iconImageForPageURL(pageURLString).isNull())
+ return;
+
+ unsigned iconID = iconURLHashForPageURL(pageURLString);
+ QUrl url;
+ url.setScheme(QStringLiteral("image"));
+ url.setHost(QStringLiteral("webicon"));
+ QString path;
+ path.append(QLatin1Char('/'));
+ path.append(QString::number(m_contextId));
+ path.append(QLatin1Char('/'));
+ path.append(QString::number(iconID));
+ url.setPath(path);
+ url.setEncodedFragment(pageURL.toEncoded());
+ emit iconChangedForPageURL(pageURL, url);
+}
+
void QtWebIconDatabaseClient::retainIconForPageURL(const String& pageURL)
{
m_iconDatabase->retainIconForPageURL(pageURL);
diff --git a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
index 65e86e1..933ad9a 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
+++ b/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.h
@@ -49,16 +49,18 @@ public:
QtWebIconDatabaseClient(QtWebContext*);
~QtWebIconDatabaseClient();
- WTF::String iconForPageURL(const WTF::String& pageURL);
QImage iconImageForPageURL(const WTF::String& pageURL, const QSize& iconSize = QSize(32, 32));
-
void retainIconForPageURL(const WTF::String&);
void releaseIconForPageURL(const WTF::String&);
+public Q_SLOTS:
+ void requestIconForPageURL(const QUrl&);
+
public:
- Q_SIGNAL void iconChangedForPageURL(const QString& pageURL);
+ Q_SIGNAL void iconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL);
private:
+ unsigned iconURLHashForPageURL(const WTF::String&);
static void didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo);
uint64_t m_contextId;
RefPtr<WebKit::WebIconDatabase> m_iconDatabase;
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
index 21eec5d..d231340 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
@@ -31,8 +31,8 @@
#include <QtCore/QObject>
#include <wtf/OwnPtr.h>
-class QQmlComponent;
-class QQmlContext;
+class QDeclarativeComponent;
+class QDeclarativeContext;
class QQuickWebView;
class QQuickItem;
@@ -59,11 +59,11 @@ private Q_SLOTS:
private:
WebPopupMenuProxyQt(WebPopupMenuProxy::Client*, QQuickWebView*);
void createItem(QObject*);
- void createContext(QQmlComponent*, QObject*);
+ void createContext(QDeclarativeComponent*, QObject*);
void notifyValueChanged();
- OwnPtr<QQmlContext> m_context;
+ OwnPtr<QDeclarativeContext> m_context;
OwnPtr<QQuickItem> m_itemSelector;
QQuickWebView* m_webView;
diff --git a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml
index 77b6c36..308708b 100644
--- a/Tools/MiniBrowser/qt/qml/BrowserWindow.qml
+++ b/Tools/MiniBrowser/qt/qml/BrowserWindow.qml
@@ -290,7 +290,7 @@ Rectangle {
height: 16
anchors {
left: parent.left
- leftMargin: 6
+ leftMargin: 4
verticalCenter: parent.verticalCenter
}
}
--
1.7.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment