Title: [209414] trunk/Source/WebCore
Revision
209414
Author
cdu...@apple.com
Date
2016-12-06 13:34:38 -0800 (Tue, 06 Dec 2016)

Log Message

Unreviewed, rollout r209050.

This change may impact other popovers than the HTML validation one.
The previous code is safer.

* platform/ValidationBubble.h:
* platform/ios/ValidationBubbleIOS.mm:
(-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]):
(WebCore::ValidationBubble::setAnchorRect):
* platform/spi/ios/UIKitSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209413 => 209414)


--- trunk/Source/WebCore/ChangeLog	2016-12-06 21:03:43 UTC (rev 209413)
+++ trunk/Source/WebCore/ChangeLog	2016-12-06 21:34:38 UTC (rev 209414)
@@ -1,3 +1,16 @@
+2016-12-06  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, rollout r209050.
+
+        This change may impact other popovers than the HTML validation one.
+        The previous code is safer.
+
+        * platform/ValidationBubble.h:
+        * platform/ios/ValidationBubbleIOS.mm:
+        (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]):
+        (WebCore::ValidationBubble::setAnchorRect):
+        * platform/spi/ios/UIKitSPI.h:
+
 2016-12-05  Simon Fraser  <simon.fra...@apple.com>
 
         Improve the behavior of scroll-into-view when the target is inside position:fixed

Modified: trunk/Source/WebCore/platform/ValidationBubble.h (209413 => 209414)


--- trunk/Source/WebCore/platform/ValidationBubble.h	2016-12-06 21:03:43 UTC (rev 209413)
+++ trunk/Source/WebCore/platform/ValidationBubble.h	2016-12-06 21:34:38 UTC (rev 209414)
@@ -37,6 +37,7 @@
 OBJC_CLASS NSPopover;
 #elif PLATFORM(IOS)
 OBJC_CLASS UIViewController;
+OBJC_CLASS WebValidationBubbleDelegate;
 OBJC_CLASS WebValidationBubbleTapRecognizer;
 #endif
 
@@ -74,6 +75,7 @@
 #elif PLATFORM(IOS)
     RetainPtr<UIViewController> m_popoverController;
     RetainPtr<WebValidationBubbleTapRecognizer> m_tapRecognizer;
+    RetainPtr<WebValidationBubbleDelegate> m_popoverDelegate;
     UIViewController *m_presentingViewController;
 #endif
 };

Modified: trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm (209413 => 209414)


--- trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2016-12-06 21:03:43 UTC (rev 209413)
+++ trunk/Source/WebCore/platform/ios/ValidationBubbleIOS.mm	2016-12-06 21:34:38 UTC (rev 209414)
@@ -74,6 +74,22 @@
 
 @end
 
+@interface WebValidationBubbleDelegate : NSObject <UIPopoverPresentationControllerDelegate> {
+}
+@end
+
+@implementation WebValidationBubbleDelegate
+
+- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection
+{
+    UNUSED_PARAM(controller);
+    UNUSED_PARAM(traitCollection);
+    // This is needed to force UIKit to use a popover on iPhone as well.
+    return UIModalPresentationNone;
+}
+
+@end
+
 namespace WebCore {
 
 static const CGFloat horizontalPadding = 8;
@@ -130,8 +146,8 @@
         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];
+    m_popoverDelegate = adoptNS([[WebValidationBubbleDelegate alloc] init]);
+    presentationController.delegate = m_popoverDelegate.get();
     presentationController.passthroughViews = [NSArray arrayWithObjects:presentingViewController.view, m_view, nil];
 
     presentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;

Modified: trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h (209413 => 209414)


--- trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h	2016-12-06 21:03:43 UTC (rev 209413)
+++ trunk/Source/WebCore/platform/spi/ios/UIKitSPI.h	2016-12-06 21:34:38 UTC (rev 209414)
@@ -27,7 +27,6 @@
 
 #import <UIKit/UIApplication_Private.h>
 #import <UIKit/UIInterface_Private.h>
-#import <UIKit/UIPopoverPresentationController_Private.h>
 #import <UIKit/UIScreen_Private.h>
 #import <UIKit/UIViewController_Private.h>
 
@@ -59,12 +58,6 @@
 
 @end
 
-@interface UIPopoverPresentationController()
-
-+ (void)_setAlwaysAllowPopoverPresentations:(BOOL)flag;
-
-@end
-
 @interface UIViewController ()
 + (UIViewController *)viewControllerForView:(UIView *)view;
 @end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to