[Mac] Clicking on an HTML validation bubble should dismiss it
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Nov 2016 01:08:29 +0000 (01:08 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Nov 2016 01:08:29 +0000 (01:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165117
<rdar://problem/29409837>

Reviewed by Simon Fraser.

Clicking on an HTML validation bubble should dismiss it. It previously
did nothing.

No new tests, this is not easily testable as EventSender.keyDown() sends
the event to the view, not to a particular screen location.

* platform/mac/ValidationBubbleMac.mm:
(-[WebValidationPopover mouseDown:]):
(WebCore::ValidationBubble::ValidationBubble):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/ValidationBubbleMac.mm

index 01f4f8d..fac7905 100644 (file)
@@ -1,3 +1,21 @@
+2016-11-28  Chris Dumez  <cdumez@apple.com>
+
+        [Mac] Clicking on an HTML validation bubble should dismiss it
+        https://bugs.webkit.org/show_bug.cgi?id=165117
+        <rdar://problem/29409837>
+
+        Reviewed by Simon Fraser.
+
+        Clicking on an HTML validation bubble should dismiss it. It previously
+        did nothing.
+
+        No new tests, this is not easily testable as EventSender.keyDown() sends
+        the event to the view, not to a particular screen location.
+
+        * platform/mac/ValidationBubbleMac.mm:
+        (-[WebValidationPopover mouseDown:]):
+        (WebCore::ValidationBubble::ValidationBubble):
+
 2016-11-27  Sam Weinig  <sam@webkit.org>
 
         Make CanvasRenderingContext2D use WebIDL unions / Variants for createPattern and drawImage
index 9e7de36..0ded82e 100644 (file)
 #import <AppKit/AppKit.h>
 #import <wtf/text/WTFString.h>
 
+@interface WebValidationPopover : NSPopover
+@end
+
+@implementation WebValidationPopover
+
+- (void)mouseDown:(NSEvent *)event
+{
+    UNUSED_PARAM(event);
+    [self close];
+}
+
+@end
+
 namespace WebCore {
 
 static const CGFloat horizontalPadding = 5;
@@ -59,7 +72,7 @@ ValidationBubble::ValidationBubble(NSView* view, const String& message)
     [label setFrame:NSMakeRect(horizontalPadding, verticalPadding, labelSize.width, labelSize.height)];
     [popoverView setFrame:NSMakeRect(0, 0, labelSize.width + horizontalPadding * 2, labelSize.height + verticalPadding * 2)];
 
-    m_popover = adoptNS([[NSPopover alloc] init]);
+    m_popover = adoptNS([[WebValidationPopover alloc] init]);
     [m_popover setContentViewController:controller.get()];
     [m_popover setBehavior:NSPopoverBehaviorTransient];
     [m_popover setAnimates:NO];