Diff
Modified: trunk/LayoutTests/ChangeLog (89049 => 89050)
--- trunk/LayoutTests/ChangeLog 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/LayoutTests/ChangeLog 2011-06-16 18:23:36 UTC (rev 89050)
@@ -1,3 +1,14 @@
+2011-06-16 Chang Shu <[email protected]>
+
+ Reviewed by Sam Weinig.
+
+ [Qt] [WK2] Qt WebKit2 needs undo/redo support
+ https://bugs.webkit.org/show_bug.cgi?id=62637
+
+ Unskip passed tests.
+
+ * platform/qt-wk2/Skipped:
+
2011-06-16 Vsevolod Vlasov <[email protected]>
Reviewed by Pavel Feldman.
Modified: trunk/LayoutTests/platform/qt-wk2/Skipped (89049 => 89050)
--- trunk/LayoutTests/platform/qt-wk2/Skipped 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/LayoutTests/platform/qt-wk2/Skipped 2011-06-16 18:23:36 UTC (rev 89050)
@@ -199,9 +199,6 @@
editing/selection/user-drag-element-and-user-select-none.html
editing/selection/word-granularity.html
editing/spelling/context-menu-suggestions.html
-editing/undo/undo-deleteWord.html
-editing/undo/undo-smart-delete-reversed-selection.html
-editing/undo/undo-smart-delete-word.html
fast/blockflow/horizontal-bt-replaced-selection.html
fast/blockflow/japanese-lr-selection.html
fast/blockflow/japanese-rl-selection.html
@@ -1297,7 +1294,6 @@
editing/style/remove-underline-from-stylesheet.html
editing/style/typing-style-003.html
editing/text-iterator/thai-cursor-movement.html
-editing/undo/replace-by-span-then-remove.html
editing/deleting/5168598.html
editing/deleting/delete-line-011.html
editing/pasteboard/createMarkup-assert.xml
@@ -1749,28 +1745,6 @@
fast/dom/Window/window-resize-and-move-arguments.html
fast/dom/Window/window-resize.html
-# WebKit2 needs undo/redo support
-editing/undo/remove-css-property-and-remove-style.html
-editing/deleting/delete-and-undo.html
-editing/execCommand/convert-style-elements-to-spans.html
-editing/inserting/redo.html
-editing/undo/4063751.html
-editing/undo/5378473.html
-editing/undo/redo-split-text-node.html
-editing/undo/redo-split-text-with-removal.html
-editing/undo/redo-style.html
-editing/undo/redo-typing-001.html
-editing/undo/undo-combined-delete-boundary.html
-editing/undo/undo-combined-delete.html
-editing/undo/undo-delete-boundary.html
-editing/undo/undo-delete.html
-editing/undo/undo-forward-delete-boundary.html
-editing/undo/undo-forward-delete.html
-editing/undo/undo-iframe-location-change.html
-editing/undo/undo-indent.html
-editing/undo/undo-misspellings.html
-editing/undo/undo-typing-001.html
-
# WebKit2 needs to define a default charset (Settings::defaultTextEncodingName)
fast/dom/Document/document-charset.html
@@ -2968,6 +2942,7 @@
tables/mozilla_expected_failures/dom/appendCellsRebuild1.html
tables/mozilla_expected_failures/dom/insertTbodyExpand1.html
tables/mozilla_expected_failures/dom/insertTbodyRebuild1.html
+editing/deleting/delete-and-undo.html
# [Qt][WK2]http/tests/loading/preload-append-scan.php fails
# https://bugs.webkit.org/show_bug.cgi?id=58253
@@ -3018,9 +2993,6 @@
# fail after http://trac.webkit.org/changeset/87067
fast/forms/textfield-overflow.html
-# new test inroduced in r87204, but fail
-editing/undo/undo-after-setting-value.html
-
# unskipped by r88152, but fail on Qt-WK2 platform
editing/selection/select-across-readonly-input-1.html
editing/selection/select-across-readonly-input-2.html
Modified: trunk/Source/WebKit2/ChangeLog (89049 => 89050)
--- trunk/Source/WebKit2/ChangeLog 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-16 18:23:36 UTC (rev 89050)
@@ -1,3 +1,29 @@
+2011-06-16 Chang Shu <[email protected]>
+
+ Reviewed by Sam Weinig.
+
+ [Qt] [WK2] Qt WebKit2 needs undo/redo support
+ https://bugs.webkit.org/show_bug.cgi?id=62637
+
+ Implement undo/redo support for document.execCommand().
+
+ * UIProcess/API/qt/qwkpage.cpp:
+ (QWKPagePrivate::QWKPagePrivate):
+ (QWKPagePrivate::~QWKPagePrivate):
+ (QWKPagePrivate::registerEditCommand):
+ (QWKPagePrivate::clearAllEditCommands):
+ (QWKPagePrivate::canUndoRedo):
+ (QWKPagePrivate::executeUndoRedo):
+ * UIProcess/API/qt/qwkpage_p.h:
+ * UIProcess/qt/WebUndoCommandQt.cpp: Added.
+ (WebUndoCommandQt::WebUndoCommandQt):
+ (WebUndoCommandQt::~WebUndoCommandQt):
+ (WebUndoCommandQt::redo):
+ (WebUndoCommandQt::undo):
+ * UIProcess/qt/WebUndoCommandQt.h: Added.
+ (WebUndoCommandQt::inUndoRedo):
+ * WebKit2.pro:
+
2011-06-16 Anders Carlsson <[email protected]>
Fix build.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp (89049 => 89050)
--- trunk/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp 2011-06-16 18:23:36 UTC (rev 89050)
@@ -41,8 +41,10 @@
#include "TiledDrawingAreaProxy.h"
#include "WebContext.h"
#include "WebContextMenuProxyQt.h"
+#include "WebEditCommandProxy.h"
#include "WebEventFactoryQt.h"
#include "WebPopupMenuProxyQt.h"
+#include "WebUndoCommandQt.h"
#include "WKStringQt.h"
#include "WKURLQt.h"
#include "ViewportArguments.h"
@@ -51,6 +53,7 @@
#include <QGraphicsSceneMouseEvent>
#include <QStyle>
#include <QTouchEvent>
+#include <QUndoStack>
#include <QtDebug>
#include <WebCore/Cursor.h>
#include <WebCore/FloatRect.h>
@@ -96,6 +99,9 @@
, createNewPageFn(0)
, backingStoreType(QGraphicsWKView::Simple)
, isConnectedToEngine(true)
+#ifndef QT_NO_UNDOSTACK
+ , undoStack(adoptPtr(new QUndoStack(qq)))
+#endif
{
memset(actions, 0, sizeof(actions));
page = context->d->context->createWebPage(this, toImpl(pageGroupRef));
@@ -206,21 +212,44 @@
emit q->toolTipChanged(QString(newTooltip));
}
-void QWKPagePrivate::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo)
+void QWKPagePrivate::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo)
{
+#ifndef QT_NO_UNDOSTACK
+ if (undoOrRedo == WebPageProxy::Undo) {
+ const WebUndoCommandQt* webUndoCommand = static_cast<const WebUndoCommandQt*>(undoStack->command(undoStack->index()));
+ if (webUndoCommand && webUndoCommand->inUndoRedo())
+ return;
+ undoStack->push(new WebUndoCommandQt(command));
+ }
+#endif
}
void QWKPagePrivate::clearAllEditCommands()
{
+#ifndef QT_NO_UNDOSTACK
+ undoStack->clear();
+#endif
}
-bool QWKPagePrivate::canUndoRedo(WebPageProxy::UndoOrRedo)
+bool QWKPagePrivate::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
{
+#ifdef QT_NO_UNDOSTACK
return false;
+#else
+ if (undoOrRedo == WebPageProxy::Undo)
+ return undoStack->canUndo();
+ return undoStack->canRedo();
+#endif
}
-void QWKPagePrivate::executeUndoRedo(WebPageProxy::UndoOrRedo)
+void QWKPagePrivate::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
{
+#ifndef QT_NO_UNDOSTACK
+ if (undoOrRedo == WebPageProxy::Undo)
+ undoStack->undo();
+ else
+ undoStack->redo();
+#endif
}
FloatRect QWKPagePrivate::convertToDeviceSpace(const FloatRect& rect)
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h (89049 => 89050)
--- trunk/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h 2011-06-16 18:23:36 UTC (rev 89050)
@@ -34,6 +34,7 @@
#include <QKeyEvent>
class QGraphicsWKView;
+class QUndoStack;
class QWKPreferences;
using namespace WebKit;
@@ -138,6 +139,10 @@
QGraphicsWKView::BackingStoreType backingStoreType;
bool isConnectedToEngine;
+
+#ifndef QT_NO_UNDOSTACK
+ OwnPtr<QUndoStack> undoStack;
+#endif
};
class QtViewportAttributesPrivate : public QSharedData {
Added: trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.cpp (0 => 89050)
--- trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.cpp 2011-06-16 18:23:36 UTC (rev 89050)
@@ -0,0 +1,71 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2007 Staikos Computing Services Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "WebUndoCommandQt.h"
+
+using namespace WebKit;
+
+#ifndef QT_NO_UNDOCOMMAND
+WebUndoCommandQt::WebUndoCommandQt(PassRefPtr<WebEditCommandProxy> command, QUndoCommand* parent)
+ : QUndoCommand(parent)
+ , m_command(command)
+ , m_first(true)
+ , m_inUndoRedo(false)
+{
+}
+#else
+WebUndoCommandQt::WebUndoCommandQt(PassRefPtr<WebEditCommandProxy> command)
+ : m_command(command)
+ , m_first(true)
+ , m_inUndoRedo(false)
+{
+}
+#endif
+
+WebUndoCommandQt::~WebUndoCommandQt()
+{
+}
+
+void WebUndoCommandQt::redo()
+{
+ m_inUndoRedo = true;
+
+ // Ignore the first redo called from QUndoStack::push().
+ if (m_first) {
+ m_first = false;
+ m_inUndoRedo = false;
+ return;
+ }
+ if (m_command)
+ m_command->reapply();
+
+ m_inUndoRedo = false;
+}
+
+void WebUndoCommandQt::undo()
+{
+ m_inUndoRedo = true;
+
+ if (m_command)
+ m_command->unapply();
+
+ m_inUndoRedo = false;
+}
Added: trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.h (0 => 89050)
--- trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/qt/WebUndoCommandQt.h 2011-06-16 18:23:36 UTC (rev 89050)
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2007 Staikos Computing Services Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef WebUndoCommandQt_h
+#define WebUndoCommandQt_h
+
+#include "WebEditCommandProxy.h"
+#include <QUndoCommand>
+#include <qglobal.h>
+#include <wtf/RefPtr.h>
+
+class WebUndoCommandQt
+#ifndef QT_NO_UNDOCOMMAND
+ : public QUndoCommand
+#endif
+{
+public:
+#ifndef QT_NO_UNDOCOMMAND
+ WebUndoCommandQt(PassRefPtr<WebKit::WebEditCommandProxy>, QUndoCommand* parent = 0);
+#else
+ WebUndoCommandQt(PassRefPtr<WebKit::WebEditCommandProxy>);
+#endif
+ ~WebUndoCommandQt();
+
+ void redo();
+ void undo();
+
+ bool inUndoRedo() const { return m_inUndoRedo; };
+
+private:
+ RefPtr<WebKit::WebEditCommandProxy> m_command;
+ bool m_first;
+ bool m_inUndoRedo;
+};
+
+#endif // WebUndoCommandQt_h
Modified: trunk/Source/WebKit2/WebKit2.pro (89049 => 89050)
--- trunk/Source/WebKit2/WebKit2.pro 2011-06-16 18:14:32 UTC (rev 89049)
+++ trunk/Source/WebKit2/WebKit2.pro 2011-06-16 18:23:36 UTC (rev 89050)
@@ -232,6 +232,7 @@
UIProcess/WebResourceCacheManagerProxy.h \
UIProcess/WebResourceLoadClient.h \
UIProcess/WebUIClient.h \
+ UIProcess/qt/WebUndoCommandQt.h \
UIProcess/qt/WebContextMenuProxyQt.h \
UIProcess/qt/WebPopupMenuProxyQt.h \
WebProcess/ApplicationCache/WebApplicationCacheManager.h \
@@ -391,6 +392,7 @@
UIProcess/Downloads/DownloadProxy.cpp \
UIProcess/DrawingAreaProxy.cpp \
UIProcess/DrawingAreaProxyImpl.cpp \
+ UIProcess/qt/WebUndoCommandQt.cpp \
UIProcess/FindIndicator.cpp \
UIProcess/GeolocationPermissionRequestManagerProxy.cpp \
UIProcess/GeolocationPermissionRequestProxy.cpp \