Replace uses of +self with +class
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 May 2020 22:22:02 +0000 (22:22 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 May 2020 22:22:02 +0000 (22:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212041

Reviewed by Darin Adler.

Source/WebCore:

No change in behavior.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayer::isWebLayer):

Source/WebKit:

* Shared/API/Cocoa/_WKFrameHandle.mm:
(-[_WKFrameHandle isEqual:]):
(-[_WKFrameHandle initWithCoder:]):
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
(WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(+[WKTransformView layerClass]):
(+[WKSimpleBackdropView layerClass]): Deleted.
(+[WKShapeView layerClass]): Deleted.
(-[WKRemoteView initWithFrame:contextID:]): Deleted.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView selectFormAccessoryPickerRow:]):
(-[WKContentView selectFormPopoverTitle]):

Tools:

* DumpRenderTree/mac/EventSendingController.mm:
(-[EventSendingController monitorWheelEventsWithOptions:]):
* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(TestWebKitAPI::TEST):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::enclosingScrollViewIncludingSelf):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/API/Cocoa/_WKFrameHandle.mm
Source/WebKit/Shared/Cocoa/APIObject.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/EventSendingController.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

index 9d5d48c..0597a04 100644 (file)
@@ -1,3 +1,18 @@
+2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Replace uses of +self with +class
+        https://bugs.webkit.org/show_bug.cgi?id=212041
+
+        Reviewed by Darin Adler.
+
+        No change in behavior.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (WebCore::PlatformCALayer::isWebLayer):
+
 2020-05-18  Ross Kirsling  <ross.kirsling@sony.com>
 
         Unreviewed restabilization of non-unified build. 
index ea1017e..37b80e7 100644 (file)
@@ -3514,13 +3514,13 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
     // decode the parameter
     if (AXObjectIsTextMarkerRange(value))
         textMarkerRange = value;
-    else if ([value isKindOfClass:[NSNumber self]])
+    else if ([value isKindOfClass:[NSNumber class]])
         number = value;
-    else if ([value isKindOfClass:[NSString self]])
+    else if ([value isKindOfClass:[NSString class]])
         string = value;
-    else if ([value isKindOfClass:[NSValue self]])
+    else if ([value isKindOfClass:[NSValue class]])
         range = [value rangeValue];
-    else if ([value isKindOfClass:[NSArray self]])
+    else if ([value isKindOfClass:[NSArray class]])
         array = value;
 
     // handle the command
@@ -3898,21 +3898,21 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
         textMarker = parameter;
     else if (AXObjectIsTextMarkerRange(parameter))
         textMarkerRange = parameter;
-    else if ([parameter isKindOfClass:[WebAccessibilityObjectWrapper self]])
+    else if ([parameter isKindOfClass:[WebAccessibilityObjectWrapper class]])
         uiElement = [(WebAccessibilityObjectWrapper*)parameter axBackingObject];
-    else if ([parameter isKindOfClass:[NSNumber self]])
+    else if ([parameter isKindOfClass:[NSNumber class]])
         number = parameter;
-    else if ([parameter isKindOfClass:[NSArray self]])
+    else if ([parameter isKindOfClass:[NSArray class]])
         array = parameter;
-    else if ([parameter isKindOfClass:[NSDictionary self]])
+    else if ([parameter isKindOfClass:[NSDictionary class]])
         dictionary = parameter;
