Changeset 175577 in webkit
- Timestamp:
- Nov 4, 2014 1:44:11 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r175568 r175577 1 2014-11-04 Andy Estes <aestes@apple.com> 2 3 [iOS] Include a WKActionSheetAssistant parameter in WKActionSheetAssistantDelegate methods 4 https://bugs.webkit.org/show_bug.cgi?id=137792 5 6 Reviewed by Dan Bernstein. 7 8 * UIProcess/API/Cocoa/_WKElementAction.mm: 9 (+[_WKElementAction elementActionWithTitle:actionHandler:]): 10 (+[_WKElementAction elementActionWithType:customTitle:]): 11 (-[_WKElementAction _runActionWithElementInfo:forActionSheetAssistant:]): 12 * UIProcess/API/Cocoa/_WKElementActionInternal.h: 13 * UIProcess/ios/WKActionSheetAssistant.h: 14 * UIProcess/ios/WKActionSheetAssistant.mm: 15 (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]): 16 (-[WKActionSheetAssistant presentationRectInHostViewForSheet]): 17 (-[WKActionSheetAssistant updatePositionInformation]): 18 (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): 19 (-[WKActionSheetAssistant showImageSheet]): 20 (-[WKActionSheetAssistant showLinkSheet]): 21 (-[WKActionSheetAssistant showDataDetectorsSheet]): 22 (-[WKActionSheetAssistant cleanupSheet]): 23 * UIProcess/ios/WKContentViewInteraction.mm: 24 (-[WKContentView positionInformationForActionSheetAssistant:]): 25 (-[WKContentView updatePositionInformationForActionSheetAssistant:]): 26 (-[WKContentView actionSheetAssistant:performAction:]): 27 (-[WKContentView actionSheetAssistant:openElementAtLocation:]): 28 (-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]): 29 (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]): 30 (-[WKContentView actionSheetAssistantDidStopInteraction:]): 31 1 32 2014-11-04 Csaba Osztrogonác <ossy@webkit.org> 2 33 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm
r174885 r175577 44 44 SOFT_LINK_CLASS(SafariServices, SSReadingList); 45 45 46 typedef void (^WKElementActionHandlerInternal)( id <WKActionSheetAssistantDelegate>, _WKActivatedElementInfo *);46 typedef void (^WKElementActionHandlerInternal)(WKActionSheetAssistant *, _WKActivatedElementInfo *); 47 47 48 48 @implementation _WKElementAction { … … 73 73 + (instancetype)elementActionWithTitle:(NSString *)title actionHandler:(WKElementActionHandler)handler 74 74 { 75 return [[[self alloc] _initWithTitle:title actionHandler:^( id <WKActionSheetAssistantDelegate>, _WKActivatedElementInfo *actionInfo) { handler(actionInfo); }75 return [[[self alloc] _initWithTitle:title actionHandler:^(WKActionSheetAssistant *, _WKActivatedElementInfo *actionInfo) { handler(actionInfo); } 76 76 type:_WKElementActionTypeCustom] autorelease]; 77 77 } … … 92 92 case _WKElementActionTypeCopy: 93 93 title = WEB_UI_STRING_KEY("Copy", "Copy ActionSheet Link", "Title for Copy Link or Image action button"); 94 handler = ^( id <WKActionSheetAssistantDelegate> delegate, _WKActivatedElementInfo *actionInfo) {95 [ delegateperformAction:WebKit::SheetAction::Copy];94 handler = ^(WKActionSheetAssistant *assistant, _WKActivatedElementInfo *actionInfo) { 95 [assistant.delegate actionSheetAssistant:assistant performAction:WebKit::SheetAction::Copy]; 96 96 }; 97 97 break; 98 98 case _WKElementActionTypeOpen: 99 99 title = WEB_UI_STRING_KEY("Open", "Open ActionSheet Link", "Title for Open Link action button"); 100 handler = ^( id <WKActionSheetAssistantDelegate> delegate, _WKActivatedElementInfo *actionInfo) {101 [ delegateopenElementAtLocation:actionInfo._interactionLocation];100 handler = ^(WKActionSheetAssistant *assistant, _WKActivatedElementInfo *actionInfo) { 101 [assistant.delegate actionSheetAssistant:assistant openElementAtLocation:actionInfo._interactionLocation]; 102 102 }; 103 103 break; 104 104 case _WKElementActionTypeSaveImage: 105 105 title = WEB_UI_STRING_KEY("Save Image", "Save Image", "Title for Save Image action button"); 106 handler = ^( id <WKActionSheetAssistantDelegate> delegate, _WKActivatedElementInfo *actionInfo) {107 [ delegateperformAction:WebKit::SheetAction::SaveImage];106 handler = ^(WKActionSheetAssistant *assistant, _WKActivatedElementInfo *actionInfo) { 107 [assistant.delegate actionSheetAssistant:assistant performAction:WebKit::SheetAction::SaveImage]; 108 108 }; 109 109 break; 110 110 case _WKElementActionTypeAddToReadingList: 111 111 title = WEB_UI_STRING("Add to Reading List", "Title for Add to Reading List action button"); 112 handler = ^( id <WKActionSheetAssistantDelegate>, _WKActivatedElementInfo *actionInfo) {112 handler = ^(WKActionSheetAssistant *, _WKActivatedElementInfo *actionInfo) { 113 113 addToReadingList(actionInfo.URL, actionInfo.title); 114 114 }; … … 132 132 } 133 133 134 - (void)_runActionWithElementInfo:(_WKActivatedElementInfo *)info delegate:(id <WKActionSheetAssistantDelegate>)delegate134 - (void)_runActionWithElementInfo:(_WKActivatedElementInfo *)info forActionSheetAssistant:(WKActionSheetAssistant *)assistant 135 135 { 136 _actionHandler( delegate, info);136 _actionHandler(assistant, info); 137 137 } 138 138 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementActionInternal.h
r174885 r175577 30 30 #if PLATFORM(IOS) 31 31 32 @class WKActionSheetAssistant; 32 33 @class WKContentView; 33 @protocol WKActionSheetAssistantDelegate;34 34 35 35 @interface _WKElementAction () 36 36 37 - (void)_runActionWithElementInfo:(_WKActivatedElementInfo *)info delegate:(id <WKActionSheetAssistantDelegate>)delegate;37 - (void)_runActionWithElementInfo:(_WKActivatedElementInfo *)info forActionSheetAssistant:(WKActionSheetAssistant *)assistant; 38 38 39 39 @end -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h
r174885 r175577 37 37 } 38 38 39 @class WKActionSheetAssistant; 40 @class _WKActivatedElementInfo; 39 41 @protocol WKActionSheetDelegate; 40 @class _WKActivatedElementInfo;41 42 42 43 @protocol WKActionSheetAssistantDelegate 43 44 @required 44 @property (nonatomic, readonly) const WebKit::InteractionInformationAtPosition& positionInformation;45 - (void)updatePositionInformation ;46 - (void) performAction:(WebKit::SheetAction)action;47 - (void) openElementAtLocation:(CGPoint)location;48 - (RetainPtr<NSArray>)action sForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions;49 - (void) startInteractionWithElement:(_WKActivatedElementInfo *)element;50 - (void) stopInteraction;45 - (const WebKit::InteractionInformationAtPosition&)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant; 46 - (void)updatePositionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant; 47 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:(WebKit::SheetAction)action; 48 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location; 49 - (RetainPtr<NSArray>)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions; 50 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant willStartInteractionWithElement:(_WKActivatedElementInfo *)element; 51 - (void)actionSheetAssistantDidStopInteraction:(WKActionSheetAssistant *)assistant; 51 52 @end 52 53 -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm
r174885 r175577 138 138 return CGRectZero; 139 139 140 return [self _presentationRectForSheetGivenPoint:[delegate positionInformation].point inHostView:view]; 141 140 return [self _presentationRectForSheetGivenPoint:[delegate positionInformationForActionSheetAssistant:self].point inHostView:view]; 142 141 } 143 142 … … 149 148 return CGRectZero; 150 149 151 const auto& positionInformation = [delegate positionInformation ];150 const auto& positionInformation = [delegate positionInformationForActionSheetAssistant:self]; 152 151 153 152 CGRect boundingRect = positionInformation.bounds; … … 165 164 - (void)updatePositionInformation 166 165 { 167 [_delegate.get() updatePositionInformation ];166 [_delegate.get() updatePositionInformationForActionSheetAssistant:self]; 168 167 } 169 168 … … 193 192 return; 194 193 195 const auto& positionInformation = [delegate positionInformation ];194 const auto& positionInformation = [delegate positionInformationForActionSheetAssistant:self]; 196 195 197 196 NSURL *targetURL = [NSURL URLWithString:positionInformation.url]; … … 226 225 for (_WKElementAction *action in actions) { 227 226 [_interactionSheet _addActionWithTitle:[action title] style:UIAlertActionStyleDefault handler:^{ 228 [action _runActionWithElementInfo:_elementInfo.get() delegate:delegate.get()];227 [action _runActionWithElementInfo:_elementInfo.get() forActionSheetAssistant:self]; 229 228 [self cleanupSheet]; 230 229 } shouldDismissHandler:^{ … … 238 237 [self cleanupSheet]; 239 238 }]]; 240 [delegate startInteractionWithElement:_elementInfo.get()];239 [delegate actionSheetAssistant:self willStartInteractionWithElement:_elementInfo.get()]; 241 240 } 242 241 … … 250 249 return; 251 250 252 const auto& positionInformation = [delegate positionInformation ];251 const auto& positionInformation = [delegate positionInformationForActionSheetAssistant:self]; 253 252 254 253 NSURL *targetURL = [NSURL URLWithString:positionInformation.url]; … … 266 265 URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]); 267 266 268 RetainPtr<NSArray> actions = [delegate action sForElement:elementInfo.get() defaultActions:WTF::move(defaultActions)];267 RetainPtr<NSArray> actions = [delegate actionSheetAssistant:self decideActionsForElement:elementInfo.get() defaultActions:WTF::move(defaultActions)]; 269 268 270 269 if (![actions count]) … … 290 289 return; 291 290 292 const auto& positionInformation = [delegate positionInformation ];291 const auto& positionInformation = [delegate positionInformationForActionSheetAssistant:self]; 293 292 294 293 NSURL *targetURL = [NSURL URLWithString:positionInformation.url]; … … 306 305 URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]); 307 306 308 RetainPtr<NSArray> actions = [delegate action sForElement:elementInfo.get() defaultActions:WTF::move(defaultActions)];307 RetainPtr<NSArray> actions = [delegate actionSheetAssistant:self decideActionsForElement:elementInfo.get() defaultActions:WTF::move(defaultActions)]; 309 308 310 309 if (![actions count]) … … 329 328 return; 330 329 331 NSURL *targetURL = [NSURL URLWithString:[delegate positionInformation ].url];330 NSURL *targetURL = [NSURL URLWithString:[delegate positionInformationForActionSheetAssistant:self].url]; 332 331 if (!targetURL) 333 332 return; … … 367 366 - (void)cleanupSheet 368 367 { 369 [_delegate.get() stopInteraction];368 [_delegate.get() actionSheetAssistantDidStopInteraction:self]; 370 369 371 370 [_interactionSheet doneWithSheet]; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r174885 r175577 2689 2689 #pragma mark - Implementation of WKActionSheetAssistantDelegate. 2690 2690 2691 - (void)updatePositionInformation 2691 - (const WebKit::InteractionInformationAtPosition&)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant 2692 { 2693 return _positionInformation; 2694 } 2695 2696 - (void)updatePositionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant 2692 2697 { 2693 2698 _hasValidPositionInformation = NO; … … 2695 2700 } 2696 2701 2697 - (void) performAction:(WebKit::SheetAction)action2702 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:(WebKit::SheetAction)action 2698 2703 { 2699 2704 _page->performActionOnElement((uint32_t)action); 2700 2705 } 2701 2706 2702 - (void) openElementAtLocation:(CGPoint)location2707 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location 2703 2708 { 2704 2709 [self _attemptClickAtLocation:location]; 2705 2710 } 2706 2711 2707 - (RetainPtr<NSArray>)action sForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions2712 - (RetainPtr<NSArray>)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr<NSArray>)defaultActions 2708 2713 { 2709 2714 return _page->uiClient().actionsForElement(element, WTF::move(defaultActions)); 2710 2715 } 2711 2716 2712 - (void) startInteractionWithElement:(_WKActivatedElementInfo *)element2717 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant willStartInteractionWithElement:(_WKActivatedElementInfo *)element 2713 2718 { 2714 2719 _page->startInteractionWithElementAtPosition(_positionInformation.point); 2715 2720 } 2716 2721 2717 - (void) stopInteraction2722 - (void)actionSheetAssistantDidStopInteraction:(WKActionSheetAssistant *)assistant 2718 2723 { 2719 2724 _page->stopInteraction();
Note: See TracChangeset
for help on using the changeset viewer.