Title: [209282] trunk/Source/WebCore
- Revision
- 209282
- Author
- [email protected]
- Date
- 2016-12-02 16:22:00 -0800 (Fri, 02 Dec 2016)
Log Message
HTML Interactive Form Validation popovers do not show in iOS WKWebViews
https://bugs.webkit.org/show_bug.cgi?id=165340
<rdar://problem/29489966>
Reviewed by Simon Fraser.
HTML Interactive Form Validation popovers do not show in iOS WKWebViews,
only in MobileSafari. To address the issue try to find an appropriate
UIViewController to present the popover when the client does not provide
a presenting view controller.
* platform/ValidationBubble.h:
* platform/ios/ValidationBubbleIOS.mm:
(WebCore::fallbackViewController):
(WebCore::ValidationBubble::setAnchorRect):
* platform/spi/ios/UIKitSPI.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (209281 => 209282)
--- trunk/Source/WebCore/ChangeLog 2016-12-02 23:36:50 UTC (rev 209281)
+++ trunk/Source/WebCore/ChangeLog 2016-12-03 00:22:00 UTC (rev 209282)
@@ -1,3 +1,22 @@
+2016-12-02 Chris Dumez <[email protected]>
+
+ HTML Interactive Form Validation popovers do not show in iOS WKWebViews
+ https://bugs.webkit.org/show_bug.cgi?id=165340
+ <rdar://problem/29489966>
+
+ Reviewed by Simon Fraser.
+
+ HTML Interactive Form Validation popovers do not show in iOS WKWebViews,
+ only in MobileSafari. To address the issue try to find an appropriate
+ UIViewController to present the popover when the client does not provide
+ a presenting view controller.
+
+ * platform/ValidationBubble.h:
+ * platform/ios/ValidationBubbleIOS.mm:
+ (WebCore::fallbackViewController):
+ (WebCore::ValidationBubble::setAnchorRect):
+ * platform/spi/ios/UIKitSPI.h:
+
2016-12-02 Zalan Bujtas <[email protected]>
Remove redundant LayoutUnit conversions.
Modified: trunk/Source/WebCore/platform/ValidationBubble.h (209281 => 209282)
--- trunk/Source/WebCore/platform/ValidationBubble.h 2016-12-02 23:36:50 UTC (rev 209281)
+++ trunk/Source/WebCore/platform/ValidationBubble.h 2016-12-03 00:22:00 UTC (rev 209282)
@@ -60,7 +60,7 @@
const String& message() const { return m_message; }
#if PLATFORM(IOS)
- WEBCORE_EXPORT void setAnchorRect(const IntRect& anchorRect, UIViewController* presentingViewController);
+ WEBCORE_EXPORT void setAnchorRect(const IntRect& anchorRect, UIViewController* presentingViewController = nullptr);
WEBCORE_EXPORT void show();
#else
WEBCORE_EXPORT void showRelativeTo(const IntRect& anchorRect);
Modified: trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm (209281 => 209282)
--- trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm 2016-12-02 23:36:50 UTC (rev 209281)
+++ trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm 2016-12-03 00:22:00 UTC (rev 209282)
@@ -114,8 +114,21 @@
[m_presentingViewController presentViewController:m_popoverController.get() animated:NO completion:nil];
}
+static UIViewController *fallbackViewController(UIView *view)
+{
+ for (UIView *currentView = view; currentView; currentView = currentView.superview) {
+ if (UIViewController *viewController = [getUIViewControllerClass() viewControllerForView:currentView])
+ return viewController;
+ }
+ NSLog(@"Failed to find a view controller to show form validation popover");
+ return nil;
+}
+
void ValidationBubble::setAnchorRect(const IntRect& anchorRect, UIViewController* presentingViewController)
{
+ if (!presentingViewController)
+ presentingViewController = fallbackViewController(m_view);
+
UIPopoverPresentationController *presentationController = [m_popoverController popoverPresentationController];
// This is needed to force UIKit to use a popover on iPhone as well.
[getUIPopoverPresentationControllerClass() _setAlwaysAllowPopoverPresentations:YES];
Modified: trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h (209281 => 209282)
--- trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h 2016-12-02 23:36:50 UTC (rev 209281)
+++ trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h 2016-12-03 00:22:00 UTC (rev 209282)
@@ -29,6 +29,7 @@
#import <UIKit/UIInterface_Private.h>
#import <UIKit/UIPopoverPresentationController_Private.h>
#import <UIKit/UIScreen_Private.h>
+#import <UIKit/UIViewController_Private.h>
#else
@@ -64,4 +65,8 @@
@end
+@interface UIViewController ()
++ (UIViewController *)viewControllerForView:(UIView *)view;
+@end
+
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes