summaryrefslogtreecommitdiffstats
path: root/WebKit/qt/WebCoreSupport
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-05-21 16:53:46 +0100
committerKristian Monsen <kristianm@google.com>2010-05-25 10:24:15 +0100
commit6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch)
treef7111b9b22befab472616c1d50ec94eb50f1ec8c /WebKit/qt/WebCoreSupport
parenta149172322a9067c14e8b474a53e63649aa17cad (diff)
downloadexternal_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebKit/qt/WebCoreSupport')
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.cpp17
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.h7
-rw-r--r--WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp137
-rw-r--r--WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h20
-rw-r--r--WebKit/qt/WebCoreSupport/EditorClientQt.cpp16
-rw-r--r--WebKit/qt/WebCoreSupport/EditorClientQt.h3
-rw-r--r--WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp63
-rw-r--r--WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h7
-rw-r--r--WebKit/qt/WebCoreSupport/InspectorClientQt.cpp4
-rw-r--r--WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp8
-rw-r--r--WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h2
-rw-r--r--WebKit/qt/WebCoreSupport/PageClientQt.cpp197
-rw-r--r--WebKit/qt/WebCoreSupport/PageClientQt.h135
-rw-r--r--WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp4
-rw-r--r--WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h4
-rw-r--r--WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp143
-rw-r--r--WebKit/qt/WebCoreSupport/QtPlatformPlugin.h64
17 files changed, 765 insertions, 66 deletions
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index cf100f7..1c475b3 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -567,13 +567,28 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const
}
#endif
+
+#if ENABLE(TILED_BACKING_STORE)
+IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
+{
+ if (!platformPageClient())
+ return IntRect();
+ return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect()));
+}
+#endif
QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
{
+ QtAbstractWebPopup* result = m_platformPlugin.createSelectInputMethod();
+ if (result)
+ return result;
+
#if defined(Q_WS_MAEMO_5)
return new QtMaemoWebPopup;
-#else
+#elif !defined(QT_NO_COMBOBOX)
return new QtFallbackWebPopup;
+#else
+ return result;
#endif
}
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index a4575e2..0396aef 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -33,6 +33,7 @@
#include "RefCounted.h"
#include "KURL.h"
#include "PlatformString.h"
+#include "QtPlatformPlugin.h"
QT_BEGIN_NAMESPACE
class QEventLoop;
@@ -144,6 +145,10 @@ namespace WebCore {
virtual bool allowsAcceleratedCompositing() const;
#endif
+#if ENABLE(TILED_BACKING_STORE)
+ virtual IntRect visibleRectForTiledBackingStore() const;
+#endif
+
#if ENABLE(TOUCH_EVENTS)
virtual void needTouchEvents(bool) { }
#endif
@@ -181,6 +186,8 @@ namespace WebCore {
bool statusBarVisible;
bool menuBarVisible;
QEventLoop* m_eventLoop;
+
+ QtPlatformPlugin m_platformPlugin;
};
}
diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 935be85..6e59a20 100644
--- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -23,16 +23,21 @@
#include "config.h"
#include "DumpRenderTreeSupportQt.h"
+#include "CSSComputedStyleDeclaration.h"
#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
#include "ContextMenuController.h"
#include "Editor.h"
+#include "EditorClientQt.h"
#include "Element.h"
#include "FocusController.h"
#include "Frame.h"
+#include "FrameLoaderClientQt.h"
#include "FrameView.h"
#include "GCController.h"
+#include "HTMLInputElement.h"
#include "InspectorController.h"
+#include "NotificationPresenterClientQt.h"
#include "Page.h"
#include "PageGroup.h"
#include "PluginDatabase.h"
@@ -47,6 +52,7 @@
#include "TextIterator.h"
#include "WorkerThread.h"
+#include "qwebelement.h"
#include "qwebframe.h"
#include "qwebframe_p.h"
#include "qwebpage.h"
@@ -377,6 +383,23 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt
return WebCore::markerTextForListItem(listItem.m_element);
}
+QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWebElement& element)
+{
+ QVariantMap res;
+
+ WebCore::Element* webElement = element.m_element;
+ if (!webElement)
+ return res;
+
+ RefPtr<WebCore::CSSComputedStyleDeclaration> style = computedStyle(webElement, true);
+ for (int i = 0; i < style->length(); i++) {
+ QString name = style->item(i);
+ QString value = (static_cast<WebCore::CSSStyleDeclaration*>(style.get()))->getPropertyValue(name);
+ res[name] = QVariant(value);
+ }
+ return res;
+}
+
QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
{
WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
@@ -421,6 +444,74 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page,
return rect;
}
+bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId)
+{
+ Frame* coreFrame = QWebFramePrivate::core(frame);
+ if (!coreFrame)
+ return false;
+
+ Document* doc = coreFrame->document();
+ Q_ASSERT(doc);
+
+ Node* coreNode = doc->getElementById(elementId);
+ if (!coreNode || !coreNode->renderer())
+ return false;
+
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(coreNode);
+ if (!inputElement)
+ return false;
+
+ return (inputElement->isTextField()
+ && inputElement->inputType() != HTMLInputElement::PASSWORD
+ && inputElement->autoComplete());
+}
+
+void DumpRenderTreeSupportQt::dumpFrameLoader(bool b)
+{
+ FrameLoaderClientQt::dumpFrameLoaderCallbacks = b;
+}
+
+void DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(bool b)
+{
+ FrameLoaderClientQt::dumpResourceLoadCallbacks = b;
+}
+
+void DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(const QString& path)
+{
+ FrameLoaderClientQt::dumpResourceLoadCallbacksPath = path;
+}
+
+void DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(bool b)
+{
+ FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = b;
+}
+
+void DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(bool b)
+{
+ FrameLoaderClientQt::sendRequestReturnsNull = b;
+}
+
+void DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(const QStringList& headers)
+{
+ FrameLoaderClientQt::sendRequestClearHeaders = headers;
+}
+
+void DumpRenderTreeSupportQt::dumpEditingCallbacks(bool b)
+{
+ EditorClientQt::dumpEditingCallbacks = b;
+}
+
+void DumpRenderTreeSupportQt::dumpSetAcceptsEditing(bool b)
+{
+ EditorClientQt::acceptsEditing = b;
+}
+
+void DumpRenderTreeSupportQt::dumpNotification(bool b)
+{
+#if ENABLE(NOTIFICATIONS)
+ NotificationPresenterClientQt::dumpNotification = b;
+#endif
+}
// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
@@ -502,3 +593,49 @@ void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& group
{
DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName);
}
+
+void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
+{
+ DumpRenderTreeSupportQt::dumpFrameLoader(b);
+}
+
+void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
+{
+ DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
+}
+
+void QWEBKIT_EXPORT qt_dump_resource_load_callbacks_path(const QString& path)
+{
+ DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(path);
+}
+
+void QWEBKIT_EXPORT qt_set_will_send_request_returns_null_on_redirect(bool b)
+{
+ DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(b);
+
+}
+
+void QWEBKIT_EXPORT qt_set_will_send_request_returns_null(bool b)
+{
+ DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(b);
+}
+
+void QWEBKIT_EXPORT qt_set_will_send_request_clear_headers(const QStringList& headers)
+{
+ DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(headers);
+}
+
+void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
+{
+ DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
+}
+
+void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
+{
+ DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
+}
+
+void QWEBKIT_EXPORT qt_dump_notification(bool b)
+{
+ DumpRenderTreeSupportQt::dumpNotification(b);
+}
diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
index c0187df..6045463 100644
--- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -26,10 +26,9 @@
#include "qwebkitglobal.h"
#include <QVariant>
-#include "qwebelement.h"
-
-class QWebPage;
+class QWebElement;
class QWebFrame;
+class QWebPage;
class QWEBKIT_EXPORT DumpRenderTreeSupportQt {
@@ -78,6 +77,7 @@ public:
static int numberOfPages(QWebFrame* frame, float width, float height);
static int pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height);
static bool hasDocumentElement(QWebFrame* frame);
+ static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId);
static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
static void resetOriginAccessWhiteLists();
@@ -85,6 +85,20 @@ public:
static int workerThreadCount();
static QString markerTextForListItem(const QWebElement& listItem);
+ static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element);
+
+ static void dumpFrameLoader(bool b);
+ static void dumpResourceLoadCallbacks(bool b);
+ static void dumpResourceLoadCallbacksPath(const QString& path);
+ static void setWillSendRequestReturnsNullOnRedirect(bool b);
+ static void setWillSendRequestReturnsNull(bool b);
+ static void setWillSendRequestClearHeaders(const QStringList& headers);
+
+ static void dumpEditingCallbacks(bool b);
+ static void dumpSetAcceptsEditing(bool b);
+
+ static void dumpNotification(bool b);
+
};
#endif
diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index 8a0aa08..83aa2a9 100644
--- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -57,19 +57,6 @@
#include <QUndoStack>
#define methodDebug() qDebug("EditorClientQt: %s", __FUNCTION__);
-static bool dumpEditingCallbacks = false;
-static bool acceptsEditing = true;
-void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
-{
- dumpEditingCallbacks = b;
-}
-
-void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
-{
- acceptsEditing = b;
-}
-
-
static QString dumpPath(WebCore::Node *node)
{
QString str = node->nodeName();
@@ -99,6 +86,9 @@ static QString dumpRange(WebCore::Range *range)
namespace WebCore {
+bool EditorClientQt::dumpEditingCallbacks = false;
+bool EditorClientQt::acceptsEditing = true;
+
using namespace HTMLNames;
bool EditorClientQt::shouldDeleteRange(Range* range)
diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.h b/WebKit/qt/WebCoreSupport/EditorClientQt.h
index 6c20898..811298b 100644
--- a/WebKit/qt/WebCoreSupport/EditorClientQt.h
+++ b/WebKit/qt/WebCoreSupport/EditorClientQt.h
@@ -109,6 +109,9 @@ public:
bool isEditing() const;
+ static bool dumpEditingCallbacks;
+ static bool acceptsEditing;
+
private:
QWebPage* m_page;
bool m_editing;
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index a0b06fb..00359c0 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -78,39 +78,8 @@
#include <QStringList>
#include "qwebhistory_p.h"
-static bool dumpFrameLoaderCallbacks = false;
-static bool dumpResourceLoadCallbacks = false;
-static bool sendRequestReturnsNullOnRedirect = false;
-static bool sendRequestReturnsNull = false;
-static QStringList sendRequestClearHeaders;
-
static QMap<unsigned long, QString> dumpAssignedUrls;
-void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
-{
- dumpFrameLoaderCallbacks = b;
-}
-
-void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
-{
- dumpResourceLoadCallbacks = b;
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_returns_null_on_redirect(bool b)
-{
- sendRequestReturnsNullOnRedirect = b;
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_returns_null(bool b)
-{
- sendRequestReturnsNull = b;
-}
-
-void QWEBKIT_EXPORT qt_set_will_send_request_clear_headers(const QStringList& headers)
-{
- sendRequestClearHeaders = headers;
-}
-
// Compare with WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame)
{
@@ -131,8 +100,10 @@ static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame)
static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url)
{
- QUrl url = _url;
- return url.toString();
+ 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);
}
static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error)
@@ -143,15 +114,15 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError&
static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRequest& request)
{
- QString url = request.url().string();
+ QString url = drtDescriptionSuitableForTestResult(request.url());
QString httpMethod = request.httpMethod();
- QString mainDocumentUrl = request.firstPartyForCookies().string();
+ QString mainDocumentUrl = drtDescriptionSuitableForTestResult(request.firstPartyForCookies());
return QString::fromLatin1("<NSURLRequest URL %1, main document URL %2, http method %3>").arg(url).arg(mainDocumentUrl).arg(httpMethod);
}
static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceResponse& response)
{
- QString url = response.url().string();
+ QString url = drtDescriptionSuitableForTestResult(response.url());
int httpStatusCode = response.httpStatusCode();
return QString::fromLatin1("<NSURLResponse %1, http status code %2>").arg(url).arg(httpStatusCode);
}
@@ -160,6 +131,13 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRespon
namespace WebCore
{
+bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false;
+bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false;
+bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false;
+bool FrameLoaderClientQt::sendRequestReturnsNull = false;
+QStringList FrameLoaderClientQt::sendRequestClearHeaders;
+QString FrameLoaderClientQt::dumpResourceLoadCallbacksPath;
+
FrameLoaderClientQt::FrameLoaderClientQt()
: m_frame(0)
, m_webFrame(0)
@@ -446,13 +424,13 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
void FrameLoaderClientQt::dispatchDidFirstLayout()
{
- if (m_webFrame)
- emit m_webFrame->initialLayoutCompleted();
+ notImplemented();
}
void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout()
{
- notImplemented();
+ if (m_webFrame)
+ emit m_webFrame->initialLayoutCompleted();
}
void FrameLoaderClientQt::dispatchShow()
@@ -1413,11 +1391,10 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
m_hasSentResponseToPlugin = false;
}
-PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&,
- const Vector<String>&, const Vector<String>&)
+PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url,
+ const Vector<String>& paramNames, const Vector<String>& paramValues)
{
- notImplemented();
- return 0;
+ return createPlugin(pluginSize, element, url, paramNames, paramValues, "application/x-java-applet", true);
}
String FrameLoaderClientQt::overrideMediaType() const
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 9c968a0..9aa9344 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -212,6 +212,13 @@ namespace WebCore {
QString chooseFile(const QString& oldFile);
+ static bool dumpFrameLoaderCallbacks;
+ static bool dumpResourceLoadCallbacks;
+ static QString dumpResourceLoadCallbacksPath;
+ static bool sendRequestReturnsNullOnRedirect;
+ static bool sendRequestReturnsNull;
+ static QStringList sendRequestClearHeaders;
+
private:
Frame *m_frame;
QWebFrame *m_webFrame;
diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index a3dd9dd..725c5fb 100644
--- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -89,6 +89,10 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*)
inspectorView->setPage(inspectorPage);
QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector();
+ // This is a known hook that allows changing the default URL for the
+ // Web inspector. This is used for SDK purposes. Please keep this hook
+ // around and don't remove it.
+ // https://bugs.webkit.org/show_bug.cgi?id=35340
QUrl inspectorUrl = inspector->property("_q_inspectorUrl").toUrl();
if (!inspectorUrl.isValid())
inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html");
diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
index e440837..d6546ae 100644
--- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
@@ -41,17 +41,13 @@
#include <QtGui>
-static bool dumpNotification = false;
-
-void QWEBKIT_EXPORT qt_dump_notification(bool b)
-{
- dumpNotification = b;
-}
#if ENABLE(NOTIFICATIONS)
using namespace WebCore;
+bool NotificationPresenterClientQt::dumpNotification = false;
+
NotificationPresenterClientQt::NotificationPresenterClientQt()
{
}
diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
index 272c661..5967867 100644
--- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
+++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
@@ -51,6 +51,8 @@ public:
virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>);
virtual NotificationPresenter::Permission checkPermission(const KURL&);
+ static bool dumpNotification;
+
private:
#ifndef QT_NO_SYSTEMTRAYICON
QSystemTrayIcon m_tray;
diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 611bab7..e19f44f 100644
--- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -103,4 +103,201 @@ QStyle* PageClientQWidget::style() const
return view->style();
}
+PageClientQGraphicsWidget::~PageClientQGraphicsWidget()
+{
+#if USE(ACCELERATED_COMPOSITING)
+ if (!rootGraphicsLayer)
+ return;
+ // we don't need to delete the root graphics layer. The lifecycle is managed in GraphicsLayerQt.cpp.
+ rootGraphicsLayer.data()->setParentItem(0);
+ view->scene()->removeItem(rootGraphicsLayer.data());
+#endif
+}
+
+void PageClientQGraphicsWidget::scroll(int dx, int dy, const QRect& rectToScroll)
+{
+ view->scroll(qreal(dx), qreal(dy), rectToScroll);
+
+#if USE(ACCELERATED_COMPOSITING)
+ updateCompositingScrollPosition();
+#endif
+}
+
+void PageClientQGraphicsWidget::update(const QRect& dirtyRect)
+{
+ view->update(dirtyRect);
+
+ createOrDeleteOverlay();
+ if (overlay)
+ overlay->update(QRectF(dirtyRect));
+#if USE(ACCELERATED_COMPOSITING)
+ syncLayers();
+#endif
+}
+
+void PageClientQGraphicsWidget::createOrDeleteOverlay()
+{
+ bool useOverlay = false;
+ if (!viewResizesToContents) {
+#if USE(ACCELERATED_COMPOSITING)
+ useOverlay = useOverlay || rootGraphicsLayer;
+#endif
+#if ENABLE(TILED_BACKING_STORE)
+ useOverlay = useOverlay || QWebFramePrivate::core(page->mainFrame())->tiledBackingStore();
+#endif
+ }
+ if (useOverlay == !!overlay)
+ return;
+ if (useOverlay) {
+ overlay = QSharedPointer<QGraphicsItemOverlay>(new QGraphicsItemOverlay(view, page));
+ overlay->setZValue(OverlayZValue);
+ } else
+ overlay.clear();
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+void PageClientQGraphicsWidget::syncLayers()
+{
+ if (shouldSync) {
+ QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateRecursive();
+ shouldSync = false;
+ }
+}
+
+void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsItem* layer)
+{
+ if (rootGraphicsLayer) {
+ rootGraphicsLayer.data()->setParentItem(0);
+ view->scene()->removeItem(rootGraphicsLayer.data());
+ QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateRecursive();
+ }
+
+ rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;
+
+ if (layer) {
+ layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
+ layer->setParentItem(view);
+ layer->setZValue(RootGraphicsLayerZValue);
+ updateCompositingScrollPosition();
+ }
+ createOrDeleteOverlay();
+}
+
+void PageClientQGraphicsWidget::markForSync(bool scheduleSync)
+{
+ shouldSync = true;
+ if (scheduleSync)
+ syncMetaMethod.invoke(view, Qt::QueuedConnection);
+}
+
+void PageClientQGraphicsWidget::updateCompositingScrollPosition()
+{
+ if (rootGraphicsLayer && page && page->mainFrame()) {
+ const QPoint scrollPosition = page->mainFrame()->scrollPosition();
+ rootGraphicsLayer.data()->setPos(-scrollPosition);
+ }
+}
+#endif
+
+#if ENABLE(TILED_BACKING_STORE)
+void PageClientQGraphicsWidget::updateTiledBackingStoreScale()
+{
+ WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page->mainFrame())->tiledBackingStore();
+ if (!backingStore)
+ return;
+ backingStore->setContentsScale(view->scale());
+}
+#endif
+
+void PageClientQGraphicsWidget::setInputMethodEnabled(bool enable)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ view->setFlag(QGraphicsItem::ItemAcceptsInputMethod, enable);
+#endif
+}
+
+bool PageClientQGraphicsWidget::inputMethodEnabled() const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ return view->flags() & QGraphicsItem::ItemAcceptsInputMethod;
+#else
+ return false;
+#endif
+}
+
+#if QT_VERSION >= 0x040600
+void PageClientQGraphicsWidget::setInputMethodHint(Qt::InputMethodHint hint, bool enable)
+{
+ if (enable)
+ view->setInputMethodHints(view->inputMethodHints() | hint);
+ else
+ view->setInputMethodHints(view->inputMethodHints() & ~hint);
+}
+#endif
+
+#ifndef QT_NO_CURSOR
+QCursor PageClientQGraphicsWidget::cursor() const
+{
+ return view->cursor();
+}
+
+void PageClientQGraphicsWidget::updateCursor(const QCursor& cursor)
+{
+ view->setCursor(cursor);
+}
+#endif
+
+QPalette PageClientQGraphicsWidget::palette() const
+{
+ return view->palette();
+}
+
+int PageClientQGraphicsWidget::screenNumber() const
+{
+#if defined(Q_WS_X11)
+ if (QGraphicsScene* scene = view->scene()) {
+ const QList<QGraphicsView*> views = scene->views();
+
+ if (!views.isEmpty())
+ return views.at(0)->x11Info().screen();
+ }
+#endif
+
+ return 0;
+}
+
+QWidget* PageClientQGraphicsWidget::ownerWidget() const
+{
+ if (QGraphicsScene* scene = view->scene()) {
+ const QList<QGraphicsView*> views = scene->views();
+ return views.value(0);
+ }
+ return 0;
+}
+
+QRect PageClientQGraphicsWidget::geometryRelativeToOwnerWidget() const
+{
+ if (!view->scene())
+ return QRect();
+
+ QList<QGraphicsView*> views = view->scene()->views();
+ if (views.isEmpty())
+ return QRect();
+
+ QGraphicsView* graphicsView = views.at(0);
+ return graphicsView->mapFromScene(view->boundingRect()).boundingRect();
+}
+
+QObject* PageClientQGraphicsWidget::pluginParent() const
+{
+ return view;
+}
+
+QStyle* PageClientQGraphicsWidget::style() const
+{
+ return view->style();
+}
+
+
+
}
diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h
index 3f09564..9341b19 100644
--- a/WebKit/qt/WebCoreSupport/PageClientQt.h
+++ b/WebKit/qt/WebCoreSupport/PageClientQt.h
@@ -21,10 +21,27 @@
#ifndef PageClientQt_h
#define PageClientQt_h
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "qwebpage.h"
+#include "qwebpage_p.h"
#include "QWebPageClient.h"
+#include "TiledBackingStore.h"
+#include <QtCore/qmetaobject.h>
+#include <QtCore/qsharedpointer.h>
+#include <QtGui/qgraphicsscene.h>
+#include <QtGui/qgraphicsview.h>
+#include <QtGui/qgraphicswidget.h>
+#include <QtGui/qscrollbar.h>
+#include <QtGui/qstyleoption.h>
#include <QtGui/qwidget.h>
+#include <Settings.h>
+
namespace WebCore {
@@ -63,5 +80,123 @@ public:
QWidget* view;
};
+// the overlay is here for one reason only: to have the scroll-bars and other
+// extra UI elements appear on top of any QGraphicsItems created by CSS compositing layers
+class QGraphicsItemOverlay : public QGraphicsItem {
+ public:
+ QGraphicsItemOverlay(QGraphicsWidget* view, QWebPage* p)
+ :QGraphicsItem(view)
+ , q(view)
+ , page(p)
+ {
+ setPos(0, 0);
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
+#endif
+ setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ }
+
+ QRectF boundingRect() const
+ {
+ return q->boundingRect();
+ }
+
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget*)
+ {
+ page->mainFrame()->render(painter, static_cast<QWebFrame::RenderLayer>(QWebFrame::AllLayers&(~QWebFrame::ContentsLayer)), options->exposedRect.toRect());
+ }
+
+ void prepareGraphicsItemGeometryChange()
+ {
+ prepareGeometryChange();
+ }
+
+ QGraphicsWidget* q;
+ QWebPage* page;
+};
+
+
+class PageClientQGraphicsWidget : public QWebPageClient {
+public:
+ PageClientQGraphicsWidget(QGraphicsWidget* v, QWebPage* p)
+ : view(v)
+ , page(p)
+ , viewResizesToContents(false)
+#if USE(ACCELERATED_COMPOSITING)
+ , shouldSync(false)
+#endif
+ {
+ Q_ASSERT(view);
+#if USE(ACCELERATED_COMPOSITING)
+ // the overlay and stays alive for the lifetime of
+ // this QGraphicsWebView as the scrollbars are needed when there's no compositing
+ view->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption);
+ syncMetaMethod = view->metaObject()->method(view->metaObject()->indexOfMethod("syncLayers()"));
+#endif
+ }
+
+ virtual ~PageClientQGraphicsWidget();
+
+ virtual bool isQWidgetClient() const { return false; }
+
+ virtual void scroll(int dx, int dy, const QRect&);
+ virtual void update(const QRect& dirtyRect);
+ virtual void setInputMethodEnabled(bool enable);
+ virtual bool inputMethodEnabled() const;
+#if QT_VERSION >= 0x040600
+ virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable);
+#endif
+
+#ifndef QT_NO_CURSOR
+ virtual QCursor cursor() const;
+ virtual void updateCursor(const QCursor& cursor);
+#endif
+
+ virtual QPalette palette() const;
+ virtual int screenNumber() const;
+ virtual QWidget* ownerWidget() const;
+ virtual QRect geometryRelativeToOwnerWidget() const;
+
+ virtual QObject* pluginParent() const;
+
+ virtual QStyle* style() const;
+
+ void createOrDeleteOverlay();
+
+#if ENABLE(TILED_BACKING_STORE)
+ void updateTiledBackingStoreScale();
+#endif
+
+#if USE(ACCELERATED_COMPOSITING)
+ virtual void setRootGraphicsLayer(QGraphicsItem* layer);
+ virtual void markForSync(bool scheduleSync);
+ void updateCompositingScrollPosition();
+ void syncLayers();
+
+ // QGraphicsWebView can render composited layers
+ virtual bool allowsAcceleratedCompositing() const { return true; }
+#endif
+
+ QGraphicsWidget* view;
+ QWebPage* page;
+ bool viewResizesToContents;
+
+#if USE(ACCELERATED_COMPOSITING)
+ QWeakPointer<QGraphicsObject> rootGraphicsLayer;
+
+ // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue
+ QMetaMethod syncMetaMethod;
+
+ // we need to sync the layers if we get a special call from the WebCore
+ // compositor telling us to do so. We'll get that call from ChromeClientQt
+ bool shouldSync;
+#endif
+ // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached
+ QSharedPointer<QGraphicsItemOverlay> overlay;
+
+ // we need to put the root graphics layer behind the overlay (which contains the scrollbar)
+ enum { RootGraphicsLayerZValue, OverlayZValue };
+};
+
}
#endif // PageClientQt
diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
index 7514077..26420e5 100644
--- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
+++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
@@ -21,6 +21,8 @@
#include "config.h"
#include "QtFallbackWebPopup.h"
+#ifndef QT_NO_COMBOBOX
+
#include "HostWindow.h"
#include "PopupMenuClient.h"
#include "QWebPageClient.h"
@@ -225,3 +227,5 @@ void QtFallbackWebPopup::activeChanged(int index)
}
}
+
+#endif // QT_NO_COMBOBOX
diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
index 62b8aea..6d2e1ff 100644
--- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
+++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
@@ -23,6 +23,8 @@
#include "QtAbstractWebPopup.h"
#include <QComboBox>
+#ifndef QT_NO_COMBOBOX
+
QT_BEGIN_NAMESPACE
class QGraphicsProxyWidget;
QT_END_NAMESPACE
@@ -67,4 +69,6 @@ private:
}
+#endif // QT_NO_COMBOBOX
+
#endif // QtFallbackWebPopup_h
diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
new file mode 100644
index 0000000..a097bf7
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "QtPlatformPlugin.h"
+
+#include "qwebkitplatformplugin.h"
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QPluginLoader>
+
+namespace WebCore {
+
+class SelectData : public QWebSelectData {
+public:
+ SelectData(QtAbstractWebPopup* data) : d(data) {}
+
+ virtual ItemType itemType(int) const;
+ virtual QString itemText(int index) const { return d->itemText(index); }
+ virtual QString itemToolTip(int index) const { return d->itemToolTip(index); }
+ virtual bool itemIsEnabled(int index) const { return d->itemIsEnabled(index); }
+ virtual int itemCount() const { return d->itemCount(); }
+ virtual bool itemIsSelected(int index) const { return d->itemIsSelected(index); }
+ virtual bool multiple() const { return d->multiple(); }
+
+private:
+ QtAbstractWebPopup* d;
+};
+
+QWebSelectData::ItemType SelectData::itemType(int index) const
+{
+ switch (d->itemType(index)) {
+ case QtAbstractWebPopup::Separator: return Separator;
+ case QtAbstractWebPopup::Group: return Group;
+ default: return Option;
+ }
+}
+
+SelectInputMethodWrapper::SelectInputMethodWrapper(QWebSelectMethod* plugin)
+ : m_plugin(plugin)
+{
+ m_plugin->setParent(this);
+ connect(m_plugin, SIGNAL(didHide()), this, SLOT(didHide()));
+ connect(m_plugin, SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
+}
+
+void SelectInputMethodWrapper::show()
+{
+ SelectData data(this);
+ m_plugin->show(data);
+}
+
+void SelectInputMethodWrapper::hide()
+{
+ m_plugin->hide();
+}
+
+void SelectInputMethodWrapper::selectItem(int index, bool allowMultiplySelections, bool shift)
+{
+ QtAbstractWebPopup::selectItem(index, allowMultiplySelections, shift);
+}
+
+void SelectInputMethodWrapper::didHide()
+{
+ QtAbstractWebPopup::popupDidHide();
+}
+
+// QtPlatformPlugin
+
+static QWebKitPlatformPlugin* getPluginObject()
+{
+ const QLatin1String suffix("/webkit/");
+ const QStringList paths = QCoreApplication::libraryPaths();
+ QObject* obj = 0;
+ for (int i = 0; !obj && i < paths.count(); ++i) {
+ const QDir dir(paths[i] + suffix);
+ if (!dir.exists())
+ continue;
+ const QStringList files = dir.entryList(QDir::Files);
+ for (int i = 0; i < files.count(); ++i) {
+ QPluginLoader pluginLoader(dir.absoluteFilePath(files.at(i)));
+ if (!pluginLoader.load())
+ continue;
+ obj = pluginLoader.instance();
+ if (obj) {
+ QWebKitPlatformPlugin* result = qobject_cast<QWebKitPlatformPlugin*>(obj);
+ if (result)
+ return result;
+ delete obj;
+ }
+ pluginLoader.unload();
+ }
+ }
+ return 0;
+}
+
+QtPlatformPlugin::~QtPlatformPlugin()
+{
+ delete m_plugin;
+}
+
+QWebKitPlatformPlugin* QtPlatformPlugin::plugin()
+{
+ if (m_loaded)
+ return m_plugin;
+
+ m_loaded = true;
+ m_plugin = getPluginObject();
+ return m_plugin;
+}
+
+QtAbstractWebPopup* QtPlatformPlugin::createSelectInputMethod()
+{
+ QWebKitPlatformPlugin* p = plugin();
+ if (!p)
+ return 0;
+
+ QWebSelectMethod* selector = p->createSelectInputMethod();
+ if (!selector)
+ return 0;
+
+ return new SelectInputMethodWrapper(selector);
+}
+
+}
diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
new file mode 100644
index 0000000..9b73079
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef QtPlatformPlugin_h
+#define QtPlatformPlugin_h
+
+#include "QtAbstractWebPopup.h"
+#include <QObject>
+
+class QWebSelectMethod;
+class QWebKitPlatformPlugin;
+
+namespace WebCore {
+
+class SelectInputMethodWrapper : public QObject, public QtAbstractWebPopup {
+ Q_OBJECT
+public:
+ SelectInputMethodWrapper(QWebSelectMethod* plugin);
+
+ virtual void show();
+ virtual void hide();
+
+private Q_SLOTS:
+ void selectItem(int index, bool allowMultiplySelections, bool shift);
+ void didHide();
+
+private:
+ QWebSelectMethod* m_plugin;
+};
+
+class QtPlatformPlugin {
+public:
+ QtPlatformPlugin() : m_loaded(false), m_plugin(0) {}
+ ~QtPlatformPlugin();
+
+ QtAbstractWebPopup* createSelectInputMethod();
+
+private:
+ bool m_loaded;
+ QWebKitPlatformPlugin* m_plugin;
+
+ QWebKitPlatformPlugin* plugin();
+};
+
+}
+
+#endif // QtPlatformPlugin_h