Diff
Modified: trunk/Source/WebCore/ChangeLog (287958 => 287959)
--- trunk/Source/WebCore/ChangeLog 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebCore/ChangeLog 2022-01-13 00:00:15 UTC (rev 287959)
@@ -1,3 +1,19 @@
+2022-01-12 Megan Gardner <megan_gard...@apple.com>
+
+ Add to Contact menu item does nothing on mac.
+ https://bugs.webkit.org/show_bug.cgi?id=235154
+
+ Reviewed by Tim Horton.
+
+ Add to Context menu item for telephone numbers did not actually show the contact card.
+ This was because the delgate did not tell the menu where to display the card from, so it just failed.
+ Plumbing that information through fixes the issue.
+
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::handleTelephoneNumberClick):
+ * page/mac/ServicesOverlayController.mm:
+ (WebCore::ServicesOverlayController::handleClick):
+
2022-01-12 Wenson Hsieh <wenson_hs...@apple.com>
Live Text is sometimes horizontally clipped when injecting TextRecognitionBlockData
Modified: trunk/Source/WebCore/page/ChromeClient.h (287958 => 287959)
--- trunk/Source/WebCore/page/ChromeClient.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebCore/page/ChromeClient.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -524,7 +524,7 @@
#endif
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
- virtual void handleTelephoneNumberClick(const String&, const IntPoint&) { }
+ virtual void handleTelephoneNumberClick(const String&, const IntPoint&, const IntRect&) { }
#endif
#if ENABLE(DATA_DETECTION)
Modified: trunk/Source/WebCore/page/mac/ServicesOverlayController.mm (287958 => 287959)
--- trunk/Source/WebCore/page/mac/ServicesOverlayController.mm 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebCore/page/mac/ServicesOverlayController.mm 2022-01-13 00:00:15 UTC (rev 287959)
@@ -647,7 +647,7 @@
m_page.chrome().client().handleSelectionServiceClick(CheckedRef(m_page.focusController())->focusedOrMainFrame().selection(), selectedTelephoneNumbers, windowPoint);
} else if (highlight.type() == DataDetectorHighlight::Type::TelephoneNumber)
- m_page.chrome().client().handleTelephoneNumberClick(plainText(highlight.range()), windowPoint);
+ m_page.chrome().client().handleTelephoneNumberClick(plainText(highlight.range()), windowPoint, frameView->contentsToWindow(CheckedRef(m_page.focusController())->focusedOrMainFrame().editor().firstRectForRange(highlight.range())));
}
Frame& ServicesOverlayController::mainFrame() const
Modified: trunk/Source/WebKit/ChangeLog (287958 => 287959)
--- trunk/Source/WebKit/ChangeLog 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/ChangeLog 2022-01-13 00:00:15 UTC (rev 287959)
@@ -1,3 +1,34 @@
+2022-01-12 Megan Gardner <megan_gard...@apple.com>
+
+ Add to Contact menu item does nothing on mac.
+ https://bugs.webkit.org/show_bug.cgi?id=235154
+ rdar://80213097
+
+ Reviewed by Tim Horton.
+
+ Add to Context menu item for telephone numbers did not actually show the contact card.
+ This was because the delgate did not tell the menu where to display the card from, so it just failed.
+ Plumbing that information through fixes the issue.
+
+ * Platform/mac/MenuUtilities.h:
+ * Platform/mac/MenuUtilities.mm:
+ (-[WKEmptyPresenterHighlightDelegate initWithRect:]):
+ (-[WKEmptyPresenterHighlightDelegate revealContext:rectsForItem:]):
+ (-[WKEmptyPresenterHighlightDelegate revealContext:shouldUseDefaultHighlightForItem:]):
+ (WebKit::menuForTelephoneNumber):
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/mac/PageClientImplMac.h:
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::showTelephoneNumberMenu):
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::handleTelephoneNumberClick):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::handleTelephoneNumberClick):
+
2022-01-12 J Pascoe <j_pas...@apple.com>
[WebAuthn] Fix freebie call without user gesture not being given
Modified: trunk/Source/WebKit/Platform/mac/MenuUtilities.h (287958 => 287959)
--- trunk/Source/WebKit/Platform/mac/MenuUtilities.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/Platform/mac/MenuUtilities.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -26,6 +26,7 @@
#ifndef MenuUtilities_h
#define MenuUtilities_h
+#import <WebCore/IntRect.h>
#import <wtf/text/WTFString.h>
namespace WebKit {
@@ -32,7 +33,7 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber);
-RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber);
+RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber, NSView *webView, const WebCore::IntRect&);
NSString *menuItemTitleForTelephoneNumberGroup();
#endif
Modified: trunk/Source/WebKit/Platform/mac/MenuUtilities.mm (287958 => 287959)
--- trunk/Source/WebKit/Platform/mac/MenuUtilities.mm 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/Platform/mac/MenuUtilities.mm 2022-01-13 00:00:15 UTC (rev 287959)
@@ -44,15 +44,37 @@
#import <pal/mac/DataDetectorsSoftLink.h>
@interface WKEmptyPresenterHighlightDelegate : NSObject <RVPresenterHighlightDelegate>
+
+- (instancetype)initWithRect:(NSRect)rect;
+
+@property NSRect rect;
+
@end
@implementation WKEmptyPresenterHighlightDelegate
+- (instancetype)initWithRect:(NSRect)rect
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _rect = rect;
+ return self;
+}
+
+
- (NSArray <NSValue *> *)revealContext:(RVPresentingContext *)context rectsForItem:(RVItem *)item
{
- return @[ ];
+ return @[ [NSValue valueWithRect:self.rect] ];
}
+- (BOOL)revealContext:(RVPresentingContext *)context shouldUseDefaultHighlightForItem:(RVItem *)item
+{
+ UNUSED_PARAM(context);
+ UNUSED_PARAM(item);
+ return NO;
+}
+
@end
namespace WebKit {
@@ -107,20 +129,21 @@
return nil;
}
-RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber)
+RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber, NSView *webView, const WebCore::IntRect& rect)
{
if (!PAL::isRevealFrameworkAvailable() || !PAL::isRevealCoreFrameworkAvailable())
return nil;
RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
- auto viewForPresenter = adoptNS([[NSView alloc] init]);
auto urlComponents = adoptNS([[NSURLComponents alloc] init]);
[urlComponents setScheme:@"tel"];
[urlComponents setPath:telephoneNumber];
auto item = adoptNS([PAL::allocRVItemInstance() initWithURL:[urlComponents URL] rangeInContext:NSMakeRange(0, telephoneNumber.length())]);
auto presenter = adoptNS([PAL::allocRVPresenterInstance() init]);
- auto delegate = adoptNS([[WKEmptyPresenterHighlightDelegate alloc] init]);
- auto context = adoptNS([PAL::allocRVPresentingContextInstance() initWithPointerLocationInView:NSZeroPoint inView:viewForPresenter.get() highlightDelegate:delegate.get()]);
+ auto delegate = adoptNS([[WKEmptyPresenterHighlightDelegate alloc] initWithRect:rect]);
+ auto context = adoptNS([PAL::allocRVPresentingContextInstance() initWithPointerLocationInView:NSZeroPoint inView:webView highlightDelegate:delegate.get()]);
+ static char wkRevealDelegateKey;
+ objc_setAssociatedObject(context.get(), &wkRevealDelegateKey, delegate.get(), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
NSArray *proposedMenuItems = [presenter menuItemsForItem:item.get() documentContext:nil presentingContext:context.get() options:nil];
[menu setItemArray:proposedMenuItems];
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (287958 => 287959)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -432,6 +432,8 @@
virtual CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const = 0;
virtual WebCore::DestinationColorSpace colorSpace() = 0;
+
+ virtual NSView *viewForPresentingRevealPopover() const = 0;
virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) = 0;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (287958 => 287959)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -2298,7 +2298,7 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
#if PLATFORM(MAC)
- void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&);
+ void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&, const WebCore::IntRect&);
#endif
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (287958 => 287959)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-01-13 00:00:15 UTC (rev 287959)
@@ -434,7 +434,7 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
#if PLATFORM(MAC)
- ShowTelephoneNumberMenu(String telephoneNumber, WebCore::IntPoint point)
+ ShowTelephoneNumberMenu(String telephoneNumber, WebCore::IntPoint point, WebCore::IntRect rect)
#endif
#endif
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (287958 => 287959)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -229,6 +229,7 @@
NSView *activeView() const;
NSWindow *activeWindow() const;
+ NSView *viewForPresentingRevealPopover() const override { return activeView(); }
void didStartProvisionalLoadForMainFrame() override;
void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (287958 => 287959)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2022-01-13 00:00:15 UTC (rev 287959)
@@ -542,9 +542,9 @@
#endif
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-void WebPageProxy::showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint& point)
+void WebPageProxy::showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint& point, const WebCore::IntRect& rect)
{
- RetainPtr<NSMenu> menu = menuForTelephoneNumber(telephoneNumber);
+ RetainPtr<NSMenu> menu = menuForTelephoneNumber(telephoneNumber, pageClient().viewForPresentingRevealPopover(), rect);
pageClient().showPlatformContextMenu(menu.get(), point);
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (287958 => 287959)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2022-01-13 00:00:15 UTC (rev 287959)
@@ -1318,9 +1318,9 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
-void WebChromeClient::handleTelephoneNumberClick(const String& number, const IntPoint& point)
+void WebChromeClient::handleTelephoneNumberClick(const String& number, const IntPoint& point, const IntRect& rect)
{
- m_page.handleTelephoneNumberClick(number, point);
+ m_page.handleTelephoneNumberClick(number, point, rect);
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (287958 => 287959)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -371,7 +371,7 @@
String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&) const final;
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
- void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&) final;
+ void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&, const WebCore::IntRect&) final;
#endif
#if ENABLE(DATA_DETECTION)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (287958 => 287959)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-01-13 00:00:15 UTC (rev 287959)
@@ -1195,7 +1195,7 @@
void getSamplingProfilerOutput(CompletionHandler<void(const String&)>&&);
#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
- void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
+ void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&, const WebCore::IntRect&);
void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
void handleImageServiceClick(const WebCore::IntPoint&, WebCore::Image&, bool isEditable, const WebCore::IntRect&, const String& attachmentID);
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (287958 => 287959)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-01-12 23:58:43 UTC (rev 287958)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-01-13 00:00:15 UTC (rev 287959)
@@ -760,9 +760,9 @@
#endif // ENABLE(WEBGL)
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-void WebPage::handleTelephoneNumberClick(const String& number, const IntPoint& point)
+void WebPage::handleTelephoneNumberClick(const String& number, const IntPoint& point, const IntRect& rect)
{
- send(Messages::WebPageProxy::ShowTelephoneNumberMenu(number, point));
+ send(Messages::WebPageProxy::ShowTelephoneNumberMenu(number, point, rect));
}
#endif