summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/qt/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/qt/WebCoreSupport')
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp7
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp30
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp24
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp64
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h10
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp7
-rw-r--r--Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp83
-rw-r--r--Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h58
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp24
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp37
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp6
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp13
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h2
17 files changed, 284 insertions, 88 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index c784375..bec4bc4 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -411,7 +411,7 @@ void ChromeClientQt::invalidateContentsAndWindow(const IntRect& windowRect, bool
if (!rect.isEmpty())
platformPageClient()->update(rect);
}
- emit m_webPage->repaintRequested(windowRect);
+ QMetaObject::invokeMethod(m_webPage, "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect));
// FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag
// is set.
@@ -430,9 +430,10 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect,
}
#if ENABLE(TILED_BACKING_STORE)
-void ChromeClientQt::delegatedScrollRequested(const IntSize& delta)
+void ChromeClientQt::delegatedScrollRequested(const IntPoint& point)
{
- emit m_webPage->scrollRequested(delta.width(), delta.height(), QRect(QPoint(0, 0), m_webPage->viewportSize()));
+ QPoint currentPosition(m_webPage->mainFrame()->scrollPosition());
+ emit m_webPage->scrollRequested(point.x() - currentPosition.x(), point.y() - currentPosition.y(), QRect(QPoint(0, 0), m_webPage->viewportSize()));
}
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 27327ef..a12c2ec 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -120,7 +120,7 @@ namespace WebCore {
virtual void invalidateContentsForSlowScroll(const IntRect&, bool);
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
#if ENABLE(TILED_BACKING_STORE)
- virtual void delegatedScrollRequested(const IntSize& scrollDelta);
+ virtual void delegatedScrollRequested(const IntPoint& scrollPoint);
#endif
virtual IntPoint screenToWindow(const IntPoint&) const;
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index c0017a2..ba712d1 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -531,7 +531,7 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt
static QString convertToPropertyName(const QString& name)
{
- QStringList parts = name.split('-');
+ QStringList parts = name.split(QLatin1Char('-'));
QString camelCaseName;
for (int j = 0; j < parts.count(); ++j) {
QString part = parts.at(j);
@@ -626,11 +626,11 @@ void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString&
{
WebCore::EditingBehaviorType coreEditingBehavior;
- if (editingBehavior == "win")
+ if (editingBehavior == QLatin1String("win"))
coreEditingBehavior = EditingWindowsBehavior;
- else if (editingBehavior == "mac")
+ else if (editingBehavior == QLatin1String("mac"))
coreEditingBehavior = EditingMacBehavior;
- else if (editingBehavior == "unix")
+ else if (editingBehavior == QLatin1String("unix"))
coreEditingBehavior = EditingUnixBehavior;
else {
ASSERT_NOT_REACHED();
@@ -742,12 +742,13 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c
availableSize);
QString res;
- res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f]\n",
+ res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
conf.layoutSize.width(),
conf.layoutSize.height(),
conf.initialScale,
conf.minimumScale,
- conf.maximumScale);
+ conf.maximumScale,
+ conf.userScalable);
return res;
}
@@ -922,10 +923,10 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti
QString DumpRenderTreeSupportQt::plainText(const QVariant& range)
{
QMap<QString, QVariant> map = range.toMap();
- QVariant startContainer = map.value("startContainer");
+ QVariant startContainer = map.value(QLatin1String("startContainer"));
map = startContainer.toMap();
- return map.value("innerText").toString();
+ return map.value(QLatin1String("innerText")).toString();
}
QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
@@ -949,6 +950,7 @@ QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document,
return res;
}
+// API Candidate?
QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
{
WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
@@ -1038,6 +1040,18 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const
return res;
}
+// API Candidate?
+void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
+{
+ KURL kurl(baseUrl);
+ WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::ResourceRequest request(kurl);
+ const QByteArray utf8 = html.toUtf8();
+ WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
+ WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl);
+ coreFrame->loader()->load(request, substituteData, false);
+}
+
// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
index 1e7b275..78752d8 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -198,6 +198,7 @@ public:
static void setMinimumTimerInterval(QWebPage*, double);
static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId);
+ static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
};
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index cf2fa41..e7bbd2c 100644
--- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -76,9 +76,9 @@ static QString dumpRange(WebCore::Range *range)
return QLatin1String("(null)");
WebCore::ExceptionCode code;
- QString str = QString("range from %1 of %2 to %3 of %4")
- .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
- .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
+ QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4")
+ .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
+ .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
return str;
}
@@ -420,7 +420,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
return;
// FIXME: refactor all of this to use Actions or something like them
- if (start->isContentEditable()) {
+ if (start->rendererIsEditable()) {
bool doSpatialNavigation = false;
if (isSpatialNavigationEnabled(frame)) {
if (!kevent->modifiers()) {
@@ -530,8 +530,22 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
#endif // QT_NO_SHORTCUT
}
-void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*)
+void EditorClientQt::handleInputMethodKeydown(KeyboardEvent* event)
{
+#ifndef QT_NO_SHORTCUT
+ const PlatformKeyboardEvent* kevent = event->keyEvent();
+ if (kevent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
+ switch (action) {
+ case QWebPage::InsertParagraphSeparator:
+ case QWebPage::InsertLineSeparator:
+ m_page->triggerAction(action);
+ break;
+ default:
+ break;
+ }
+ }
+#endif
}
EditorClientQt::EditorClientQt(QWebPage* page)
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 5cab6a7..d318494 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008 Collabora Ltd. All rights reserved.
* Coypright (C) 2008 Holger Hans Peter Freyther
@@ -40,6 +40,9 @@
#include "FrameView.h"
#include "DocumentLoader.h"
#include "HitTestResult.h"
+#if ENABLE(ICONDATABASE)
+#include "IconDatabaseClientQt.h"
+#endif
#if USE(JSC)
#include "JSDOMWindowBase.h"
#elif USE(V8)
@@ -119,7 +122,7 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url)
if (_url.isEmpty() || !_url.isLocalFile())
return _url.string();
// Remove the leading path from file urls
- return QString(_url.string()).replace(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath, "").mid(1);
+ return QString(_url.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1);
}
static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error)
@@ -147,17 +150,17 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n
{
QString result;
if (exception) {
- result.append("ERROR");
+ result.append(QLatin1String("ERROR"));
return result;
}
if (!node) {
- result.append("NULL");
+ result.append(QLatin1String("NULL"));
return result;
}
result.append(node->nodeName());
RefPtr<WebCore::Node> parent = node->parentNode();
if (parent) {
- result.append(" > ");
+ result.append(QLatin1String(" > "));
result.append(drtDescriptionSuitableForTestResult(parent, 0));
}
return result;
@@ -437,6 +440,8 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad()
if (dumpUserGestureInFrameLoaderCallbacks)
printf("%s - in didStartProvisionalLoadForFrame\n", qPrintable(drtPrintFrameUserGestureStatus(m_frame)));
+ m_lastRequestedUrl = m_frame->loader()->activeDocumentLoader()->requestURL();
+
if (m_webFrame)
emit m_webFrame->provisionalLoad();
}
@@ -481,7 +486,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
// We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle()
// will be called very soon with the correct title.
// This properly resets the title when we navigate to a URI without a title.
- emit titleChanged(String());
+ emit titleChanged(QString());
bool isMainFrame = (m_frame == m_frame->page()->mainFrame());
if (!isMainFrame)
@@ -769,11 +774,25 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const
m_webFrame->page()->d->updateNavigationActions();
}
-void FrameLoaderClientQt::registerForIconNotification(bool)
+void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
{
- notImplemented();
+#if ENABLE(ICONDATABASE)
+ if (shouldRegister)
+ connect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString)), Qt::UniqueConnection);
+ else
+ disconnect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString)));
+#endif
}
+void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url)
+{
+#if ENABLE(ICONDATABASE)
+ if (m_webFrame && m_webFrame->url() == url)
+ emit m_webFrame->iconChanged();
+#endif
+}
+
+
void FrameLoaderClientQt::updateGlobalHistory()
{
QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface();
@@ -1210,7 +1229,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n",
qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
- (node) ? qPrintable(QString(" originating from " + drtDescriptionSuitableForTestResult(node, 0))) : "");
+ (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
if (policyDelegatePermissive)
result = PolicyUse;
@@ -1310,18 +1329,18 @@ void FrameLoaderClientQt::transferLoadingResourceFromPage(unsigned long, Documen
{
}
-ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType)
+ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages)
{
-// qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<_mimeType;
+// qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<mimeTypeIn;
QFileInfo fi(url.path());
String extension = fi.suffix();
- if (_mimeType == "application/x-qt-plugin" || _mimeType == "application/x-qt-styled-widget")
+ if (mimeTypeIn == "application/x-qt-plugin" || mimeTypeIn == "application/x-qt-styled-widget")
return ObjectContentOtherPlugin;
- if (url.isEmpty() && !_mimeType.length())
+ if (url.isEmpty() && !mimeTypeIn.length())
return ObjectContentNone;
- String mimeType = _mimeType;
+ String mimeType = mimeTypeIn;
if (!mimeType.length())
mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
@@ -1331,14 +1350,17 @@ ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const
if (!mimeType.length())
return ObjectContentFrame;
- if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
- return ObjectContentImage;
-
+ ObjectContentType plugInType = ObjectContentNone;
if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType))
- return ObjectContentNetscapePlugin;
-
- if (m_frame->page() && m_frame->page()->pluginData() && m_frame->page()->pluginData()->supportsMimeType(mimeType))
- return ObjectContentOtherPlugin;
+ plugInType = ObjectContentNetscapePlugin;
+ else if (m_frame->page() && m_frame->page()->pluginData() && m_frame->page()->pluginData()->supportsMimeType(mimeType))
+ plugInType = ObjectContentOtherPlugin;
+
+ if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
+ return shouldPreferPlugInsForImages && plugInType != ObjectContentNone ? plugInType : ObjectContentImage;
+
+ if (plugInType != ObjectContentNone)
+ return plugInType;
if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
return ObjectContentFrame;
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index e5be421..3ec5f20 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008 Collabora Ltd. All rights reserved.
*
@@ -211,7 +211,7 @@ public:
virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
- virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
+ virtual ObjectContentType objectContentType(const KURL&, const String& mimeTypeIn, bool shouldPreferPlugInsForImages);
virtual String overrideMediaType() const;
virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*);
@@ -239,6 +239,8 @@ public:
virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext();
+ const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; }
+
static bool dumpFrameLoaderCallbacks;
static bool dumpUserGestureInFrameLoaderCallbacks;
static bool dumpResourceLoadCallbacks;
@@ -253,6 +255,9 @@ public:
static bool dumpHistoryCallbacks;
static QMap<QString, QString> URLsToRedirect;
+private slots:
+ void onIconLoadedForPageURL(const QString&);
+
private:
Frame *m_frame;
QWebFrame *m_webFrame;
@@ -267,6 +272,7 @@ private:
// See finishedLoading().
bool m_hasRepresentation;
+ KURL m_lastRequestedUrl;
ResourceError m_loadError;
};
diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
index 4922cd7..bb5e2b9 100644
--- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
@@ -66,6 +66,7 @@ void FullScreenVideoWidget::show(QMediaPlayer* player)
setMouseTracking(true);
raise();
m_mediaPlayer->setVideoOutput(this);
+ setFocus();
grabMouse();
hideCursor();
}
@@ -73,6 +74,7 @@ void FullScreenVideoWidget::show(QMediaPlayer* player)
void FullScreenVideoWidget::closeEvent(QCloseEvent* event)
{
m_mediaPlayer = 0;
+ m_cursorTimer.stop();
setMouseTracking(false);
releaseMouse();
QApplication::restoreOverrideCursor();
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
index 68a2af5..3c382cf 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
@@ -82,12 +82,7 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo &geoPosition)
bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed);
double speed = geoPosition.attribute(QGeoPositionInfo::GroundSpeed);
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
double timeStampInSeconds = geoPosition.timestamp().toMSecsSinceEpoch() / 1000;
-#else
- QDateTime datetime = geoPosition.timestamp();
- double timeStampInSeconds = (datetime.toTime_t() + datetime.time().msec()) / 1000;
-#endif
m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude,
accuracy, providesAltitude, altitude,
@@ -140,3 +135,5 @@ void GeolocationClientQt::cancelPermissionRequest(Geolocation* geolocation)
}
} // namespace WebCore
+
+#include "moc_GeolocationClientQt.cpp"
diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
new file mode 100644
index 0000000..77b41db
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 Andreas Kling <kling@webkit.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IconDatabaseClientQt.h"
+
+#include "FrameLoaderClientQt.h"
+#include "IconDatabaseBase.h"
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+IconDatabaseClientQt* IconDatabaseClientQt::instance()
+{
+ static IconDatabaseClientQt* client = 0;
+ if (!client) {
+ client = new IconDatabaseClientQt;
+ iconDatabase().setClient(client);
+ }
+ return client;
+}
+
+IconDatabaseClientQt::IconDatabaseClientQt()
+{
+}
+
+IconDatabaseClientQt::~IconDatabaseClientQt()
+{
+}
+
+bool IconDatabaseClientQt::performImport()
+{
+ return true;
+}
+
+void IconDatabaseClientQt::didRemoveAllIcons()
+{
+}
+
+void IconDatabaseClientQt::didImportIconURLForPageURL(const String& url)
+{
+}
+
+void IconDatabaseClientQt::didImportIconDataForPageURL(const String& url)
+{
+ emit iconLoadedForPageURL(url);
+}
+
+void IconDatabaseClientQt::didChangeIconForPageURL(const String& url)
+{
+}
+
+void IconDatabaseClientQt::didFinishURLImport()
+{
+}
+
+}
+
+#include "moc_IconDatabaseClientQt.cpp"
diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
new file mode 100644
index 0000000..593fdd3
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Andreas Kling <kling@webkit.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IconDatabaseClientQt_h
+#define IconDatabaseClientQt_h
+
+#include "IconDatabaseClient.h"
+#include <QtCore/QObject>
+
+namespace WebCore {
+
+class IconDatabaseClientQt : public QObject, public IconDatabaseClient {
+ Q_OBJECT
+public:
+ static IconDatabaseClientQt* instance();
+
+ virtual bool performImport();
+ virtual void didRemoveAllIcons();
+ virtual void didImportIconURLForPageURL(const String&);
+ virtual void didImportIconDataForPageURL(const String&);
+ virtual void didChangeIconForPageURL(const String&);
+ virtual void didFinishURLImport();
+
+signals:
+ void iconLoadedForPageURL(const QString&);
+
+private:
+ IconDatabaseClientQt();
+ virtual ~IconDatabaseClientQt();
+};
+
+}
+
+#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index 441add6..6b557db 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -140,7 +140,7 @@ public:
QVariant valueToStore = settingToVariant(value);
QString settingKey(settingStoragePrefix + QString(name));
qsettings.setValue(settingKey, valueToStore);
- qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
+ qsettings.setValue(settingKey + settingStorageTypeSuffix, QLatin1String(QVariant::typeToName(valueToStore.type())));
#endif // QT_NO_SETTINGS
}
@@ -174,22 +174,6 @@ private:
}
-#if USE(V8)
-static void ensureDebuggerScriptLoaded()
-{
- static bool scriptLoaded = false;
- if (scriptLoaded)
- return;
-
- QFile debuggerScriptFile(":/webkit/inspector/DebuggerScript.js");
- if (debuggerScriptFile.open(QIODevice::ReadOnly)) {
- QByteArray ba = debuggerScriptFile.readAll();
- ScriptDebugServer::shared().setDebuggerScriptSource(String(ba.constData(), ba.length()));
- scriptLoaded = true;
- }
-}
-#endif
-
InspectorClientQt::InspectorClientQt(QWebPage* page)
: m_inspectedWebPage(page)
, m_frontendWebPage(0)
@@ -218,10 +202,6 @@ void InspectorClientQt::inspectorDestroyed()
void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* inspectorController)
{
#if ENABLE(INSPECTOR)
-#if USE(V8)
- ensureDebuggerScriptLoaded();
-#endif
-
QWebView* inspectorView = new QWebView;
InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView);
inspectorView->setPage(inspectorPage);
@@ -240,7 +220,7 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* insp
inspectorUrl = inspector->property("_q_inspectorUrl").toUrl();
#endif
if (!inspectorUrl.isValid())
- inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html");
+ inspectorUrl = QUrl(QLatin1String("qrc:/webkit/inspector/inspector.html"));
#ifndef QT_NO_PROPERTIES
QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects");
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index f83deb2..92b7d5c 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -73,11 +73,10 @@ static quint32 parseWebSocketChallengeNumber(QString field)
int numSpaces = 0;
for (int i = 0; i < field.size(); i++) {
QChar c = field[i];
- if (c == (QChar)' ') {
+ if (c == QLatin1Char(' '))
numSpaces++;
- } else if ((c >= (QChar)'0') && (c <= (QChar)'9')) {
- nString.append((QChar)c);
- }
+ else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9')))
+ nString.append(c);
}
quint32 num = nString.toLong();
quint32 result = (numSpaces ? (num / numSpaces) : num);
@@ -195,7 +194,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
m_path = header.path();
m_contentType = header.contentType().toLatin1();
m_contentLength = header.contentLength();
- if (header.hasKey("Upgrade") && (header.value("Upgrade") == QLatin1String("WebSocket")))
+ if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket")))
isWebSocket = true;
m_data.clear();
@@ -204,9 +203,9 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
}
if (m_endOfHeaders) {
- QStringList pathAndQuery = m_path.split("?");
+ QStringList pathAndQuery = m_path.split(QLatin1Char('?'));
m_path = pathAndQuery[0];
- QStringList words = m_path.split(QString::fromLatin1("/"));
+ QStringList words = m_path.split(QLatin1Char('/'));
if (isWebSocket) {
// switch to websocket-style WebSocketService messaging
@@ -216,18 +215,18 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
QByteArray key3 = m_tcpConnection->read(8);
- quint32 number1 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key1"));
- quint32 number2 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key2"));
+ quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1")));
+ quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2")));
char responseData[16];
generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData);
QByteArray response(responseData, sizeof(responseData));
- QHttpResponseHeader responseHeader(101, "WebSocket Protocol Handshake", 1, 1);
- responseHeader.setValue("Upgrade", header.value("Upgrade"));
- responseHeader.setValue("Connection", header.value("Connection"));
- responseHeader.setValue("Sec-WebSocket-Origin", header.value("Origin"));
- responseHeader.setValue("Sec-WebSocket-Location", ("ws://" + header.value("Host") + m_path));
+ QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1);
+ responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade")));
+ responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection")));
+ responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin")));
+ responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
responseHeader.setContentLength(response.size());
m_tcpConnection->write(responseHeader.toString().toLatin1());
m_tcpConnection->write(response);
@@ -259,19 +258,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
QString text = QString::fromLatin1("OK");
// If no path is specified, generate an index page.
- if ((m_path == "") || (m_path == "/")) {
- QString indexHtml = "<html><head><title>Remote Web Inspector</title></head><body><ul>\n";
+ if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) {
+ QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n");
for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin();
it != m_server->m_inspectorClients.end();
++it) {
- indexHtml.append(QString("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
+ indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
.arg(it.key())
.arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString()));
}
- indexHtml.append("</ul></body></html>");
+ indexHtml.append(QLatin1String("</ul></body></html>"));
response = indexHtml.toLatin1();
} else {
- QString path = QString(":%1").arg(m_path);
+ QString path = QString::fromLatin1(":%1").arg(m_path);
QFile file(path);
// It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit,
// but grep fails to turn one up.
diff --git a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
index f7c4edc..b662f5c 100644
--- a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
@@ -44,6 +44,10 @@ public:
virtual int itemCount() const { return d ? d->listSize() : 0; }
virtual bool itemIsSelected(int idx) const { return d ? d->itemIsSelected(idx) : false; }
virtual bool multiple() const;
+ virtual QColor backgroundColor() const { return d ? QColor(d->menuStyle().backgroundColor()) : QColor(); }
+ virtual QColor foregroundColor() const { return d ? QColor(d->menuStyle().foregroundColor()) : QColor(); }
+ virtual QColor itemBackgroundColor(int idx) const { return d ? QColor(d->itemStyle(idx).backgroundColor()) : QColor(); }
+ virtual QColor itemForegroundColor(int idx) const { return d ? QColor(d->itemStyle(idx).foregroundColor()) : QColor(); }
private:
WebCore::PopupMenuClient*& d;
@@ -157,4 +161,6 @@ void PopupMenuQt::selectItem(int index, bool ctrl, bool shift)
}
+#include "moc_PopupMenuQt.cpp"
+
// vim: ts=4 sw=4 et
diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
index afa6492..5e641de 100644
--- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
@@ -124,6 +124,17 @@ void QtFallbackWebPopup::show(const QWebSelectData& data)
populate(data);
+ QColor backgroundColor = data.backgroundColor();
+ QColor foregroundColor = data.foregroundColor();
+
+ QPalette palette = m_combo->palette();
+ if (backgroundColor.isValid())
+ palette.setColor(QPalette::Background, backgroundColor);
+ if (foregroundColor.isValid())
+ palette.setColor(QPalette::Foreground, foregroundColor);
+ m_combo->setPalette(palette);
+
+
QRect rect = geometry();
if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView);
@@ -235,6 +246,8 @@ void QtFallbackWebPopup::populate(const QWebSelectData& data)
#ifndef QT_NO_TOOLTIP
model->item(i)->setToolTip(data.itemToolTip(i));
#endif
+ model->item(i)->setBackground(data.itemBackgroundColor(i));
+ model->item(i)->setForeground(data.itemForegroundColor(i));
if (data.itemIsSelected(i))
currentIndex = i;
break;
diff --git a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
index fffb564..182fe38 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
@@ -332,7 +332,7 @@ String WebPlatformStrategies::contextMenuItemTagSearchWeb()
return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item");
}
-String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary()
+String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary(const String&)
{
return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item");
}
diff --git a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
index fbcfd16..b74af39 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
+++ b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
@@ -86,7 +86,7 @@ private:
virtual WTF::String contextMenuItemTagIgnoreSpelling();
virtual WTF::String contextMenuItemTagLearnSpelling();
virtual WTF::String contextMenuItemTagSearchWeb();
- virtual WTF::String contextMenuItemTagLookUpInDictionary();
+ virtual WTF::String contextMenuItemTagLookUpInDictionary(const String&);
virtual WTF::String contextMenuItemTagOpenLink();
virtual WTF::String contextMenuItemTagIgnoreGrammar();
virtual WTF::String contextMenuItemTagSpellingMenu();