Title: [246535] trunk/Source/WebKit
- Revision
- 246535
- Author
- d...@apple.com
- Date
- 2019-06-18 03:46:24 -0700 (Tue, 18 Jun 2019)
Log Message
Attachment elements are missing context menu previews
https://bugs.webkit.org/show_bug.cgi?id=198946
Reviewed by Tim Horton.
When requesting position information on an <attachment> element,
we were not providing a snapshot image.
* WebProcess/WebPage/WebPage.h: New common method to take a snapshot.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::shareableBitmapSnapshotForNode): New helper.
(WebKit::WebPage::positionInformation): If the element is an attachment,
then ask for a snapshot.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (246534 => 246535)
--- trunk/Source/WebKit/ChangeLog 2019-06-18 08:17:04 UTC (rev 246534)
+++ trunk/Source/WebKit/ChangeLog 2019-06-18 10:46:24 UTC (rev 246535)
@@ -1,3 +1,19 @@
+2019-06-18 Dean Jackson <d...@apple.com>
+
+ Attachment elements are missing context menu previews
+ https://bugs.webkit.org/show_bug.cgi?id=198946
+
+ Reviewed by Tim Horton.
+
+ When requesting position information on an <attachment> element,
+ we were not providing a snapshot image.
+
+ * WebProcess/WebPage/WebPage.h: New common method to take a snapshot.
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::shareableBitmapSnapshotForNode): New helper.
+ (WebKit::WebPage::positionInformation): If the element is an attachment,
+ then ask for a snapshot.
+
2019-06-17 Tim Horton <timothy_hor...@apple.com>
Expose DataDetectors context generation on WKContentViewInteraction
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (246534 => 246535)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-06-18 08:17:04 UTC (rev 246534)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-06-18 10:46:24 UTC (rev 246535)
@@ -1251,6 +1251,7 @@
void sendPositionInformation(InteractionInformationAtPosition&&);
InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
+ RefPtr<ShareableBitmap> shareableBitmapSnapshotForNode(WebCore::Element&);
WebAutocorrectionContext autocorrectionContext();
bool applyAutocorrectionInternal(const String& correction, const String& originalText);
bool shouldIgnoreMetaViewport() const;
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246534 => 246535)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-18 08:17:04 UTC (rev 246534)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-06-18 10:46:24 UTC (rev 246535)
@@ -2656,6 +2656,14 @@
}
#endif
+RefPtr<ShareableBitmap> WebPage::shareableBitmapSnapshotForNode(Element& element)
+{
+ // Ensure that the image contains at most 600K pixels, so that it is not too big.
+ if (RefPtr<WebImage> snapshot = snapshotNode(element, SnapshotOptionsShareable, 600 * 1024))
+ return &snapshot->bitmap();
+ return nullptr;
+}
+
InteractionInformationAtPosition WebPage::positionInformation(const InteractionInformationRequest& request)
{
InteractionInformationAtPosition info;
@@ -2678,16 +2686,19 @@
Element& element = downcast<Element>(*hitNode);
elementPositionInformation(*this, element, request, info);
- if (info.isLink && !info.isImage && request.includeSnapshot) {
- // Ensure that the image contains at most 600K pixels, so that it is not too big.
- if (RefPtr<WebImage> snapshot = snapshotNode(element, SnapshotOptionsShareable, 600 * 1024))
- info.image = &snapshot->bitmap();
- }
+ if (info.isLink && !info.isImage && request.includeSnapshot)
+ info.image = shareableBitmapSnapshotForNode(element);
}
- if (!(info.isLink || info.isImage))
+ if (!(info.isLink || info.isImage)) {
selectionPositionInformation(*this, request, info);
+ if (info.isAttachment && request.includeSnapshot) {
+ Element& element = downcast<Element>(*hitNode);
+ info.image = shareableBitmapSnapshotForNode(element);
+ }
+ }
+
// Prevent the callout bar from showing when tapping on the datalist button.
#if ENABLE(DATALIST_ELEMENT)
if (is<HTMLInputElement>(hitNode)) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes