Title: [191830] trunk/Source/WebKit2
Revision
191830
Author
bda...@apple.com
Date
2015-10-30 16:59:28 -0700 (Fri, 30 Oct 2015)

Log Message

Link preview doesn't work on XHTML pages with Content-Type header as 
‘application/xhtml+xml’
https://bugs.webkit.org/show_bug.cgi?id=150740
-and corresponding-
rdar://problem/23063585

Reviewed by Tim Horton.

For XHTML pages, the element names are lowercase. This patch uses 
equalIgnoringCase to fix the bug.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _actionForLongPress]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
(-[WKContentView _dataForPreviewItemController:atPosition:type:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (191829 => 191830)


--- trunk/Source/WebKit2/ChangeLog	2015-10-30 23:56:39 UTC (rev 191829)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-30 23:59:28 UTC (rev 191830)
@@ -1,3 +1,20 @@
+2015-10-30  Beth Dakin  <bda...@apple.com>
+
+        Link preview doesn't work on XHTML pages with Content-Type header as 
+        ‘application/xhtml+xml’
+        https://bugs.webkit.org/show_bug.cgi?id=150740
+        -and corresponding-
+        rdar://problem/23063585
+
+        Reviewed by Tim Horton.
+
+        For XHTML pages, the element names are lowercase. This patch uses 
+        equalIgnoringCase to fix the bug.
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _actionForLongPress]):
+        (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
+        (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
+
 2015-10-30  Tim Horton  <timothy_hor...@apple.com>
 
         WKView being inside WKWebView leads to weird API issues

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (191829 => 191830)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-10-30 23:56:39 UTC (rev 191829)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-10-30 23:59:28 UTC (rev 191830)
@@ -1048,14 +1048,16 @@
     if (!_positionInformation.touchCalloutEnabled)
         return nil;
 
-    if (_positionInformation.clickableElementName == "IMG")
+    if (equalIgnoringCase(_positionInformation.clickableElementName, "IMG"))
         return @selector(_showImageSheet);
-    else if (_positionInformation.clickableElementName == "A") {
+
+    if (equalIgnoringCase(_positionInformation.clickableElementName, "A")) {
         NSURL *targetURL = [NSURL URLWithString:_positionInformation.url];
         if ([[getDDDetectionControllerClass() tapAndHoldSchemes] containsObject:[targetURL scheme]])
             return @selector(_showDataDetectorsSheet);
         return @selector(_showLinkSheet);
     }
+
     return nil;
 }
 
@@ -3431,11 +3433,11 @@
         return NO;
 
     [self ensurePositionInformationIsUpToDate:position];
-    if (_positionInformation.clickableElementName != "A" && _positionInformation.clickableElementName != "IMG")
+    if (equalIgnoringCase(_positionInformation.clickableElementName, "A") && equalIgnoringCase(_positionInformation.clickableElementName, "IMG"))
         return NO;
     
     String absoluteLinkURL = _positionInformation.url;
-    if (_positionInformation.clickableElementName == "A") {
+    if (equalIgnoringCase(_positionInformation.clickableElementName, "A")) {
         if (absoluteLinkURL.isEmpty())
             return NO;
         if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL))
@@ -3454,8 +3456,8 @@
 
     id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);
     BOOL supportsImagePreview = [uiDelegate respondsToSelector:@selector(_webView:commitPreviewedImageWithURL:)];
-    BOOL canShowImagePreview = _positionInformation.clickableElementName == "IMG" && supportsImagePreview;
-    BOOL canShowLinkPreview = _positionInformation.clickableElementName == "A" || canShowImagePreview;
+    BOOL canShowImagePreview = equalIgnoringCase(_positionInformation.clickableElementName, "IMG") && supportsImagePreview;
+    BOOL canShowLinkPreview = equalIgnoringCase(_positionInformation.clickableElementName, "A") || canShowImagePreview;
     BOOL useImageURLForLink = NO;
 
     if (canShowImagePreview && _positionInformation.isAnimatedImage) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to