Changeset 272627 in webkit


Ignore:
Timestamp:
Feb 9, 2021 5:28:04 PM (3 years ago)
Author:
achristensen@apple.com
Message:

Use CompletionHandler instead of UnsignedCallback
https://bugs.webkit.org/show_bug.cgi?id=221631

Reviewed by Chris Dumez.

  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::characterIndexForPoint):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::replaceMatches):
(WebKit::WebPageProxy::characterIndexForPointAsync):
(WebKit::WebPageProxy::unsignedCallback): Deleted.

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
(-[WKContentView beginSelectionInDirection:completionHandler:]):
(-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
(-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::beginSelectionInDirection):
(WebKit::WebPageProxy::updateSelectionWithExtentPoint):
(WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):

  • UIProcess/mac/WKTextFinderClient.mm:

(-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::replaceMatches):
(WebKit::WebPage::characterIndexForPointAsync):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::beginSelectionInDirection):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):

Location:
trunk/Source/WebKit
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r272625 r272627  
     12021-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
    1372021-02-09  Peng Liu  <peng.liu6@apple.com>
    238
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r272470 r272627  
    50825082}
    50835083
    5084 void WebViewImpl::characterIndexForPoint(NSPoint point, void(^completionHandlerPtr)(NSUInteger))
    5085 {
    5086     auto completionHandler = adoptNS([completionHandlerPtr copy]);
    5087 
     5084void WebViewImpl::characterIndexForPoint(NSPoint point, void(^completionHandler)(NSUInteger))
     5085{
    50885086    LOG(TextInput, "characterIndexForPoint:(%f, %f)", point.x, point.y);
    50895087
     
    50965094    point = [m_view convertPoint:point fromView:nil];  // the point is relative to the main frame
    50975095
    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) {
    51055097        if (result == notFound)
    51065098            result = NSNotFound;
    51075099        LOG(TextInput, "    -> characterIndexForPoint returned %lu", result);
    5108         completionHandlerBlock(result);
     5100        completionHandler(result);
    51095101    });
    51105102}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r272606 r272627  
    40174017}
    40184018
    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));
     4019void 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));
    40284022}
    40294023
     
    71607154
    71617155    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, though
    7170         return;
    7171     }
    7172 
    7173     callback->performCallbackWithReturnValue(result);
    71747156}
    71757157
     
    89538935}
    89548936
    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));
     8937void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, CompletionHandler<void(uint64_t)>&& callbackFunction)
     8938{
     8939    sendWithAsyncReply(Messages::WebPage::CharacterIndexForPointAsync(point), WTFMove(callbackFunction));
    89648940}
    89658941
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r272611 r272627  
    380380
    381381typedef GenericCallback<API::Data*> DataCallback;
    382 typedef GenericCallback<uint64_t> UnsignedCallback;
    383382typedef GenericCallback<const String&> StringCallback;
    384383
     
    769768    void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
    770769    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)>&&);
    774773    void requestAutocorrectionData(const String& textForAutocorrection, CompletionHandler<void(WebAutocorrectionData)>&&);
    775774    void applyAutocorrection(const String& correction, const String& originalText, WTF::Function<void (const String&, CallbackBase::Error)>&&);
     
    880879    void getMarkedRangeAsync(CompletionHandler<void(const EditingRange&)>&&);
    881880    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)>&&);
    883882    void firstRectForCharacterRangeAsync(const EditingRange&, CompletionHandler<void(const WebCore::IntRect&, const EditingRange&)>&&);
    884883    void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>&, const Vector<WebCore::CompositionHighlight>&, const EditingRange& selectionRange, const EditingRange& replacementRange);
     
    11131112    void hideFindUI();
    11141113    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)>&&);
    11161115    void didCountStringMatches(const String&, uint32_t matchCount);
    11171116    void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorWindowLifetime */ lifetime = 0 /* Permanent */);
     
    21612160    void stringCallback(const String&, CallbackID);
    21622161    void invalidateStringCallback(CallbackID);
    2163     void unsignedCallback(uint64_t, CallbackID);
    21642162#if ENABLE(APPLICATION_MANIFEST)
    21652163    void applicationManifestCallback(const Optional<WebCore::ApplicationManifest>&, CallbackID);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r272606 r272627  
    169169    StringCallback(String resultString, WebKit::CallbackID callbackID)
    170170    InvalidateStringCallback(WebKit::CallbackID callbackID)
    171     UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID)
    172171#if ENABLE(APPLICATION_MANIFEST)
    173172    ApplicationManifestCallback(Optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID)
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r272597 r272627  
    42684268    _usingGestureForSelection = YES;
    42694269    ++_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)] {
    42744271        selectionHandler();
    42754272        view->_usingGestureForSelection = NO;
    42764273        --view->_suppressNonEditableSingleTapTextInteractionCount;
    4277         [selectionHandler release];
    42784274    });
    42794275}
     
    42814277- (void)beginSelectionInDirection:(UITextDirection)direction completionHandler:(void (^)(BOOL endIsMoving))completionHandler
    42824278{
    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) {
    42864280        selectionHandler(endIsMoving);
    4287         [selectionHandler release];
    42884281    });
    42894282}
     
    42914284- (void)updateSelectionWithExtentPoint:(CGPoint)point completionHandler:(void (^)(BOOL endIsMoving))completionHandler
    42924285{
    4293     UIWKSelectionWithDirectionCompletionHandler selectionHandler = [completionHandler copy];
    4294    
    42954286    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) {
    42974288        selectionHandler(endIsMoving);
    4298         [selectionHandler release];
    42994289    });
    43004290}
     
    43054295   
    43064296    ++_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) {
    43084298        selectionHandler(endIsMoving);
    43094299        [selectionHandler release];
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r272592 r272627  
    496496}
    497497
    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    
     498void WebPageProxy::beginSelectionInDirection(WebCore::SelectionDirection direction, CompletionHandler<void(bool)>&& callback)
     499{
     500    sendWithAsyncReply(Messages::WebPage::BeginSelectionInDirection(direction), WTFMove(callback));
     501}
     502
     503void 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
     508void 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));
    531511}
    532512
  • trunk/Source/WebKit/UIProcess/mac/WKTextFinderClient.mm

    r264055 r272627  
    197197            matchIndices.uncheckedAppend([(WKTextFinderMatch *)match index]);
    198198    }
    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);
    201201    });
    202202}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r272625 r272627  
    44184418}
    44194419
    4420 void WebPage::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID callbackID)
     4420void WebPage::replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&& completionHandler)
    44214421{
    44224422    auto numberOfReplacements = findController().replaceMatches(matchIndices, replacementText, selectionOnly);
    4423     send(Messages::WebPageProxy::UnsignedCallback(numberOfReplacements, callbackID));
     4423    completionHandler(numberOfReplacements);
    44244424}
    44254425
     
    55945594}
    55955595
    5596 void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, CallbackID callbackID)
     5596void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, CompletionHandler<void(uint64_t)>&& completionHandler)
    55975597{
    55985598    constexpr OptionSet<HitTestRequest::RequestType> hitType { HitTestRequest::ReadOnly, HitTestRequest::Active, HitTestRequest::DisallowUserAgentShadowContent,  HitTestRequest::AllowChildFrameContent };
     
    56015601    auto range = frame.rangeForPoint(result.roundedPointInInnerNodeFrame());
    56025602    auto editingRange = EditingRange::fromRange(frame, range);
    5603     send(Messages::WebPageProxy::UnsignedCallback(editingRange.location, callbackID));
     5603    completionHandler(editingRange.location);
    56045604}
    56055605
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r272606 r272627  
    743743    void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&);
    744744    void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
    745     void beginSelectionInDirection(WebCore::SelectionDirection, CallbackID);
    746     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CallbackID);
    747     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CallbackID);
     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)>&&);
    748748
    749749    void requestDictationContext(CompletionHandler<void(const String&, const String&, const String&)>&&);
     
    894894    void getMarkedRangeAsync(CompletionHandler<void(const EditingRange&)>&&);
    895895    void getSelectedRangeAsync(CompletionHandler<void(const EditingRange&)>&&);
    896     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
     896    void characterIndexForPointAsync(const WebCore::IntPoint&, CompletionHandler<void(uint64_t)>&&);
    897897    void firstRectForCharacterRangeAsync(const EditingRange&, CompletionHandler<void(const WebCore::IntRect&, const EditingRange&)>&&);
    898898    void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>&, const Vector<WebCore::CompositionHighlight>&, const EditingRange& selectionRange, const EditingRange& replacementRange);
     
    16491649    void hideFindUI();
    16501650    void countStringMatches(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount);
    1651     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
     1651    void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CompletionHandler<void(uint64_t)>&&);
    16521652
    16531653#if USE(COORDINATED_GRAPHICS)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r272606 r272627  
    7676    MoveSelectionAtBoundaryWithDirection(enum:uint8_t WebCore::TextGranularity granularity, enum:uint8_t WebCore::SelectionDirection direction) -> () Async
    7777    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
    8181    RequestDictationContext() -> (String selectedText, String textBefore, String textAfter) Async
    8282    ReplaceDictatedText(String oldText, String newText)
     
    307307    HideFindUI()
    308308    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
    310310   
    311311    AddMIMETypeWithCustomContentProvider(String mimeType)
     
    458458    GetMarkedRangeAsync() -> (struct WebKit::EditingRange range) Async
    459459    GetSelectedRangeAsync() -> (struct WebKit::EditingRange range) Async
    460     CharacterIndexForPointAsync(WebCore::IntPoint point, WebKit::CallbackID callbackID);
     460    CharacterIndexForPointAsync(WebCore::IntPoint point) -> (uint64_t location) Async
    461461    FirstRectForCharacterRangeAsync(struct WebKit::EditingRange range) -> (WebCore::IntRect rect, struct WebKit::EditingRange actualRange) Async
    462462    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  
    21572157}
    21582158
    2159 void WebPage::beginSelectionInDirection(WebCore::SelectionDirection direction, CallbackID callbackID)
     2159void WebPage::beginSelectionInDirection(WebCore::SelectionDirection direction, CompletionHandler<void(bool)>&& completionHandler)
    21602160{
    21612161    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, CallbackID callbackID)
     2162    completionHandler(m_selectionAnchor == Start);
     2163}
     2164
     2165void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, CompletionHandler<void(bool)>&& callback)
    21662166{
    21672167    auto& frame = m_page->focusController().focusedOrMainFrame();
     
    21692169    auto newRange = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithFocusedElement);
    21702170   
    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);
    21752173
    21762174    auto initialSelectionStartPosition = makeDeprecatedLegacyPosition(m_initialSelection->start);
     
    21872185        frame.selection().setSelectedRange(range, Affinity::Upstream, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    21882186
    2189     send(Messages::WebPageProxy::UnsignedCallback(selectionStart == initialSelectionStartPosition, callbackID));
    2190 }
    2191 
    2192 void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, CallbackID callbackID)
     2187    callback(selectionStart == initialSelectionStartPosition);
     2188}
     2189
     2190void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, RespectSelectionAnchor respectSelectionAnchor, CompletionHandler<void(bool)>&& callback)
    21932191{
    21942192    auto& frame = m_page->focusController().focusedOrMainFrame();
    21952193    auto position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithFocusedElement);
    21962194
    2197     if (position.isNull()) {
    2198         send(Messages::WebPageProxy::UnsignedCallback(false, callbackID));
    2199         return;
    2200     }
     2195    if (position.isNull())
     2196        return callback(false);
    22012197
    22022198    VisiblePosition selectionStart;
     
    22362232        frame.selection().setSelectedRange(range, Affinity::Upstream, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    22372233
    2238     send(Messages::WebPageProxy::UnsignedCallback(m_selectionAnchor == Start, callbackID));
     2234    callback(m_selectionAnchor == Start);
    22392235}
    22402236
Note: See TracChangeset for help on using the changeset viewer.