Bug 146482 - Provide delegate SPI for clients to notify WebKit about content inset changes
Summary: Provide delegate SPI for clients to notify WebKit about content inset changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-06-30 17:26 PDT by Brent Fulgham
Modified: 2015-07-02 15:18 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.42 KB, patch)
2015-06-30 17:33 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (3.58 KB, patch)
2015-07-02 10:46 PDT, Brent Fulgham
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2015-06-30 17:26:45 PDT
WebKit clients may sometimes modify the contents insets of the view while the user is performing scroll gestures. We should have a delegate method that WebKit can use to ask the host application if any such changes will happen so that we can properly animate to the final window state.
Comment 1 Brent Fulgham 2015-06-30 17:26:58 PDT
<rdar://problem/21602741>
Comment 2 Brent Fulgham 2015-06-30 17:33:55 PDT
Created attachment 255883 [details]
Patch
Comment 3 Sam Weinig 2015-07-01 10:49:30 PDT
Comment on attachment 255883 [details]
Patch

Given the limited use case, this should start as SPI on WKUIDelegatePrivate.h
Comment 4 Brent Fulgham 2015-07-02 10:46:27 PDT
Created attachment 256015 [details]
Patch
Comment 5 Darin Adler 2015-07-02 15:06:52 PDT
Comment on attachment 256015 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256015&action=review

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:1474
> +        UIEdgeInsets contentInset = [self _computedContentInset];
> +
> +        id<WKUIDelegatePrivate> uiDelegatePrivate = static_cast<id <WKUIDelegatePrivate>>([self UIDelegate]);
> +        if ([uiDelegatePrivate respondsToSelector:@selector(_webView:finalObscuredInsetsForScrollView:withVelocity:targetContentOffset:)])
> +            contentInset = [uiDelegatePrivate _webView:self finalObscuredInsetsForScrollView:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];

Would be better to use else so we don’t unnecessarily call _computedContentInset every time.
Comment 6 Brent Fulgham 2015-07-02 15:15:54 PDT
Comment on attachment 256015 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256015&action=review

>> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:1474
>> +            contentInset = [uiDelegatePrivate _webView:self finalObscuredInsetsForScrollView:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
> 
> Would be better to use else so we don’t unnecessarily call _computedContentInset every time.

Good idea! Will do.
Comment 7 Brent Fulgham 2015-07-02 15:18:38 PDT
Committed r186237: <http://trac.webkit.org/changeset/186237>