Changeset 260857 in webkit


Ignore:
Timestamp:
Apr 28, 2020 5:05:58 PM (4 years ago)
Author:
dbates@webkit.org
Message:

Move WebPage::textInputContextsInRect() to WebPageIOS.mm
https://bugs.webkit.org/show_bug.cgi?id=211136

Reviewed by Eric Carlson.

The function WebPage::textInputContextsInRect is very specific to a client on iOS.
Although it's tempting to keep this cross-platform because its implementation does
not make use of iOS-specific technologies it does a very specific operation, the
result of which is a list of contexts to editable elements on the page. The contexts
provide enough info for the specific iOS client, but not enough to ever be useful
to any other client. Therefore move it to WebPageIOS.mm.

Only Mac and iOS were ever using this function. The former only for testing purposes
that have since been removed.

A side effect of this change is that I also move WebPageProxy::textInputContextsInRect()
from WebPageProxy.cpp to WebPageProxyIOS.mm.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::textInputContextsInRect): Deleted; moved to WebPageProxyIOS.mm.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::textInputContextsInRect): Moved from WebPageProxy.cpp.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::textInputContextsInRect): Deleted; moved to WebPageIOS.mm.

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

(WebKit::WebPage::textInputContextsInRect): Moved from WebPage.cpp.