-    else if ([parameter isKindOfClass:[NSValue self]] && !strcmp([(NSValue*)parameter objCType], @encode(NSPoint))) {
+    else if ([parameter isKindOfClass:[NSValue class]] && !strcmp([(NSValue*)parameter objCType], @encode(NSPoint))) {
         pointSet = true;
         point = [(NSValue*)parameter pointValue];
-    } else if ([parameter isKindOfClass:[NSValue self]] && !strcmp([(NSValue*)parameter objCType], @encode(NSRange))) {
+    } else if ([parameter isKindOfClass:[NSValue class]] && !strcmp([(NSValue*)parameter objCType], @encode(NSRange))) {
         rangeSet = true;
         range = [(NSValue*)parameter rangeValue];
-    } else if ([parameter isKindOfClass:[NSValue self]] && !strcmp([(NSValue*)parameter objCType], @encode(NSRect)))
+    } else if ([parameter isKindOfClass:[NSValue class]] && !strcmp([(NSValue*)parameter objCType], @encode(NSRect)))
         rect = [(NSValue*)parameter rectValue];
     else {
         // Attribute type is not supported. Allow super to handle.
index 5cd44f0..957d72a 100644 (file)
@@ -1090,7 +1090,7 @@ bool PlatformCALayer::isWebLayer()
 {
     BOOL result = NO;
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    result = [m_layer isKindOfClass:[WebLayer self]];
+    result = [m_layer isKindOfClass:[WebLayer class]];
     END_BLOCK_OBJC_EXCEPTIONS
     return result;
 }
index a0af29b..159ed5a 100644 (file)
@@ -1,3 +1,35 @@
+2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Replace uses of +self with +class
+        https://bugs.webkit.org/show_bug.cgi?id=212041
+
+        Reviewed by Darin Adler.
+
+        * Shared/API/Cocoa/_WKFrameHandle.mm:
+        (-[_WKFrameHandle isEqual:]):
+        (-[_WKFrameHandle initWithCoder:]):
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]):
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+        * UIProcess/Cocoa/PageClientImplCocoa.mm:
+        (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
+        (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
+        (+[WKTransformView layerClass]):
+        (+[WKSimpleBackdropView layerClass]): Deleted.
+        (+[WKShapeView layerClass]): Deleted.
+        (-[WKRemoteView initWithFrame:contextID:]): Deleted.
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView selectFormAccessoryPickerRow:]):
+        (-[WKContentView selectFormPopoverTitle]):
+
 2020-05-18  Alex Christensen  <achristensen@webkit.org>
 
         WebPageProxy::DidCommitLoadForFrame should use FrameLoadType instead of casting to/from uint32_t for IPC
index d10f584..6cee71c 100644 (file)
@@ -42,7 +42,7 @@
     if (object == self)
         return YES;
 
-    if (![object isKindOfClass:[_WKFrameHandle self]])
+    if (![object isKindOfClass:[_WKFrameHandle class]])
         return NO;
 
     return _frameHandle->frameID() == ((_WKFrameHandle *)object)->_frameHandle->frameID();
@@ -77,8 +77,8 @@
     if (!(self = [super init]))
         return nil;
 
-    NSNumber *frameID = [decoder decodeObjectOfClass:[NSNumber self] forKey:@"frameID"];
-    if (![frameID isKindOfClass:[NSNumber self]]) {
+    NSNumber *frameID = [decoder decodeObjectOfClass:[NSNumber class] forKey:@"frameID"];
+    if (![frameID isKindOfClass:[NSNumber class]]) {
         [self release];
         return nil;
     }
index b9d11da..1730bd4 100644 (file)
@@ -154,7 +154,7 @@ void* Object::newObject(size_t size, Type type)
 
     case Type::AuthenticationChallenge:
         ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        wrapper = allocateWKObject([WKNSURLAuthenticationChallenge self], size);
+        wrapper = allocateWKObject([WKNSURLAuthenticationChallenge class], size);
         ALLOW_DEPRECATED_DECLARATIONS_END
         break;
 
@@ -190,7 +190,7 @@ void* Object::newObject(size_t size, Type type)
         // While not actually a WKObject instance, WKConnection uses allocateWKObject to allocate extra space
         // instead of using ObjectStorage because the wrapped C++ object is a subclass of WebConnection.
         ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        wrapper = allocateWKObject([WKConnection self], size);
+        wrapper = allocateWKObject([WKConnection class], size);
         ALLOW_DEPRECATED_DECLARATIONS_END
         break;
 
@@ -231,7 +231,7 @@ void* Object::newObject(size_t size, Type type)
         break;
 
     case Type::Error:
-        wrapper = allocateWKObject([WKNSError self], size);
+        wrapper = allocateWKObject([WKNSError class], size);
         break;
 
     case Type::FrameHandle:
@@ -298,15 +298,15 @@ void* Object::newObject(size_t size, Type type)
         break;
 
     case Type::String:
-        wrapper = allocateWKObject([WKNSString self], size);
+        wrapper = allocateWKObject([WKNSString class], size);
         break;
 
     case Type::URL:
-        wrapper = allocateWKObject([WKNSURL self], size);
+        wrapper = allocateWKObject([WKNSURL class], size);
         break;
 
     case Type::URLRequest:
-        wrapper = allocateWKObject([WKNSURLRequest self], size);
+        wrapper = allocateWKObject([WKNSURLRequest class], size);
         break;
 
     case Type::URLSchemeTask:
@@ -425,7 +425,7 @@ void* Object::newObject(size_t size, Type type)
         break;
 
     default:
-        wrapper = allocateWKObject([WKObject self], size);
+        wrapper = allocateWKObject([WKObject class], size);
         break;
     }
 
