Title: [216152] trunk/Source
Revision
216152
Author
timothy_hor...@apple.com
Date
2017-05-03 16:00:02 -0700 (Wed, 03 May 2017)

Log Message

Maintain interaction information URL as a URL, not a string
https://bugs.webkit.org/show_bug.cgi?id=171623

Reviewed by Simon Fraser.

No new tests, not a behavior change.

* platform/URL.h:

* Shared/ios/InteractionInformationAtPosition.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showAttachmentSheet]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
(-[WKContentView _dataForPreviewItemController:atPosition:type:]):
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
(-[WKPDFView actionSheetAssistant:performAction:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216151 => 216152)


--- trunk/Source/WebCore/ChangeLog	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebCore/ChangeLog	2017-05-03 23:00:02 UTC (rev 216152)
@@ -1,3 +1,14 @@
+2017-05-03  Tim Horton  <timothy_hor...@apple.com>
+
+        Maintain interaction information URL as a URL, not a string
+        https://bugs.webkit.org/show_bug.cgi?id=171623
+
+        Reviewed by Simon Fraser.
+
+        No new tests, not a behavior change.
+
+        * platform/URL.h:
+
 2017-05-03  Yoav Weiss  <y...@yoav.ws>
 
         Link preload HTMLPreloadScanner support

Modified: trunk/Source/WebCore/platform/URL.h (216151 => 216152)


--- trunk/Source/WebCore/platform/URL.h	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebCore/platform/URL.h	2017-05-03 23:00:02 UTC (rev 216152)
@@ -72,7 +72,7 @@
     URL(const URL& base, const String& relative, const TextEncoding&);
 
     static URL fakeURLWithRelativePart(const String&);
-    static URL fileURLWithFileSystemPath(const String&);
+    WEBCORE_EXPORT static URL fileURLWithFileSystemPath(const String&);
 
     String strippedForUseAsReferrer() const;
 

Modified: trunk/Source/WebKit2/ChangeLog (216151 => 216152)


--- trunk/Source/WebKit2/ChangeLog	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebKit2/ChangeLog	2017-05-03 23:00:02 UTC (rev 216152)
@@ -1,3 +1,21 @@
+2017-05-03  Tim Horton  <timothy_hor...@apple.com>
+
+        Maintain interaction information URL as a URL, not a string
+        https://bugs.webkit.org/show_bug.cgi?id=171623
+
+        Reviewed by Simon Fraser.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _showAttachmentSheet]):
+        (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
+        (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
+        (-[WKPDFView actionSheetAssistant:performAction:]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getPositionInformation):
+
 2017-05-03  Simon Fraser  <simon.fra...@apple.com>
 
         Have WKWebView call _updateVisibleContentRects for the current transaction if possible, rather than always delaying

Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h (216151 => 216152)


--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h	2017-05-03 23:00:02 UTC (rev 216152)
@@ -33,6 +33,7 @@
 #include <WebCore/IntPoint.h>
 #include <WebCore/SelectionRect.h>
 #include <WebCore/TextIndicator.h>
+#include <WebCore/URL.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -56,7 +57,7 @@
     bool isDataDetectorLink { false };
 #endif
     WebCore::FloatPoint adjustedPointForNodeRespondingToClickEvents;
-    String url;
+    WebCore::URL url;
     String imageURL;
     String title;
     String idAttribute;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (216151 => 216152)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-05-03 23:00:02 UTC (rev 216152)
@@ -1267,7 +1267,7 @@
     if (![uiDelegate respondsToSelector:@selector(_webView:showCustomSheetForElement:)])
         return;
 
-    auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
+    auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)_positionInformation.url location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
     [uiDelegate _webView:_webView showCustomSheetForElement:element.get()];
 }
 
@@ -4225,19 +4225,18 @@
     if (!_positionInformation.isLink && !_positionInformation.isImage && !_positionInformation.isAttachment)
         return NO;
 
-    String absoluteLinkURL = _positionInformation.url;
+    const URL& linkURL = _positionInformation.url;
     if (_positionInformation.isLink) {
-        NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.url];
         id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);
         if ([uiDelegate respondsToSelector:@selector(webView:shouldPreviewElement:)]) {
-            auto previewElementInfo = adoptNS([[WKPreviewElementInfo alloc] _initWithLinkURL:targetURL]);
+            auto previewElementInfo = adoptNS([[WKPreviewElementInfo alloc] _initWithLinkURL:(NSURL *)linkURL]);
             return [uiDelegate webView:_webView shouldPreviewElement:previewElementInfo.get()];
         }
