Move ElementContext from WebKit to WebCore
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2019 22:12:01 +0000 (22:12 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2019 22:12:01 +0000 (22:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203210
<rdar://problem/56475682>

Reviewed by Simon Fraser.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* dom/RadioButtonGroups.h:

Source/WebKit:

* Scripts/webkit/messages.py:
* Shared/DocumentEditingContext.h:
* Shared/DocumentEditingContext.mm:
(IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
* Shared/ElementContext.cpp: Removed.
* Shared/ElementContext.h: Removed.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCSSOMViewScrollingAPIEnabled):
* Shared/WebsitePoliciesData.cpp:
(WebKit::WebsitePoliciesData::decode):
* Shared/ios/InteractionInformationAtPosition.h:
* Sources.txt:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
* UIProcess/API/Cocoa/_WKTextInputContext.mm:
(-[_WKTextInputContext _initWithTextInputContext:]):
(-[_WKTextInputContext _textInputContext]):
* UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::textInputContextsInRect):
(WebKit::WebPageProxy::focusTextInputContext):
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::textInputContextsInRect):
(WebKit::WebPage::focusTextInputContext):
(WebKit::WebPage::elementForContext const):
(WebKit::WebPage::contextForElement const):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::startInteractionWithElementContextOrPosition):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Headers.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/ElementContext.h [moved from Source/WebKit/Shared/ElementContext.cpp with 55% similarity]
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/DocumentEditingContext.h
Source/WebKit/Shared/DocumentEditingContext.mm
Source/WebKit/Shared/ElementContext.h [deleted file]
Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
Source/WebKit/Shared/WebsitePoliciesData.cpp
Source/WebKit/Shared/ios/InteractionInformationAtPosition.h
Source/WebKit/Sources.txt
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/_WKTextInputContext.mm
Source/WebKit/UIProcess/API/Cocoa/_WKTextInputContextInternal.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index 9b8cf2f..f01b10e 100644 (file)
@@ -1,3 +1,14 @@
+2019-10-21  Dean Jackson  <dino@apple.com>
+
+        Move ElementContext from WebKit to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=203210
+        <rdar://problem/56475682>
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/RadioButtonGroups.h:
+
 2019-10-21  Alex Christensen  <achristensen@webkit.org>
 
         ServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
index e85d9e3..b7ef1e1 100644 (file)
@@ -382,6 +382,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
     dom/Element.h
     dom/ElementAncestorIterator.h
     dom/ElementChildIterator.h
+    dom/ElementContext.h
     dom/ElementData.h
     dom/ElementDescendantIterator.h
     dom/ElementIdentifier.h
index d59fa24..4381795 100644 (file)
                313591091E7DDC7300F30630 /* RTCIceTransportState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591031E7DDC6000F30630 /* RTCIceTransportState.h */; };
                3135910A1E7DDC7300F30630 /* RTCSdpType.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591041E7DDC6000F30630 /* RTCSdpType.h */; };
                3135910B1E7DDC7300F30630 /* RTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591051E7DDC6000F30630 /* RTCSignalingState.h */; };
+               313BCE1C235E3BE500FC39E5 /* ElementContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 313BCE1B235E3BDB00FC39E5 /* ElementContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                3140379B124BEA7F00AF40E4 /* WebCoreMotionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */; };
                3140379D124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */; };
                3140C5201FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3140C51E1FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h */; };
                313591041E7DDC6000F30630 /* RTCSdpType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCSdpType.h; sourceTree = "<group>"; };
                313591051E7DDC6000F30630 /* RTCSignalingState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCSignalingState.h; sourceTree = "<group>"; };
                3135910C1E7DDCB600F30630 /* RTCBundlePolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCBundlePolicy.h; sourceTree = "<group>"; };
+               313BCE1B235E3BDB00FC39E5 /* ElementContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementContext.h; sourceTree = "<group>"; };
                31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreMotionManager.h; sourceTree = "<group>"; };
                31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreMotionManager.mm; sourceTree = "<group>"; };
                31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientIOS.h; sourceTree = "<group>"; };
                                E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */,
                                E440AA951C68420800A265CC /* ElementAndTextDescendantIterator.h */,
                                E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */,
