Make WAKScrollView delegate a weak property
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2018 18:22:03 +0000 (18:22 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2018 18:22:03 +0000 (18:22 +0000)
<https://webkit.org/b/184799>
<rdar://problem/39469669>

Reviewed by Simon Fraser.

* platform/ios/wak/WAKScrollView.h:
- Remove `delegate` instance variable declaration.
- Declare `delegate` property as weak.
(-[WAKScrollView setDelegate:]): Delete declaration.
(-[WAKScrollView delegate]): Ditto.
* platform/ios/wak/WAKScrollView.mm:
- Synthesize getter/setter methods for `delegate` property.
(-[WAKScrollView setDelegate:]): Delete implementation.
(-[WAKScrollView delegate]): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/wak/WAKScrollView.h
Source/WebCore/platform/ios/wak/WAKScrollView.mm

index a8468e0..e588827 100644 (file)
@@ -1,3 +1,21 @@
+2018-04-26  David Kilzer  <ddkilzer@apple.com>
+
+        Make WAKScrollView delegate a weak property
+        <https://webkit.org/b/184799>
+        <rdar://problem/39469669>
+
+        Reviewed by Simon Fraser.
+
+        * platform/ios/wak/WAKScrollView.h:
+        - Remove `delegate` instance variable declaration.
+        - Declare `delegate` property as weak.
+        (-[WAKScrollView setDelegate:]): Delete declaration.
+        (-[WAKScrollView delegate]): Ditto.
+        * platform/ios/wak/WAKScrollView.mm:
+        - Synthesize getter/setter methods for `delegate` property.
+        (-[WAKScrollView setDelegate:]): Delete implementation.
+        (-[WAKScrollView delegate]): Ditto.
+
 2018-04-26  Youenn Fablet  <youenn@apple.com>
 
         CORS preflight checker should add a console message when preflight load is blocked
index b769aa8..586dc87 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,7 +38,6 @@ WEBCORE_EXPORT @interface WAKScrollView : WAKView <WebCoreFrameScrollView>
 {
     WAKView *_documentView;  // Only here so the ObjC instance stays around.
     WAKClipView *_contentView;
-    id _delegate;
     NSPoint _scrollOrigin;
 }
 
@@ -57,8 +56,7 @@ WEBCORE_EXPORT @interface WAKScrollView : WAKView <WebCoreFrameScrollView>
 - (BOOL)drawsBackground;
 - (float)horizontalLineScroll;
 
-- (void)setDelegate:(id)delegate;
-- (id)delegate;
+@property (nonatomic, weak) id delegate;
 
 - (CGRect)unobscuredContentRect;
 - (void)setActualScrollPosition:(CGPoint)point;
index 78e6132..598322b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,6 +62,8 @@ static void _notificationCallback(WKViewRef v, WKViewNotificationType type, void
 
 @implementation WAKScrollView
 
+@synthesize delegate;
+
 - (id)initWithFrame:(CGRect)rect
 {
     WKViewRef view = WKViewCreateWithFrame(rect, &viewContext);
@@ -114,16 +116,6 @@ static void _notificationCallback(WKViewRef v, WKViewNotificationType type, void
     return NO;
 }
 
-- (void)setDelegate:(id)delegate
-{
-    _delegate = delegate;
-}
-
-- (id)delegate
-{
-    return _delegate;
-}
-
 - (CGRect)documentVisibleRect 
 {
     return [_contentView documentVisibleRect];