Changeset 246697 in webkit
- Timestamp:
- Jun 21, 2019 2:22:51 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246694 r246697 1 2019-06-21 Tim Horton <timothy_horton@apple.com> 2 3 WebKit context menu highlights include extra padding 4 https://bugs.webkit.org/show_bug.cgi?id=199080 5 <rdar://problem/51140126> 6 7 Reviewed by Dean Jackson. 8 9 * Shared/ios/InteractionInformationRequest.cpp: 10 (WebKit::InteractionInformationRequest::encode const): 11 (WebKit::InteractionInformationRequest::decode): 12 (WebKit::InteractionInformationRequest::isValidForRequest): 13 (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest): 14 * Shared/ios/InteractionInformationRequest.h: 15 * UIProcess/ios/WKContentViewInteraction.mm: 16 (-[WKContentView gestureRecognizerShouldBegin:]): 17 (-[WKContentView positionInformationForActionSheetAssistant:]): 18 (-[WKContentView updatePositionInformationForActionSheetAssistant:]): 19 (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): 20 (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]): 21 * WebProcess/WebPage/ios/WebPageIOS.mm: 22 (WebKit::linkIndicatorPositionInformation): 23 Disable the margin going forward, but leave it if we're using the legacy 24 API, because there is no way to add margin at the platform level with 25 the legacy API. 26 27 In the future we should always have no margin in our indicator, and just 28 apply it in whatever consumes the indicator, so that there is no 29 disagreement between clients about the size of the margin. 30 1 31 2019-06-21 Youenn Fablet <youenn@apple.com> 2 32 -
trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.cpp
r242968 r246697 39 39 encoder << includeSnapshot; 40 40 encoder << includeLinkIndicator; 41 encoder << linkIndicatorShouldHaveLegacyMargins; 41 42 encoder << readonly; 42 43 } … … 51 52 52 53 if (!decoder.decode(result.includeLinkIndicator)) 54 return false; 55 56 if (!decoder.decode(result.linkIndicatorShouldHaveLegacyMargins)) 53 57 return false; 54 58 … … 70 74 return false; 71 75 76 if (other.linkIndicatorShouldHaveLegacyMargins != linkIndicatorShouldHaveLegacyMargins) 77 return false; 78 72 79 if (!other.readonly && readonly) 73 80 return false; … … 86 93 if (!other.readonly && readonly) 87 94 return false; 95 96 if (other.linkIndicatorShouldHaveLegacyMargins != linkIndicatorShouldHaveLegacyMargins) 97 return false; 88 98 89 99 return (other.point - point).diagonalLengthSquared() <= 4; -
trunk/Source/WebKit/Shared/ios/InteractionInformationRequest.h
r242968 r246697 43 43 bool includeLinkIndicator { false }; 44 44 45 bool linkIndicatorShouldHaveLegacyMargins { false }; 46 45 47 // FIXME: This readonly flag ought to be true by default, but there are a number of interactions (e.g. selection) that currently 46 48 // rely on the fact that interaction information requests additionally change the focused frame. We should explicitly turn the -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r246693 r246697 525 525 - (void)_didStartProvisionalLoadForMainFrame; 526 526 527 @property (nonatomic, readonly, getter=_shouldUseContextMenus) BOOL _shouldUseContextMenus; 528 527 529 @end 528 530 … … 549 551 @interface WKContentView (WKInteractionPreview) <UIPreviewItemDelegate> 550 552 #endif 551 - (bool)_shouldUseContextMenus;552 553 - (void)_registerPreview; 553 554 - (void)_unregisterPreview; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246693 r246697 771 771 772 772 #if HAVE(LINK_PREVIEW) 773 if (! [self _shouldUseContextMenus]) {773 if (!self._shouldUseContextMenus) { 774 774 [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()]; 775 775 [self _createAndConfigureLongPressGestureRecognizer]; … … 2067 2067 request.includeSnapshot = true; 2068 2068 request.includeLinkIndicator = true; 2069 request.linkIndicatorShouldHaveLegacyMargins = !self._shouldUseContextMenus; 2069 2070 } 2070 2071 … … 6075 6076 request.includeSnapshot = true; 6076 6077 request.includeLinkIndicator = assistant.needsLinkIndicator; 6078 request.linkIndicatorShouldHaveLegacyMargins = !self._shouldUseContextMenus; 6077 6079 if (![self ensurePositionInformationIsUpToDate:request]) 6078 6080 return WTF::nullopt; … … 6087 6089 request.includeSnapshot = true; 6088 6090 request.includeLinkIndicator = assistant.needsLinkIndicator; 6091 request.linkIndicatorShouldHaveLegacyMargins = !self._shouldUseContextMenus; 6089 6092 6090 6093 [self requestAsynchronousPositionInformationUpdate:request]; … … 6203 6206 } else 6204 6207 completion(nil, nil); 6208 } 6209 6210 - (BOOL)_shouldUseContextMenus 6211 { 6212 #if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU) 6213 return linkedOnOrAfter(WebKit::SDKVersion::FirstThatHasUIContextMenuInteraction); 6214 #endif 6215 return NO; 6205 6216 } 6206 6217 … … 7383 7394 #if HAVE(LINK_PREVIEW) 7384 7395 if ([userInterfaceItem isEqualToString:@"linkPreviewPopoverContents"]) { 7385 if ( [self _shouldUseContextMenus])7396 if (self._shouldUseContextMenus) 7386 7397 return @{ userInterfaceItem: @{ @"pageURL": WTF::userVisibleString(_positionInformation.url) } }; 7387 7398 … … 7428 7439 @implementation WKContentView (WKInteractionPreview) 7429 7440 7430 - (bool)_shouldUseContextMenus 7431 { 7441 - (void)_registerPreview 7442 { 7443 if (!_webView.allowsLinkPreview) 7444 return; 7445 7432 7446 #if USE(UICONTEXTMENU) 7433 return linkedOnOrAfter(WebKit::SDKVersion::FirstThatHasUIContextMenuInteraction); 7434 #endif 7435 return false; 7436 } 7437 7438 - (void)_registerPreview 7439 { 7440 if (!_webView.allowsLinkPreview) 7441 return; 7442 7443 #if USE(UICONTEXTMENU) 7444 if ([self _shouldUseContextMenus]) { 7447 if (self._shouldUseContextMenus) { 7445 7448 _contextMenuInteraction = adoptNS([[UIContextMenuInteraction alloc] initWithDelegate:self]); 7446 7449 _contextMenuHasRequestedLegacyData = NO; … … 7461 7464 #endif 7462 7465 7463 if (!_webView.allowsLinkPreview)7464 return;7465 7466 7466 _previewItemController = adoptNS([[UIPreviewItemController alloc] initWithView:self]); 7467 7467 [_previewItemController setDelegate:self]; … … 7474 7474 { 7475 7475 #if USE(UICONTEXTMENU) 7476 if ( [self _shouldUseContextMenus]) {7476 if (self._shouldUseContextMenus) { 7477 7477 if (!_contextMenuInteraction) 7478 7478 return; … … 7713 7713 request.includeSnapshot = true; 7714 7714 request.includeLinkIndicator = true; 7715 request.linkIndicatorShouldHaveLegacyMargins = !self._shouldUseContextMenus; 7715 7716 7716 7717 [self doAfterPositionInformationUpdate:[weakSelf = WeakObjCPtr<WKContentView>(self), completion = makeBlockPtr(completion)] (WebKit::InteractionInformationAtPosition) { … … 8068 8069 request.includeSnapshot = true; 8069 8070 request.includeLinkIndicator = true; 8071 request.linkIndicatorShouldHaveLegacyMargins = !self._shouldUseContextMenus; 8070 8072 if (![self ensurePositionInformationIsUpToDate:request]) 8071 8073 return NO; -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r246535 r246697 2493 2493 auto linkRange = rangeOfContents(linkElement); 2494 2494 float deviceScaleFactor = page.corePage()->deviceScaleFactor(); 2495 const float marginInPoints = 4;2495 const float marginInPoints = request.linkIndicatorShouldHaveLegacyMargins ? 4 : 0; 2496 2496 2497 2497 auto textIndicator = TextIndicator::createWithRange(linkRange.get(),
Note: See TracChangeset
for help on using the changeset viewer.