+                               313BCE1B235E3BDB00FC39E5 /* ElementContext.h */,
                                B5B7A16F17C1080600E4AA0A /* ElementData.cpp */,
                                B5B7A16E17C1048000E4AA0A /* ElementData.h */,
                                ADE11F4A18D8311B0078983B /* ElementDescendantIterator.h */,
                                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */,
                                E440AA961C68420800A265CC /* ElementAndTextDescendantIterator.h in Headers */,
                                E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */,
+                               313BCE1C235E3BE500FC39E5 /* ElementContext.h in Headers */,
                                B5B7A17117C10AC000E4AA0A /* ElementData.h in Headers */,
                                93D437A11D57B3F400AB85EA /* ElementDescendantIterator.h in Headers */,
                                2D2BEB312234A335005544CA /* ElementIdentifier.h in Headers */,
similarity index 55%
rename from Source/WebKit/Shared/ElementContext.cpp
rename to Source/WebCore/dom/ElementContext.h
index 3f74e7f..59f65e9 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "ElementContext.h"
+#pragma once
 
-#include "WebCoreArgumentCoders.h"
-#include <WebCore/Element.h>
+#include "DocumentIdentifier.h"
+#include "ElementIdentifier.h"
+#include "FloatRect.h"
+#include "PageIdentifier.h"
 
