Ensure frame creation messages get through to UI process
https://bugs.webkit.org/show_bug.cgi?id=134591
<rdar://problem/16918218>

Reviewed by Anders Carlsson.

If we are middle of handling a synchronous message from UI process a frame creation message back gets delayed.
The subsequent synchronous DecidePolicyForNavigationAction message expects that the frame creation
message has arrived first and fails.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createWithCoreMainFrame):
(WebKit::WebFrame::createSubframe):
        
    Send messages with DispatchMessageEvenWhenWaitingForSyncReply so they always go through in order.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Selection rects sent to ServicesOverlayController are wrong.
<rdar://problem/16727796> and https://bugs.webkit.org/show_bug.cgi?id=134568

Reviewed by Darin Adler (and Tim Horton and Ryosuke Niwa).

Source/WebCore:
* WebCore.exp.in:

Update the gatherer to keep GapRects separate from LayoutRects:
* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::addRects):
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
(WebCore::SelectionRectGatherer::clearAndCreateNotifier):
* editing/SelectionRectGatherer.h:

* page/EditorClient.h:
(WebCore::EditorClient::selectionRectsDidChange): Updated to take LayoutRects and GapRects separately.

Change RenderSelectionInfo to also hang on to the individual rects that formed the final bounding rect:
* rendering/RenderSelectionInfo.h:
(WebCore::RenderSelectionInfo::RenderSelectionInfo): If the RenderObject is a RenderText, then call
  collectSelectionRectsForLineBoxes instead of selectionRectForRepaint.
(WebCore::RenderSelectionInfo::rects):

* rendering/RenderText.cpp:
(WebCore::RenderText::collectSelectionRectsForLineBoxes): Added
(WebCore::RenderText::selectionRectForRepaint):
* rendering/RenderText.h:

* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::collectSelectionRectsForRange): Added
* rendering/RenderTextLineBoxes.h:

* rendering/RenderView.cpp:
(WebCore::RenderView::setSubtreeSelection): Add the list of rects to the gatherer instead of just
  the bounding rect.

Source/WebKit2:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::selectionRectsDidChange): Also pass the GapRects to the ServicesOverlayController.
* WebProcess/WebCoreSupport/WebEditorClient.h:

* WebProcess/WebPage/ServicesOverlayController.h:
* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::expandForGap):
(WebKit::compactRectsWithGapRects): Combine 3+ rects down to exactly 3 rects, then expand them based on GapRects.
(WebKit::ServicesOverlayController::selectionRectsDidChange): Call compactRectsWithGapRects, then reverse the list.
(WebKit::ServicesOverlayController::drawSelectionHighlight): Tell data detectors to flip this.
(WebKit::ServicesOverlayController::drawTelephoneNumberHighlight): Tell data detectors to flip this.
(WebKit::ServicesOverlayController::drawCurrentHighlight): No need to flip this anymore.

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