Changeset 247342 in webkit
- Timestamp:
- Jul 10, 2019 9:09:52 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r247340 r247342 1 2019-07-10 Tim Horton <timothy_horton@apple.com> 2 3 Long pressing on attachments will crash the WebContent process 4 https://bugs.webkit.org/show_bug.cgi?id=199696 5 <rdar://problem/52920241> 6 7 Reviewed by Dean Jackson. 8 9 * WebProcess/WebPage/ios/WebPageIOS.mm: 10 (WebKit::linkIndicatorPositionInformation): 11 (WebKit::elementPositionInformation): 12 (WebKit::selectionPositionInformation): 13 (WebKit::WebPage::positionInformation): 14 Instead of one-off creating a node snapshot for <attachment>, just 15 use TextIndicator. This way, we get an estimated background color, 16 paint at the right resolution, etc. 17 18 Also, hitNode was often null where we were previously calling 19 shareableBitmapSnapshotForNode, because it depends on the element 20 having click event handlers. selectionPositionInformation() re-hit-tests 21 more permissively to find the <attachment>, so moving this code 22 inside that function ensures that we don't try to snapshot a null node. 23 1 24 2019-07-10 Dean Jackson <dino@apple.com> 2 25 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r247317 r247342 2524 2524 } 2525 2525 2526 static void linkIndicatorPositionInformation(WebPage& page, Element& element, Element&linkElement, const InteractionInformationRequest& request, InteractionInformationAtPosition& info)2526 static void linkIndicatorPositionInformation(WebPage& page, Element& linkElement, const InteractionInformationRequest& request, InteractionInformationAtPosition& info) 2527 2527 { 2528 2528 if (!request.includeLinkIndicator) … … 2636 2636 info.url = linkElement->document().completeURL(stripLeadingAndTrailingHTMLSpaces(linkElement->getAttribute(HTMLNames::hrefAttr))); 2637 2637 2638 linkIndicatorPositionInformation(page, element,*linkElement, request, info);2638 linkIndicatorPositionInformation(page, *linkElement, request, info); 2639 2639 #if ENABLE(DATA_DETECTION) 2640 2640 dataDetectorLinkPositionInformation(element, info); … … 2663 2663 if (is<HTMLAttachmentElement>(*hitNode)) { 2664 2664 info.isAttachment = true; 2665 constHTMLAttachmentElement& attachment = downcast<HTMLAttachmentElement>(*hitNode);2665 HTMLAttachmentElement& attachment = downcast<HTMLAttachmentElement>(*hitNode); 2666 2666 info.title = attachment.attachmentTitle(); 2667 linkIndicatorPositionInformation(page, attachment, request, info); 2667 2668 if (attachment.file()) 2668 2669 info.url = URL::fileURLWithFileSystemPath(downcast<HTMLAttachmentElement>(*hitNode).file()->path()); … … 2726 2727 } 2727 2728 2728 if (!(info.isLink || info.isImage)) {2729 if (!(info.isLink || info.isImage)) 2729 2730 selectionPositionInformation(*this, request, info); 2730 2731 if (info.isAttachment && request.includeSnapshot) {2732 Element& element = downcast<Element>(*hitNode);2733 info.image = shareableBitmapSnapshotForNode(element);2734 }2735 }2736 2731 2737 2732 // Prevent the callout bar from showing when tapping on the datalist button. -
trunk/Tools/ChangeLog
r247336 r247342 1 2019-07-10 Tim Horton <timothy_horton@apple.com> 2 3 Long pressing on attachments will crash the WebContent process 4 https://bugs.webkit.org/show_bug.cgi?id=199696 5 <rdar://problem/52920241> 6 7 Reviewed by Dean Jackson. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm: 10 (TestWebKitAPI::TEST): 11 Add a test that previously crashed. 12 1 13 2019-07-10 Dean Jackson <dino@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm
r245872 r247342 31 31 #import "TestWKWebView.h" 32 32 #import <WebKit/WKWebView.h> 33 #import <WebKit/WKWebViewConfigurationPrivate.h> 33 34 #import <WebKit/_WKActivatedElementInfo.h> 34 35 #import <wtf/RetainPtr.h> … … 135 136 } 136 137 138 TEST(WebKit, RequestActivatedElementInfoForAttachment) 139 { 140 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 141 [configuration _setAttachmentElementEnabled:YES]; 142 143 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]); 144 [webView loadHTMLString:@"<html><head><meta name='viewport' content='initial-scale=1'></head><body style='margin: 0px;'><attachment /></body></html>" baseURL:nil]; 145 [webView _test_waitForDidFinishNavigation]; 146 147 __block bool finished = false; 148 [webView _requestActivatedElementAtPosition:CGPointMake(20, 20) completionBlock:^(_WKActivatedElementInfo *elementInfo) { 149 EXPECT_TRUE(elementInfo.type == _WKActivatedElementTypeAttachment); 150 151 finished = true; 152 }]; 153 154 TestWebKitAPI::Util::run(&finished); 155 } 156 137 157 TEST(WebKit, RequestActivatedElementInfoWithNestedSynchronousUpdates) 138 158 {
Note: See TracChangeset
for help on using the changeset viewer.