| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 // UIViews conforming to CRWScrollableContent (i.e. CRWContentViews) are used | 10 // UIViews conforming to CRWScrollableContent (i.e. CRWContentViews) are used |
| 11 // to display content within a WebState. | 11 // to display content within a WebState. |
| 12 @protocol CRWScrollableContent<NSObject> | 12 @protocol CRWScrollableContent<NSObject> |
| 13 | 13 |
| 14 // The scroll view used to display the content. If |scrollView| is non-nil, | 14 // The scroll view used to display the content. If |scrollView| is non-nil, |
| 15 // it will be used to back the CRWContentViewScrollViewProxy and is expected to | 15 // it will be used to back the CRWContentViewScrollViewProxy and is expected to |
| 16 // be a subview of the CRWContentView. | 16 // be a subview of the CRWContentView. |
| 17 @property(nonatomic, strong, readonly) UIScrollView* scrollView; | 17 @property(nonatomic, retain, readonly) UIScrollView* scrollView; |
| 18 | 18 |
| 19 // Adds a top padding to content view. Implementations of this protocol can | 19 // Adds a top padding to content view. Implementations of this protocol can |
| 20 // implement this method using UIScrollView.contentInset (where applicable) or | 20 // implement this method using UIScrollView.contentInset (where applicable) or |
| 21 // via resizing a subview's frame. Can be used as a workaround for WKWebView | 21 // via resizing a subview's frame. Can be used as a workaround for WKWebView |
| 22 // bug, where UIScrollView.content inset does not work (rdar://23584409). | 22 // bug, where UIScrollView.content inset does not work (rdar://23584409). |
| 23 @property(nonatomic, assign) CGFloat topContentPadding; | 23 @property(nonatomic, assign) CGFloat topContentPadding; |
| 24 | 24 |
| 25 // Returns YES if content is being displayed in the scroll view. | 25 // Returns YES if content is being displayed in the scroll view. |
| 26 // TODO(stuartmorgan): See if this can be removed from the public interface. | 26 // TODO(stuartmorgan): See if this can be removed from the public interface. |
| 27 - (BOOL)isViewAlive; | 27 - (BOOL)isViewAlive; |
| 28 | 28 |
| 29 @optional | 29 @optional |
| 30 | 30 |
| 31 // Whether or not the content view should use the content inset when setting | 31 // Whether or not the content view should use the content inset when setting |
| 32 // |topContentPadding|. | 32 // |topContentPadding|. |
| 33 @property(nonatomic, assign) BOOL shouldUseInsetForTopPadding; | 33 @property(nonatomic, assign) BOOL shouldUseInsetForTopPadding; |
| 34 | 34 |
| 35 @end | 35 @end |
| 36 | 36 |
| 37 // Convenience type for content views. | 37 // Convenience type for content views. |
| 38 typedef UIView<CRWScrollableContent> CRWContentView; | 38 typedef UIView<CRWScrollableContent> CRWContentView; |
| 39 | 39 |
| 40 #endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ | 40 #endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_CONTENT_VIEW_H_ |
| OLD | NEW |