Title: [209253] trunk/Source/WebCore
Revision
209253
Author
[email protected]
Date
2016-12-02 12:05:15 -0800 (Fri, 02 Dec 2016)

Log Message

[iOS] Tapping on an HTML validation bubble should dismiss it
https://bugs.webkit.org/show_bug.cgi?id=165122
<rdar://problem/29429372>

Reviewed by Simon Fraser.

Tapping on an HTML validation bubble should dismiss it. Previously it did
nothing.

No new tests, I tried writing one but the validation popover does not
show in the simulator, only on device. I believe at least one reason is that
_presentingViewControllerForWebView() is required and is currently not
implemented by WKTR. I'll look into this issue separately.

* platform/ValidationBubble.h:
* platform/ios/ValidationBubbleIOS.mm:
(-[WebValidationBubbleTapRecognizer initWithPopoverController:withPopoverView:]):
(-[WebValidationBubbleTapRecognizer dismissPopover]):
(WebCore::ValidationBubble::ValidationBubble):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209252 => 209253)


--- trunk/Source/WebCore/ChangeLog	2016-12-02 20:05:07 UTC (rev 209252)
+++ trunk/Source/WebCore/ChangeLog	2016-12-02 20:05:15 UTC (rev 209253)
@@ -1,3 +1,25 @@
+2016-12-02  Chris Dumez  <[email protected]>
+
+        [iOS] Tapping on an HTML validation bubble should dismiss it
+        https://bugs.webkit.org/show_bug.cgi?id=165122
+        <rdar://problem/29429372>
+
+        Reviewed by Simon Fraser.
+
+        Tapping on an HTML validation bubble should dismiss it. Previously it did
+        nothing.
+
+        No new tests, I tried writing one but the validation popover does not
+        show in the simulator, only on device. I believe at least one reason is that
+        _presentingViewControllerForWebView() is required and is currently not
+        implemented by WKTR. I'll look into this issue separately.
+
+        * platform/ValidationBubble.h:
+        * platform/ios/ValidationBubbleIOS.mm:
+        (-[WebValidationBubbleTapRecognizer initWithPopoverController:withPopoverView:]):
+        (-[WebValidationBubbleTapRecognizer dismissPopover]):
+        (WebCore::ValidationBubble::ValidationBubble):
+
 2016-12-02  Dave Hyatt  <[email protected]>
 
         [CSS Parser] Add support for the SVG 'kerning' property

Modified: trunk/Source/WebCore/platform/ValidationBubble.h (209252 => 209253)


--- trunk/Source/WebCore/platform/ValidationBubble.h	2016-12-02 20:05:07 UTC (rev 209252)
+++ trunk/Source/WebCore/platform/ValidationBubble.h	2016-12-02 20:05:15 UTC (rev 209253)
@@ -37,6 +37,7 @@
 OBJC_CLASS NSPopover;
 #elif PLATFORM(IOS)
 OBJC_CLASS UIViewController;
+OBJC_CLASS WebValidationBubbleTapRecognizer;
 #endif
 
 #if PLATFORM(MAC)
@@ -72,6 +73,7 @@
     RetainPtr<NSPopover> m_popover;
 #elif PLATFORM(IOS)
     RetainPtr<UIViewController> m_popoverController;
+    RetainPtr<WebValidationBubbleTapRecognizer> m_tapRecognizer;
     UIViewController *m_presentingViewController;
 #endif
 };

Modified: trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm (209252 => 209253)


--- trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2016-12-02 20:05:07 UTC (rev 209252)
+++ trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2016-12-02 20:05:15 UTC (rev 209253)
@@ -30,14 +30,50 @@
 
 #import "SoftLinking.h"
 #import "UIKitSPI.h"
+#import <wtf/RetainPtr.h>
 #import <wtf/text/WTFString.h>
 
 SOFT_LINK_FRAMEWORK(UIKit);
 SOFT_LINK_CLASS(UIKit, UILabel);
 SOFT_LINK_CLASS(UIKit, UIPopoverPresentationController);
+SOFT_LINK_CLASS(UIKit, UITapGestureRecognizer);
 SOFT_LINK_CLASS(UIKit, UIView);
 SOFT_LINK_CLASS(UIKit, UIViewController);
 
+@interface WebValidationBubbleTapRecognizer : NSObject
+@end
+
+@implementation WebValidationBubbleTapRecognizer {
+    RetainPtr<UIViewController> _popoverController;
+    RetainPtr<UITapGestureRecognizer> _tapGestureRecognizer;
+}
+
+- (WebValidationBubbleTapRecognizer *)initWithPopoverController:(UIViewController *)popoverController
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _popoverController = popoverController;
+    _tapGestureRecognizer = adoptNS([[getUITapGestureRecognizerClass() alloc] initWithTarget:self action:@selector(dismissPopover)]);
+    [[_popoverController view] addGestureRecognizer:_tapGestureRecognizer.get()];
+
+    return self;
+}
+
+- (void)dealloc
+{
+    [[_popoverController view] removeGestureRecognizer:_tapGestureRecognizer.get()];
+    [super dealloc];
+}
+
+- (void)dismissPopover
+{
+    [_popoverController dismissViewControllerAnimated:NO completion:nil];
+}
+
+@end
+
 namespace WebCore {
 
 static const CGFloat horizontalPadding = 8;
@@ -53,6 +89,7 @@
 
     RetainPtr<UIView> popoverView = adoptNS([[getUIViewClass() alloc] initWithFrame:CGRectZero]);
     [m_popoverController setView:popoverView.get()];
+    m_tapRecognizer = adoptNS([[WebValidationBubbleTapRecognizer alloc] initWithPopoverController:m_popoverController.get()]);
 
     RetainPtr<UILabel> label = adoptNS([[getUILabelClass() alloc] initWithFrame:CGRectZero]);
     [label setText:message];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to