index a0f102b..f276de4 100644 (file)
@@ -866,7 +866,7 @@ ALLOW_DEPRECATED_DECLARATIONS_END
 
 - (void)_setAttachmentFileWrapperClass:(Class)attachmentFileWrapperClass
 {
-    if (attachmentFileWrapperClass && ![attachmentFileWrapperClass isSubclassOfClass:[NSFileWrapper self]])
+    if (attachmentFileWrapperClass && ![attachmentFileWrapperClass isSubclassOfClass:[NSFileWrapper class]])
         [NSException raise:NSInvalidArgumentException format:@"Class %@ does not inherit from NSFileWrapper", attachmentFileWrapperClass];
 
     _attachmentFileWrapperClass = attachmentFileWrapperClass;
index d9a31d3..32bb23a 100644 (file)
@@ -598,13 +598,13 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP
         checker->didCallCompletionHandler();
 
         RefPtr<API::WebsitePolicies> apiWebsitePolicies;
-        if ([policiesOrPreferences isKindOfClass:WKWebpagePreferences.self])
+        if ([policiesOrPreferences isKindOfClass:WKWebpagePreferences.class])
             apiWebsitePolicies = ((WKWebpagePreferences *)policiesOrPreferences)->_websitePolicies.get();
 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        else if ([policiesOrPreferences isKindOfClass:_WKWebsitePolicies.self])
+        else if ([policiesOrPreferences isKindOfClass:_WKWebsitePolicies.class])
             apiWebsitePolicies = [policiesOrPreferences webpagePreferences]->_websitePolicies.get();
         else if (policiesOrPreferences)
-            [NSException raise:NSInvalidArgumentException format:@"Expected policies of class %@, but got %@", NSStringFromClass(_WKWebsitePolicies.self), [policiesOrPreferences class]];
+            [NSException raise:NSInvalidArgumentException format:@"Expected policies of class %@, but got %@", NSStringFromClass(_WKWebsitePolicies.class), [policiesOrPreferences class]];
 ALLOW_DEPRECATED_DECLARATIONS_END
         else
             apiWebsitePolicies = defaultWebsitePolicies;
index d96a0ef..aafa6bf 100644 (file)
@@ -76,13 +76,13 @@ void PageClientImplCocoa::didInvalidateDataForAttachment(API::Attachment& attach
 
 NSFileWrapper *PageClientImplCocoa::allocFileWrapperInstance() const
 {
-    Class cls = [m_webView configuration]._attachmentFileWrapperClass ?: [NSFileWrapper self];
+    Class cls = [m_webView configuration]._attachmentFileWrapperClass ?: [NSFileWrapper class];
     return [cls alloc];
 }
 
 NSSet *PageClientImplCocoa::serializableFileWrapperClasses() const
 {
-    Class defaultFileWrapperClass = NSFileWrapper.self;
+    Class defaultFileWrapperClass = NSFileWrapper.class;
     Class configuredFileWrapperClass = [m_webView configuration]._attachmentFileWrapperClass;
     if (configuredFileWrapperClass && configuredFileWrapperClass != defaultFileWrapperClass)
         return [NSSet setWithObjects:configuredFileWrapperClass, defaultFileWrapperClass, nil];
index 69f1fc1..52a8a75 100644 (file)
@@ -284,7 +284,7 @@ static Class scrollViewScrollIndicatorClass()
 
 + (Class)layerClass
 {
-    return [CATransformLayer self];
+    return [CATransformLayer class];
 }
 
 @end
@@ -293,7 +293,7 @@ static Class scrollViewScrollIndicatorClass()
 
 + (Class)layerClass
 {
-    return [CABackdropLayer self];
+    return [CABackdropLayer class];
 }
 
 @end
@@ -302,7 +302,7 @@ static Class scrollViewScrollIndicatorClass()
 
 + (Class)layerClass
 {
-    return [CAShapeLayer self];
+    return [CAShapeLayer class];
 }
 
 @end
index 2887137..672263a 100644 (file)
@@ -201,7 +201,7 @@ ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     if (UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]) {
-        ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+        ASSERT([scrollView isKindOfClass:[UIScrollView class]]);
         // The scrollView may have been adopted by another node, so only clear the delegate if it's ours.
         if (scrollView.delegate == m_scrollViewDelegate.get())
             scrollView.delegate = nil;
@@ -213,7 +213,7 @@ void ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     if (UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]) {
-        ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+        ASSERT([scrollView isKindOfClass:[UIScrollView class]]);
         scrollView.delegate = nil;
     }
     END_BLOCK_OBJC_EXCEPTIONS
@@ -340,7 +340,7 @@ void ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange(uns
 UIScrollView *ScrollingTreeScrollingNodeDelegateIOS::scrollView() const
 {
     UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
-    ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+    ASSERT([scrollView isKindOfClass:[UIScrollView class]]);
     return scrollView;
 }
 
index c7d328e..4316743 100644 (file)
@@ -8752,7 +8752,7 @@ static RetainPtr<NSItemProvider> createItemProvider(const WebKit::WebPageProxy&
     if ([_presentedFullScreenInputViewController isKindOfClass:[WKSelectMenuListViewController class]])
         [(WKSelectMenuListViewController *)_presentedFullScreenInputViewController.get() selectItemAtIndex:rowIndex];
 #else
-    if ([_inputPeripheral isKindOfClass:[WKFormSelectControl self]])
+    if ([_inputPeripheral isKindOfClass:[WKFormSelectControl class]])
         [(WKFormSelectControl *)_inputPeripheral selectRow:rowIndex inComponent:0 extendingSelection:NO];
 #endif
 }
@@ -8777,7 +8777,7 @@ static RetainPtr<NSItemProvider> createItemProvider(const WebKit::WebPageProxy&
 
 - (NSString *)selectFormPopoverTitle
 {
-    if (![_inputPeripheral isKindOfClass:[WKFormSelectControl self]])
+    if (![_inputPeripheral isKindOfClass:[WKFormSelectControl class]])
         return nil;
 
     return [(WKFormSelectControl *)_inputPeripheral selectFormPopoverTitle];
index 70dca1b..21f23fc 100644 (file)
@@ -1,3 +1,17 @@
+2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Replace uses of +self with +class
+        https://bugs.webkit.org/show_bug.cgi?id=212041
+
+        Reviewed by Darin Adler.
+
+        * DumpRenderTree/mac/EventSendingController.mm:
+        (-[EventSendingController monitorWheelEventsWithOptions:]):
+        * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+        (TestWebKitAPI::TEST):
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::enclosingScrollViewIncludingSelf):
+
 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
 
         Implement conversion between P3 and sRGB color
index 48b667d..5c01287 100644 (file)
@@ -1399,9 +1399,9 @@ static NSUInteger swizzledEventPressedMouseButtons()
 
     bool resetLatching = true;
 
-    if (![options isKindOfClass:[WebUndefined self]]) {
+    if (![options isKindOfClass:[WebUndefined class]]) {
         if (id resetLatchingValue = [options valueForKey:@"resetLatching"]) {
-            if ([resetLatchingValue isKindOfClass:[NSNumber self]])
+            if ([resetLatchingValue isKindOfClass:[NSNumber class]])
                 resetLatching = [resetLatchingValue boolValue];
         }
     }
index 4f9b3dd..76276ad 100644 (file)
@@ -1470,13 +1470,13 @@ TEST(WKAttachmentTests, CustomFileWrapperSubclass)
     [configuration _setAttachmentElementEnabled:YES];
     RetainPtr<NSException> exception;
     @try {
-        [configuration _setAttachmentFileWrapperClass:[NSArray self]];
+        [configuration _setAttachmentFileWrapperClass:[NSArray class]];
     } @catch(NSException *caught) {
         exception = caught;
     }
     EXPECT_TRUE(exception);
 
-    [configuration _setAttachmentFileWrapperClass:[FileWrapper self]];
+    [configuration _setAttachmentFileWrapperClass:[FileWrapper class]];
 
     auto webView = webViewForTestingAttachments(CGSizeZero, configuration.get());
 
@@ -1486,7 +1486,7 @@ TEST(WKAttachmentTests, CustomFileWrapperSubclass)
     NSArray<_WKAttachment *> * insertedAttachments = observer.observer().inserted;
 
     EXPECT_EQ(1U, insertedAttachments.count);
-    EXPECT_EQ([FileWrapper self], [insertedAttachments.firstObject.info.fileWrapper class]);
+    EXPECT_EQ([FileWrapper class], [insertedAttachments.firstObject.info.fileWrapper class]);
 }
 
 // FIXME: Remove this version guard once rdar://51752593 is resolved.
index 28c46c0..2aba507 100644 (file)
@@ -682,7 +682,7 @@ void UIScriptControllerIOS::immediateScrollToOffset(long x, long y)
 static UIScrollView *enclosingScrollViewIncludingSelf(UIView *view)
 {
     do {
-        if ([view isKindOfClass:[UIScrollView self]])
+        if ([view isKindOfClass:[UIScrollView class]])
             return static_cast<UIScrollView *>(view);
     } while ((view = [view superview]));