-namespace WebKit {
+namespace WebCore {
 
-ElementContext::~ElementContext() = default;
+struct ElementContext {
+    FloatRect boundingRect;
 
-}
+    PageIdentifier webPageIdentifier;
+    DocumentIdentifier documentIdentifier;
+    ElementIdentifier elementIdentifier;
+
+    ~ElementContext() = default;
+
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static Optional<ElementContext> decode(Decoder&);
+};
 
-namespace IPC {
+inline bool operator==(const ElementContext& a, const ElementContext& b)
+{
+    return a.boundingRect == b.boundingRect
+        && a.webPageIdentifier == b.webPageIdentifier
+        && a.documentIdentifier == b.documentIdentifier
+        && a.elementIdentifier == b.elementIdentifier;
+}
 
-void ArgumentCoder<WebKit::ElementContext>::encode(Encoder& encoder, const WebKit::ElementContext& context)
+template<class Encoder>
+void ElementContext::encode(Encoder& encoder) const
 {
-    encoder << context.boundingRect;
-    encoder << context.webPageIdentifier;
-    encoder << context.documentIdentifier;
-    encoder << context.elementIdentifier;
+    encoder << boundingRect;
+    encoder << webPageIdentifier;
+    encoder << documentIdentifier;
+    encoder << elementIdentifier;
 }
 
-Optional<WebKit::ElementContext> ArgumentCoder<WebKit::ElementContext>::decode(Decoder& decoder)
+template<class Decoder>
+Optional<ElementContext> ElementContext::decode(Decoder& decoder)
 {
-    WebKit::ElementContext context;
+    ElementContext context;
+
     if (!decoder.decode(context.boundingRect))
         return WTF::nullopt;
-    if (!decoder.decode(context.webPageIdentifier))
+
+    auto pageIdentifier = PageIdentifier::decode(decoder);
+    if (!pageIdentifier)
         return WTF::nullopt;
-    auto documentIdentifier = WebCore::DocumentIdentifier::decode(decoder);
+    context.webPageIdentifier = *pageIdentifier;
+
+    auto documentIdentifier = DocumentIdentifier::decode(decoder);
     if (!documentIdentifier)
         return WTF::nullopt;
     context.documentIdentifier = *documentIdentifier;
-    auto elementIdentifier = WebCore::ElementIdentifier::decode(decoder);
+
+    auto elementIdentifier = ElementIdentifier::decode(decoder);
     if (!elementIdentifier)
         return WTF::nullopt;
     context.elementIdentifier = *elementIdentifier;
index 3549395..8e19626 100644 (file)
@@ -1,3 +1,44 @@
+2019-10-21  Dean Jackson  <dino@apple.com>
+
+        Move ElementContext from WebKit to WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=203210
+        <rdar://problem/56475682>
+
+        Reviewed by Simon Fraser.
+
+        * Scripts/webkit/messages.py:
+        * Shared/DocumentEditingContext.h:
+        * Shared/DocumentEditingContext.mm:
+        (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
+        * Shared/ElementContext.cpp: Removed.
+        * Shared/ElementContext.h: Removed.
+        * Shared/WebPreferencesDefaultValues.cpp:
+        (WebKit::defaultCSSOMViewScrollingAPIEnabled):
+        * Shared/WebsitePoliciesData.cpp:
+        (WebKit::WebsitePoliciesData::decode):
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Sources.txt:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
+        * UIProcess/API/Cocoa/_WKTextInputContext.mm:
+        (-[_WKTextInputContext _initWithTextInputContext:]):
+        (-[_WKTextInputContext _textInputContext]):
+        * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::textInputContextsInRect):
+        (WebKit::WebPageProxy::focusTextInputContext):
+        * UIProcess/WebPageProxy.h:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::textInputContextsInRect):
+        (WebKit::WebPage::focusTextInputContext):
+        (WebKit::WebPage::elementForContext const):
+        (WebKit::WebPage::contextForElement const):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::startInteractionWithElementContextOrPosition):
+
 2019-10-21  Alex Christensen  <achristensen@webkit.org>
 
         ServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
index df3bb4b..356134b 100644 (file)
@@ -486,7 +486,7 @@ def headers_for_type(type):
         'WebKit::WebMouseEvent': ['"WebEvent.h"'],
         'WebKit::WebTouchEvent': ['"WebEvent.h"'],
         'WebKit::WebWheelEvent': ['"WebEvent.h"'],
-        'struct WebKit::ElementContext': ['"ElementContext.h"'],
+        'struct WebCore::ElementContext': ['<WebCore/ElementContext.h>'],
         'struct WebKit::WebUserScriptData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebUserStyleSheetData': ['"WebUserContentControllerDataTypes.h"'],
         'struct WebKit::WebScriptMessageHandlerData': ['"WebUserContentControllerDataTypes.h"'],
index 861c891..c193cf3 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "ArgumentCoders.h"
 #include "AttributedString.h"
-#include "ElementContext.h"
+#include <WebCore/ElementContext.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/TextGranularity.h>
 #include <wtf/OptionSet.h>
@@ -56,7 +56,7 @@ struct DocumentEditingContextRequest {
 
     WebCore::FloatRect rect;
 
-    Optional<WebKit::ElementContext> textInputContext;
+    Optional<WebCore::ElementContext> textInputContext;
 };
 
 struct DocumentEditingContext {
index 482e8c7..f9f6d35 100644 (file)
@@ -28,9 +28,9 @@
 
 #if PLATFORM(IOS_FAMILY)
 
-#include "ElementContext.h"
 #include "UIKitSPI.h"
 #include "WebCoreArgumentCoders.h"
+#include <WebCore/ElementContext.h>
 
 namespace WebKit {
 
@@ -198,7 +198,7 @@ Optional<WebKit::DocumentEditingContextRequest> ArgumentCoder<WebKit::DocumentEd
     if (!decoder.decode(request.rect))
         return WTF::nullopt;
 
-    Optional<Optional<WebKit::ElementContext>> optionalTextInputContext;
+    Optional<Optional<WebCore::ElementContext>> optionalTextInputContext;
     decoder >> optionalTextInputContext;
     if (!optionalTextInputContext)
         return WTF::nullopt;
diff --git a/Source/WebKit/Shared/ElementContext.h b/Source/WebKit/Shared/ElementContext.h
deleted file mode 100644 (file)
index 215cc42..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "ArgumentCoders.h"
-#include <WebCore/DocumentIdentifier.h>
-#include <WebCore/ElementIdentifier.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/PageIdentifier.h>
-
-namespace WebKit {
-
-struct ElementContext {
-    WebCore::FloatRect boundingRect;
-
-    WebCore::PageIdentifier webPageIdentifier;
-    WebCore::DocumentIdentifier documentIdentifier;
-    WebCore::ElementIdentifier elementIdentifier;
-
-    ~ElementContext();
-};
-
-inline bool operator==(const ElementContext& a, const ElementContext& b)
-{
-    return a.boundingRect == b.boundingRect
-        && a.webPageIdentifier == b.webPageIdentifier
-        && a.documentIdentifier == b.documentIdentifier
-        && a.elementIdentifier == b.elementIdentifier;
-}
-
-}
-
-namespace IPC {
-template<> struct ArgumentCoder<WebKit::ElementContext> {
-    static void encode(Encoder&, const WebKit::ElementContext&);
-    static Optional<WebKit::ElementContext> decode(Decoder&);
-};
-}
index 9429edf..aa37855 100644 (file)
@@ -49,7 +49,7 @@ bool defaultPassiveTouchListenersAsDefaultOnDocument()
 bool defaultCSSOMViewScrollingAPIEnabled()
 {
 #if PLATFORM(IOS_FAMILY)
-    if (WebCore::IOSApplication::isIMDb() && applicationSDKVersion() < DYLD_IOS_VERSION_13_0)
+    if (WebCore::IOSApplication::isIMDb() && WebCore::applicationSDKVersion() < DYLD_IOS_VERSION_13_0)
         return false;
 #endif
     return true;
index a21cc95..b85783d 100644 (file)
@@ -69,7 +69,7 @@ Optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder)
         return WTF::nullopt;
 
 #if ENABLE(DEVICE_ORIENTATION)
-    Optional<DeviceOrientationOrMotionPermissionState> deviceOrientationAndMotionAccessState;
+    Optional<WebCore::DeviceOrientationOrMotionPermissionState> deviceOrientationAndMotionAccessState;
     decoder >> deviceOrientationAndMotionAccessState;
     if (!deviceOrientationAndMotionAccessState)
         return WTF::nullopt;
index a287138..5307d25 100644 (file)
@@ -28,9 +28,9 @@
 #if PLATFORM(IOS_FAMILY)
 
 #include "ArgumentCoders.h"
-#include "ElementContext.h"
 #include "InteractionInformationRequest.h"
 #include "ShareableBitmap.h"
+#include <WebCore/ElementContext.h>
 #include <WebCore/IntPoint.h>
 #include <WebCore/ScrollTypes.h>
 #include <WebCore/SelectionRect.h>
@@ -90,7 +90,7 @@ struct InteractionInformationAtPosition {
     RetainPtr<NSArray> dataDetectorResults;
 #endif
 
-    Optional<ElementContext> elementContext;
+    Optional<WebCore::ElementContext> elementContext;
 
     // Copy compatible optional bits forward (for example, if we have a InteractionInformationAtPosition
     // with snapshots in it, and perform another request for the same point without requesting the snapshots,
index 31ee118..1675275 100644 (file)
@@ -121,7 +121,6 @@ Shared/CacheModel.cpp
 Shared/ContextMenuContextData.cpp
 Shared/EditingRange.cpp
 Shared/EditorState.cpp
-Shared/ElementContext.cpp
 Shared/FontInfo.cpp
 Shared/FrameInfoData.cpp
 Shared/LayerTreeContext.cpp
index 7e04826..e6f9d69 100644 (file)
@@ -33,7 +33,6 @@
 #import "CompletionHandlerCallChecker.h"
 #import "DiagnosticLoggingClient.h"
 #import "DynamicViewportSizeUpdate.h"
-#import "ElementContext.h"
 #import "FindClient.h"
 #import "FullscreenClient.h"
 #import "GlobalFindInPageState.h"
 #import "_WKTextInputContextInternal.h"
 #import "_WKVisitedLinkStoreInternal.h"
 #import "_WKWebsitePoliciesInternal.h"
+#import <WebCore/ElementContext.h>
 #import <WebCore/GraphicsContextCG.h>
 #import <WebCore/IOSurface.h>
 #import <WebCore/JSDOMBinding.h>
@@ -5059,12 +5059,12 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKCONTENTVIEW)
 
     CGRect rectInRootViewCoordinates = [self _convertRectToRootViewCoordinates:rectInWebViewCoordinates];
     auto weakSelf = WeakObjCPtr<WKWebView>(self);
-    _page->textInputContextsInRect(rectInRootViewCoordinates, [weakSelf, capturedCompletionHandler = makeBlockPtr(completionHandler)] (const Vector<WebKit::ElementContext>& contexts) {
+    _page->textInputContextsInRect(rectInRootViewCoordinates, [weakSelf, capturedCompletionHandler = makeBlockPtr(completionHandler)] (const Vector<WebCore::ElementContext>& contexts) {
         RetainPtr<NSMutableArray> elements = adoptNS([[NSMutableArray alloc] initWithCapacity:contexts.size()]);
 
         auto strongSelf = weakSelf.get();
         for (const auto& context : contexts) {
-            WebKit::ElementContext contextWithWebViewBoundingRect = context;
+            WebCore::ElementContext contextWithWebViewBoundingRect = context;
             contextWithWebViewBoundingRect.boundingRect = [strongSelf _convertRectFromRootViewCoordinates:context.boundingRect];
             [elements addObject:adoptNS([[_WKTextInputContext alloc] _initWithTextInputContext:contextWithWebViewBoundingRect]).get()];
         }
index f61d727..7eb65d0 100644 (file)
 #import "config.h"
 #import "_WKTextInputContext.h"
 
-#import "ElementContext.h"
 #import "_WKTextInputContextInternal.h"
+#import <WebCore/ElementContext.h>
 
 @implementation _WKTextInputContext {
-    WebKit::ElementContext _textInputContext;
+    WebCore::ElementContext _textInputContext;
 }
 
 - (instancetype)init
@@ -38,7 +38,7 @@
     return nil;
 }
 
-- (instancetype)_initWithTextInputContext:(const WebKit::ElementContext&)context
+- (instancetype)_initWithTextInputContext:(const WebCore::ElementContext&)context
 {
     self = [super init];
     if (!self)
@@ -54,7 +54,7 @@
     return _textInputContext.boundingRect;
 }
 
-- (const WebKit::ElementContext&)_textInputContext
+- (const WebCore::ElementContext&)_textInputContext
 {
     return _textInputContext;
 }
index 4ac7002..8f67fc2 100644 (file)
 
 #import "_WKTextInputContext.h"
 
-namespace WebKit {
+namespace WebCore {
 struct ElementContext;
 }
 
 @interface _WKTextInputContext ()
 
-- (instancetype)_initWithTextInputContext:(const WebKit::ElementContext&)context;
+- (instancetype)_initWithTextInputContext:(const WebCore::ElementContext&)context;
 
-- (const WebKit::ElementContext&)_textInputContext;
+- (const WebCore::ElementContext&)_textInputContext;
 
 @end
index cebd11f..eb90c5a 100644 (file)
@@ -59,7 +59,6 @@
 #include "DownloadProxy.h"
 #include "DrawingAreaMessages.h"
 #include "DrawingAreaProxy.h"
-#include "ElementContext.h"
 #include "EventDispatcherMessages.h"
 #include "FormDataReference.h"
 #include "FrameInfoData.h"
 #include <WebCore/DiagnosticLoggingKeys.h>
 #include <WebCore/DragController.h>
 #include <WebCore/DragData.h>
+#include <WebCore/ElementContext.h>
 #include <WebCore/EventNames.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FocusDirection.h>
@@ -9377,7 +9377,7 @@ void WebPageProxy::webViewDidMoveToWindow()
     }
 }
 
-void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHandler<void(const Vector<WebKit::ElementContext>&)>&& completionHandler)
+void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
 {
     if (!hasRunningProcess()) {
         completionHandler({ });
@@ -9387,7 +9387,7 @@ void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHa
     m_process->connection()->sendWithAsyncReply(Messages::WebPage::TextInputContextsInRect(rect), WTFMove(completionHandler), m_webPageID);
 }
 
-void WebPageProxy::focusTextInputContext(const ElementContext& context, CompletionHandler<void(bool)>&& completionHandler)
+void WebPageProxy::focusTextInputContext(const WebCore::ElementContext& context, CompletionHandler<void(bool)>&& completionHandler)
 {
     if (!hasRunningProcess()) {
         completionHandler(false);
index c6a4fdc..84e755e 100644 (file)
@@ -242,6 +242,10 @@ typedef struct OpaqueJSContext* JSGlobalContextRef;
 typedef HWND PlatformViewWidget;
 #endif
 
+namespace WebCore {
+struct ElementContext;
+}
+
 namespace WebKit {
 class DrawingAreaProxy;
 class EditableImageController;
@@ -290,7 +294,6 @@ struct DocumentEditingContext;
 struct DocumentEditingContextRequest;
 struct EditingRange;
 struct EditorState;
-struct ElementContext;
 struct FontInfo;
 struct FrameInfoData;
 struct InsertTextOptions;
@@ -648,8 +651,8 @@ public:
     void requestFontAttributesAtSelectionStart(Function<void(const WebCore::FontAttributes&, CallbackBase::Error)>&&);
     void fontAttributesCallback(const WebCore::FontAttributes&, CallbackID);
 
-    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<ElementContext>&)>&&);
-    void focusTextInputContext(const ElementContext&, CompletionHandler<void(bool)>&&);
+    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
+    void focusTextInputContext(const WebCore::ElementContext&, CompletionHandler<void(bool)>&&);
 
 #if PLATFORM(IOS_FAMILY)
     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
index cc2e10d..d557c17 100644 (file)
                2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDF731318E95060004F5A66 /* RemoteLayerBackingStoreCollection.h */; };
                2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */; };
                2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */; };
-               2DE9B1352231B5B2005287B7 /* ElementContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE9B1332231B5B2005287B7 /* ElementContext.h */; };
                2DE9B13A2231F61C005287B7 /* _WKTextInputContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE9B1382231F61C005287B7 /* _WKTextInputContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DE9B13C2231F77C005287B7 /* _WKTextInputContextInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE9B13B2231F77C005287B7 /* _WKTextInputContextInternal.h */; };
                2DEAC5CF1AC368BB00A195D8 /* _WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEAC5CE1AC368BB00A195D8 /* _WKFindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DDF731418E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStoreCollection.mm; sourceTree = "<group>"; };
                2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SmartMagnificationControllerMessageReceiver.cpp; path = DerivedSources/WebKit2/SmartMagnificationControllerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
                2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationControllerMessages.h; path = DerivedSources/WebKit2/SmartMagnificationControllerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
-               2DE9B1332231B5B2005287B7 /* ElementContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementContext.h; sourceTree = "<group>"; };
-               2DE9B1342231B5B2005287B7 /* ElementContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ElementContext.cpp; sourceTree = "<group>"; };
                2DE9B1372231F61C005287B7 /* _WKTextInputContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKTextInputContext.mm; sourceTree = "<group>"; };
                2DE9B1382231F61C005287B7 /* _WKTextInputContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKTextInputContext.h; sourceTree = "<group>"; };
                2DE9B13B2231F77C005287B7 /* _WKTextInputContextInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKTextInputContextInternal.h; sourceTree = "<group>"; };
                                E105FE5318D7B9DE008F57A8 /* EditingRange.h */,
                                8CFECE931490F140002AAA32 /* EditorState.cpp */,
                                1AA41AB412C02EC4002BE67B /* EditorState.h */,
-                               2DE9B1342231B5B2005287B7 /* ElementContext.cpp */,
-                               2DE9B1332231B5B2005287B7 /* ElementContext.h */,
                                C59C4A5618B81174007BDCB6 /* FocusedElementInformation.cpp */,
                                C59C4A5718B81174007BDCB6 /* FocusedElementInformation.h */,
                                BCE81D8A1319F7EF00241910 /* FontInfo.cpp */,
                                2DAADA8E2298C21000E36B0C /* DeviceManagementSPI.h */,
                                57B826402304EB3E00B72EB0 /* NearFieldSPI.h */,
                                3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */,
+                               37B47E2C1D64DB76005F4EFF /* objcSPI.h */,
                                0E97D74C200E8FF300BF6643 /* SafeBrowsingSPI.h */,
                                7AA746D42359308400095050 /* SecItemSPI.h */,
-                               37B47E2C1D64DB76005F4EFF /* objcSPI.h */,
                        );
                        path = Cocoa;
                        sourceTree = "<group>";
                                1AFDE6621954E9B100C48FFA /* APISessionState.h in Headers */,
                                1A4D664818A2D91A00D82E21 /* APIUIClient.h in Headers */,
                                BCDB86C11200FB97007254BE /* APIURL.h in Headers */,
