Changeset 272627 in webkit
- Timestamp:
- Feb 9, 2021, 5:28:04 PM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r272625 r272627 1 2021-02-09 Alex Christensen <achristensen@webkit.org> 2 3 Use CompletionHandler instead of UnsignedCallback 4 https://bugs.webkit.org/show_bug.cgi?id=221631 5 6 Reviewed by Chris Dumez. 7 8 * UIProcess/Cocoa/WebViewImpl.mm: 9 (WebKit::WebViewImpl::characterIndexForPoint): 10 * UIProcess/WebPageProxy.cpp: 11 (WebKit::WebPageProxy::replaceMatches): 12 (WebKit::WebPageProxy::characterIndexForPointAsync): 13 (WebKit::WebPageProxy::unsignedCallback): Deleted. 14 * UIProcess/WebPageProxy.h: 15 * UIProcess/WebPageProxy.messages.in: 16 * UIProcess/ios/WKContentViewInteraction.mm: 17 (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]): 18 (-[WKContentView beginSelectionInDirection:completionHandler:]): 19 (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]): 20 (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]): 21 * UIProcess/ios/WebPageProxyIOS.mm: 22 (WebKit::WebPageProxy::beginSelectionInDirection): 23 (WebKit::WebPageProxy::updateSelectionWithExtentPoint): 24 (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary): 25 * UIProcess/mac/WKTextFinderClient.mm: 26 (-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]): 27 * WebProcess/WebPage/WebPage.cpp: 28 (WebKit::WebPage::replaceMatches): 29 (WebKit::WebPage::characterIndexForPointAsync): 30 * WebProcess/WebPage/WebPage.h: 31 * WebProcess/WebPage/WebPage.messages.in: 32 * WebProcess/WebPage/ios/WebPageIOS.mm: 33 (WebKit::WebPage::beginSelectionInDirection): 34 (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): 35 (WebKit::WebPage::updateSelectionWithExtentPoint): 36 1 37 2021-02-09 Peng Liu <peng.liu6@apple.com> 2 38 -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r272470 r272627 5082 5082 } 5083 5083 5084 void WebViewImpl::characterIndexForPoint(NSPoint point, void(^completionHandlerPtr)(NSUInteger)) 5085 { 5086 auto completionHandler = adoptNS([completionHandlerPtr copy]); 5087 5084 void WebViewImpl::characterIndexForPoint(NSPoint point, void(^completionHandler)(NSUInteger)) 5085 { 5088 5086 LOG(TextInput, "characterIndexForPoint:(%f, %f)", point.x, point.y); 5089 5087 … … 5096 5094 point = [m_view convertPoint:point fromView:nil]; // the point is relative to the main frame 5097 5095 5098 m_page->characterIndexForPointAsync(WebCore::IntPoint(point), [completionHandler](uint64_t result, WebKit::CallbackBase::Error error) { 5099 void (^completionHandlerBlock)(NSUInteger) = (void (^)(NSUInteger))completionHandler.get(); 5100 if (error != WebKit::CallbackBase::Error::None) { 5101 LOG(TextInput, " ...characterIndexForPoint failed."); 5102 completionHandlerBlock(0); 5103 return; 5104 } 5096 m_page->characterIndexForPointAsync(WebCore::IntPoint(point), [completionHandler = makeBlockPtr(completionHandler)](uint64_t result) { 5105 5097 if (result == notFound) 5106 5098 result = NSNotFound; 5107 5099 LOG(TextInput, " -> characterIndexForPoint returned %lu", result); 5108 completionHandler Block(result);5100 completionHandler(result); 5109 5101 }); 5110 5102 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r272606 r272627 4017 4017 } 4018 4018 4019 void WebPageProxy::replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, Function<void(uint64_t, CallbackBase::Error)>&& callback) 4020 { 4021 if (!hasRunningProcess()) { 4022 callback(0, CallbackBase::Error::Unknown); 4023 return; 4024 } 4025 4026 auto callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivity("WebPageProxy::replaceMatches"_s)); 4027 send(Messages::WebPage::ReplaceMatches(WTFMove(matchIndices), replacementText, selectionOnly, callbackID)); 4019 void WebPageProxy::replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&& callback) 4020 { 4021 sendWithAsyncReply(Messages::WebPage::ReplaceMatches(WTFMove(matchIndices), replacementText, selectionOnly), WTFMove(callback)); 4028 4022 } 4029 4023 … … 7160 7154 7161 7155 callback->invalidate(); 7162 }7163 7164 void WebPageProxy::unsignedCallback(uint64_t result, CallbackID callbackID)7165 {7166 auto callback = m_callbacks.take<UnsignedCallback>(callbackID);7167 if (!callback) {7168 // FIXME: Log error or assert.7169 // this can validly happen if a load invalidated the callback, though7170 return;7171 }7172 7173 callback->performCallbackWithReturnValue(result);7174 7156 } 7175 7157 … … 8953 8935 } 8954 8936 8955 void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, WTF::Function<void (uint64_t, CallbackBase::Error)>&& callbackFunction) 8956 { 8957 if (!hasRunningProcess()) { 8958 callbackFunction(0, CallbackBase::Error::Unknown); 8959 return; 8960 } 8961 8962 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::characterIndexForPointAsync"_s)); 8963 send(Messages::WebPage::CharacterIndexForPointAsync(point, callbackID)); 8937 void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, CompletionHandler<void(uint64_t)>&& callbackFunction) 8938 { 8939 sendWithAsyncReply(Messages::WebPage::CharacterIndexForPointAsync(point), WTFMove(callbackFunction)); 8964 8940 } 8965 8941 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r272611 r272627 380 380 381 381 typedef GenericCallback<API::Data*> DataCallback; 382 typedef GenericCallback<uint64_t> UnsignedCallback;383 382 typedef GenericCallback<const String&> StringCallback; 384 383 … … 769 768 void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 770 769 void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&); 771 void beginSelectionInDirection(WebCore::SelectionDirection, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);772 void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, RespectSelectionAnchor, WTF::Function<void(uint64_t, CallbackBase::Error)>&&);773 void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, WTF::Function<void(uint64_t, CallbackBase::Error)>&&);770 void beginSelectionInDirection(WebCore::SelectionDirection, CompletionHandler<void(bool)>&&); 771 void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CompletionHandler<void(bool)>&&); 772 void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void(bool)>&&); 774 773 void requestAutocorrectionData(const String& textForAutocorrection, CompletionHandler<void(WebAutocorrectionData)>&&); 775 774 void applyAutocorrection(const String& correction, const String& originalText, WTF::Function<void (const String&, CallbackBase::Error)>&&); … … 880 879 void getMarkedRangeAsync(CompletionHandler<void(const EditingRange&)>&&); 881 880 void getSelectedRangeAsync(CompletionHandler<void(const EditingRange&)>&&); 882 void characterIndexForPointAsync(const WebCore::IntPoint&, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);881 void characterIndexForPointAsync(const WebCore::IntPoint&, CompletionHandler<void(uint64_t)>&&); 883 882 void firstRectForCharacterRangeAsync(const EditingRange&, CompletionHandler<void(const WebCore::IntRect&, const EditingRange&)>&&); 884 883 void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>&, const Vector<WebCore::CompositionHighlight>&, const EditingRange& selectionRange, const EditingRange& replacementRange); … … 1113 1112 void hideFindUI(); 1114 1113 void countStringMatches(const String&, OptionSet<FindOptions>, unsigned maxMatchCount); 1115 void replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, Function<void(uint64_t, CallbackBase::Error)>&&);1114 void replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&&); 1116 1115 void didCountStringMatches(const String&, uint32_t matchCount); 1117 1116 void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorWindowLifetime */ lifetime = 0 /* Permanent */); … … 2161 2160 void stringCallback(const String&, CallbackID); 2162 2161 void invalidateStringCallback(CallbackID); 2163 void unsignedCallback(uint64_t, CallbackID);2164 2162 #if ENABLE(APPLICATION_MANIFEST) 2165 2163 void applicationManifestCallback(const Optional<WebCore::ApplicationManifest>&, CallbackID); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r272606 r272627 169 169 StringCallback(String resultString, WebKit::CallbackID callbackID) 170 170 InvalidateStringCallback(WebKit::CallbackID callbackID) 171 UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID)172 171 #if ENABLE(APPLICATION_MANIFEST) 173 172 ApplicationManifestCallback(Optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID) -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r272597 r272627 4268 4268 _usingGestureForSelection = YES; 4269 4269 ++_suppressNonEditableSingleTapTextInteractionCount; 4270 UIWKSelectionCompletionHandler selectionHandler = [completionHandler copy]; 4271 RetainPtr<WKContentView> view = self; 4272 4273 _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view, selectionHandler] { 4270 _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view = retainPtr(self), selectionHandler = makeBlockPtr(completionHandler)] { 4274 4271 selectionHandler(); 4275 4272 view->_usingGestureForSelection = NO; 4276 4273 --view->_suppressNonEditableSingleTapTextInteractionCount; 4277 [selectionHandler release];4278 4274 }); 4279 4275 } … … 4281 4277 - (void)beginSelectionInDirection:(UITextDirection)direction completionHandler:(void (^)(BOOL endIsMoving))completionHandler 4282 4278 { 4283 UIWKSelectionWithDirectionCompletionHandler selectionHandler = [completionHandler copy]; 4284 4285 _page->beginSelectionInDirection(toWKSelectionDirection(direction), [selectionHandler](bool endIsMoving, WebKit::CallbackBase::Error error) { 4279 _page->beginSelectionInDirection(toWKSelectionDirection(direction), [selectionHandler = makeBlockPtr(completionHandler)] (bool endIsMoving) { 4286 4280 selectionHandler(endIsMoving); 4287 [selectionHandler release];4288 4281 }); 4289 4282 } … … 4291 4284 - (void)updateSelectionWithExtentPoint:(CGPoint)point completionHandler:(void (^)(BOOL endIsMoving))completionHandler 4292 4285 { 4293 UIWKSelectionWithDirectionCompletionHandler selectionHandler = [completionHandler copy];4294 4295 4286 auto respectSelectionAnchor = self.interactionAssistant._wk_hasFloatingCursor ? WebKit::RespectSelectionAnchor::Yes : WebKit::RespectSelectionAnchor::No; 4296 _page->updateSelectionWithExtentPoint(WebCore::IntPoint(point), self._hasFocusedElement, respectSelectionAnchor, [selectionHandler ](bool endIsMoving, WebKit::CallbackBase::Error error) {4287 _page->updateSelectionWithExtentPoint(WebCore::IntPoint(point), self._hasFocusedElement, respectSelectionAnchor, [selectionHandler = makeBlockPtr(completionHandler)](bool endIsMoving) { 4297 4288 selectionHandler(endIsMoving); 4298 [selectionHandler release];4299 4289 }); 4300 4290 } … … 4305 4295 4306 4296 ++_suppressNonEditableSingleTapTextInteractionCount; 4307 _page->updateSelectionWithExtentPointAndBoundary(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [selectionHandler, protectedSelf = retainPtr(self)] (bool endIsMoving , WebKit::CallbackBase::Error error) {4297 _page->updateSelectionWithExtentPointAndBoundary(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [selectionHandler, protectedSelf = retainPtr(self)] (bool endIsMoving) { 4308 4298 selectionHandler(endIsMoving); 4309 4299 [selectionHandler release]; -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r272592 r272627 496 496 } 497 497 498 void WebPageProxy::beginSelectionInDirection(WebCore::SelectionDirection direction, WTF::Function<void (uint64_t, CallbackBase::Error)>&& callbackFunction) 499 { 500 if (!hasRunningProcess()) { 501 callbackFunction(0, CallbackBase::Error::Unknown); 502 return; 503 } 504 505 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::beginSelectionInDirection"_s)); 506 m_process->send(Messages::WebPage::BeginSelectionInDirection(direction, callbackID), m_webPageID); 507 } 508 509 void WebPageProxy::updateSelectionWithExtentPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, WTF::Function<void(uint64_t, CallbackBase::Error)>&& callbackFunction) 510 { 511 if (!hasRunningProcess()) { 512 callbackFunction(0, CallbackBase::Error::Unknown); 513 return; 514 } 515 516 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::updateSelectionWithExtentPoint"_s)); 517 m_process->send(Messages::WebPage::UpdateSelectionWithExtentPoint(point, isInteractingWithFocusedElement, respectSelectionAnchor, callbackID), m_webPageID); 518 519 } 520 521 void WebPageProxy::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, WTF::Function<void(uint64_t, CallbackBase::Error)>&& callbackFunction) 522 { 523 if (!hasRunningProcess()) { 524 callbackFunction(0, CallbackBase::Error::Unknown); 525 return; 526 } 527 528 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::updateSelectionWithExtentPointAndBoundary"_s)); 529 m_process->send(Messages::WebPage::UpdateSelectionWithExtentPointAndBoundary(point, granularity, isInteractingWithFocusedElement, callbackID), m_webPageID); 530 498 void WebPageProxy::beginSelectionInDirection(WebCore::SelectionDirection direction, CompletionHandler<void(bool)>&& callback) 499 { 500 sendWithAsyncReply(Messages::WebPage::BeginSelectionInDirection(direction), WTFMove(callback)); 501 } 502 503 void WebPageProxy::updateSelectionWithExtentPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, CompletionHandler<void(bool)>&& callback) 504 { 505 sendWithAsyncReply(Messages::WebPage::UpdateSelectionWithExtentPoint(point, isInteractingWithFocusedElement, respectSelectionAnchor), WTFMove(callback)); 506 } 507 508 void WebPageProxy::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, CompletionHandler<void(bool)>&& callback) 509 { 510 sendWithAsyncReply(Messages::WebPage::UpdateSelectionWithExtentPointAndBoundary(point, granularity, isInteractingWithFocusedElement), WTFMove(callback)); 531 511 } 532 512 -
trunk/Source/WebKit/UIProcess/mac/WKTextFinderClient.mm
r264055 r272627 197 197 matchIndices.uncheckedAppend([(WKTextFinderMatch *)match index]); 198 198 } 199 _page->replaceMatches(WTFMove(matchIndices), replacementText, selectionOnly, [collector = makeBlockPtr(resultCollector)] (uint64_t numberOfReplacements , auto error) {200 collector( error == WebKit::CallbackBase::Error::None ? numberOfReplacements : 0);199 _page->replaceMatches(WTFMove(matchIndices), replacementText, selectionOnly, [collector = makeBlockPtr(resultCollector)] (uint64_t numberOfReplacements) { 200 collector(numberOfReplacements); 201 201 }); 202 202 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r272625 r272627 4418 4418 } 4419 4419 4420 void WebPage::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, C allbackID callbackID)4420 void WebPage::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&& completionHandler) 4421 4421 { 4422 4422 auto numberOfReplacements = findController().replaceMatches(matchIndices, replacementText, selectionOnly); 4423 send(Messages::WebPageProxy::UnsignedCallback(numberOfReplacements, callbackID));4423 completionHandler(numberOfReplacements); 4424 4424 } 4425 4425 … … 5594 5594 } 5595 5595 5596 void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, C allbackID callbackID)5596 void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, CompletionHandler<void(uint64_t)>&& completionHandler) 5597 5597 { 5598 5598 constexpr OptionSet<HitTestRequest::RequestType> hitType { HitTestRequest::ReadOnly, HitTestRequest::Active, HitTestRequest::DisallowUserAgentShadowContent, HitTestRequest::AllowChildFrameContent }; … … 5601 5601 auto range = frame.rangeForPoint(result.roundedPointInInnerNodeFrame()); 5602 5602 auto editingRange = EditingRange::fromRange(frame, range); 5603 send(Messages::WebPageProxy::UnsignedCallback(editingRange.location, callbackID));5603 completionHandler(editingRange.location); 5604 5604 } 5605 5605 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r272606 r272627 743 743 void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&); 744 744 void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&); 745 void beginSelectionInDirection(WebCore::SelectionDirection, C allbackID);746 void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, C allbackID);747 void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, C allbackID);745 void beginSelectionInDirection(WebCore::SelectionDirection, CompletionHandler<void(bool)>&&); 746 void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CompletionHandler<void(bool)>&&); 747 void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void(bool)>&&); 748 748 749 749 void requestDictationContext(CompletionHandler<void(const String&, const String&, const String&)>&&); … … 894 894 void getMarkedRangeAsync(CompletionHandler<void(const EditingRange&)>&&); 895 895 void getSelectedRangeAsync(CompletionHandler<void(const EditingRange&)>&&); 896 void characterIndexForPointAsync(const WebCore::IntPoint&, C allbackID);896 void characterIndexForPointAsync(const WebCore::IntPoint&, CompletionHandler<void(uint64_t)>&&); 897 897 void firstRectForCharacterRangeAsync(const EditingRange&, CompletionHandler<void(const WebCore::IntRect&, const EditingRange&)>&&); 898 898 void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>&, const Vector<WebCore::CompositionHighlight>&, const EditingRange& selectionRange, const EditingRange& replacementRange); … … 1649 1649 void hideFindUI(); 1650 1650 void countStringMatches(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount); 1651 void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, C allbackID);1651 void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&&); 1652 1652 1653 1653 #if USE(COORDINATED_GRAPHICS) -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r272606 r272627 76 76 MoveSelectionAtBoundaryWithDirection(enum:uint8_t WebCore::TextGranularity granularity, enum:uint8_t WebCore::SelectionDirection direction) -> () Async 77 77 SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement) -> () Async 78 BeginSelectionInDirection(enum:uint8_t WebCore::SelectionDirection direction , WebKit::CallbackID callbackID)79 UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement, enum:bool WebKit::RespectSelectionAnchor respectSelectionAnchor , WebKit::CallbackID callbackID)80 UpdateSelectionWithExtentPointAndBoundary(WebCore::IntPoint point, enum:uint8_t WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement , WebKit::CallbackID callbackID)78 BeginSelectionInDirection(enum:uint8_t WebCore::SelectionDirection direction) -> (bool endIsMoving) Async 79 UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement, enum:bool WebKit::RespectSelectionAnchor respectSelectionAnchor) -> (bool endIsMoving) Async 80 UpdateSelectionWithExtentPointAndBoundary(WebCore::IntPoint point, enum:uint8_t WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement) -> (bool endIsMoving) Async 81 81 RequestDictationContext() -> (String selectedText, String textBefore, String textAfter) Async 82 82 ReplaceDictatedText(String oldText, String newText) … … 307 307 HideFindUI() 308 308 CountStringMatches(String string, OptionSet<WebKit::FindOptions> findOptions, unsigned maxMatchCount) 309 ReplaceMatches(Vector<uint32_t> matchIndices, String replacementText, bool selectionOnly , WebKit::CallbackID callbackID)309 ReplaceMatches(Vector<uint32_t> matchIndices, String replacementText, bool selectionOnly) -> (uint64_t numberOfReplacements) Async 310 310 311 311 AddMIMETypeWithCustomContentProvider(String mimeType) … … 458 458 GetMarkedRangeAsync() -> (struct WebKit::EditingRange range) Async 459 459 GetSelectedRangeAsync() -> (struct WebKit::EditingRange range) Async 460 CharacterIndexForPointAsync(WebCore::IntPoint point , WebKit::CallbackID callbackID);460 CharacterIndexForPointAsync(WebCore::IntPoint point) -> (uint64_t location) Async 461 461 FirstRectForCharacterRangeAsync(struct WebKit::EditingRange range) -> (WebCore::IntRect rect, struct WebKit::EditingRange actualRange) Async 462 462 SetCompositionAsync(String text, Vector<WebCore::CompositionUnderline> underlines, Vector<WebCore::CompositionHighlight> highlights, struct WebKit::EditingRange selectionRange, struct WebKit::EditingRange replacementRange) -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r272597 r272627 2157 2157 } 2158 2158 2159 void WebPage::beginSelectionInDirection(WebCore::SelectionDirection direction, C allbackID callbackID)2159 void WebPage::beginSelectionInDirection(WebCore::SelectionDirection direction, CompletionHandler<void(bool)>&& completionHandler) 2160 2160 { 2161 2161 m_selectionAnchor = direction == SelectionDirection::Left ? Start : End; 2162 send(Messages::WebPageProxy::UnsignedCallback(m_selectionAnchor == Start, callbackID));2163 } 2164 2165 void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, C allbackID callbackID)2162 completionHandler(m_selectionAnchor == Start); 2163 } 2164 2165 void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, CompletionHandler<void(bool)>&& callback) 2166 2166 { 2167 2167 auto& frame = m_page->focusController().focusedOrMainFrame(); … … 2169 2169 auto newRange = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement); 2170 2170 2171 if (position.isNull() || !m_initialSelection || !newRange) { 2172 send(Messages::WebPageProxy::UnsignedCallback(false, callbackID)); 2173 return; 2174 } 2171 if (position.isNull() || !m_initialSelection || !newRange) 2172 return callback(false); 2175 2173 2176 2174 auto initialSelectionStartPosition = makeDeprecatedLegacyPosition(m_initialSelection->start); … … 2187 2185 frame.selection().setSelectedRange(range, Affinity::Upstream, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2188 2186 2189 send(Messages::WebPageProxy::UnsignedCallback(selectionStart == initialSelectionStartPosition, callbackID));2190 } 2191 2192 void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, C allbackID callbackID)2187 callback(selectionStart == initialSelectionStartPosition); 2188 } 2189 2190 void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, CompletionHandler<void(bool)>&& callback) 2193 2191 { 2194 2192 auto& frame = m_page->focusController().focusedOrMainFrame(); 2195 2193 auto position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithFocusedElement); 2196 2194 2197 if (position.isNull()) { 2198 send(Messages::WebPageProxy::UnsignedCallback(false, callbackID)); 2199 return; 2200 } 2195 if (position.isNull()) 2196 return callback(false); 2201 2197 2202 2198 VisiblePosition selectionStart; … … 2236 2232 frame.selection().setSelectedRange(range, Affinity::Upstream, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered); 2237 2233 2238 send(Messages::WebPageProxy::UnsignedCallback(m_selectionAnchor == Start, callbackID));2234 callback(m_selectionAnchor == Start); 2239 2235 } 2240 2236
Note:
See TracChangeset
for help on using the changeset viewer.