Changeset 80609 in webkit
- Timestamp:
- Mar 8, 2011 5:35:18 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r80605 r80609 1 2011-03-08 Jeff Miller <jeffm@apple.com> 2 3 Reviewed by Adele Peterson. 4 5 WebKit2: Implement Windows glue for Undo/Redo 6 https://bugs.webkit.org/show_bug.cgi?id=55961 7 8 Expose Undo/Redo infrastructure through WKView on Windows by 9 adding an undo client as well as APIs to reapply and unapply 10 an edit command. 11 12 * UIProcess/API/C/win/WKView.cpp: 13 (WKViewSetViewUndoClient): Added. 14 (WKViewReapplyEditCommand): Added. 15 (WKViewUnapplyEditCommand): Added. 16 * UIProcess/API/C/win/WKView.h: Added WKViewUndoClient, WKViewSetViewUndoClient(), and WKViewUnapplyEditCommand(). 17 * UIProcess/WebPageProxy.cpp: 18 (WebKit::WebPageProxy::isValidEditCommand): Added, used to validated an edit command from a WKView API. 19 * UIProcess/WebPageProxy.h: Added isValidEditCommand(). 20 * UIProcess/win/WebUndoClient.cpp: Added, APIClient for WKViewUndoClient. 21 (WebKit::WebUndoClient::registerEditCommand): Added. 22 (WebKit::WebUndoClient::clearAllEditCommands): Added. 23 * UIProcess/win/WebUndoClient.h: Added, APIClient for WKViewUndoClient. 24 * UIProcess/win/WebView.cpp: 25 (WebKit::WebView::initializeUndoClient): Added. 26 (WebKit::WebView::close): Clear out undo client. 27 (WebKit::WebView::registerEditCommand): Implemented to call through to WKViewUndoClient. 28 (WebKit::WebView::clearAllEditCommands): Implmented to call through to WKViewUndoClient. 29 (WebKit::WebView::reapplyEditCommand): Added. 30 (WebKit::WebView::unapplyEditCommand): Added. 31 * UIProcess/win/WebView.h: Added undo client support. 32 * win/WebKit2.vcproj: Added WebUndoClient.cpp and WebUndoClient.h. 33 1 34 2011-03-08 Jeff Miller <jeffm@apple.com> 2 35 -
trunk/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
r80365 r80609 82 82 return toImpl(viewRef)->getFindIndicatorCallback(context); 83 83 } 84 85 void WKViewSetViewUndoClient(WKViewRef viewRef, const WKViewUndoClient* wkClient) 86 { 87 if (wkClient && wkClient->version) 88 return; 89 toImpl(viewRef)->initializeUndoClient(wkClient); 90 } 91 92 void WKViewReapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command) 93 { 94 toImpl(viewRef)->reapplyEditCommand(toImpl(command)); 95 } 96 97 void WKViewUnapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command) 98 { 99 toImpl(viewRef)->unapplyEditCommand(toImpl(command)); 100 } -
trunk/Source/WebKit2/UIProcess/API/C/win/WKView.h
r80365 r80609 34 34 #endif 35 35 36 // Undo Client. 37 enum { 38 kWKViewUndo = 0, 39 kWKViewRedo = 1 40 }; 41 typedef uint32_t WKViewUndoType; 42 43 typedef void (*WKViewRegisterEditCommandCallback)(WKViewRef, WKEditCommandRef, int32_t undoOrRedo, const void *clientInfo); 44 typedef void (*WKViewClearAllEditCommandsCallback)(WKViewRef, const void *clientInfo); 45 46 struct WKViewUndoClient { 47 int version; 48 const void * clientInfo; 49 WKViewRegisterEditCommandCallback registerEditCommand; 50 WKViewClearAllEditCommandsCallback clearAllEditCommands; 51 }; 52 typedef struct WKViewUndoClient WKViewUndoClient; 53 36 54 WK_EXPORT WKTypeID WKViewGetTypeID(); 37 55 … … 41 59 42 60 WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); 61 62 WK_EXPORT void WKViewSetViewUndoClient(WKViewRef view, const WKViewUndoClient* client); 63 WK_EXPORT void WKViewReapplyEditCommand(WKViewRef view, WKEditCommandRef command); 64 WK_EXPORT void WKViewUnapplyEditCommand(WKViewRef view, WKEditCommandRef command); 43 65 44 66 WK_EXPORT void WKViewSetParentWindow(WKViewRef view, HWND parentWindow); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r80578 r80609 2299 2299 } 2300 2300 2301 bool WebPageProxy::isValidEditCommand(WebEditCommandProxy* command) 2302 { 2303 return m_editCommandSet.find(command) != m_editCommandSet.end(); 2304 } 2305 2301 2306 int64_t WebPageProxy::spellDocumentTag() 2302 2307 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r80578 r80609 396 396 void addEditCommand(WebEditCommandProxy*); 397 397 void removeEditCommand(WebEditCommandProxy*); 398 bool isValidEditCommand(WebEditCommandProxy*); 398 399 void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo); 399 400 -
trunk/Source/WebKit2/UIProcess/win/WebView.cpp
r80596 r80609 285 285 } 286 286 287 void WebView::initializeUndoClient(const WKViewUndoClient* client) 288 { 289 m_undoClient.initialize(client); 290 } 291 287 292 void WebView::setParentWindow(HWND parentWindow) 288 293 { … … 643 648 void WebView::close() 644 649 { 650 m_undoClient.initialize(0); 645 651 ::RevokeDragDrop(m_window); 646 652 setParentWindow(0); … … 796 802 } 797 803 798 void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) 799 { 804 void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo) 805 { 806 RefPtr<WebEditCommandProxy> command = prpCommand; 807 m_undoClient.registerEditCommand(this, command, undoOrRedo); 800 808 } 801 809 802 810 void WebView::clearAllEditCommands() 803 811 { 812 m_undoClient.clearAllEditCommands(this); 813 } 814 815 void WebView::reapplyEditCommand(WebEditCommandProxy* command) 816 { 817 if (!m_page->isValid() || !m_page->isValidEditCommand(command)) 818 return; 819 820 command->reapply(); 821 } 822 823 void WebView::unapplyEditCommand(WebEditCommandProxy* command) 824 { 825 if (!m_page->isValid() || !m_page->isValidEditCommand(command)) 826 return; 827 828 command->unapply(); 804 829 } 805 830 -
trunk/Source/WebKit2/UIProcess/win/WebView.h
r80578 r80609 31 31 #include "WKView.h" 32 32 #include "WebPageProxy.h" 33 #include "WebUndoClient.h" 33 34 #include <ShlObj.h> 34 35 #include <WebCore/COMPtr.h> … … 65 66 WKViewFindIndicatorCallback getFindIndicatorCallback(void**); 66 67 void initialize(); 68 69 void initializeUndoClient(const WKViewUndoClient*); 70 void reapplyEditCommand(WebEditCommandProxy*); 71 void unapplyEditCommand(WebEditCommandProxy*); 67 72 68 73 // IUnknown … … 195 200 unsigned m_inIMEComposition; 196 201 202 WebUndoClient m_undoClient; 203 197 204 WKViewFindIndicatorCallback m_findIndicatorCallback; 198 205 void* m_findIndicatorCallbackContext; -
trunk/Source/WebKit2/win/WebKit2.vcproj
r80602 r80609 3127 3127 </File> 3128 3128 <File 3129 RelativePath="..\UIProcess\win\WebUndoClient.cpp" 3130 > 3131 </File> 3132 <File 3133 RelativePath="..\UIProcess\win\WebUndoClient.h" 3134 > 3135 </File> 3136 <File 3129 3137 RelativePath="..\UIProcess\win\WebView.cpp" 3130 3138 >
Note: See TracChangeset
for help on using the changeset viewer.