Title: [257851] trunk/Source/WebKit
Revision
257851
Author
[email protected]
Date
2020-03-04 10:04:05 -0800 (Wed, 04 Mar 2020)

Log Message

Move WKTextSelectionRect into its own file
https://bugs.webkit.org/show_bug.cgi?id=208561

Reviewed by Alex Christensen.

WKTextSelectionRect is currently defined in WKContentViewInteraction.mm. Separate it
out into its own file to improve project organization and de-clutter WKContentViewInteraction.mm.

* SourcesCocoa.txt:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKTextSelectionRect initWithWebRect:]): Deleted.
(-[WKTextSelectionRect dealloc]): Deleted.
(+[WKTextSelectionRect textSelectionRectsWithWebRects:]): Deleted.
(-[WKTextSelectionRect rect]): Deleted.
(-[WKTextSelectionRect writingDirection]): Deleted.
(-[WKTextSelectionRect range]): Deleted.
(-[WKTextSelectionRect containsStart]): Deleted.
(-[WKTextSelectionRect containsEnd]): Deleted.
(-[WKTextSelectionRect isVertical]): Deleted.
* UIProcess/ios/WKTextSelectionRect.h: Added.
* UIProcess/ios/WKTextSelectionRect.mm: Added.
(-[WKTextSelectionRect initWithWebRect:]):
(-[WKTextSelectionRect dealloc]):
(+[WKTextSelectionRect textSelectionRectsWithWebRects:]):
(-[WKTextSelectionRect rect]):
(-[WKTextSelectionRect writingDirection]):
(-[WKTextSelectionRect range]):
(-[WKTextSelectionRect containsStart]):
(-[WKTextSelectionRect containsEnd]):
(-[WKTextSelectionRect isVertical]):
* WebKit.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257850 => 257851)


--- trunk/Source/WebKit/ChangeLog	2020-03-04 17:55:48 UTC (rev 257850)
+++ trunk/Source/WebKit/ChangeLog	2020-03-04 18:04:05 UTC (rev 257851)
@@ -1,3 +1,37 @@
+2020-03-04  Daniel Bates  <[email protected]>
+
+        Move WKTextSelectionRect into its own file
+        https://bugs.webkit.org/show_bug.cgi?id=208561
+
+        Reviewed by Alex Christensen.
+
+        WKTextSelectionRect is currently defined in WKContentViewInteraction.mm. Separate it
+        out into its own file to improve project organization and de-clutter WKContentViewInteraction.mm.
+
+        * SourcesCocoa.txt:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKTextSelectionRect initWithWebRect:]): Deleted.
+        (-[WKTextSelectionRect dealloc]): Deleted.
+        (+[WKTextSelectionRect textSelectionRectsWithWebRects:]): Deleted.
+        (-[WKTextSelectionRect rect]): Deleted.
+        (-[WKTextSelectionRect writingDirection]): Deleted.
+        (-[WKTextSelectionRect range]): Deleted.
+        (-[WKTextSelectionRect containsStart]): Deleted.
+        (-[WKTextSelectionRect containsEnd]): Deleted.
+        (-[WKTextSelectionRect isVertical]): Deleted.
+        * UIProcess/ios/WKTextSelectionRect.h: Added.
+        * UIProcess/ios/WKTextSelectionRect.mm: Added.
+        (-[WKTextSelectionRect initWithWebRect:]):
+        (-[WKTextSelectionRect dealloc]):
+        (+[WKTextSelectionRect textSelectionRectsWithWebRects:]):
+        (-[WKTextSelectionRect rect]):
+        (-[WKTextSelectionRect writingDirection]):
+        (-[WKTextSelectionRect range]):
+        (-[WKTextSelectionRect containsStart]):
+        (-[WKTextSelectionRect containsEnd]):
+        (-[WKTextSelectionRect isVertical]):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2020-03-04  Youenn Fablet  <[email protected]>
 
         WebChromeClient::createImageBuffer should not create a connection to GPU Process if page does not want remote rendering

Modified: trunk/Source/WebKit/SourcesCocoa.txt (257850 => 257851)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-03-04 17:55:48 UTC (rev 257850)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-03-04 18:04:05 UTC (rev 257851)
@@ -471,6 +471,7 @@
 UIProcess/ios/WKSyntheticTapGestureRecognizer.mm
 UIProcess/ios/WKSystemPreviewView.mm
 UIProcess/ios/WKTouchActionGestureRecognizer.mm
