Changeset 166730 in webkit
- Timestamp:
- Apr 3, 2014 10:56:03 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r166728 r166730 1 2014-04-03 Anders Carlsson <andersca@apple.com> 2 3 Make actionsForElement a proper API::UIClient member function 4 https://bugs.webkit.org/show_bug.cgi?id=131171 5 6 Reviewed by Sam Weinig. 7 8 * UIProcess/API/APIUIClient.h: 9 (API::UIClient::actionsForElement): 10 * UIProcess/Cocoa/UIDelegate.h: 11 * UIProcess/Cocoa/UIDelegate.mm: 12 (WebKit::UIClient::actionsForElement): 13 * UIProcess/ios/WKActionSheetAssistant.mm: 14 (-[WKActionSheetAssistant showImageSheet]): 15 (-[WKActionSheetAssistant showLinkSheet]): 16 1 17 2014-04-03 Martin Hodovan <mhodovan@inf.u-szeged.hu> 2 18 -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r166265 r166730 34 34 #include <functional> 35 35 #include <wtf/PassRefPtr.h> 36 37 #if PLATFORM(IOS) 38 OBJC_CLASS NSArray; 39 OBJC_CLASS _WKActivatedElementInfo; 40 #endif 36 41 37 42 namespace WebCore { … … 137 142 138 143 virtual bool shouldInterruptJavaScript(WebKit::WebPageProxy*) { return false; } 144 145 #if PLATFORM(IOS) 146 virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) { return std::move(defaultActions); } 147 #endif 139 148 }; 140 149 -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
r166720 r166730 49 49 void setDelegate(id <WKUIDelegate>); 50 50 51 NSArray *actionsForElement(_WKActivatedElementInfo *, NSArray *defaultActions);52 53 51 private: 54 52 // API::UIClient … … 57 55 virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) override; 58 56 virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override; 57 #if PLATFORM(IOS) 58 virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override; 59 #endif 59 60 60 61 WKWebView *m_webView; -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
r166720 r166730 63 63 m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)]; 64 64 #endif 65 }66 67 NSArray *UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, NSArray *defaultActions)68 {69 #if PLATFORM(IOS)70 if (!m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler)71 return defaultActions;72 73 auto delegate = m_delegate.get();74 if (!delegate)75 return defaultActions;76 77 return [(id <WKUIDelegatePrivate>)delegate _webView:m_webView actionsForElement:elementInfo defaultActions:defaultActions];78 #endif79 return defaultActions;80 65 } 81 66 … … 164 149 } 165 150 151 #if PLATFORM(IOS) 152 RetainPtr<NSArray> UIClient::actionsForElement(_WKActivatedElementInfo *elementInfo, RetainPtr<NSArray> defaultActions) 153 { 154 if (!m_delegateMethods.webViewActionsForElementDefaultActions) 155 return std::move(defaultActions); 156 157 auto delegate = m_delegate.get(); 158 if (!delegate) 159 return defaultActions; 160 161 return [(id <WKUIDelegatePrivate>)delegate _webView:m_webView actionsForElement:elementInfo defaultActions:defaultActions.get()]; 162 } 163 #endif 164 166 165 } // namespace WebKit 167 166 -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm
r166725 r166730 228 228 229 229 NSURL *targetURL = [NSURL URLWithString:positionInformation.url]; 230 NSMutableArray *defaultActions = [NSMutableArray array];230 auto defaultActions = adoptNS([[NSMutableArray alloc] init]); 231 231 if (!positionInformation.url.isEmpty()) 232 232 [defaultActions addObject:[_WKElementAction elementActionWithType:_WKElementActionTypeOpen]]; … … 238 238 [defaultActions addObject:[_WKElementAction elementActionWithType:_WKElementActionTypeCopy]]; 239 239 240 RetainPtr<_WKActivatedElementInfo>elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage240 auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage 241 241 URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds]); 242 242 243 RetainPtr<NSArray> actions = static_cast<UIClient&>(_view.page->uiClient()).actionsForElement(elementInfo.get(), [[defaultActions copy] autorelease]);243 RetainPtr<NSArray> actions = _view.page->uiClient().actionsForElement(elementInfo.get(), std::move(defaultActions)); 244 244 245 245 if (![actions count]) … … 267 267 return; 268 268 269 NSMutableArray *defaultActions = [NSMutableArray array];269 auto defaultActions = adoptNS([[NSMutableArray alloc] init]); 270 270 [defaultActions addObject:[_WKElementAction elementActionWithType:_WKElementActionTypeOpen]]; 271 271 if ([getSSReadingListClass() supportsURL:targetURL]) … … 277 277 URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds]); 278 278 279 RetainPtr<NSArray> actions = static_cast<UIClient&>(_view.page->uiClient()).actionsForElement(elementInfo.get(), [[defaultActions copy] autorelease]);279 RetainPtr<NSArray> actions = _view.page->uiClient().actionsForElement(elementInfo.get(), std::move(defaultActions)); 280 280 281 281 if (![actions count])
Note: See TracChangeset
for help on using the changeset viewer.