Location:
trunk/Source/WebKit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r260856 r260857  
     12020-04-28  Daniel Bates  <dabates@apple.com>
     2
     3        Move WebPage::textInputContextsInRect() to WebPageIOS.mm
     4        https://bugs.webkit.org/show_bug.cgi?id=211136
     5
     6        Reviewed by Eric Carlson.
     7
     8        The function WebPage::textInputContextsInRect is very specific to a client on iOS.
     9        Although it's tempting to keep this cross-platform because its implementation does
     10        not make use of iOS-specific technologies it does a very specific operation, the
     11        result of which is a list of contexts to editable elements on the page. The contexts
     12        provide enough info for the specific iOS client, but not enough to ever be useful
     13        to any other client. Therefore move it to WebPageIOS.mm.
     14
     15        Only Mac and iOS were ever using this function. The former only for testing purposes
     16        that have since been removed.
     17
     18        A side effect of this change is that I also move WebPageProxy::textInputContextsInRect()
     19        from WebPageProxy.cpp to WebPageProxyIOS.mm.
     20
     21        * UIProcess/WebPageProxy.cpp:
     22        (WebKit::WebPageProxy::textInputContextsInRect): Deleted; moved to WebPageProxyIOS.mm.
     23        * UIProcess/WebPageProxy.h:
     24        * UIProcess/ios/WebPageProxyIOS.mm:
     25        (WebKit::WebPageProxy::textInputContextsInRect): Moved from WebPageProxy.cpp.
     26        * WebProcess/WebPage/WebPage.cpp:
     27        (WebKit::WebPage::textInputContextsInRect): Deleted; moved to WebPageIOS.mm.
     28        * WebProcess/WebPage/WebPage.h:
     29        * WebProcess/WebPage/WebPage.messages.in:
     30        * WebProcess/WebPage/ios/WebPageIOS.mm:
     31        (WebKit::WebPage::textInputContextsInRect): Moved from WebPage.cpp.
     32
    1332020-04-28  Chris Dumez  <cdumez@apple.com>
    234
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r260820 r260857  
    1002710027}
    1002810028
    10029 void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
    10030 {
    10031     if (!hasRunningProcess()) {
    10032         completionHandler({ });
    10033         return;
    10034     }
    10035 
    10036     sendWithAsyncReply(Messages::WebPage::TextInputContextsInRect(rect), WTFMove(completionHandler));
    10037 }
    10038 
    1003910029void WebPageProxy::setCanShowPlaceholder(const WebCore::ElementContext& context, bool canShowPlaceholder)
    1004010030{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r260764 r260857  
    707707    void fontAttributesCallback(const WebCore::FontAttributes&, CallbackID);
    708708
    709     void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
    710709    void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
    711710
     
    715714
    716715#if PLATFORM(IOS_FAMILY)
     716    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
    717717    void focusTextInputContextAndPlaceCaret(const WebCore::ElementContext&, const WebCore::IntPoint&, CompletionHandler<void(bool)>&&);
    718718
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r260764 r260857  
    15471547}
    15481548
     1549void WebPageProxy::textInputContextsInRect(FloatRect rect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
     1550{
     1551    if (!hasRunningProcess()) {
     1552        completionHandler({ });
     1553        return;
     1554    }
     1555
     1556    sendWithAsyncReply(Messages::WebPage::TextInputContextsInRect(rect), WTFMove(completionHandler));
     1557}
     1558
    15491559void WebPageProxy::focusTextInputContextAndPlaceCaret(const ElementContext& context, const IntPoint& point, CompletionHandler<void(bool)>&& completionHandler)
    15501560{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r260846 r260857  
    69186918#endif // !PLATFORM(IOS_FAMILY)
    69196919
    6920 void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
    6921 {
    6922     auto contexts = m_page->editableElementsInRect(searchRect).map([&] (const auto& element) {
    6923         auto& document = element->document();
    6924 
    6925         WebCore::ElementContext context;
    6926         context.webPageIdentifier = m_identifier;
    6927         context.documentIdentifier = document.identifier();
    6928         context.elementIdentifier = document.identifierForElement(element);
    6929         context.boundingRect = element->clientRect();
    6930         return context;
    6931     });
    6932     completionHandler(contexts);
    6933 }
    6934 
    69356920void WebPage::setCanShowPlaceholder(const WebCore::ElementContext& elementContext, bool canShowPlaceholder)
    69366921{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r260846 r260857  
    645645    void selectAll();
    646646
     647    void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
     648
     649#if PLATFORM(IOS_FAMILY)
    647650    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
    648     void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
    649 
    650 #if PLATFORM(IOS_FAMILY)
    651651    void focusTextInputContextAndPlaceCaret(const WebCore::ElementContext&, const WebCore::IntPoint&, CompletionHandler<void(bool)>&&);
    652652
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r260846 r260857  
    122122    InsertTextPlaceholder(WebCore::IntSize size) -> (Optional<WebCore::ElementContext> placeholder) Async
    123123    RemoveTextPlaceholder(struct WebCore::ElementContext placeholder) -> () Async
     124    TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebCore::ElementContext> contexts) Async
    124125    FocusTextInputContextAndPlaceCaret(struct WebCore::ElementContext context, WebCore::IntPoint point) -> (bool success) Async
    125126    ClearServiceWorkerEntitlementOverride() -> () Async
     
    578579#endif
    579580
    580     TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebCore::ElementContext> contexts) Async
    581581    SetCanShowPlaceholder(struct WebCore::ElementContext context, bool canShowPlaceholder)
    582582
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r260826 r260857  
    43164316}
    43174317
     4318void WebPage::textInputContextsInRect(FloatRect searchRect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
     4319{
     4320    auto contexts = m_page->editableElementsInRect(searchRect).map([&] (const auto& element) {
     4321        auto& document = element->document();
     4322
     4323        ElementContext context;
     4324        context.webPageIdentifier = m_identifier;
     4325        context.documentIdentifier = document.identifier();
     4326        context.elementIdentifier = document.identifierForElement(element);
     4327        context.boundingRect = element->clientRect();
     4328        return context;
     4329    });
     4330    completionHandler(contexts);
     4331}
     4332
    43184333void WebPage::focusTextInputContextAndPlaceCaret(const ElementContext& elementContext, const IntPoint& point, CompletionHandler<void(bool)>&& completionHandler)
    43194334{
Note: See TracChangeset for help on using the changeset viewer.