-        if (absoluteLinkURL.isEmpty())
+        if (linkURL.isEmpty())
             return NO;
-        if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL))
+        if (linkURL.protocolIsInHTTPFamily())
             return YES;
-        if ([[getDDDetectionControllerClass() tapAndHoldSchemes] containsObject:targetURL.scheme.lowercaseString])
+        if ([[getDDDetectionControllerClass() tapAndHoldSchemes] containsObject:linkURL.protocol().toString().convertToASCIILowercase()])
             return YES;
         return NO;
     }
@@ -4267,8 +4266,8 @@
     if (!canShowLinkPreview && !canShowImagePreview && !canShowAttachmentPreview)
         return nil;
 
-    String absoluteLinkURL = _positionInformation.url;
-    if (!useImageURLForLink && (absoluteLinkURL.isEmpty() || (!WebCore::protocolIsInHTTPFamily(absoluteLinkURL) && !_positionInformation.isDataDetectorLink))) {
+    const URL& linkURL = _positionInformation.url;
+    if (!useImageURLForLink && (linkURL.isEmpty() || (!linkURL.protocolIsInHTTPFamily() && !_positionInformation.isDataDetectorLink))) {
         if (canShowLinkPreview && !canShowImagePreview)
             return nil;
         canShowLinkPreview = NO;
@@ -4280,7 +4279,7 @@
         if (useImageURLForLink)
             dataForPreview[UIPreviewDataLink] = [NSURL _web_URLWithWTFString:_positionInformation.imageURL];
         else
-            dataForPreview[UIPreviewDataLink] = [NSURL _web_URLWithWTFString:_positionInformation.url];
+            dataForPreview[UIPreviewDataLink] = (NSURL *)linkURL;
         if (_positionInformation.isDataDetectorLink) {
             NSDictionary *context = nil;
             if ([uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)])
@@ -4311,7 +4310,7 @@
     } else if (canShowAttachmentPreview) {
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
         *type = UIPreviewItemTypeAttachment;
-        auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
+        auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)linkURL location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
         NSUInteger index = [uiDelegate _webView:_webView indexIntoAttachmentListForElement:element.get()];
         if (index != NSNotFound) {
             BOOL sourceIsManaged = NO;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm (216151 => 216152)


--- trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2017-05-03 23:00:02 UTC (rev 216152)
@@ -695,7 +695,7 @@
 
     _positionInformation.request.point = roundedIntPoint([controller.pageView convertPoint:point toView:self]);
 
-    _positionInformation.url = ""
+    _positionInformation.url = ""
     _positionInformation.bounds = roundedIntRect([self convertRect:[controller.pageView convertRectFromPDFPageSpace:annotation.Rect] fromView:controller.pageView]);
 
     [self _highlightLinkAnnotation:linkAnnotation forDuration:.75 completionHandler:^{
@@ -716,8 +716,8 @@
         return;
 
     NSDictionary *representations = @{
-        (NSString *)kUTTypeUTF8PlainText : _positionInformation.url,
-        (NSString *)kUTTypeURL : [NSURL URLWithString:_positionInformation.url]
+        (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url,
+        (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url
     };
 
     [UIPasteboard generalPasteboard].items = @[ representations ];

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (216151 => 216152)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-05-03 22:36:29 UTC (rev 216151)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-05-03 23:00:02 UTC (rev 216152)
@@ -2524,7 +2524,7 @@
                 }
             }
             if (linkElement)
-                info.url = "" *)linkElement->document().completeURL(stripLeadingAndTrailingHTMLSpaces(linkElement->getAttribute(HTMLNames::hrefAttr))) absoluteString];
+                info.url = ""
             info.title = element->attributeWithoutSynchronization(HTMLNames::titleAttr).string();
             if (linkElement && info.title.isEmpty())
                 info.title = element->innerText();
@@ -2559,7 +2559,7 @@
                 const HTMLAttachmentElement& attachment = downcast<HTMLAttachmentElement>(*hitNode);
                 info.title = attachment.attachmentTitle();
                 if (attachment.file())
-                    info.url = ""
+                    info.url = ""
             } else {
                 info.isSelectable = renderer->style().userSelect() != SELECT_NONE;
                 if (info.isSelectable && !hitNode->isTextNode())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to