Changeset 260764 in webkit
- Timestamp:
- Apr 27, 2020, 10:13:19 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r260763 r260764 1 2020-04-27 Alex Christensen <achristensen@webkit.org> 2 3 Reduce use of WebPageProxy::VoidCallback 4 https://bugs.webkit.org/show_bug.cgi?id=210944 5 6 Reviewed by Darin Adler. 7 8 Use sendWithAsyncReply and CompletionHandler<void()> instead. 9 10 * UIProcess/API/Cocoa/WKWebView.mm: 11 (-[WKWebView _executeEditCommand:argument:completion:]): 12 * UIProcess/Cocoa/WebViewImpl.mm: 13 (WebKit::WebViewImpl::becomeFirstResponder): 14 * UIProcess/WebPageProxy.cpp: 15 (WebKit::WebPageProxy::setInitialFocus): 16 (WebKit::WebPageProxy::executeEditCommand): 17 * UIProcess/WebPageProxy.h: 18 (WebKit::WebPageProxy::focusNextFocusedElement): 19 * UIProcess/ios/WKContentViewInteraction.mm: 20 (-[WKContentView pasteWithCompletionHandler:]): 21 (-[WKContentView moveByOffset:]): 22 (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]): 23 (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]): 24 (-[WKContentView moveSelectionAtBoundary:inDirection:completionHandler:]): 25 (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]): 26 (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): 27 (-[WKContentView accessoryTab:]): 28 (-[WKContentView executeEditCommandWithCallback:]): 29 * UIProcess/ios/WebPageProxyIOS.mm: 30 (WebKit::WebPageProxy::selectTextWithGranularityAtPoint): 31 (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection): 32 (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection): 33 (WebKit::WebPageProxy::selectPositionAtPoint): 34 (WebKit::WebPageProxy::moveSelectionByOffset): 35 (WebKit::WebPageProxy::focusNextFocusedElement): 36 * WebProcess/WebPage/WebPage.cpp: 37 (WebKit::WebPage::executeEditCommandWithCallback): 38 (WebKit::WebPage::setInitialFocus): 39 * WebProcess/WebPage/WebPage.h: 40 * WebProcess/WebPage/WebPage.messages.in: 41 * WebProcess/WebPage/ios/WebPageIOS.mm: 42 (WebKit::WebPage::moveSelectionByOffset): 43 (WebKit::WebPage::selectPositionAtPoint): 44 (WebKit::WebPage::selectPositionAtBoundaryWithDirection): 45 (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): 46 (WebKit::WebPage::selectTextWithGranularityAtPoint): 47 (WebKit::WebPage::focusNextFocusedElement): 48 1 49 2020-04-27 Per Arne Vollan <pvollan@apple.com> 2 50 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r260739 r260764 1617 1617 - (void)_executeEditCommand:(NSString *)command argument:(NSString *)argument completion:(void (^)(BOOL))completion 1618 1618 { 1619 _page->executeEditCommand(command, argument, [capturedCompletionBlock = makeBlockPtr(completion)] (WebKit::CallbackBase::Error error){1619 _page->executeEditCommand(command, argument, [capturedCompletionBlock = makeBlockPtr(completion)] { 1620 1620 if (capturedCompletionBlock) 1621 capturedCompletionBlock( error == WebKit::CallbackBase::Error::None);1621 capturedCompletionBlock(YES); 1622 1622 }); 1623 1623 } -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r260739 r260764 1582 1582 if ([event type] == NSEventTypeKeyDown || [event type] == NSEventTypeKeyUp) 1583 1583 keyboardEvent = event; 1584 m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, false, { }), [] (WebKit::CallbackBase::Error){ });1584 m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, false, { }), [] { }); 1585 1585 } 1586 1586 return true; -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r260739 r260764 2166 2166 } 2167 2167 2168 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, WTF::Function<void (CallbackBase::Error)>&& callbackFunction)2168 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, CompletionHandler<void()>&& callbackFunction) 2169 2169 { 2170 2170 if (!hasRunningProcess()) { 2171 callbackFunction(CallbackBase::Error::OwnerWasInvalidated); 2172 return; 2173 } 2174 2175 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::setInitialFocus"_s)); 2176 send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent, callbackID)); 2171 callbackFunction(); 2172 return; 2173 } 2174 2175 sendWithAsyncReply(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::setInitialFocus"_s)] () mutable { 2176 callbackFunction(); 2177 }); 2177 2178 } 2178 2179 … … 2300 2301 } 2301 2302 2302 void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)2303 void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, CompletionHandler<void()>&& callbackFunction) 2303 2304 { 2304 2305 if (!hasRunningProcess()) { 2305 callbackFunction( CallbackBase::Error::Unknown);2306 callbackFunction(); 2306 2307 return; 2307 2308 } … … 2310 2311 willPerformPasteCommand(); 2311 2312 2312 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)); 2313 send(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument, callbackID)); 2313 sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable { 2314 callbackFunction(); 2315 }); 2314 2316 } 2315 2317 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r260752 r260764 642 642 void viewWillEndLiveResize(); 643 643 644 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, WTF::Function<void (CallbackBase::Error)>&&);644 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CompletionHandler<void()>&&); 645 645 646 646 void clearSelection(); … … 675 675 void selectAll(); 676 676 void executeEditCommand(const String& commandName, const String& argument = String()); 677 void executeEditCommand(const String& commandName, const String& argument, CompletionHandler<void()>&&); 677 678 void validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&&); 678 679 … … 702 703 bool isMediaStreamCaptureMuted() const { return m_mutedState & WebCore::MediaProducer::MediaStreamCaptureIsMuted; } 703 704 void setMediaStreamCaptureMuted(bool); 704 void executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&&); 705 705 706 706 void requestFontAttributesAtSelectionStart(Function<void(const WebCore::FontAttributes&, CallbackBase::Error)>&&); 707 707 void fontAttributesCallback(const WebCore::FontAttributes&, CallbackID); … … 757 757 void extendSelection(WebCore::TextGranularity); 758 758 void selectWordBackward(); 759 void moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&&);760 void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);761 void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);762 void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);763 void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, WTF::Function<void(CallbackBase::Error)>&&);759 void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&); 760 void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 761 void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 762 void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 763 void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&); 764 764 void beginSelectionInDirection(WebCore::SelectionDirection, WTF::Function<void (uint64_t, CallbackBase::Error)>&&); 765 765 void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, RespectSelectionAnchor, WTF::Function<void(uint64_t, CallbackBase::Error)>&&); … … 779 779 void performActionOnElement(uint32_t action); 780 780 void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize); 781 void focusNextFocusedElement(bool isForward, WTF::Function<void (CallbackBase::Error)>&& = [] (auto){ });781 void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& = [] { }); 782 782 void setFocusedElementValue(const String&); 783 783 void setFocusedElementValueAsNumber(double); -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r260663 r260764 2833 2833 - (void)pasteWithCompletionHandler:(void (^)(void))completionHandler 2834 2834 { 2835 _page->executeEditCommand("Paste"_s, { }, [completion = makeBlockPtr(completionHandler)] (auto){2835 _page->executeEditCommand("Paste"_s, { }, [completion = makeBlockPtr(completionHandler)] { 2836 2836 if (completion) 2837 2837 completion(); … … 3921 3921 [self beginSelectionChange]; 3922 3922 RetainPtr<WKContentView> view = self; 3923 _page->moveSelectionByOffset(offset, [view] (WebKit::CallbackBase::Error){3923 _page->moveSelectionByOffset(offset, [view] { 3924 3924 [view endSelectionChange]; 3925 3925 }); … … 4012 4012 RetainPtr<WKContentView> view = self; 4013 4013 4014 _page->selectPositionAtPoint(WebCore::IntPoint(point), stayingWithinFocusedElement, [view, selectionHandler]( WebKit::CallbackBase::Error error) {4014 _page->selectPositionAtPoint(WebCore::IntPoint(point), stayingWithinFocusedElement, [view, selectionHandler]() { 4015 4015 selectionHandler(); 4016 4016 view->_usingGestureForSelection = NO; … … 4025 4025 RetainPtr<WKContentView> view = self; 4026 4026 4027 _page->selectPositionAtBoundaryWithDirection(WebCore::IntPoint(point), toWKTextGranularity(granularity), toWKSelectionDirection(direction), self._hasFocusedElement, [view, selectionHandler]( WebKit::CallbackBase::Error error) {4027 _page->selectPositionAtBoundaryWithDirection(WebCore::IntPoint(point), toWKTextGranularity(granularity), toWKSelectionDirection(direction), self._hasFocusedElement, [view, selectionHandler]() { 4028 4028 selectionHandler(); 4029 4029 view->_usingGestureForSelection = NO; … … 4038 4038 RetainPtr<WKContentView> view = self; 4039 4039 4040 _page->moveSelectionAtBoundaryWithDirection(toWKTextGranularity(granularity), toWKSelectionDirection(direction), [view, selectionHandler] (WebKit::CallbackBase::Error error){4040 _page->moveSelectionAtBoundaryWithDirection(toWKTextGranularity(granularity), toWKSelectionDirection(direction), [view, selectionHandler] { 4041 4041 selectionHandler(); 4042 4042 view->_usingGestureForSelection = NO; … … 4052 4052 RetainPtr<WKContentView> view = self; 4053 4053 4054 _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view, selectionHandler] (WebKit::CallbackBase::Error error){4054 _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view, selectionHandler] { 4055 4055 selectionHandler(); 4056 4056 view->_usingGestureForSelection = NO; … … 4273 4273 { 4274 4274 constexpr bool isKeyboardEventValid = false; 4275 _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] (auto){4275 _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] { 4276 4276 completionHandler([protectedSelf becomeFirstResponder]); 4277 4277 }); … … 4337 4337 _isChangingFocusUsingAccessoryTab = YES; 4338 4338 [self beginSelectionChange]; 4339 _page->focusNextFocusedElement(isNext, [protectedSelf = retainPtr(self)] (WebKit::CallbackBase::Error){4339 _page->focusNextFocusedElement(isNext, [protectedSelf = retainPtr(self)] { 4340 4340 [protectedSelf endSelectionChange]; 4341 4341 [protectedSelf reloadInputViews]; … … 5408 5408 [self beginSelectionChange]; 5409 5409 RetainPtr<WKContentView> view = self; 5410 _page->executeEditCommand(commandName, { }, [view] (WebKit::CallbackBase::Error){5410 _page->executeEditCommand(commandName, { }, [view] { 5411 5411 [view endSelectionChange]; 5412 5412 }); -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r260486 r260764 506 506 } 507 507 508 void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 509 { 510 if (!hasRunningProcess()) { 511 callbackFunction(CallbackBase::Error::Unknown); 512 return; 513 } 514 515 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectTextWithGranularityAtPoint"_s)); 516 m_process->send(Messages::WebPage::SelectTextWithGranularityAtPoint(point, static_cast<uint32_t>(granularity), isInteractingWithFocusedElement, callbackID), m_webPageID); 517 } 518 519 void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint point, WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 520 { 521 if (!hasRunningProcess()) { 522 callbackFunction(CallbackBase::Error::Unknown); 523 return; 524 } 525 526 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtBoundaryWithDirection"_s)); 527 m_process->send(Messages::WebPage::SelectPositionAtBoundaryWithDirection(point, static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), isInteractingWithFocusedElement, callbackID), m_webPageID); 528 } 529 530 void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 531 { 532 if (!hasRunningProcess()) { 533 callbackFunction(CallbackBase::Error::Unknown); 534 return; 535 } 536 537 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionAtBoundaryWithDirection"_s)); 538 m_process->send(Messages::WebPage::MoveSelectionAtBoundaryWithDirection(static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), callbackID), m_webPageID); 539 } 540 541 void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 542 { 543 if (!hasRunningProcess()) { 544 callbackFunction(CallbackBase::Error::Unknown); 545 return; 546 } 547 548 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtPoint"_s)); 549 m_process->send(Messages::WebPage::SelectPositionAtPoint(point, isInteractingWithFocusedElement, callbackID), m_webPageID); 508 void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction) 509 { 510 if (!hasRunningProcess()) { 511 callbackFunction(); 512 return; 513 } 514 515 sendWithAsyncReply(Messages::WebPage::SelectTextWithGranularityAtPoint(point, static_cast<uint32_t>(granularity), isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectTextWithGranularityAtPoint"_s)] () mutable { 516 callbackFunction(); 517 }); 518 } 519 520 void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint point, WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction) 521 { 522 if (!hasRunningProcess()) { 523 callbackFunction(); 524 return; 525 } 526 527 sendWithAsyncReply(Messages::WebPage::SelectPositionAtBoundaryWithDirection(point, static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtBoundaryWithDirection"_s)] () mutable { 528 callbackFunction(); 529 }); 530 } 531 532 void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, CompletionHandler<void()>&& callbackFunction) 533 { 534 if (!hasRunningProcess()) { 535 callbackFunction(); 536 return; 537 } 538 539 sendWithAsyncReply(Messages::WebPage::MoveSelectionAtBoundaryWithDirection(static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction)), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionAtBoundaryWithDirection"_s)] () mutable { 540 callbackFunction(); 541 }); 542 } 543 544 void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction) 545 { 546 if (!hasRunningProcess()) { 547 callbackFunction(); 548 return; 549 } 550 551 sendWithAsyncReply(Messages::WebPage::SelectPositionAtPoint(point, isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtPoint"_s)] () mutable { 552 callbackFunction(); 553 }); 550 554 } 551 555 … … 796 800 } 797 801 798 void WebPageProxy::moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&& callbackFunction) 799 { 800 if (!hasRunningProcess()) { 801 callbackFunction(CallbackBase::Error::Unknown); 802 return; 803 } 804 805 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionByOffset"_s)); 806 m_process->send(Messages::WebPage::MoveSelectionByOffset(offset, callbackID), m_webPageID); 802 void WebPageProxy::moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&& callbackFunction) 803 { 804 if (!hasRunningProcess()) { 805 callbackFunction(); 806 return; 807 } 808 809 sendWithAsyncReply(Messages::WebPage::MoveSelectionByOffset(offset), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionByOffset"_s)] () mutable { 810 callbackFunction(); 811 }); 807 812 } 808 813 … … 1051 1056 } 1052 1057 1053 void WebPageProxy::focusNextFocusedElement(bool isForward, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 1054 { 1055 if (!hasRunningProcess()) { 1056 callbackFunction(CallbackBase::Error::Unknown); 1057 return; 1058 } 1059 1060 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::focusNextFocusedElement"_s)); 1061 process().send(Messages::WebPage::FocusNextFocusedElement(isForward, callbackID), m_webPageID); 1058 void WebPageProxy::focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& callbackFunction) 1059 { 1060 if (!hasRunningProcess()) { 1061 callbackFunction(); 1062 return; 1063 } 1064 1065 sendWithAsyncReply(Messages::WebPage::FocusNextFocusedElement(isForward), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::focusNextFocusedElement"_s)] () mutable { 1066 callbackFunction(); 1067 }); 1062 1068 } 1063 1069 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r260753 r260764 1120 1120 } 1121 1121 1122 void WebPage::executeEditCommandWithCallback(const String& commandName, const String& argument, C allbackID callbackID)1122 void WebPage::executeEditCommandWithCallback(const String& commandName, const String& argument, CompletionHandler<void()>&& completionHandler) 1123 1123 { 1124 1124 executeEditCommand(commandName, argument); 1125 send(Messages::WebPageProxy::VoidCallback(callbackID));1125 completionHandler(); 1126 1126 } 1127 1127 … … 3143 3143 } 3144 3144 3145 void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, C allbackID callbackID)3145 void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, CompletionHandler<void()>&& completionHandler) 3146 3146 { 3147 3147 if (!m_page) 3148 return ;3148 return completionHandler(); 3149 3149 3150 3150 SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true }; … … 3157 3157 platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); 3158 3158 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, &KeyboardEvent::create(platformEvent, &frame.windowProxy()).get()); 3159 3160 send(Messages::WebPageProxy::VoidCallback(callbackID)); 3159 completionHandler(); 3161 3160 return; 3162 3161 } 3163 3162 3164 3163 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, nullptr); 3165 send(Messages::WebPageProxy::VoidCallback(callbackID));3164 completionHandler(); 3166 3165 } 3167 3166 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r260753 r260764 642 642 void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&); 643 643 void viewportPropertiesDidChange(const WebCore::ViewportArguments&); 644 void executeEditCommandWithCallback(const String&, const String& argument, C allbackID);644 void executeEditCommandWithCallback(const String&, const String& argument, CompletionHandler<void()>&&); 645 645 void selectAll(); 646 646 … … 690 690 void extendSelection(uint32_t granularity); 691 691 void selectWordBackward(); 692 void moveSelectionByOffset(int32_t offset, C allbackID);693 void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, C allbackID);694 void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, C allbackID);695 void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, C allbackID);696 void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, C allbackID);692 void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&); 693 void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 694 void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 695 void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CompletionHandler<void()>&&); 696 void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 697 697 void beginSelectionInDirection(uint32_t direction, CallbackID); 698 698 void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CallbackID); … … 711 711 void stopInteraction(); 712 712 void performActionOnElement(uint32_t action); 713 void focusNextFocusedElement(bool isForward, C allbackID);713 void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&&); 714 714 void autofillLoginCredentials(const String&, const String&); 715 715 void setFocusedElementValue(const String&); … … 1430 1430 void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&); 1431 1431 void tryRestoreScrollPosition(); 1432 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, C allbackID);1432 void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CompletionHandler<void()>&&); 1433 1433 void updateIsInWindow(bool isInitialState = false); 1434 1434 void visibilityDidChange(); -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r260739 r260764 22 22 23 23 messages -> WebPage LegacyReceiver { 24 SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event , WebKit::CallbackID callbackID)24 SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event) -> () Async 25 25 SetActivityState(OptionSet<WebCore::ActivityState::Flag> activityState, WebKit::ActivityStateChangeID activityStateChangeID, Vector<WebKit::CallbackID> callbackIDs) 26 26 SetLayerHostingMode(enum:uint8_t WebKit::LayerHostingMode layerHostingMode) … … 44 44 ViewWillEndLiveResize() 45 45 46 ExecuteEditCommandWithCallback(String name, String argument , WebKit::CallbackID callbackID)46 ExecuteEditCommandWithCallback(String name, String argument) -> () Async 47 47 KeyEvent(WebKit::WebKeyboardEvent event) 48 48 MouseEvent(WebKit::WebMouseEvent event) … … 69 69 ExtendSelection(uint32_t granularity) 70 70 SelectWordBackward() 71 MoveSelectionByOffset(int32_t offset , WebKit::CallbackID callbackID)72 SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithFocusedElement , WebKit::CallbackID callbackID)73 SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement , WebKit::CallbackID callbackID)74 MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction , WebKit::CallbackID callbackID)75 SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement , WebKit::CallbackID callbackID)71 MoveSelectionByOffset(int32_t offset) -> () Async 72 SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithFocusedElement) -> () Async 73 SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement) -> () Async 74 MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction) -> () Async 75 SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement) -> () Async 76 76 BeginSelectionInDirection(uint32_t direction, WebKit::CallbackID callbackID) 77 77 UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement, enum:bool WebKit::RespectSelectionAnchor respectSelectionAnchor, WebKit::CallbackID callbackID) … … 90 90 StopInteraction() 91 91 PerformActionOnElement(uint32_t action) 92 FocusNextFocusedElement(bool isForward , WebKit::CallbackID callbackID)92 FocusNextFocusedElement(bool isForward) -> () Async 93 93 SetFocusedElementValue(String value) 94 94 AutofillLoginCredentials(String username, String password) -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r260759 r260764 1837 1837 } 1838 1838 1839 void WebPage::moveSelectionByOffset(int32_t offset, C allbackID callbackID)1839 void WebPage::moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&& completionHandler) 1840 1840 { 1841 1841 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 1853 1853 if (position.isNotNull() && startPosition != position) 1854 1854 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 1855 send(Messages::WebPageProxy::VoidCallback(callbackID));1855 completionHandler(); 1856 1856 } 1857 1857 … … 2074 2074 } 2075 2075 2076 void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, C allbackID callbackID)2076 void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler) 2077 2077 { 2078 2078 SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true }; … … 2085 2085 if (position.isNotNull()) 2086 2086 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2087 send(Messages::WebPageProxy::VoidCallback(callbackID));2088 } 2089 2090 void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, C allbackID callbackID)2087 completionHandler(); 2088 } 2089 2090 void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler) 2091 2091 { 2092 2092 auto& frame = m_page->focusController().focusedOrMainFrame(); … … 2098 2098 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2099 2099 } 2100 send(Messages::WebPageProxy::VoidCallback(callbackID));2101 } 2102 2103 void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, C allbackID callbackID)2100 completionHandler(); 2101 } 2102 2103 void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CompletionHandler<void()>&& completionHandler) 2104 2104 { 2105 2105 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 2112 2112 frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), isForward? UPSTREAM : DOWNSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2113 2113 } 2114 send(Messages::WebPageProxy::VoidCallback(callbackID));2114 completionHandler(); 2115 2115 } 2116 2116 … … 2158 2158 } 2159 2159 2160 void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithFocusedElement, C allbackID callbackID)2160 void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler) 2161 2161 { 2162 2162 setFocusedFrameBeforeSelectingTextAtLocation(point); … … 2167 2167 frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2168 2168 m_initialSelection = range; 2169 send(Messages::WebPageProxy::VoidCallback(callbackID));2169 completionHandler(); 2170 2170 } 2171 2171 … … 3069 3069 } 3070 3070 3071 void WebPage::focusNextFocusedElement(bool isForward, C allbackID callbackID)3071 void WebPage::focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& completionHandler) 3072 3072 { 3073 3073 Element* nextElement = nextAssistableElement(m_focusedElement.get(), *m_page, isForward); … … 3076 3076 nextElement->focus(); 3077 3077 m_userIsInteracting = false; 3078 send(Messages::WebPageProxy::VoidCallback(callbackID));3078 completionHandler(); 3079 3079 } 3080 3080
Note:
See TracChangeset
for help on using the changeset viewer.