Changeset 181836 in webkit
- Timestamp:
- Mar 22, 2015, 2:44:50 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/Cocoa/WKWebView.mm (modified) (2 diffs)
-
UIProcess/API/Cocoa/WKWebViewPrivate.h (modified) (1 diff)
-
UIProcess/API/mac/WKView.mm (modified) (1 diff)
-
UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
UIProcess/WebPageProxy.h (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.h (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
WebProcess/WebPage/WebPage.cpp (modified) (3 diffs)
-
WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r181832 r181836 1 2015-03-22 Dan Bernstein <mitz@apple.com> 2 3 [iOS] Expose WebPageProxy::setInitialFocus as SPI 4 https://bugs.webkit.org/show_bug.cgi?id=142951 5 6 Reviewed by Anders Carlsson. 7 8 * UIProcess/API/Cocoa/WKWebView.mm: 9 (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): New SPI. 10 Just calls through to WKWebContentView, but allows a nil completion handler. 11 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 12 13 * UIProcess/API/mac/WKView.mm: 14 (-[WKView becomeFirstResponder]): Pass an empty lambda for the new callback parameter to 15 WebPageProxy::setInitialFocus. 16 17 * UIProcess/WebPageProxy.cpp: 18 (WebKit::WebPageProxy::setInitialFocus): Added a void callback parameter and made sure to 19 call it. 20 * UIProcess/WebPageProxy.h: 21 22 * UIProcess/ios/WKContentViewInteraction.h: 23 * UIProcess/ios/WKContentViewInteraction.mm: 24 (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): 25 Added. Calls WebPageProxy::setInitialFocus, and once that completes, checks if anything was 26 focused and if so, becomes first responder, then calls the completion handler. 27 28 * WebProcess/WebPage/WebPage.cpp: 29 (WebKit::WebPage::setInitialFocus): Added a callbackID parameter, and made sure to send the 30 callback message. Added a temporary change of m_userIsInteracting to true, so that the UI 31 process won’t ignore any StartAssistingNode message resulting from the focus change. 32 * WebProcess/WebPage/WebPage.h: 33 34 * WebProcess/WebPage/WebPage.messages.in: Added a callbackID parameter to SetInitialFocus. 35 1 36 2015-03-21 Dean Jackson <dino@apple.com> 2 37 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r181511 r181836 91 91 #import "RemoteScrollingCoordinatorProxy.h" 92 92 #import "UIKitSPI.h" 93 #import "WKContentViewInteraction.h" 93 94 #import "WKPDFView.h" 94 95 #import "WKScrollView.h" … … 1785 1786 --_activeFocusedStateRetainCount; 1786 1787 } copy] autorelease]; 1788 } 1789 1790 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler 1791 { 1792 typeof(completionHandler) completionHandlerCopy = nil; 1793 if (completionHandler) 1794 completionHandlerCopy = Block_copy(completionHandler); 1795 1796 [_contentView _becomeFirstResponderWithSelectionMovingForward:selectingForward completionHandler:[completionHandlerCopy](BOOL didBecomeFirstResponder) { 1797 if (!completionHandlerCopy) 1798 return; 1799 1800 completionHandlerCopy(didBecomeFirstResponder); 1801 Block_release(completionHandlerCopy); 1802 }]; 1787 1803 } 1788 1804 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r181511 r181836 156 156 - (void (^)(void))_retainActiveFocusedState WK_AVAILABLE(NA, WK_IOS_TBA); 157 157 158 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler WK_AVAILABLE(NA, WK_IOS_TBA); 159 158 160 #else 159 161 @property (readonly) NSColor *_pageExtendedBackgroundColor; -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r181812 r181836 402 402 if ([event type] == NSKeyDown || [event type] == NSKeyUp) 403 403 keyboardEvent = event; 404 _data->_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, Vector<KeypressCommand>()) );404 _data->_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, Vector<KeypressCommand>()), [](CallbackBase::Error) { }); 405 405 } 406 406 return YES; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r181815 r181836 1420 1420 } 1421 1421 1422 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent) 1423 { 1424 if (!isValid()) 1425 return; 1426 m_process->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), m_pageID); 1422 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, std::function<void (CallbackBase::Error)> callbackFunction) 1423 { 1424 if (!isValid()) { 1425 callbackFunction(CallbackBase::Error::OwnerWasInvalidated); 1426 return; 1427 } 1428 1429 uint64_t callbackID = m_callbacks.put(WTF::move(callbackFunction), m_process->throttler().backgroundActivityToken()); 1430 m_process->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent, callbackID), m_pageID); 1427 1431 } 1428 1432 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r181815 r181836 390 390 void viewWillEndLiveResize(); 391 391 392 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& );392 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, std::function<void (CallbackBase::Error)>); 393 393 void setWindowResizerSize(const WebCore::IntSize&); 394 394 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r180441 r181836 197 197 - (void)_enableInspectorNodeSearch; 198 198 - (void)_disableInspectorNodeSearch; 199 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler; 199 200 @end 200 201 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r181511 r181836 2054 2054 } 2055 2055 2056 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler 2057 { 2058 auto completionHandlerCopy = Block_copy(completionHandler); 2059 _page->setInitialFocus(selectingForward, false, WebKit::WebKeyboardEvent(), [self, completionHandlerCopy](WebKit::CallbackBase::Error) { 2060 BOOL didBecomeFirstResponder = _assistedNodeInformation.elementType != InputType::None && [self becomeFirstResponder]; 2061 completionHandlerCopy(didBecomeFirstResponder); 2062 Block_release(completionHandlerCopy); 2063 }); 2064 } 2065 2056 2066 - (void)accessoryAutoFill 2057 2067 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r181815 r181836 168 168 #include <runtime/JSLock.h> 169 169 #include <wtf/RunLoop.h> 170 #include <wtf/TemporaryChange.h> 170 171 171 172 #if ENABLE(MHTML) … … 2208 2209 } 2209 2210 2210 void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event )2211 void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, uint64_t callbackID) 2211 2212 { 2212 2213 if (!m_page) 2213 2214 return; 2215 2216 #if PLATFORM(IOS) 2217 TemporaryChange<bool> userIsInteractingChange { m_userIsInteracting, true }; 2218 #endif 2214 2219 2215 2220 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 2220 2225 platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); 2221 2226 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, &KeyboardEvent::create(platformEvent, frame.document()->defaultView()).get()); 2227 2228 send(Messages::WebPageProxy::VoidCallback(callbackID)); 2222 2229 return; 2223 2230 } 2224 2231 2225 2232 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0); 2233 send(Messages::WebPageProxy::VoidCallback(callbackID)); 2226 2234 } 2227 2235 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r181815 r181836 929 929 void goToBackForwardItem(uint64_t navigationID, uint64_t); 930 930 void tryRestoreScrollPosition(); 931 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& );931 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, uint64_t callbackID); 932 932 void setWindowResizerSize(const WebCore::IntSize&); 933 933 void updateIsInWindow(bool isInitialState = false); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r181815 r181836 22 22 23 23 messages -> WebPage LegacyReceiver { 24 SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event )24 SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, uint64_t callbackID) 25 25 SetViewState(unsigned viewState, bool wantsDidUpdateViewState, Vector<uint64_t> callbackIDs) 26 26 SetLayerHostingMode(unsigned layerHostingMode)
Note:
See TracChangeset
for help on using the changeset viewer.