diff options
author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit2/UIProcess/qt | |
parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit2/UIProcess/qt')
-rw-r--r-- | Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp | 81 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp | 98 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp | 71 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp | 160 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp | 144 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h | 55 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebContextQt.cpp | 47 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp | 61 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp | 36 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp | 52 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h | 50 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp | 50 |
12 files changed, 905 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp new file mode 100644 index 0000000..06ce7c6 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "ChunkedUpdateDrawingAreaProxy.h" + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "WebPageProxy.h" +#include "qgraphicswkview.h" +#include <QPainter> + +using namespace WebCore; + +namespace WebKit { + +WebPageProxy* ChunkedUpdateDrawingAreaProxy::page() +{ + return toImpl(m_webView->page()->pageRef()); +} + +void ChunkedUpdateDrawingAreaProxy::ensureBackingStore() +{ + if (!m_backingStoreImage.isNull()) + return; + + m_backingStoreImage = QImage(size().width(), size().height(), QImage::Format_RGB32); +} + +void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore() +{ + m_backingStoreImage = QImage(); +} + +bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, QPainter* painter) +{ + if (m_backingStoreImage.isNull()) + return false; + + painter->drawImage(QPoint(0, 0), m_backingStoreImage); + return true; +} + +void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) +{ + ensureBackingStore(); + + QImage image(updateChunk->createImage()); + const IntRect& updateChunkRect = updateChunk->rect(); + + QPainter painter(&m_backingStoreImage); + painter.drawImage(updateChunkRect.topLeft(), image); + + m_webView->update(QRect(updateChunkRect)); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp new file mode 100644 index 0000000..9ab6297 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "TextChecker.h" + +#include "NotImplemented.h" +#include "TextCheckerState.h" + +using namespace WebCore; + +namespace WebKit { + +static TextCheckerState textCheckerState; + +const TextCheckerState& TextChecker::state() +{ + notImplemented(); + + return textCheckerState; +} + +bool TextChecker::isContinuousSpellCheckingAllowed() +{ + notImplemented(); + + return false; +} + +void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled) +{ + notImplemented(); +} + +void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled) +{ + notImplemented(); +} + +int64_t TextChecker::uniqueSpellDocumentTag() +{ + notImplemented(); + return 0; +} + +void TextChecker::closeSpellDocumentWithTag(int64_t) +{ + notImplemented(); +} + +Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +{ + notImplemented(); + return Vector<WebCore::TextCheckingResult>(); +} + +void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +{ + notImplemented(); +} + +void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses) +{ + notImplemented(); +} + +void TextChecker::learnWord(const String& word) +{ + notImplemented(); +} + +void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp new file mode 100644 index 0000000..59faa1e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "TiledDrawingAreaProxy.h" + +#if ENABLE(TILED_BACKING_STORE) + +#include "DrawingAreaMessageKinds.h" +#include "DrawingAreaProxyMessageKinds.h" +#include "UpdateChunk.h" +#include "WKAPICast.h" +#include "WebPageProxy.h" + +#include "qgraphicswkview.h" + +using namespace WebCore; + +#define TILE_DEBUG_LOG + +namespace WebKit { + +void TiledDrawingAreaProxy::updateWebView(const Vector<IntRect>& paintedArea) +{ + if (!page() || !page()->isValid()) + return; + + unsigned size = paintedArea.size(); + for (unsigned n = 0; n < size; ++n) + m_webView->update(QRect(paintedArea[n])); +} + +IntRect TiledDrawingAreaProxy::webViewVisibleRect() +{ + return enclosingIntRect(FloatRect(m_webView->visibleRect())); +} + +WebPageProxy* TiledDrawingAreaProxy::page() +{ + return toImpl(m_webView->page()->pageRef()); +} + +void TiledDrawingAreaProxy::snapshotTaken(UpdateChunk& chunk) +{ + emit m_webView->snapshotTaken(chunk.createImage()); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp new file mode 100644 index 0000000..2b631ca --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "TiledDrawingAreaTile.h" + +#if ENABLE(TILED_BACKING_STORE) + +#include "GraphicsContext.h" +#include "TiledDrawingAreaProxy.h" +#include "WebPageProxy.h" +#include "WebProcessProxy.h" +#include "UpdateChunk.h" +#include <QApplication> +#include <QObject> +#include <QPainter> + +using namespace WebCore; + +namespace WebKit { + +TiledDrawingAreaTile::TiledDrawingAreaTile(TiledDrawingAreaProxy* proxy, const Coordinate& tileCoordinate) + : m_proxy(proxy) + , m_coordinate(tileCoordinate) + , m_rect(proxy->tileRectForCoordinate(tileCoordinate)) + , m_hasUpdatePending(false) + , m_dirtyRegion(m_rect) +{ + static int id = 0; + m_ID = ++id; +#ifdef TILE_DEBUG_LOG + qDebug() << "deleting tile id=" << m_ID; +#endif +} + +TiledDrawingAreaTile::~TiledDrawingAreaTile() +{ +#ifdef TILE_DEBUG_LOG + qDebug() << "deleting tile id=" << m_ID; +#endif +} + +bool TiledDrawingAreaTile::isDirty() const +{ + return !m_dirtyRegion.isEmpty(); +} + +bool TiledDrawingAreaTile::isReadyToPaint() const +{ + return !m_buffer.isNull(); +} + +bool TiledDrawingAreaTile::hasReadyBackBuffer() const +{ + return !m_backBuffer.isNull() && !m_hasUpdatePending; +} + +void TiledDrawingAreaTile::invalidate(const IntRect& dirtyRect) +{ + IntRect tileDirtyRect = intersection(dirtyRect, m_rect); + if (tileDirtyRect.isEmpty()) + return; + + m_dirtyRegion += tileDirtyRect; +} + +void TiledDrawingAreaTile::resize(const IntSize& newSize) +{ + IntRect oldRect = m_rect; + m_rect = IntRect(m_rect.topLeft(), newSize); + if (m_rect.right() > oldRect.right()) + invalidate(IntRect(oldRect.right(), oldRect.y(), m_rect.right() - oldRect.right(), m_rect.height())); + if (m_rect.bottom() > oldRect.bottom()) + invalidate(IntRect(oldRect.x(), oldRect.bottom(), m_rect.width(), m_rect.bottom() - oldRect.bottom())); +} + +void TiledDrawingAreaTile::swapBackBufferToFront() +{ + ASSERT(!m_backBuffer.isNull()); + + m_buffer = m_backBuffer; + m_backBuffer = QPixmap(); +} + +void TiledDrawingAreaTile::paint(GraphicsContext* context, const IntRect& rect) +{ + ASSERT(!m_buffer.isNull()); + + IntRect target = intersection(rect, m_rect); + IntRect source((target.x() - m_rect.x()), + (target.y() - m_rect.y()), + target.width(), + target.height()); + + context->platformContext()->drawPixmap(target, m_buffer, source); +} + +void TiledDrawingAreaTile::updateFromChunk(UpdateChunk* updateChunk, float) +{ + QImage image(updateChunk->createImage()); + const IntRect& updateChunkRect = updateChunk->rect(); + +#ifdef TILE_DEBUG_LOG + qDebug() << "tile updated id=" << ID() << " rect=" << QRect(updateChunkRect); +#endif + if (updateChunkRect.size() == m_proxy->tileSize()) { + // Make a deep copy of the image since it's in shared memory. + m_backBuffer = QPixmap::fromImage(image.copy()); + } else { + if (m_backBuffer.isNull()) + m_backBuffer = m_buffer.isNull() ? QPixmap(m_proxy->tileSize()) : m_buffer; + QPainter painter(&m_backBuffer); + IntSize drawPoint = updateChunkRect.topLeft() - m_rect.topLeft(); + painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image); + } + m_hasUpdatePending = false; +} + +void TiledDrawingAreaTile::updateBackBuffer() +{ + if (isReadyToPaint() && !isDirty()) + return; + + // FIXME: individual rects + IntRect dirtyRect = m_dirtyRegion.boundingRect(); + m_dirtyRegion = QRegion(); + +#ifdef TILE_DEBUG_LOG + qDebug() << "requesting tile update id=" << m_ID << " rect=" << QRect(dirtyRect) << " scale=" << m_proxy->contentsScale(); +#endif + if (!m_proxy->page()->process()->isValid()) + return; + m_proxy->requestTileUpdate(m_ID, dirtyRect); + + m_hasUpdatePending = true; +} + +} +#endif diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp new file mode 100644 index 0000000..566a22e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "WebContextMenuProxyQt.h" + +#include <IntPoint.h> +#include <WebContextMenuItemData.h> +#include <qmenu.h> +#include <qwkpage.h> + +using namespace WebCore; + +namespace WebKit { + +static QWKPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAction action) +{ + switch (action) { + case WebCore::ContextMenuItemTagOpenLink: + return QWKPage::OpenLink; + case WebCore::ContextMenuItemTagOpenLinkInNewWindow: + return QWKPage::OpenLinkInNewWindow; + case WebCore::ContextMenuItemTagCopyLinkToClipboard: + return QWKPage::CopyLinkToClipboard; + case WebCore::ContextMenuItemTagOpenImageInNewWindow: + return QWKPage::OpenImageInNewWindow; + case WebCore::ContextMenuItemTagGoBack: + return QWKPage::Back; + case WebCore::ContextMenuItemTagGoForward: + return QWKPage::Forward; + case WebCore::ContextMenuItemTagStop: + return QWKPage::Stop; + case WebCore::ContextMenuItemTagReload: + return QWKPage::Reload; + case WebCore::ContextMenuItemTagCut: + return QWKPage::Cut; + case WebCore::ContextMenuItemTagCopy: + return QWKPage::Copy; + case WebCore::ContextMenuItemTagPaste: + return QWKPage::Paste; + case WebCore::ContextMenuItemTagSelectAll: + return QWKPage::SelectAll; + default: + break; + } + return QWKPage::NoWebAction; +} + +WebContextMenuProxyQt::WebContextMenuProxyQt(QWKPage* page) + : m_page(page) +{ +} + +PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QWKPage* page) +{ + return adoptRef(new WebContextMenuProxyQt(page)); +} + +void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items) +{ + if (QMenu* menu = createContextMenu(items)) { + menu->move(position); + emit m_page->showContextMenu(menu); + } +} + +void WebContextMenuProxyQt::hideContextMenu() +{ +} + +QMenu* WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) +{ + QMenu* menu = new QMenu; + for (int i = 0; i < items.size(); ++i) { + const WebContextMenuItemData& item = items.at(i); + switch (item.type()) { + case WebCore::CheckableActionType: /* fall through */ + case WebCore::ActionType: { + QWKPage::WebAction action = webActionForContextMenuAction(item.action()); + QAction* qtAction = m_page->action(action); + if (qtAction) { + qtAction->setEnabled(item.enabled()); + qtAction->setChecked(item.checked()); + qtAction->setCheckable(item.type() == WebCore::CheckableActionType); + + menu->addAction(qtAction); + } + break; + } + case WebCore::SeparatorType: + menu->addSeparator(); + break; + case WebCore::SubmenuType: + if (QMenu *subMenu = createContextMenu(item.submenu())) { + subMenu->setTitle(item.title()); + menu->addAction(subMenu->menuAction()); + } + + break; + } + } + + // Do not show sub-menus with just disabled actions. + if (menu->isEmpty()) { + delete menu; + return 0; + } + bool isAnyActionEnabled = false; + QList<QAction *> actions = menu->actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->isVisible()) + isAnyActionEnabled |= actions.at(i)->isEnabled(); + } + if (!isAnyActionEnabled) { + delete menu; + return 0; + } + + return menu; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h new file mode 100644 index 0000000..435204f --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WebContextMenuProxyQt_h +#define WebContextMenuProxyQt_h + +#include "WebContextMenuProxy.h" + +class QMenu; +class QWKPage; +class WebContextMenuItemData; + +namespace WebKit { + +class WebContextMenuProxyQt : public WebContextMenuProxy { +public: + static PassRefPtr<WebContextMenuProxyQt> create(QWKPage*); + +private: + WebContextMenuProxyQt(QWKPage*); + + virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&); + virtual void hideContextMenu(); + + QMenu* createContextMenu(const Vector<WebContextMenuItemData>& items); + + QWKPage* const m_page; +}; + +} // namespace WebKit + +#endif // WebContextMenuProxyQt_h diff --git a/Source/WebKit2/UIProcess/qt/WebContextQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp new file mode 100644 index 0000000..5b2cd88 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebContextQt.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 University of Szeged + * + * 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 INC. AND ITS CONTRIBUTORS 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 INC. OR ITS 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 "WebContext.h" + +#include "ApplicationCacheStorage.h" +#include "WebProcessCreationParameters.h" + +namespace WebKit { + +String WebContext::applicationCacheDirectory() +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + return WebCore::cacheStorage().cacheDirectory(); +#else + return QString(); +#endif +} + +void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&) +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp new file mode 100644 index 0000000..c04bd99 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "WebInspectorProxy.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/WTFString.h> + +#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1 +#include "NotImplemented.h" + +namespace WebKit { + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + notImplemented(); + return 0; +} + +void WebInspectorProxy::platformOpen() +{ + notImplemented(); +} + +void WebInspectorProxy::platformClose() +{ + notImplemented(); +} + +String WebInspectorProxy::inspectorPageURL() const +{ + notImplemented(); + return String(); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp new file mode 100644 index 0000000..baf765a --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "WebPageProxy.h" + +namespace WebKit { + +String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) +{ + // FIXME: This should not be hard coded. + return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-us) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4"; +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp new file mode 100644 index 0000000..5e13499 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "WebPopupMenuProxyQt.h" + +#include "PlatformPopupMenuData.h" +#include "WebPopupItem.h" + +using namespace WebCore; + +namespace WebKit { + +WebPopupMenuProxyQt::WebPopupMenuProxyQt() + : WebPopupMenuProxy(0) +{ +} + +WebPopupMenuProxyQt::~WebPopupMenuProxyQt() +{ +} + +void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) +{ +} + +void WebPopupMenuProxyQt::hidePopupMenu() +{ +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h new file mode 100644 index 0000000..e6c7a1e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WebPopupMenuProxyQt_h +#define WebPopupMenuProxyQt_h + +#include "WebPopupMenuProxy.h" + +namespace WebKit { + +class WebPopupMenuProxyQt : public WebPopupMenuProxy { +public: + static PassRefPtr<WebPopupMenuProxyQt> create() + { + return adoptRef(new WebPopupMenuProxyQt()); + } + ~WebPopupMenuProxyQt(); + + virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex); + virtual void hidePopupMenu(); + +private: + WebPopupMenuProxyQt(); +}; + +} // namespace WebKit + +#endif // WebPopupMenuProxyQt_h diff --git a/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp new file mode 100644 index 0000000..173cfd5 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/WebPreferencesQt.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Apple Inc. 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "WebPreferences.h" + +namespace WebKit { + +void WebPreferences::platformInitializeStore() +{ +} + +void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) +{ +} + +void WebPreferences::platformUpdateBoolValueForKey(const String&, bool) +{ +} + +void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t) +{ +} + +void WebPreferences::platformUpdateDoubleValueForKey(const String&, double) +{ +} + +} // namespace WebKit |