-                               7AA746D523593D8100095050 /* SecItemSPI.h in Headers */,
                                BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */,
                                BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */,
                                F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */,
                                2D5875BF219B53150070B9AA /* EditableImageController.h in Headers */,
                                E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */,
                                1AA41AB512C02EC4002BE67B /* EditorState.h in Headers */,
-                               2DE9B1352231B5B2005287B7 /* ElementContext.h in Headers */,
                                BC032DA810F437D10058C15A /* Encoder.h in Headers */,
                                51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */,
                                1AA575FB1496B52600A4EE06 /* EventDispatcher.h in Headers */,
                                511F8A7B138B460900A95F44 /* SecItemShimLibrary.h in Headers */,
                                E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
                                E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
+                               7AA746D523593D8100095050 /* SecItemSPI.h in Headers */,
                                570AB8F320AE3BD700B8BE87 /* SecKeyProxyStore.h in Headers */,
                                514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
                                1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
index df961e4..901ba06 100644 (file)
@@ -6758,9 +6758,9 @@ static bool isEditableTextInputElement(Element& element)
     return element.isRootEditableElement();
 }
 
-void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
+void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&& completionHandler)
 {
-    Vector<WebKit::ElementContext> textInputContexts;
+    Vector<WebCore::ElementContext> textInputContexts;
 
     for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         Document* document = frame->document();
@@ -6786,7 +6786,7 @@ void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionH
             if (!searchRect.intersects(elementRect))
                 continue;
 
-            WebKit::ElementContext context;
+            WebCore::ElementContext context;
             context.webPageIdentifier = m_identifier;
             context.documentIdentifier = document->identifier();
             context.elementIdentifier = document->identifierForElement(element);
@@ -6799,7 +6799,7 @@ void WebPage::textInputContextsInRect(WebCore::FloatRect searchRect, CompletionH
     completionHandler(textInputContexts);
 }
 
-void WebPage::focusTextInputContext(const ElementContext& textInputContext, CompletionHandler<void(bool)>&& completionHandler)
+void WebPage::focusTextInputContext(const WebCore::ElementContext& textInputContext, CompletionHandler<void(bool)>&& completionHandler)
 {
     RefPtr<Element> element = elementForContext(textInputContext);
 
@@ -6809,7 +6809,7 @@ void WebPage::focusTextInputContext(const ElementContext& textInputContext, Comp
     completionHandler(element);
 }
 
-Element* WebPage::elementForContext(const ElementContext& elementContext) const
+Element* WebPage::elementForContext(const WebCore::ElementContext& elementContext) const
 {
     if (elementContext.webPageIdentifier != m_identifier)
         return nullptr;
@@ -6824,7 +6824,7 @@ Element* WebPage::elementForContext(const ElementContext& elementContext) const
     return document->searchForElementByIdentifier(elementContext.elementIdentifier);
 }
 
-Optional<ElementContext> WebPage::contextForElement(WebCore::Element& element) const
+Optional<WebCore::ElementContext> WebPage::contextForElement(WebCore::Element& element) const
 {
     auto& document = element.document();
     if (!m_page || document.page() != m_page.get())
@@ -6834,7 +6834,7 @@ Optional<ElementContext> WebPage::contextForElement(WebCore::Element& element) c
     if (!frame)
         return WTF::nullopt;
 
-    return ElementContext { elementRectInRootViewCoordinates(element, *frame), m_identifier, document.identifier(), document.identifierForElement(element) };
+    return WebCore::ElementContext { elementRectInRootViewCoordinates(element, *frame), m_identifier, document.identifier(), document.identifierForElement(element) };
 }
 
 PAL::SessionID WebPage::sessionID() const
index bae86ab..a6224f0 100644 (file)
@@ -191,6 +191,7 @@ enum class WritingDirection : uint8_t;
 struct BackForwardItemIdentifier;
 struct CompositionUnderline;
 struct DictationAlternative;
+struct ElementContext;
 struct GlobalFrameIdentifier;
 struct GlobalWindowIdentifier;
 struct Highlight;
@@ -262,7 +263,6 @@ struct AttributedString;
 struct BackForwardListItemState;
 struct DataDetectionResult;
 struct EditorState;
-struct ElementContext;
 struct FontInfo;
 struct InsertTextOptions;
 struct InteractionInformationAtPosition;
@@ -614,8 +614,8 @@ public:
     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
     void selectAll();
 
-    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebKit::ElementContext>&)>&&);
-    void focusTextInputContext(const ElementContext&, CompletionHandler<void(bool)>&&);
+    void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
+    void focusTextInputContext(const WebCore::ElementContext&, CompletionHandler<void(bool)>&&);
 
 #if PLATFORM(IOS_FAMILY)
     WebCore::FloatSize screenSize() const;
