WKProcessAssertionBackgroundTaskManager should clear member if task expires
https://bugs.webkit.org/show_bug.cgi?id=134618

Reviewed by Anders Carlson.

Failure to do so results in a warning, and could result in us erroneously completing a background task too soon.

* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
    - remove local variable, _backgroundTask = UIBackgroundTaskInvalid;



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
When showing the selection menu, include menu options for all selected phone numbers.
<rdar://problem/16983434>, <rdar://problem/16874568>, and https://bugs.webkit.org/show_bug.cgi?id=134613

Reviewed by Tim Horton.

Source/WebCore:
* English.lproj/Localizable.strings:

* dom/Range.cpp:
(WebCore::rangesOverlap): Fix reversed arguments that caused some types of overlaps to not be detected.

Source/WebKit2:
Move some telephone number menu logic from WebKitSystemInterface here.
Also provide utility to get just the one menu item relevant to a telephone number.
* Platform/mac/MenuUtilities.h:
* Platform/mac/MenuUtilities.mm: Added.
(WebKit::menuItemForTelephoneNumber):
(WebKit::menuItemsForTelephoneNumber):

* Platform/mac/StringUtilities.h:
* Platform/mac/StringUtilities.mm:
(WebKit::formattedPhoneNumberString): Return a localized formatted phone number.

Add a member to track the selected phone numbers:
* Shared/ContextMenuContextData.h:
(WebKit::ContextMenuContextData::ContextMenuContextData):
(WebKit::ContextMenuContextData::selectedTelephoneNumbers):

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu): Also add menu items for each phone number that is
  in the selection.

Switch away from a WKSI method, and remove a lot of unneeded forward declarations and soft linking:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::showTelephoneNumberMenu):
(WebKit::WebPageProxy::showSelectionServiceMenu):

* WebKit2.xcodeproj/project.pbxproj:

* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::ServicesOverlayController::drawSelectionHighlight):
(WebKit::ServicesOverlayController::handleClick): Pass the phone numbers along.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::handleSelectionServiceClick): Pass the phone numbers along.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WK2] Compositing layers draw outside page bounds
https://bugs.webkit.org/show_bug.cgi?id=134619
<rdar://problem/16953222>

Reviewed by Benjamin Poulain.

With the new rubber-banding behavior, we no longer have the root content layer clipping all
the web layers, but this resulted in web layers which were moved outside the viewport by CSS
transforms not being clipped.

Fix by adding a clipping layer inside the scroll view, above _rootContentView. This layer
normally has the same bounds as the content, but when rubber-banding or pinching,
it takes the union of the content bounds and the rect used for fixed positioning.
To make scrolling work as expected in this scenario, when it has non-zero offset, it
has to compensate by setting its bounds origin.

The bounds of the clipping layer are updated on scrolling/zooming, and when the
layer commit tells us that the content size changed.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateScrollViewBackground]):
* UIProcess/ios/WKContentView.mm:
(-[WKContentView initWithFrame:context:configuration:webView:]):
(-[WKContentView updateFixedClippingView:]):
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
(-[WKContentView _didCommitLayerTree:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up Brady's mess on iOS.

* Platform/mac/StringUtilities.h:
* Platform/mac/StringUtilities.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Should not take background task assertion for NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=134622

Reviewed by Tim Horton.

When the WebContent wants to complete a task in the background we take a process assertion on the child process, and also need to prevent the UI process from suspending.
However for the NetworkProcess we always just hold a process assertion, and don't want this to interfere with UIApp suspension.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
    - ProcessAssertion -> ProcessAndUIAssertion
* UIProcess/ProcessAssertion.cpp:
(WebKit::ProcessAssertion::ProcessAssertion):
    - assignment -> initializer list.
(WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::setState):
    - added no-op implementation.
(WebKit::ProcessAssertion::~ProcessAssertion): Deleted.
* UIProcess/ProcessAssertion.h:
    - removed ~ProcessAssertion, added ProcessAndUIAssertion class.
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::didConnnectToProcess):
    - ProcessAssertion -> ProcessAndUIAssertion
* UIProcess/ProcessThrottler.h:
    - ProcessAssertion -> ProcessAndUIAssertion
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):
    - assignment -> initializer list.
    - moved code to manage WKProcessAssertionBackgroundTaskManager
(WebKit::ProcessAssertion::setState):
    - moved code to manage WKProcessAssertionBackgroundTaskManager
(WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
(WebKit::ProcessAndUIAssertion::setState):
    - moved code to manage WKProcessAssertionBackgroundTaskManager from ProcessAssertion.
(WebKit::ProcessAssertion::~ProcessAssertion): Deleted.
    - delete - moved code to manage WKProcessAssertionBackgroundTaskManager



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