Source/WebCore:
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jan 2017 00:59:34 +0000 (00:59 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jan 2017 00:59:34 +0000 (00:59 +0000)
commit0426406e6b966cf08eed9ea6a70c9c633a92f767
treeace596dfe46742eda993bbeb0f474b7474c6c513
parent4db9d585d13ce23aac7641bbbdd074a02ef47ee2
Source/WebCore:
[iOS] HTML form validation popover sometimes does not go away
https://bugs.webkit.org/show_bug.cgi?id=166990
<rdar://problem/29985957>

Reviewed by Tim Horton.

The issue was that [UIViewController presentViewController:] is asynchronous
and that we sometimes tried to call [m_popoverController dismissViewControllerAnimated:]
before presentViewController had completed. This is something that UIKit does
not handle nicely and the popover just stays visible even though we have
asked for the controller to be dismissed and destroyed the ValidationBubble
object.

To address the issue, I made ValidationBubble RefCounted and make sure the
ValidationBubble object stays alive at least until the completion handler for
[UIViewController presentViewController:] has been called. This is done via
protecting the object using a RefPtr<> and capturing it in the lambda.
Because dismissViewControllerAnimated is called in the destructor, it is no
longer possible to call dismissViewControllerAnimated before the call to
presentViewController has completed.

No new tests, no easily testable since the popover was staying visible
after being destroyed (held on by UIKit).

* platform/ValidationBubble.h:
(WebCore::ValidationBubble::create):
* platform/ios/ValidationBubbleIOS.mm:
(WebCore::ValidationBubble::show):

Source/WebKit/mac:
HTML form validation popover sometimes does not go away
https://bugs.webkit.org/show_bug.cgi?id=166990
<rdar://problem/29985957>

Reviewed by Tim Horton.

Update code using ValidationBubble now that it is RefCounted.

* WebView/WebView.mm:
(-[WebView showFormValidationMessage:withAnchorRect:]):

Source/WebKit2:
[iOS] HTML form validation popover sometimes does not go away
https://bugs.webkit.org/show_bug.cgi?id=166990
<rdar://problem/29985957>

Reviewed by Tim Horton.

Update code using ValidationBubble now that it is RefCounted.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::createValidationBubble):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::createValidationBubble):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/ValidationBubble.h
Source/WebCore/platform/ios/ValidationBubbleIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewData.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/mac/PageClientImpl.h
Source/WebKit2/UIProcess/mac/PageClientImpl.mm