OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web_view/public/cwv_scroll_view.h" | 5 #import "ios/web_view/public/cwv_scroll_view.h" |
6 | 6 |
7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" | 7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" |
8 #import "ios/web_view/internal/cwv_scroll_view_internal.h" | 8 #import "ios/web_view/internal/cwv_scroll_view_internal.h" |
9 #import "ios/web_view/public/cwv_scroll_view_delegate.h" | 9 #import "ios/web_view/public/cwv_scroll_view_delegate.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 - (void)setContentInset:(UIEdgeInsets)contentInset { | 57 - (void)setContentInset:(UIEdgeInsets)contentInset { |
58 _proxy.contentInset = contentInset; | 58 _proxy.contentInset = contentInset; |
59 } | 59 } |
60 | 60 |
61 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { | 61 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { |
62 [_proxy addGestureRecognizer:gestureRecognizer]; | 62 [_proxy addGestureRecognizer:gestureRecognizer]; |
63 } | 63 } |
64 | 64 |
| 65 #pragma mark - NSObject |
| 66 |
| 67 - (void)dealloc { |
| 68 // Removes |self| from |_proxy|'s observers. Otherwise |_proxy| will keep a |
| 69 // dangling pointer to |self| and cause SEGV later. |
| 70 [_proxy removeObserver:self]; |
| 71 } |
| 72 |
65 #pragma mark - CRWWebViewScrollViewObserver | 73 #pragma mark - CRWWebViewScrollViewObserver |
66 | 74 |
67 - (void)webViewScrollViewWillBeginDragging: | 75 - (void)webViewScrollViewWillBeginDragging: |
68 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 76 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
69 SEL selector = @selector(webViewScrollViewWillBeginDragging:); | 77 SEL selector = @selector(webViewScrollViewWillBeginDragging:); |
70 if ([_delegate respondsToSelector:selector]) { | 78 if ([_delegate respondsToSelector:selector]) { |
71 [_delegate scrollViewWillBeginDragging:self]; | 79 [_delegate scrollViewWillBeginDragging:self]; |
72 } | 80 } |
73 } | 81 } |
74 - (void)webViewScrollViewWillEndDragging: | 82 - (void)webViewScrollViewWillEndDragging: |
(...skipping 24 matching lines...) Expand all Loading... |
99 [_delegate scrollViewDidEndDecelerating:self]; | 107 [_delegate scrollViewDidEndDecelerating:self]; |
100 } | 108 } |
101 } | 109 } |
102 | 110 |
103 - (void)webViewScrollViewDidResetContentSize: | 111 - (void)webViewScrollViewDidResetContentSize: |
104 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 112 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
105 self.contentSize = _proxy.contentSize; | 113 self.contentSize = _proxy.contentSize; |
106 } | 114 } |
107 | 115 |
108 @end | 116 @end |
OLD | NEW |