Changeset 221714 in webkit
- Timestamp:
- Sep 6, 2017 8:42:39 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r221710 r221714 1 2017-09-06 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll 4 https://bugs.webkit.org/show_bug.cgi?id=176482 5 <rdar://problem/29270035> 6 7 Reviewed by Tim Horton. 8 9 Covered by a new API test! 10 11 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 12 * UIProcess/Cocoa/UIDelegate.h: 13 * UIProcess/Cocoa/UIDelegate.mm: 14 (WebKit::UIDelegate::setDelegate): 15 (WebKit::UIDelegate::UIClient::pageDidScroll): 16 1 17 2017-09-06 Youenn Fablet <youenn@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r221658 r221714 153 153 - (void)_focusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 154 154 - (void)_unfocusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 155 - (void)_webViewDidScroll:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 155 156 - (void)_webView:(WKWebView *)webView takeFocus:(_WKFocusDirection)direction WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 156 157 - (void)_webView:(WKWebView *)webView didNotHandleWheelEvent:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA)); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r221658 r221714 101 101 void focus(WebPageProxy*) final; 102 102 void unfocus(WebPageProxy*) final; 103 void pageDidScroll(WebPageProxy*) final; 103 104 void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final; 104 105 void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final; … … 153 154 bool unfocusWebView : 1; 154 155 bool webViewTakeFocus : 1; 156 bool webViewDidScroll : 1; 155 157 bool webViewDidNotHandleWheelEvent : 1; 156 158 bool webViewHandleAutoplayEventWithFlags : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r221658 r221714 110 110 m_delegateMethods.unfocusWebView = [delegate respondsToSelector:@selector(_unfocusWebView:)]; 111 111 m_delegateMethods.webViewTakeFocus = [delegate respondsToSelector:@selector(_webView:takeFocus:)]; 112 m_delegateMethods.webViewDidScroll = [delegate respondsToSelector:@selector(_webViewDidScroll:)]; 112 113 m_delegateMethods.webViewGetToolbarsAreVisibleWithCompletionHandler = [delegate respondsToSelector:@selector(_webView:getToolbarsAreVisibleWithCompletionHandler:)]; 113 114 m_delegateMethods.webViewDidNotHandleWheelEvent = [delegate respondsToSelector:@selector(_webView:didNotHandleWheelEvent:)]; … … 410 411 411 412 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView takeFocus:toWKFocusDirection(direction)]; 413 } 414 415 void UIDelegate::UIClient::pageDidScroll(WebPageProxy*) 416 { 417 if (!m_uiDelegate.m_delegateMethods.webViewDidScroll) 418 return; 419 420 auto delegate = m_uiDelegate.m_delegate.get(); 421 if (!delegate) 422 return; 423 424 [(id <WKUIDelegatePrivate>)delegate _webViewDidScroll:m_uiDelegate.m_webView]; 412 425 } 413 426 -
trunk/Tools/ChangeLog
r221712 r221714 1 2017-09-06 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll 4 https://bugs.webkit.org/show_bug.cgi?id=176482 5 <rdar://problem/29270035> 6 7 Reviewed by Tim Horton. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: 10 (-[DidScrollDelegate _webViewDidScroll:]): 11 (TEST): 12 1 13 2017-09-06 Eric Carlson <eric.carlson@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
r221707 r221714 250 250 } 251 251 252 @interface PinnedStateObserver : NSObject <WKUIDelegatePrivate>252 @interface PinnedStateObserver : NSObject 253 253 @end 254 254 … … 272 272 auto observer = adoptNS([[PinnedStateObserver alloc] init]); 273 273 [webView addObserver:observer.get() forKeyPath:@"_pinnedState" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; 274 [webView loadHTMLString:@"<body onload='scroll(100, 100)' style='height:10000vh;'/>" baseURL:[NSURL URLWithString:@"http://example.com/"]]; 275 TestWebKitAPI::Util::run(&done); 276 } 277 278 @interface DidScrollDelegate : NSObject <WKUIDelegatePrivate> 279 @end 280 281 @implementation DidScrollDelegate 282 283 - (void)_webViewDidScroll:(WKWebView *)webView 284 { 285 done = true; 286 } 287 288 @end 289 290 TEST(WebKit, DidScroll) 291 { 292 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]); 293 auto delegate = adoptNS([[DidScrollDelegate alloc] init]); 294 [webView setUIDelegate:delegate.get()]; 274 295 [webView loadHTMLString:@"<body onload='scroll(100, 100)' style='height:10000vh;'/>" baseURL:[NSURL URLWithString:@"http://example.com/"]]; 275 296 TestWebKitAPI::Util::run(&done);
Note: See TracChangeset
for help on using the changeset viewer.