crw_content_view.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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
  3. // found in the LICENSE file.
  4. #ifndef IOS_WEB_COMMON_CRW_CONTENT_VIEW_H_
  5. #define IOS_WEB_COMMON_CRW_CONTENT_VIEW_H_
  6. #import <UIKit/UIKit.h>
  7. // For devices running on a version >= iOS 16.0+, WKFullScreenState is converted
  8. // into CrFullscreenState. Once min version supported is iOS 16.0,
  9. // uses of this enum should be be replaced with WKFullScreenState and this enum
  10. // declaration should be removed.
  11. enum class CrFullscreenState {
  12. kEnteringFullscreen,
  13. kExitingFullscreen,
  14. kInFullscreen,
  15. kNotInFullScreen,
  16. };
  17. // UIViews conforming to CRWScrollableContent (i.e. CRWContentViews) are used
  18. // to display content within a WebState.
  19. @protocol CRWScrollableContent <NSObject>
  20. // The scroll view used to display the content. If |scrollView| is non-nil,
  21. // it will be used to back the CRWContentViewScrollViewProxy and is expected to
  22. // be a subview of the CRWContentView.
  23. @property(nonatomic, strong, readonly) UIScrollView* scrollView;
  24. // Adds an offset to the content view. This updates the location of the scroll
  25. // view relative to the receiver, and does not update the scroll view's content
  26. // offset.
  27. @property(nonatomic, assign) CGPoint contentOffset;
  28. // Adds an inset to content view. Implementations of this protocol can
  29. // implement this method using UIScrollView.contentInset (where applicable) or
  30. // via resizing a subview's frame. Can be used as a workaround for WKWebView
  31. // bug, where UIScrollView.content inset does not work (rdar://23584409).
  32. @property(nonatomic, assign) UIEdgeInsets contentInset;
  33. @optional
  34. // Whether or not the content view should use the content inset when setting
  35. // |contentInset|.
  36. @property(nonatomic, assign) BOOL shouldUseViewContentInset;
  37. @end
  38. // Convenience type for content views.
  39. typedef UIView<CRWScrollableContent> CRWContentView;
  40. #endif // IOS_WEB_COMMON_CRW_CONTENT_VIEW_H_