Diff
Modified: trunk/Source/WebKit2/ChangeLog (198445 => 198446)
--- trunk/Source/WebKit2/ChangeLog 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-18 22:35:33 UTC (rev 198446)
@@ -1,3 +1,32 @@
+2016-03-18 Enrica Casucci <[email protected]>
+
+ Add id attribute to _WKActivatedElementInfo.
+ https://bugs.webkit.org/show_bug.cgi?id=155666
+ rdar://problem/25181956
+
+ Reviewed by Beth Dakin.
+
+ * Shared/ios/InteractionInformationAtPosition.h:
+ * Shared/ios/InteractionInformationAtPosition.mm:
+ (WebKit::InteractionInformationAtPosition::encode):
+ (WebKit::InteractionInformationAtPosition::decode):
+ * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
+ * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
+ (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]):
+ (-[_WKActivatedElementInfo ID]):
+ (-[_WKActivatedElementInfo _initWithType:URL:location:title:rect:image:]): Deleted.
+ * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
+ * UIProcess/ios/WKActionSheetAssistant.mm:
+ (-[WKActionSheetAssistant showImageSheet]):
+ (-[WKActionSheetAssistant showLinkSheet]):
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _showAttachmentSheet]):
+ (-[WKContentView _showLinkSheet]):
+ (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
+ (-[WKContentView _presentedViewControllerForPreviewItemController:]):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::getPositionInformation):
+
2016-03-18 Antti Koivisto <[email protected]>
Protect against excessive cache traversal
Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h (198445 => 198446)
--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h 2016-03-18 22:35:33 UTC (rev 198446)
@@ -54,6 +54,7 @@
String url;
String imageURL;
String title;
+ String idAttribute;
WebCore::IntRect bounds;
RefPtr<ShareableBitmap> image;
String textBefore;
Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm (198445 => 198446)
--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm 2016-03-18 22:35:33 UTC (rev 198446)
@@ -54,6 +54,7 @@
encoder << url;
encoder << imageURL;
encoder << title;
+ encoder << idAttribute;
encoder << bounds;
encoder << textBefore;
encoder << textAfter;
@@ -119,6 +120,9 @@
if (!decoder.decode(result.title))
return false;
+ if (!decoder.decode(result.idAttribute))
+ return false;
+
if (!decoder.decode(result.bounds))
return false;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h (198445 => 198446)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h 2016-03-18 22:35:33 UTC (rev 198446)
@@ -46,6 +46,7 @@
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, readonly) _WKActivatedElementType type;
@property (nonatomic, readonly) CGRect boundingRect;
+@property (nonatomic, readonly) NSString *ID WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
#if TARGET_OS_IPHONE
@property (nonatomic, readonly, copy) UIImage *image;
#else
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm (198445 => 198446)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm 2016-03-18 22:35:33 UTC (rev 198446)
@@ -43,6 +43,7 @@
RetainPtr<NSURL> _URL;
RetainPtr<NSString> _title;
CGPoint _interactionLocation;
+ RetainPtr<NSString> _ID;
RefPtr<WebKit::ShareableBitmap> _image;
#if PLATFORM(IOS)
RetainPtr<UIImage> _uiImage;
@@ -52,7 +53,7 @@
#endif
}
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url location:(CGPoint)location title:(NSString *)title rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url location:(CGPoint)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image
{
if (!(self = [super init]))
return nil;
@@ -63,6 +64,7 @@
_boundingRect = rect;
_type = type;
_image = image;
+ _ID = ID;
return self;
}
@@ -77,6 +79,11 @@
return _title.get();
}
+- (NSString *)ID
+{
+ return _ID.get();
+}
+
- (CGPoint)_interactionLocation
{
return _interactionLocation;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h (198445 => 198446)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h 2016-03-18 22:35:33 UTC (rev 198446)
@@ -33,7 +33,7 @@
@interface _WKActivatedElementInfo ()
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url location:(CGPoint)location title:(NSString *)title rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image;
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url location:(CGPoint)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image;
@property (nonatomic, readonly) CGPoint _interactionLocation;
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm (198445 => 198446)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2016-03-18 22:35:33 UTC (rev 198446)
@@ -280,7 +280,7 @@
const auto& positionInformation = [delegate positionInformationForActionSheetAssistant:self];
NSURL *targetURL = [NSURL _web_URLWithWTFString:positionInformation.url];
- auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:positionInformation.point title:positionInformation.title ID:positionInformation.idAttribute rect:positionInformation.bounds image:positionInformation.image.get()]);
if ([delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] && [delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()])
return;
auto defaultActions = [self defaultActionsForImageSheet:elementInfo.get()];
@@ -396,7 +396,7 @@
if (!targetURL)
return;
- auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:positionInformation.point title:positionInformation.title ID:positionInformation.idAttribute rect:positionInformation.bounds image:positionInformation.image.get()]);
if ([delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] && [delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()])
return;
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (198445 => 198446)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-03-18 22:35:33 UTC (rev 198446)
@@ -1123,7 +1123,7 @@
id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);
if ([uiDelegate respondsToSelector:@selector(_webView:showCustomSheetForElement:)])
- [uiDelegate _webView:_webView showCustomSheetForElement:[[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:nil]];
+ [uiDelegate _webView:_webView showCustomSheetForElement:[[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]];
}
- (void)_showLinkSheet
@@ -3885,7 +3885,7 @@
// FIXME: Should use UIKit constants.
enum { WKUIPreviewItemTypeAttachment = 5 };
*type = static_cast<UIPreviewItemType>(WKUIPreviewItemTypeAttachment);
- const auto& element = [[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:nil];
+ const auto& element = [[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil];
dataForPreview[@"UIPreviewDataAttachmentList"] = [uiDelegate _attachmentListForWebView:_webView];
dataForPreview[@"UIPreviewDataAttachmentIndex"] = [NSNumber numberWithUnsignedInteger:[uiDelegate _webView:_webView indexIntoAttachmentListForElement:element]];
}
@@ -3932,7 +3932,7 @@
// Treat animated images like a link preview
if (isValidURLForImagePreview && _positionInformation.isAnimatedImage) {
- RetainPtr<_WKActivatedElementInfo> animatedImageElementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ RetainPtr<_WKActivatedElementInfo> animatedImageElementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get()]);
if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForAnimatedImageAtURL:defaultActions:elementInfo:imageSize:)]) {
RetainPtr<NSArray> actions = [_actionSheetAssistant defaultActionsForImageSheet:animatedImageElementInfo.get()];
@@ -3940,7 +3940,7 @@
}
}
- RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:_positionInformation.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get()]);
auto actions = [_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()];
if ([uiDelegate respondsToSelector:@selector(webView:previewingViewControllerForElement:defaultActions:)]) {
@@ -3968,7 +3968,7 @@
if (!isValidURLForImagePreview)
return nil;
- RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:_positionInformation.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get()]);
_page->startInteractionWithElementAtPosition(_positionInformation.point);
if ([uiDelegate respondsToSelector:@selector(_webView:willPreviewImageWithURL:)])
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (198445 => 198446)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-03-18 22:35:26 UTC (rev 198445)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2016-03-18 22:35:33 UTC (rev 198446)
@@ -2193,6 +2193,7 @@
Element* element = is<Element>(*hitNode) ? downcast<Element>(hitNode) : nullptr;
if (element) {
info.isElement = true;
+ info.idAttribute = element->getIdAttribute();
Element* linkElement = nullptr;
if (element->renderer() && element->renderer()->isRenderImage()) {
elementIsLinkOrImage = true;