blob: 69a90a7b1ba6d990e53ad49fa3f23d7c3fd50fcd [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <UIKit/UIKit.h>
// UIViews conforming to CRWScrollableContent (i.e. CRWContentViews) are used
// to display content within a WebState.
@protocol CRWScrollableContent <NSObject>
// The scroll view used to display the content. If |scrollView| is non-nil,
// it will be used to back the CRWContentViewScrollViewProxy and is expected to
// be a subview of the CRWContentView.
@property(nonatomic, strong, readonly) UIScrollView* scrollView;
// Adds an offset to the content view. This updates the location of the scroll
// view relative to the receiver, and does not update the scroll view's content
// offset.
@property(nonatomic, assign) CGPoint contentOffset;
// Adds an inset to content view. Implementations of this protocol can
// implement this method using UIScrollView.contentInset (where applicable) or
// via resizing a subview's frame. Can be used as a workaround for WKWebView
// bug, where UIScrollView.content inset does not work (rdar://23584409).
@property(nonatomic, assign) UIEdgeInsets contentInset;
// Whether or not the content view should use the content inset when setting
// |contentInset|.
@property(nonatomic, assign) BOOL shouldUseViewContentInset;
// Convenience type for content views.
typedef UIView<CRWScrollableContent> CRWContentView;