Changeset 102666 in webkit
- Timestamp:
- Dec 13, 2011 2:24:44 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102652 r102666 1 2011-12-12 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 [Qt][WK2] Move undo & edit command PageClient callbacks into QtWebUndoController 4 https://bugs.webkit.org/show_bug.cgi?id=74364 5 6 Reviewed by Simon Hausmann. 7 8 The four callbacks in PageClient related to Undo depend only on the QUndoStack. So we 9 move their handling to a QtWebUndoController (owned by QQuickWebViewPrivate). This also 10 make QtWebUndoCommand an implementation detail. 11 12 * Target.pri: 13 * UIProcess/API/qt/qquickwebview.cpp: 14 (QQuickWebViewPrivate::QQuickWebViewPrivate): 15 * UIProcess/API/qt/qquickwebview_p_p.h: 16 * UIProcess/qt/QtPageClient.cpp: 17 (QtPageClient::registerEditCommand): 18 (QtPageClient::clearAllEditCommands): 19 (QtPageClient::canUndoRedo): 20 (QtPageClient::executeUndoRedo): 21 * UIProcess/qt/QtPageClient.h: 22 (QtPageClient::initialize): 23 * UIProcess/qt/QtWebPageProxy.cpp: 24 * UIProcess/qt/QtWebPageProxy.h: 25 * UIProcess/qt/QtWebUndoController.cpp: Renamed from Source/WebKit2/UIProcess/qt/QtWebUndoCommand.cpp. 26 (QtWebUndoCommand::inUndoRedo): 27 (QtWebUndoCommand::QtWebUndoCommand): 28 (QtWebUndoCommand::~QtWebUndoCommand): 29 (QtWebUndoCommand::redo): 30 (QtWebUndoCommand::undo): 31 (QtWebUndoController::QtWebUndoController): 32 (QtWebUndoController::registerEditCommand): 33 (QtWebUndoController::clearAllEditCommands): 34 (QtWebUndoController::canUndoRedo): 35 (QtWebUndoController::executeUndoRedo): 36 * UIProcess/qt/QtWebUndoController.h: Renamed from Source/WebKit2/UIProcess/qt/QtWebUndoCommand.h. 37 1 38 2011-12-12 Andreas Kling <kling@webkit.org> 2 39 -
trunk/Source/WebKit2/Target.pri
r102640 r102666 270 270 UIProcess/qt/QtSGTileNode.h \ 271 271 UIProcess/qt/QtViewportInteractionEngine.h \ 272 UIProcess/qt/QtWebUndoCo mmand.h \272 UIProcess/qt/QtWebUndoController.h \ 273 273 UIProcess/qt/WebContextMenuProxyQt.h \ 274 274 UIProcess/qt/WebGeolocationProviderQt.h \ … … 512 512 UIProcess/DrawingAreaProxy.cpp \ 513 513 UIProcess/DrawingAreaProxyImpl.cpp \ 514 UIProcess/qt/QtWebUndoCo mmand.cpp \514 UIProcess/qt/QtWebUndoController.cpp \ 515 515 UIProcess/FindIndicator.cpp \ 516 516 UIProcess/GeolocationPermissionRequestManagerProxy.cpp \ -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r102593 r102666 70 70 QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true); 71 71 72 pageClient->setEventHandler(eventHandler.data()); 73 pageClient->setPageProxy(pageProxy.data()); 72 pageClient->initialize(pageProxy.data(), eventHandler.data(), &undoController); 74 73 75 74 // Creates a page with the page creation parameters. -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
r102593 r102666 29 29 #include "QtWebPageProxy.h" 30 30 #include "QtWebPageUIClient.h" 31 #include "QtWebUndoController.h" 31 32 32 33 #include "qquickwebview_p.h" … … 117 118 }; 118 119 120 QtWebUndoController undoController; 121 119 122 QScopedPointer<QtPageClient> pageClient; 120 123 QScopedPointer<QtWebPageEventHandler> eventHandler; -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp
r102579 r102666 24 24 #include "QtWebPageEventHandler.h" 25 25 #include "QtWebPageProxy.h" 26 #include "QtWebUndoCo mmand.h"26 #include "QtWebUndoController.h" 27 27 #include "WebContextMenuProxyQt.h" 28 28 #include "WebEditCommandProxy.h" … … 109 109 void QtPageClient::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo) 110 110 { 111 m_ qtWebPageProxy->registerEditCommand(command, undoOrRedo);111 m_undoController->registerEditCommand(command, undoOrRedo); 112 112 } 113 113 114 114 void QtPageClient::clearAllEditCommands() 115 115 { 116 m_ qtWebPageProxy->clearAllEditCommands();116 m_undoController->clearAllEditCommands(); 117 117 } 118 118 119 119 bool QtPageClient::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) 120 120 { 121 return m_ qtWebPageProxy->canUndoRedo(undoOrRedo);121 return m_undoController->canUndoRedo(undoOrRedo); 122 122 } 123 123 124 124 void QtPageClient::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) 125 125 { 126 m_ qtWebPageProxy->executeUndoRedo(undoOrRedo);126 m_undoController->executeUndoRedo(undoOrRedo); 127 127 } 128 128 -
trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h
r102136 r102666 29 29 30 30 class QtWebPageEventHandler; 31 class QtWebUndoController; 31 32 32 33 using namespace WebKit; … … 60 61 virtual void setCursorHiddenUntilMouseMoves(bool); 61 62 virtual void toolTipChanged(const String&, const String&); 63 64 // QtWebUndoController 62 65 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo); 63 66 virtual void clearAllEditCommands(); 64 67 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo); 65 68 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo); 69 66 70 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&); 67 71 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&); … … 89 93 #endif 90 94 91 void setEventHandler(QtWebPageEventHandler* eventHandler) { m_eventHandler = eventHandler; } 92 void setPageProxy(QtWebPageProxy* pageProxy) { m_qtWebPageProxy = pageProxy; } 95 void initialize(QtWebPageProxy* pageProxy, QtWebPageEventHandler* eventHandler, QtWebUndoController* undoController) 96 { 97 m_eventHandler = eventHandler; 98 m_qtWebPageProxy = pageProxy; 99 m_undoController = undoController; 100 } 93 101 94 102 private: 95 103 QtWebPageProxy* m_qtWebPageProxy; 96 104 QtWebPageEventHandler* m_eventHandler; 105 QtWebUndoController* m_undoController; 97 106 }; 98 107 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r102586 r102666 40 40 #include "QtPageClient.h" 41 41 #include "QtWebPageEventHandler.h" 42 #include "QtWebUndoCommand.h"43 42 #include "WebBackForwardList.h" 44 43 #include "WebContextMenuProxyQt.h" … … 143 142 } 144 143 145 void QtWebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo)146 {147 if (undoOrRedo == WebPageProxy::Undo) {148 const QtWebUndoCommand* webUndoCommand = static_cast<const QtWebUndoCommand*>(m_undoStack->command(m_undoStack->index()));149 if (webUndoCommand && webUndoCommand->inUndoRedo())150 return;151 m_undoStack->push(new QtWebUndoCommand(command));152 }153 }154 155 void QtWebPageProxy::clearAllEditCommands()156 {157 m_undoStack->clear();158 }159 160 bool QtWebPageProxy::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)161 {162 if (undoOrRedo == WebPageProxy::Undo)163 return m_undoStack->canUndo();164 return m_undoStack->canRedo();165 }166 167 void QtWebPageProxy::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)168 {169 if (undoOrRedo == WebPageProxy::Undo)170 m_undoStack->undo();171 else172 m_undoStack->redo();173 }174 175 144 PassRefPtr<WebPopupMenuProxy> QtWebPageProxy::createPopupMenuProxy(WebPageProxy*) 176 145 { -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r102586 r102666 69 69 void didChangeContentsSize(const WebCore::IntSize&); 70 70 void didChangeViewportProperties(const WebCore::ViewportArguments&); 71 72 void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);73 void clearAllEditCommands();74 bool canUndoRedo(WebPageProxy::UndoOrRedo);75 void executeUndoRedo(WebPageProxy::UndoOrRedo);76 71 77 72 PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*); -
trunk/Source/WebKit2/UIProcess/qt/QtWebUndoController.cpp
r102665 r102666 20 20 21 21 #include "config.h" 22 #include "QtWebUndoCommand.h" 22 #include "QtWebUndoController.h" 23 24 #include "WebEditCommandProxy.h" 25 #include <qglobal.h> 26 #include <wtf/RefPtr.h> 23 27 24 28 using namespace WebKit; 29 30 class QtWebUndoCommand : public QUndoCommand { 31 public: 32 QtWebUndoCommand(PassRefPtr<WebEditCommandProxy>, QUndoCommand* parent = 0); 33 ~QtWebUndoCommand(); 34 35 void redo(); 36 void undo(); 37 38 bool inUndoRedo() const { return m_inUndoRedo; }; 39 40 private: 41 RefPtr<WebEditCommandProxy> m_command; 42 bool m_first; 43 bool m_inUndoRedo; 44 }; 25 45 26 46 QtWebUndoCommand::QtWebUndoCommand(PassRefPtr<WebEditCommandProxy> command, QUndoCommand* parent) … … 61 81 m_inUndoRedo = false; 62 82 } 83 84 QtWebUndoController::QtWebUndoController() 85 { 86 } 87 88 void QtWebUndoController::registerEditCommand(PassRefPtr<WebEditCommandProxy> command, WebPageProxy::UndoOrRedo undoOrRedo) 89 { 90 if (undoOrRedo == WebPageProxy::Undo) { 91 const QtWebUndoCommand* webUndoCommand = static_cast<const QtWebUndoCommand*>(m_undoStack.command(m_undoStack.index())); 92 if (webUndoCommand && webUndoCommand->inUndoRedo()) 93 return; 94 m_undoStack.push(new QtWebUndoCommand(command)); 95 } 96 } 97 98 void QtWebUndoController::clearAllEditCommands() 99 { 100 m_undoStack.clear(); 101 } 102 103 bool QtWebUndoController::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) 104 { 105 if (undoOrRedo == WebPageProxy::Undo) 106 return m_undoStack.canUndo(); 107 return m_undoStack.canRedo(); 108 } 109 110 void QtWebUndoController::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) 111 { 112 if (undoOrRedo == WebPageProxy::Undo) 113 m_undoStack.undo(); 114 else 115 m_undoStack.redo(); 116 } -
trunk/Source/WebKit2/UIProcess/qt/QtWebUndoController.h
r102665 r102666 19 19 */ 20 20 21 #ifndef QtWebUndoCo mmand_h22 #define QtWebUndoCo mmand_h21 #ifndef QtWebUndoController_h 22 #define QtWebUndoController_h 23 23 24 #include "WebEditCommandProxy.h" 25 #include <QUndoCommand> 26 #include <qglobal.h> 27 #include <wtf/RefPtr.h> 24 #include "PageClient.h" 25 #include "WebPageProxy.h" 26 #include <QUndoStack> 28 27 29 class QtWebUndoCo mmand : public QUndoCommand{28 class QtWebUndoController { 30 29 public: 31 QtWebUndoCommand(PassRefPtr<WebKit::WebEditCommandProxy>, QUndoCommand* parent = 0); 32 ~QtWebUndoCommand(); 33 34 void redo(); 35 void undo(); 36 37 bool inUndoRedo() const { return m_inUndoRedo; }; 30 QtWebUndoController(); 38 31 39 32 private: 40 RefPtr<WebKit::WebEditCommandProxy> m_command; 41 bool m_first; 42 bool m_inUndoRedo; 33 friend class QtPageClient; 34 35 // Page Client. 36 void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo); 37 void clearAllEditCommands(); 38 bool canUndoRedo(WebKit::WebPageProxy::UndoOrRedo); 39 void executeUndoRedo(WebKit::WebPageProxy::UndoOrRedo); 40 41 QUndoStack m_undoStack; 43 42 }; 44 43 45 #endif // QtWebUndoCo mmand_h44 #endif // QtWebUndoController_h
Note: See TracChangeset
for help on using the changeset viewer.