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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231058 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a8468e0..e588827 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -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
diff --git a/Source/WebCore/platform/ios/wak/WAKScrollView.h b/Source/WebCore/platform/ios/wak/WAKScrollView.h
index b769aa8..586dc87 100644
--- a/Source/WebCore/platform/ios/wak/WAKScrollView.h
+++ b/Source/WebCore/platform/ios/wak/WAKScrollView.h
@@ -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 @@
 {
     WAKView *_documentView;  // Only here so the ObjC instance stays around.
     WAKClipView *_contentView;
-    id _delegate;
     NSPoint _scrollOrigin;
 }
 
@@ -57,8 +56,7 @@
 - (BOOL)drawsBackground;
 - (float)horizontalLineScroll;
 
-- (void)setDelegate:(id)delegate;
-- (id)delegate;
+@property (nonatomic, weak) id delegate;
 
 - (CGRect)unobscuredContentRect;
 - (void)setActualScrollPosition:(CGPoint)point;
diff --git a/Source/WebCore/platform/ios/wak/WAKScrollView.mm b/Source/WebCore/platform/ios/wak/WAKScrollView.mm
index 78e6132..598322b 100644
--- a/Source/WebCore/platform/ios/wak/WAKScrollView.mm
+++ b/Source/WebCore/platform/ios/wak/WAKScrollView.mm
@@ -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 @@
 
 @implementation WAKScrollView
 
+@synthesize delegate;
+
 - (id)initWithFrame:(CGRect)rect
 {
     WKViewRef view = WKViewCreateWithFrame(rect, &viewContext);
@@ -114,16 +116,6 @@
     return NO;
 }
 
-- (void)setDelegate:(id)delegate
-{
-    _delegate = delegate;
-}
-
-- (id)delegate
-{
-    return _delegate;
-}
-
 - (CGRect)documentVisibleRect 
 {
     return [_contentView documentVisibleRect];