+UIProcess/ios/WKTextSelectionRect.mm
 UIProcess/ios/WKWebEvent.mm
 
 UIProcess/Launcher/mac/ProcessLauncherMac.mm

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (257850 => 257851)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-03-04 17:55:48 UTC (rev 257850)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-03-04 18:04:05 UTC (rev 257851)
@@ -65,6 +65,7 @@
 #import "WKSelectMenuListViewController.h"
 #import "WKSyntheticFlagsChangedWebEvent.h"
 #import "WKTextInputListViewController.h"
+#import "WKTextSelectionRect.h"
 #import "WKTimePickerViewController.h"
 #import "WKUIDelegatePrivate.h"
 #import "WKWebViewConfiguration.h"
@@ -290,14 +291,7 @@
 
 @end
 
-@interface WKTextSelectionRect : UITextSelectionRect
 
-@property (nonatomic, retain) WebSelectionRect *webRect;
-
-+ (NSArray *)textSelectionRectsWithWebRects:(NSArray *)webRects;
-
-@end
-
 @interface WKAutocorrectionRects : UIWKAutocorrectionRects
 + (WKAutocorrectionRects *)autocorrectionRectsWithFirstCGRect:(CGRect)firstRect lastCGRect:(CGRect)lastRect;
 @end
@@ -9304,7 +9298,8 @@
 
 #endif // HAVE(LINK_PREVIEW)
 
-// UITextRange, UITextPosition and UITextSelectionRect implementations for WK2
+// UITextRange and UITextPosition implementations for WK2
+// FIXME: Move these out into separate files.
 
 @implementation WKTextRange (UITextInputAdditions)
 
@@ -9420,71 +9415,6 @@
 
 @end
 
-@implementation WKTextSelectionRect
-
-- (id)initWithWebRect:(WebSelectionRect *)wRect
-{
-    self = [super init];
-    if (self)
-        self.webRect = wRect;
-
-    return self;
-}
-
-- (void)dealloc
-{
-    self.webRect = nil;
-    [super dealloc];
-}
-
-// FIXME: we are using this implementation for now
-// that uses WebSelectionRect, but we want to provide our own
-// based on WebCore::SelectionRect.
-
-+ (NSArray *)textSelectionRectsWithWebRects:(NSArray *)webRects
-{
-    NSMutableArray *array = [NSMutableArray arrayWithCapacity:webRects.count];
-    for (WebSelectionRect *webRect in webRects) {
-        RetainPtr<WKTextSelectionRect> rect = adoptNS([[WKTextSelectionRect alloc] initWithWebRect:webRect]);
-        [array addObject:rect.get()];
-    }
-    return array;
-}
-
-- (CGRect)rect
-{
-    return _webRect.rect;
-}
-
-ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-- (UITextWritingDirection)writingDirection
-{
-    return (UITextWritingDirection)_webRect.writingDirection;
-}
-ALLOW_DEPRECATED_DECLARATIONS_END
-
-- (UITextRange *)range
-{
-    return nil;
-}
-
-- (BOOL)containsStart
-{
-    return _webRect.containsStart;
-}
-
-- (BOOL)containsEnd
-{
-    return _webRect.containsEnd;
-}
-
-- (BOOL)isVertical
-{
-    return !_webRect.isHorizontal;
-}
-
-@end
-
 @implementation WKAutocorrectionRects
 
 + (WKAutocorrectionRects *)autocorrectionRectsWithFirstCGRect:(CGRect)firstRect lastCGRect:(CGRect)lastRect

Added: trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.h (0 => 257851)


--- trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.h	2020-03-04 18:04:05 UTC (rev 257851)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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
+
+#if PLATFORM(IOS_FAMILY)
+
+#import <UIKit/UIKit.h>
+
+@class WebSelectionRect;
+
+@interface WKTextSelectionRect : UITextSelectionRect
+
+@property (nonatomic, retain) WebSelectionRect *webRect;
+
++ (NSArray *)textSelectionRectsWithWebRects:(NSArray *)webRects;
+
+@end
+
+#endif // PLATFORM(IOS_FAMILY)

Added: trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.mm (0 => 257851)


--- trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/WKTextSelectionRect.mm	2020-03-04 18:04:05 UTC (rev 257851)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#import "config.h"
+#import "WKTextSelectionRect.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+// FIXME: Layering violation; WebKit2 should not include WebKit headers.
+#import <WebKit/WebSelectionRect.h>
+
+@implementation WKTextSelectionRect
+
+- (id)initWithWebRect:(WebSelectionRect *)wRect
+{
+    self = [super init];
+    if (self)
+        self.webRect = wRect;
+
+    return self;
+}
+
+- (void)dealloc
+{
+    self.webRect = nil;
+    [super dealloc];
+}
+
+// FIXME: We are using this implementation for now that uses WebSelectionRect, but
+// we want to provide our own based on WebCore::SelectionRect.
++ (NSArray *)textSelectionRectsWithWebRects:(NSArray *)webRects
+{
+    NSMutableArray *array = [NSMutableArray arrayWithCapacity:webRects.count];
+    for (WebSelectionRect *webRect in webRects) {
+        RetainPtr<WKTextSelectionRect> rect = adoptNS([[WKTextSelectionRect alloc] initWithWebRect:webRect]);
+        [array addObject:rect.get()];
+    }
+    return array;
+}
+
+- (CGRect)rect
+{
+    return _webRect.rect;
+}
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+- (UITextWritingDirection)writingDirection
+{
+    return (UITextWritingDirection)_webRect.writingDirection;
+}
+ALLOW_DEPRECATED_DECLARATIONS_END
+
+- (UITextRange *)range
+{
+    return nil;
+}
+
+- (BOOL)containsStart
+{
+    return _webRect.containsStart;
+}
+
+- (BOOL)containsEnd
+{
+    return _webRect.containsEnd;
+}
+
+- (BOOL)isVertical
+{
+    return !_webRect.isHorizontal;
+}
+
+@end
+
+#endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (257850 => 257851)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-03-04 17:55:48 UTC (rev 257850)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-03-04 18:04:05 UTC (rev 257851)
@@ -1734,6 +1734,7 @@
 		CE1A0BD21A48E6C60054EF74 /* AssertionServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */; };
 		CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */; };
 		CE1A0BD71A48E6C60054EF74 /* TextInputSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */; };
+		CE45945C240F88550078019F /* WKTextSelectionRect.h in Headers */ = {isa = PBXBuildFile; fileRef = CE45945A240F85B90078019F /* WKTextSelectionRect.h */; };
 		CE550E152283752200D28791 /* InsertTextOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = CE550E12228373C800D28791 /* InsertTextOptions.h */; };
 		CE5B4C8821B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5B4C8621B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h */; };
 		CE70EE5D22442BD000E0AF0F /* WKFormPeripheralBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CE70EE5C22442BD000E0AF0F /* WKFormPeripheralBase.h */; };
@@ -5050,6 +5051,8 @@
 		CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssertionServicesSPI.h; sourceTree = "<group>"; };
 		CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCCSPI.h; sourceTree = "<group>"; };
 		CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputSPI.h; sourceTree = "<group>"; };
+		CE45945A240F85B90078019F /* WKTextSelectionRect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKTextSelectionRect.h; path = ios/WKTextSelectionRect.h; sourceTree = "<group>"; };
+		CE45945B240F85B90078019F /* WKTextSelectionRect.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTextSelectionRect.mm; path = ios/WKTextSelectionRect.mm; sourceTree = "<group>"; };
 		CE550E12228373C800D28791 /* InsertTextOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InsertTextOptions.h; sourceTree = "<group>"; };
 		CE550E132283744400D28791 /* InsertTextOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InsertTextOptions.cpp; sourceTree = "<group>"; };
 		CE5B4C8621B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKSyntheticFlagsChangedWebEvent.h; path = ios/WKSyntheticFlagsChangedWebEvent.h; sourceTree = "<group>"; };
@@ -6795,6 +6798,8 @@
 				26F10BE719187E2E001D0E68 /* WKSyntheticTapGestureRecognizer.mm */,
 				316B8B622054B55800BD4A62 /* WKSystemPreviewView.h */,
 				316B8B612054B55800BD4A62 /* WKSystemPreviewView.mm */,
+				CE45945A240F85B90078019F /* WKTextSelectionRect.h */,
+				CE45945B240F85B90078019F /* WKTextSelectionRect.mm */,
 				71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */,
 				71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */,
 				2D1E8221216FFF5000A15265 /* WKWebEvent.h */,
@@ -11347,6 +11352,7 @@
 				2DD67A351BD861060053B251 /* WKTextFinderClient.h in Headers */,
 				F4D5F51D206087A10038BBA8 /* WKTextInputListViewController.h in Headers */,
 				0FCB4E6818BBE3D9000FCFC9 /* WKTextInputWindowController.h in Headers */,
+				CE45945C240F88550078019F /* WKTextSelectionRect.h in Headers */,
 				2EB6FC01203021960017E619 /* WKTimePickerViewController.h in Headers */,
 				71A676A622C62325007D6295 /* WKTouchActionGestureRecognizer.h in Headers */,
 				BC407608124FF0270068F20A /* WKType.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to