Changeset 83004 in webkit
- Timestamp:
- Apr 5, 2011 5:55:34 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r82997 r83004 1 2011-04-05 Darin Adler <darin@apple.com> 2 3 Reviewed by Alexey Proskuryakov. 4 5 [Mac] WebKit2: Escape key does not stop page loads when focus is on the web page 6 https://bugs.webkit.org/show_bug.cgi?id=57893 7 <rdar://problem/9130486> 8 9 * UIProcess/API/mac/PageClientImpl.h: Added executeSavedCommandBySelector. 10 * UIProcess/API/mac/PageClientImpl.mm: Renamed internal Objective-C classes to use 11 the WebKit2 Objective-C class prefix, WK, rather than the WebKit1 Objective-C class 12 prefix, Web. Removed some unneeded explicit WebKit namespace prefixes. 13 (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Removed unneeded WebKit 14 namespace prefix. 15 (-[WKEditCommandObjC command]): Ditto. 16 (-[WKEditorUndoTargetObjC undoEditing:]): Updated for new class name. 17 (-[WKEditorUndoTargetObjC redoEditing:]): Ditto. 18 (WebKit::PageClientImpl::PageClientImpl): Ditto. 19 (WebKit::PageClientImpl::registerEditCommand): Ditto. 20 (WebKit::PageClientImpl::executeSavedCommandBySelector): Added. 21 22 * UIProcess/API/mac/WKView.mm: Renamed internal Objective-C categories to use the 23 WebKit2 Objective-C prefix, WK, rather than the WebKit1 Objective-C prefix, Web, 24 or no prefix at all. Tweaked use of extern "C" a little. 25 (-[WKView doCommandBySelector:]): Tweaked the comment. 26 (-[WKView _executeSavedCommandBySelector:]): Added. For use when command is not handled 27 by WebCore. 28 (-[WKResponderChainSink initWithResponderChain:]): Added. Based on the 29 WebResponderChainSink class in WebKit1. 30 (-[WKResponderChainSink detach]): Added. 31 (-[WKResponderChainSink didReceiveUnhandledCommand]): Added. 32 (-[WKResponderChainSink noResponderFor:]): Added. 33 (-[WKResponderChainSink doCommandBySelector:]): Added. 34 (-[WKResponderChainSink tryToPerform:with:]): Added. 35 36 * UIProcess/API/mac/WKViewInternal.h: Added declaration of _executeSavedCommandBySelector: 37 method. Also removed unneeded includes. 38 39 * UIProcess/PageClient.h: Added executeSavedCommandBySelector. 40 * UIProcess/WebPageProxy.h: Added executeSavedCommandBySelector. 41 * UIProcess/WebPageProxy.messages.in: Added ExecuteSavedCommandBySelector. 42 43 * UIProcess/mac/WebFullScreenManagerProxyMac.mm: Updated includes. 44 45 * UIProcess/mac/WebPageProxyMac.mm: 46 (WebKit::WebPageProxy::executeSavedCommandBySelector): Added. 47 48 * WebProcess/WebPage/mac/WebPageMac.mm: 49 (WebKit::WebPage::executeKeypressCommandsInternal): Send the synchronous 50 ExecuteSavedCommandBySelector message when a command is not handled by WebCore. 51 1 52 2011-04-05 Anders Carlsson <andersca@apple.com> 2 53 -
trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
r82717 r83004 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 73 73 virtual void clearAllEditCommands(); 74 74 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, const TextInputState&, Vector<WebCore::KeypressCommand>&); 75 virtual bool executeSavedCommandBySelector(const String& selector); 75 76 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag); 76 77 -
trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
r82717 r83004 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 54 54 using namespace WebCore; 55 56 @interface WebEditCommandObjC : NSObject 57 { 58 RefPtr<WebKit::WebEditCommandProxy> m_command; 59 } 60 61 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebKit::WebEditCommandProxy>)command; 62 - (WebKit::WebEditCommandProxy*)command; 63 55 using namespace WebKit; 56 57 @interface WKEditCommandObjC : NSObject 58 { 59 RefPtr<WebEditCommandProxy> m_command; 60 } 61 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command; 62 - (WebEditCommandProxy*)command; 64 63 @end 65 64 66 @implementation WebEditCommandObjC 67 68 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebKit::WebEditCommandProxy>)command 65 @interface WKEditorUndoTargetObjC : NSObject 66 - (void)undoEditing:(id)sender; 67 - (void)redoEditing:(id)sender; 68 @end 69 70 @implementation WKEditCommandObjC 71 72 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command 69 73 { 70 74 self = [super init]; … … 76 80 } 77 81 78 - (Web Kit::WebEditCommandProxy*)command82 - (WebEditCommandProxy*)command 79 83 { 80 84 return m_command.get(); … … 83 87 @end 84 88 85 @interface WebEditorUndoTargetObjC : NSObject 86 87 - (void)undoEditing:(id)sender; 88 - (void)redoEditing:(id)sender; 89 90 @end 91 92 @implementation WebEditorUndoTargetObjC 89 @implementation WKEditorUndoTargetObjC 93 90 94 91 - (void)undoEditing:(id)sender 95 92 { 96 ASSERT([sender isKindOfClass:[W ebEditCommandObjC class]]);93 ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]); 97 94 [sender command]->unapply(); 98 95 } … … 100 97 - (void)redoEditing:(id)sender 101 98 { 102 ASSERT([sender isKindOfClass:[W ebEditCommandObjC class]]);99 ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]); 103 100 [sender command]->reapply(); 104 101 } … … 120 117 PageClientImpl::PageClientImpl(WKView* wkView) 121 118 : m_wkView(wkView) 122 , m_undoTarget(AdoptNS, [[W ebEditorUndoTargetObjC alloc] init])119 , m_undoTarget(AdoptNS, [[WKEditorUndoTargetObjC alloc] init]) 123 120 { 124 121 } … … 278 275 RefPtr<WebEditCommandProxy> command = prpCommand; 279 276 280 RetainPtr<W ebEditCommandObjC> commandObjC(AdoptNS, [[WebEditCommandObjC alloc] initWithWebEditCommandProxy:command]);277 RetainPtr<WKEditCommandObjC> commandObjC(AdoptNS, [[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]); 281 278 NSString *actionName = nameForEditAction(command->editAction()); 282 279 … … 484 481 } 485 482 483 bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) 484 { 485 return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; 486 } 487 486 488 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r82870 r83004 71 71 #import <wtf/RetainPtr.h> 72 72 73 @interface NSApplication (W ebNSApplicationDetails)73 @interface NSApplication (WKNSApplicationDetails) 74 74 - (void)speakString:(NSString *)string; 75 75 - (void)_setCurrentEvent:(NSEvent *)event; 76 76 @end 77 77 78 @interface NSWindow (WebNSWindowDetails) 78 @interface NSObject (WKNSTextInputContextDetails) 79 - (BOOL)wantsToHandleMouseEvents; 80 - (BOOL)handleMouseEvent:(NSEvent *)event; 81 @end 82 83 @interface NSWindow (WKNSWindowDetails) 79 84 - (NSRect)_growBoxRect; 80 85 - (id)_growBoxOwner; … … 83 88 @end 84 89 85 extern "C" { 86 // Need to declare this attribute name because AppKit exports it but does not make it available in API or SPI headers. 87 // FIXME: We wouldn't need this if we implemented NSTextInputClient protocol instead of deprecated NSTextInput. 88 extern NSString *NSTextInputReplacementRangeAttributeName; 89 } 90 // Declare this attribute name because AppKit exports it but does not make it available in API or SPI headers. 91 // FIXME: We wouldn't need this if we implemented the NSTextInputClient protocol instead of the deprecated NSTextInput. 92 extern "C" NSString *NSTextInputReplacementRangeAttributeName; 90 93 91 94 using namespace WebKit; … … 157 160 @end 158 161 162 @interface WKResponderChainSink : NSResponder { 163 NSResponder *_lastResponderInChain; 164 bool _didReceiveUnhandledCommand; 165 } 166 - (id)initWithResponderChain:(NSResponder *)chain; 167 - (void)detach; 168 - (bool)didReceiveUnhandledCommand; 169 @end 170 159 171 @implementation WKViewData 160 @end161 162 @interface NSObject (NSTextInputContextDetails)163 - (BOOL)wantsToHandleMouseEvents;164 - (BOOL)handleMouseEvent:(NSEvent *)event;165 172 @end 166 173 … … 1032 1039 parameters->commands->append(KeypressCommand(NSStringFromSelector(selector))); 1033 1040 else { 1034 // FIXME: Send the command to Editor synchronously. 1041 // FIXME: Send the command to Editor synchronously and only send it along the 1042 // responder chain if it's a selector that does not correspond to an editing command. 1035 1043 [super doCommandBySelector:selector]; 1036 1044 } … … 2173 2181 #endif 2174 2182 2183 - (bool)_executeSavedCommandBySelector:(SEL)selector 2184 { 2185 // The sink does two things: 1) Tells us if the responder went unhandled, and 2186 // 2) prevents any NSBeep; we don't ever want to beep here. 2187 RetainPtr<WKResponderChainSink> sink(AdoptNS, [[WKResponderChainSink alloc] initWithResponderChain:self]); 2188 [super doCommandBySelector:selector]; 2189 [sink.get() detach]; 2190 return ![sink.get() didReceiveUnhandledCommand]; 2191 } 2192 2175 2193 @end 2176 2194 … … 2221 2239 @end 2222 2240 2241 @implementation WKResponderChainSink 2242 2243 - (id)initWithResponderChain:(NSResponder *)chain 2244 { 2245 self = [super init]; 2246 if (!self) 2247 return nil; 2248 _lastResponderInChain = chain; 2249 while (NSResponder *next = [_lastResponderInChain nextResponder]) 2250 _lastResponderInChain = next; 2251 [_lastResponderInChain setNextResponder:self]; 2252 return self; 2253 } 2254 2255 - (void)detach 2256 { 2257 [_lastResponderInChain setNextResponder:nil]; 2258 _lastResponderInChain = nil; 2259 } 2260 2261 - (bool)didReceiveUnhandledCommand 2262 { 2263 return _didReceiveUnhandledCommand; 2264 } 2265 2266 - (void)noResponderFor:(SEL)selector 2267 { 2268 _didReceiveUnhandledCommand = true; 2269 } 2270 2271 - (void)doCommandBySelector:(SEL)selector 2272 { 2273 _didReceiveUnhandledCommand = true; 2274 } 2275 2276 - (BOOL)tryToPerform:(SEL)action with:(id)object 2277 { 2278 _didReceiveUnhandledCommand = true; 2279 return YES; 2280 } 2281 2282 @end -
trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r82717 r83004 25 25 26 26 #import "WKView.h" 27 #import < WebCore/Editor.h>28 #import < WebCore/KeyboardEvent.h>27 #import <wtf/Forward.h> 28 #import <wtf/Vector.h> 29 29 30 30 namespace CoreIPC { 31 31 class DataReference; 32 } 33 34 namespace WebCore { 35 struct KeypressCommand; 32 36 } 33 37 … … 39 43 } 40 44 41 #if ENABLE(FULLSCREEN_API)42 45 @class WKFullScreenWindowController; 43 #endif44 46 45 47 @interface WKView (Internal) … … 55 57 - (BOOL)_interpretKeyEvent:(NSEvent *)theEvent withCachedTextInputState:(const WebKit::TextInputState&)cachedTextInputState savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; 56 58 - (void)_resendKeyDownEvent:(NSEvent *)event; 59 - (bool)_executeSavedCommandBySelector:(SEL)selector; 57 60 - (NSRect)_convertToDeviceSpace:(NSRect)rect; 58 61 - (NSRect)_convertToUserSpace:(NSRect)rect; -
trunk/Source/WebKit2/UIProcess/PageClient.h
r82929 r83004 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 102 102 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0; 103 103 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, const TextInputState&, Vector<WebCore::KeypressCommand>&) = 0; 104 virtual bool executeSavedCommandBySelector(const String& selector) = 0; 104 105 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0; 105 106 #endif -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r82929 r83004 594 594 #if PLATFORM(MAC) 595 595 void interpretQueuedKeyEvent(const TextInputState&, bool& handled, Vector<WebCore::KeypressCommand>&); 596 void executeSavedCommandBySelector(const String& selector, bool& handled); 596 597 #endif 597 598 598 599 #if PLATFORM(GTK) 599 void getEditorCommandsForKeyEvent(Vector< WTF::String>&);600 void getEditorCommandsForKeyEvent(Vector<String>&); 600 601 #endif 601 602 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r82936 r83004 200 200 # Keyboard input support messages 201 201 InterpretQueuedKeyEvent(WebKit::TextInputState state) -> (bool handled, Vector<WebCore::KeypressCommand> savedCommands) 202 202 ExecuteSavedCommandBySelector(WTF::String selector) -> (bool handled) 203 203 204 # Remote accessibility messages 204 205 RegisterWebProcessAccessibilityToken(CoreIPC::DataReference data) -
trunk/Source/WebKit2/UIProcess/mac/WebFullScreenManagerProxyMac.mm
r80924 r83004 24 24 */ 25 25 26 #include "config.h" 27 #include "WebFullScreenManagerProxy.h" 28 #include "LayerTreeContext.h" 29 #include "WKFullScreenWindowController.h" 30 #include "WKViewInternal.h" 26 #import "config.h" 27 #import "WebFullScreenManagerProxy.h" 28 29 #import "LayerTreeContext.h" 30 #import "WKFullScreenWindowController.h" 31 #import "WKViewInternal.h" 32 #import <WebCore/IntRect.h> 31 33 32 34 #if ENABLE(FULLSCREEN_API) -
trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r82779 r83004 284 284 } 285 285 286 void WebPageProxy::executeSavedCommandBySelector(const String& selector, bool& handled) 287 { 288 handled = m_pageClient->executeSavedCommandBySelector(selector); 289 } 290 286 291 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r82853 r83004 153 153 if (command.isSupported()) 154 154 eventWasHandled |= command.execute(event); 155 // FIXME: WebHTMLView sends the event up the responder chain with WebResponderChainSink if it's not supported by the editor. Should we do the same? 155 else { 156 bool eventWasHandledByUIProcess = false; 157 WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::ExecuteSavedCommandBySelector(commands[i].commandName), 158 Messages::WebPageProxy::ExecuteSavedCommandBySelector::Reply(eventWasHandledByUIProcess), m_pageID); 159 eventWasHandled |= eventWasHandledByUIProcess; 160 } 156 161 } 157 162 }
Note: See TracChangeset
for help on using the changeset viewer.