@@ -671,7 +671,7 @@ public:
     void requestAutocorrectionContext();
     void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&);
     void requestPositionInformation(const InteractionInformationRequest&);
-    void startInteractionWithElementContextOrPosition(Optional<ElementContext>&&, WebCore::IntPoint&&);
+    void startInteractionWithElementContextOrPosition(Optional<WebCore::ElementContext>&&, WebCore::IntPoint&&);
     void stopInteraction();
     void performActionOnElement(uint32_t action);
     void focusNextFocusedElement(bool isForward, CallbackID);
@@ -1191,8 +1191,8 @@ public:
 
     void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel);
 
-    WebCore::Element* elementForContext(const ElementContext&) const;
-    Optional<ElementContext> contextForElement(WebCore::Element&) const;
+    WebCore::Element* elementForContext(const WebCore::ElementContext&) const;
+    Optional<WebCore::ElementContext> contextForElement(WebCore::Element&) const;
 
 #if ENABLE(APPLE_PAY)
     WebPaymentCoordinator* paymentCoordinator();
index 672af6f..380eb0c 100644 (file)
@@ -86,7 +86,7 @@ messages -> WebPage LegacyReceiver {
     RequestEvasionRectsAboveSelection() -> (Vector<WebCore::FloatRect> rects) Async
     GetPositionInformation(struct WebKit::InteractionInformationRequest request) -> (struct WebKit::InteractionInformationAtPosition information) Synchronous
     RequestPositionInformation(struct WebKit::InteractionInformationRequest request)
-    StartInteractionWithElementContextOrPosition(Optional<WebKit::ElementContext> elementContext, WebCore::IntPoint point)
+    StartInteractionWithElementContextOrPosition(Optional<WebCore::ElementContext> elementContext, WebCore::IntPoint point)
     StopInteraction()
     PerformActionOnElement(uint32_t action)
     FocusNextFocusedElement(bool isForward, WebKit::CallbackID callbackID)
@@ -567,8 +567,8 @@ GenerateSyntheticEditingCommand(enum:uint8_t WebKit::SyntheticEditingCommandType
     VoicesDidChange()
 #endif
 
-    TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebKit::ElementContext> contexts) Async
-    FocusTextInputContext(struct WebKit::ElementContext context) -> (bool success) Async
+    TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebCore::ElementContext> contexts) Async
+    FocusTextInputContext(struct WebCore::ElementContext context) -> (bool success) Async
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     WasLoadedWithDataTransferFromPrevalentResource()
index 919599c..6626c24 100644 (file)
@@ -2815,7 +2815,7 @@ void WebPage::requestPositionInformation(const InteractionInformationRequest& re
     send(Messages::WebPageProxy::DidReceivePositionInformation(positionInformation(request)));
 }
 
-void WebPage::startInteractionWithElementContextOrPosition(Optional<ElementContext>&& elementContext, WebCore::IntPoint&& point)
+void WebPage::startInteractionWithElementContextOrPosition(Optional<WebCore::ElementContext>&& elementContext, WebCore::IntPoint&& point)
 {
     if (elementContext) {
         m_interactionNode = elementForContext(*elementContext);