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 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 - (CGPoint)contentOffset { | 37 - (CGPoint)contentOffset { |
38 return _proxy.contentOffset; | 38 return _proxy.contentOffset; |
39 } | 39 } |
40 | 40 |
41 - (void)setContentOffset:(CGPoint)contentOffset { | 41 - (void)setContentOffset:(CGPoint)contentOffset { |
42 _proxy.contentOffset = contentOffset; | 42 _proxy.contentOffset = contentOffset; |
43 } | 43 } |
44 | 44 |
| 45 - (UIEdgeInsets)scrollIndicatorInsets { |
| 46 return _proxy.scrollIndicatorInsets; |
| 47 } |
| 48 |
| 49 - (void)setScrollIndicatorInsets:(UIEdgeInsets)scrollIndicatorInsets { |
| 50 _proxy.scrollIndicatorInsets = scrollIndicatorInsets; |
| 51 } |
| 52 |
45 - (CGRect)bounds { | 53 - (CGRect)bounds { |
46 return {_proxy.contentOffset, _proxy.frame.size}; | 54 return {_proxy.contentOffset, _proxy.frame.size}; |
47 } | 55 } |
48 | 56 |
| 57 - (BOOL)isDecelerating { |
| 58 return _proxy.decelerating; |
| 59 } |
| 60 |
49 - (BOOL)isDragging { | 61 - (BOOL)isDragging { |
50 return _proxy.dragging; | 62 return _proxy.dragging; |
51 } | 63 } |
52 | 64 |
| 65 - (UIPanGestureRecognizer*)panGestureRecognizer { |
| 66 return _proxy.panGestureRecognizer; |
| 67 } |
| 68 |
53 - (UIEdgeInsets)contentInset { | 69 - (UIEdgeInsets)contentInset { |
54 return _proxy.contentInset; | 70 return _proxy.contentInset; |
55 } | 71 } |
56 | 72 |
57 - (void)setContentInset:(UIEdgeInsets)contentInset { | 73 - (void)setContentInset:(UIEdgeInsets)contentInset { |
58 _proxy.contentInset = contentInset; | 74 _proxy.contentInset = contentInset; |
59 } | 75 } |
60 | 76 |
| 77 - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated { |
| 78 [_proxy setContentOffset:contentOffset animated:animated]; |
| 79 } |
| 80 |
61 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { | 81 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { |
62 [_proxy addGestureRecognizer:gestureRecognizer]; | 82 [_proxy addGestureRecognizer:gestureRecognizer]; |
63 } | 83 } |
64 | 84 |
| 85 - (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { |
| 86 [_proxy removeGestureRecognizer:gestureRecognizer]; |
| 87 } |
| 88 |
65 #pragma mark - NSObject | 89 #pragma mark - NSObject |
66 | 90 |
67 - (void)dealloc { | 91 - (void)dealloc { |
68 // Removes |self| from |_proxy|'s observers. Otherwise |_proxy| will keep a | 92 // Removes |self| from |_proxy|'s observers. Otherwise |_proxy| will keep a |
69 // dangling pointer to |self| and cause SEGV later. | 93 // dangling pointer to |self| and cause SEGV later. |
70 [_proxy removeObserver:self]; | 94 [_proxy removeObserver:self]; |
71 } | 95 } |
72 | 96 |
73 #pragma mark - CRWWebViewScrollViewObserver | 97 #pragma mark - CRWWebViewScrollViewObserver |
74 | 98 |
(...skipping 26 matching lines...) Expand all Loading... |
101 } | 125 } |
102 | 126 |
103 - (void)webViewScrollViewDidEndDecelerating: | 127 - (void)webViewScrollViewDidEndDecelerating: |
104 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 128 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
105 SEL selector = @selector(webViewScrollViewDidEndDecelerating:); | 129 SEL selector = @selector(webViewScrollViewDidEndDecelerating:); |
106 if ([_delegate respondsToSelector:selector]) { | 130 if ([_delegate respondsToSelector:selector]) { |
107 [_delegate scrollViewDidEndDecelerating:self]; | 131 [_delegate scrollViewDidEndDecelerating:self]; |
108 } | 132 } |
109 } | 133 } |
110 | 134 |
| 135 - (void)webViewScrollViewWillBeginZooming: |
| 136 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
| 137 SEL selector = @selector(scrollViewWillBeginZooming:); |
| 138 if ([_delegate respondsToSelector:selector]) { |
| 139 [_delegate scrollViewWillBeginZooming:self]; |
| 140 } |
| 141 } |
| 142 |
111 - (void)webViewScrollViewDidResetContentSize: | 143 - (void)webViewScrollViewDidResetContentSize: |
112 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 144 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
113 self.contentSize = _proxy.contentSize; | 145 self.contentSize = _proxy.contentSize; |
114 } | 146 } |
115 | 147 |
116 @end | 148 @end |
OLD | NEW |