| 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 #ifndef IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ | 5 #ifndef IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ |
| 6 #define IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ | 6 #define IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ |
| 7 | 7 |
| 8 #import <ChromeWebView/cwv_export.h> | 8 #import <ChromeWebView/cwv_export.h> |
| 9 #import <CoreGraphics/CoreGraphics.h> | 9 #import <CoreGraphics/CoreGraphics.h> |
| 10 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
| 11 #import <UIKit/UIKit.h> | 11 #import <UIKit/UIKit.h> |
| 12 | 12 |
| 13 @protocol CWVScrollViewDelegate; | 13 @protocol CWVScrollViewDelegate; |
| 14 | 14 |
| 15 // Scroll view inside the web view. This is not a subclass of UIScrollView | 15 // Scroll view inside the web view. This is not a subclass of UIScrollView |
| 16 // because the underlying //ios/web API only exposes a proxy object of the | 16 // because the underlying //ios/web API only exposes a proxy object of the |
| 17 // scroll view, not the raw UIScrollView. | 17 // scroll view, not the raw UIScrollView. |
| 18 // | 18 // |
| 19 // These methods are forwarded to the internal UIScrollView. Please see the | 19 // These methods are forwarded to the internal UIScrollView. Please see the |
| 20 // <UIKit/UIScrollView.h> documentation for details about the following methods. | 20 // <UIKit/UIScrollView.h> documentation for details about the following methods. |
| 21 // | 21 // |
| 22 // TODO(crbug.com/719323): Add nullability annotations. | 22 // TODO(crbug.com/719323): Add nullability annotations. |
| 23 CWV_EXPORT | 23 CWV_EXPORT |
| 24 @interface CWVScrollView : NSObject | 24 @interface CWVScrollView : NSObject |
| 25 | 25 |
| 26 @property(nonatomic, readonly) CGRect bounds; | 26 @property(nonatomic, readonly) CGRect bounds; |
| 27 @property(nonatomic) CGPoint contentOffset; | 27 @property(nonatomic) CGPoint contentOffset; |
| 28 @property(nonatomic) UIEdgeInsets scrollIndicatorInsets; |
| 28 @property(nonatomic, weak) id<CWVScrollViewDelegate> delegate; | 29 @property(nonatomic, weak) id<CWVScrollViewDelegate> delegate; |
| 30 @property(nonatomic, readonly, getter=isDecelerating) BOOL decelerating; |
| 29 @property(nonatomic, readonly, getter=isDragging) BOOL dragging; | 31 @property(nonatomic, readonly, getter=isDragging) BOOL dragging; |
| 32 @property(nonatomic, readonly) UIPanGestureRecognizer* panGestureRecognizer; |
| 30 | 33 |
| 31 // KVO compliant. | 34 // KVO compliant. |
| 32 @property(nonatomic, readonly) CGSize contentSize; | 35 @property(nonatomic, readonly) CGSize contentSize; |
| 33 | 36 |
| 34 // Be careful when using this property. There's a bug with the | 37 // Be careful when using this property. There's a bug with the |
| 35 // underlying WKWebView where the web view does not respect contentInsets | 38 // underlying WKWebView where the web view does not respect contentInsets |
| 36 // properly when laying out content and calculating innerHeight for Javascript. | 39 // properly when laying out content and calculating innerHeight for Javascript. |
| 37 // Content is laid out based on the entire height of the web view rather than | 40 // Content is laid out based on the entire height of the web view rather than |
| 38 // the height between the top and bottom insets. | 41 // the height between the top and bottom insets. |
| 39 // https://bugs.webkit.org/show_bug.cgi?id=134230 | 42 // https://bugs.webkit.org/show_bug.cgi?id=134230 |
| 40 // rdar://23584409 (not available on Open Radar) | 43 // rdar://23584409 (not available on Open Radar) |
| 41 @property(nonatomic) UIEdgeInsets contentInset; | 44 @property(nonatomic) UIEdgeInsets contentInset; |
| 42 | 45 |
| 46 - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; |
| 43 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer; | 47 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer; |
| 48 - (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer; |
| 44 | 49 |
| 45 @end | 50 @end |
| 46 | 51 |
| 47 #endif // IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ | 52 #endif // IOS_WEB_VIEW_PUBLIC_CWV_SCROLL_VIEW_H_ |
| OLD | NEW |