- Revision
- 260857
- Author
- [email protected]
- Date
- 2020-04-28 17:05:58 -0700 (Tue, 28 Apr 2020)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (260856 => 260857)
--- trunk/Source/WebKit/ChangeLog 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/ChangeLog 2020-04-29 00:05:58 UTC (rev 260857)
@@ -1,3 +1,35 @@
+2020-04-28 Daniel Bates <[email protected]>
+
+ 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.
+
2020-04-28 Chris Dumez <[email protected]>
[iOS][WK2] Drop process assertion logic for holding locked files
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (260856 => 260857)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-29 00:05:58 UTC (rev 260857)
@@ -10026,16 +10026,6 @@
}
}
-void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
-{
- if (!hasRunningProcess()) {
- completionHandler({ });
- return;
- }
-
- sendWithAsyncReply(Messages::WebPage::TextInputContextsInRect(rect), WTFMove(completionHandler));
-}
-
void WebPageProxy::setCanShowPlaceholder(const WebCore::ElementContext& context, bool canShowPlaceholder)
{
if (hasRunningProcess())
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (260856 => 260857)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-29 00:05:58 UTC (rev 260857)
@@ -706,7 +706,6 @@
void requestFontAttributesAtSelectionStart(Function<void(const WebCore::FontAttributes&, CallbackBase::Error)>&&);
void fontAttributesCallback(const WebCore::FontAttributes&, CallbackID);
- void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
#if ENABLE(UI_SIDE_COMPOSITING)
@@ -714,6 +713,7 @@
#endif
#if PLATFORM(IOS_FAMILY)
+ void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
void focusTextInputContextAndPlaceCaret(const WebCore::ElementContext&, const WebCore::IntPoint&, CompletionHandler<void(bool)>&&);
void setShouldRevealCurrentSelectionAfterInsertion(bool);
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (260856 => 260857)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2020-04-29 00:05:58 UTC (rev 260857)
@@ -1546,6 +1546,16 @@
return pageClient().isApplicationVisible();
}
+void WebPageProxy::textInputContextsInRect(FloatRect rect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
+{
+ if (!hasRunningProcess()) {
+ completionHandler({ });
+ return;
+ }
+
+ sendWithAsyncReply(Messages::WebPage::TextInputContextsInRect(rect), WTFMove(completionHandler));
+}
+
void WebPageProxy::focusTextInputContextAndPlaceCaret(const ElementContext& context, const IntPoint& point, CompletionHandler<void(bool)>&& completionHandler)
{
if (!hasRunningProcess()) {
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (260856 => 260857)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-29 00:05:58 UTC (rev 260857)
@@ -6917,21 +6917,6 @@
#endif // !PLATFORM(IOS_FAMILY)
-void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
-{
- auto contexts = m_page->editableElementsInRect(searchRect).map([&] (const auto& element) {
- auto& document = element->document();
-
- WebCore::ElementContext context;
- context.webPageIdentifier = m_identifier;
- context.documentIdentifier = document.identifier();
- context.elementIdentifier = document.identifierForElement(element);
- context.boundingRect = element->clientRect();
- return context;
- });
- completionHandler(contexts);
-}
-
void WebPage::setCanShowPlaceholder(const WebCore::ElementContext& elementContext, bool canShowPlaceholder)
{
RefPtr<Element> element = elementForContext(elementContext);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (260856 => 260857)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-29 00:05:58 UTC (rev 260857)
@@ -644,10 +644,10 @@
void executeEditCommandWithCallback(const String&, const String& argument, CompletionHandler<void()>&&);
void selectAll();
- void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
#if PLATFORM(IOS_FAMILY)
+ void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
void focusTextInputContextAndPlaceCaret(const WebCore::ElementContext&, const WebCore::IntPoint&, CompletionHandler<void(bool)>&&);
bool shouldRevealCurrentSelectionAfterInsertion() const { return m_shouldRevealCurrentSelectionAfterInsertion; }
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (260856 => 260857)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-29 00:05:58 UTC (rev 260857)
@@ -121,6 +121,7 @@
SetShouldRevealCurrentSelectionAfterInsertion(bool shouldRevealCurrentSelectionAfterInsertion)
InsertTextPlaceholder(WebCore::IntSize size) -> (Optional<WebCore::ElementContext> placeholder) Async
RemoveTextPlaceholder(struct WebCore::ElementContext placeholder) -> () Async
+ TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebCore::ElementContext> contexts) Async
FocusTextInputContextAndPlaceCaret(struct WebCore::ElementContext context, WebCore::IntPoint point) -> (bool success) Async
ClearServiceWorkerEntitlementOverride() -> () Async
#endif
@@ -577,7 +578,6 @@
VoicesDidChange()
#endif
- TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebCore::ElementContext> contexts) Async
SetCanShowPlaceholder(struct WebCore::ElementContext context, bool canShowPlaceholder)
#if ENABLE(RESOURCE_LOAD_STATISTICS)
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (260856 => 260857)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2020-04-29 00:03:23 UTC (rev 260856)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2020-04-29 00:05:58 UTC (rev 260857)
@@ -4315,6 +4315,21 @@
scheduleFullEditorStateUpdate();
}
+void WebPage::textInputContextsInRect(FloatRect searchRect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
+{
+ auto contexts = m_page->editableElementsInRect(searchRect).map([&] (const auto& element) {
+ auto& document = element->document();
+
+ ElementContext context;
+ context.webPageIdentifier = m_identifier;
+ context.documentIdentifier = document.identifier();
+ context.elementIdentifier = document.identifierForElement(element);
+ context.boundingRect = element->clientRect();
+ return context;
+ });
+ completionHandler(contexts);
+}
+
void WebPage::focusTextInputContextAndPlaceCaret(const ElementContext& elementContext, const IntPoint& point, CompletionHandler<void(bool)>&& completionHandler)
{
auto target = elementForContext(elementContext);