Changeset 219287 in webkit
- Timestamp:
- Jul 10, 2017 3:04:53 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r219283 r219287 1 2017-07-10 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [WK2] Action sheets for links fail to present in WebKit2 PDF view 4 https://bugs.webkit.org/show_bug.cgi?id=174307 5 <rdar://problem/31412128> 6 7 Reviewed by Tim Horton. 8 9 Currently, presenting an action sheet for a link always uses the WKActionSheetPresentAtClosestIndicatorRect 10 codepath, which requires text indicator data for the link. However, when showing an action sheet for a link via 11 WKPDFView, a text indicator for the link is not included, so the popover rect ends up being an empty rect at the 12 origin, which causes us to bail from presenting the popover. 13 14 To address this, we tweak our heuristic for determining which action sheet presentation style to use, so that we 15 only use the closest indicator rect for a link if the text indicator data is also present (otherwise, we fall 16 back to using the element rect). All other behavior is the same. 17 18 * UIProcess/ios/WKActionSheetAssistant.mm: 19 (-[WKActionSheetAssistant showImageSheet]): 20 (presentationStyleForView): 21 22 Refactor _shouldPresentAtTouchLocationForElementRect into presentationStyleForView, a static function that 23 returns a WKActionSheetPresentationStyle. 24 25 (-[WKActionSheetAssistant showLinkSheet]): 26 (-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]): Deleted. 27 1 28 2017-07-09 Brady Eidson <beidson@apple.com> 2 29 -
trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm
r219191 r219287 372 372 _elementInfo = WTFMove(elementInfo); 373 373 374 if (![_interactionSheet presentSheet: [self _shouldPresentAtTouchLocationForElementRect:elementBounds] ? WKActionSheetPresentAtTouchLocation : WKActionSheetPresentAtElementRect])374 if (![_interactionSheet presentSheet:presentationStyleForView(_view.getAutoreleased(), _positionInformation.value(), _elementInfo.get())]) 375 375 [self cleanupSheet]; 376 376 }; … … 394 394 } 395 395 396 - (BOOL)_shouldPresentAtTouchLocationForElementRect:(CGRect)elementRect 397 { 398 UIView *view = _view.getAutoreleased(); 399 auto apparentElementRect = [view convertRect:elementRect toView:view.window]; 396 static WKActionSheetPresentationStyle presentationStyleForView(UIView *view, const InteractionInformationAtPosition& positionInfo, _WKActivatedElementInfo *elementInfo) 397 { 398 auto apparentElementRect = [view convertRect:positionInfo.bounds toView:view.window]; 400 399 auto windowRect = view.window.bounds; 401 400 apparentElementRect = CGRectIntersection(apparentElementRect, windowRect); … … 409 408 // Otherwise, there is not enough space to position the popover around the element, so revert to using the touch location instead. 410 409 static const CGFloat minimumAvailableWidthOrHeightRatio = 0.4; 411 return std::max(leftInset, rightInset) <= minimumAvailableWidthOrHeightRatio * CGRectGetWidth(windowRect) && std::max(topInset, bottomInset) <= minimumAvailableWidthOrHeightRatio * CGRectGetHeight(windowRect); 410 if (std::max(leftInset, rightInset) <= minimumAvailableWidthOrHeightRatio * CGRectGetWidth(windowRect) && std::max(topInset, bottomInset) <= minimumAvailableWidthOrHeightRatio * CGRectGetHeight(windowRect)) 411 return WKActionSheetPresentAtTouchLocation; 412 413 if (elementInfo.type == _WKActivatedElementTypeLink && positionInfo.linkIndicator.textRectsInBoundingRectCoordinates.size()) 414 return WKActionSheetPresentAtClosestIndicatorRect; 415 416 return WKActionSheetPresentAtElementRect; 412 417 } 413 418 … … 531 536 _elementInfo = WTFMove(elementInfo); 532 537 533 if (![_interactionSheet presentSheet: [self _shouldPresentAtTouchLocationForElementRect:_positionInformation->bounds] ? WKActionSheetPresentAtTouchLocation : WKActionSheetPresentAtClosestIndicatorRect])538 if (![_interactionSheet presentSheet:presentationStyleForView(_view.getAutoreleased(), _positionInformation.value(), _elementInfo.get())]) 534 539 [self cleanupSheet]; 535 540 }
Note: See TracChangeset
for help on using the changeset viewer.