[Services with UI] Action menu arrow hit testing is sometimes wrong.
https://bugs.webkit.org/show_bug.cgi?id=135776
<rdar://problem/17837670>

Reviewed by Brady Eidson.

There was a problem in the algorithm that stitches together the selection rectangles
to be given to Data Detectors API.
This change adds a new function that stiches together all the rects contributing to the
first line, all the rects contributing to the last line and all the ones in the middle.
This way we can have a maximum of 3 non overlapping rectangles.

* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::stitchRects):
(WebKit::compactRectsWithGapRects):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Add a helper to avoid leaking single-fire event listeners in Promise chains
https://bugs.webkit.org/show_bug.cgi?id=135772

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

A common pattern when working with promise chains is to convert an event
handler into a promise by using a single-fire event listener with the
resolve continuation as the callback. This is fine if the event fires;
if it doesn't fire, then the event emitter permanently keeps a reference to the
this-object and the callback.

This patch adds EventListener, a proxy object for events that can be manipulated
from multiple promise callback functions. If a promise is rejected, the catch
block can disconnect any event listeners set up earlier in the promise chain.

This patch also reimplements EventListenerSet to use multiple EventListeners,
since they share the same logic to uniformly handle Inspector and DOM events.

Test: inspector/event-listener.html
Test: inspector/event-listener-set.html

* UserInterface/Base/EventListener.js: Added.
(WebInspector.EventListener):
(WebInspector.EventListener.prototype.this._callback):
(WebInspector.EventListener.prototype.connect):
(WebInspector.EventListener.prototype.disconnect):
* UserInterface/Base/EventListenerSet.js: Update license block.
(WebInspector.EventListenerSet.prototype.register):
(WebInspector.EventListenerSet.prototype.install):
(WebInspector.EventListenerSet.prototype.uninstall):
* UserInterface/Main.html: Include EventListener.
* UserInterface/Test.html: Include EventListener and EventListenerSet.

LayoutTests:

* inspector/event-listener-expected.txt: Added.
* inspector/event-listener-set-expected.txt: Added.
* inspector/event-listener-set.html: Added.
* inspector/event-listener.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Adjust build script for Windows production build.
https://bugs.webkit.org/show_bug.cgi?id=135806
<rdar://problem/17978299>

Reviewed by Timothy Hatcher.

../JavaScriptCore:

* JavaScriptCore.vcxproj/copy-files.cmd: Copy file for later use
in WebInspectorUI build.

../WebCore:

* WebCore.vcxproj/copyForwardingHeaders.cmd: Copy file needed
for WebInspectorUI build.

../WebInspectorUI:

* WebInspectorUI.vcxproj/WebInspectorUI.make: Make sure target for
xcopy operation exists.
* WebInspectorUI.vcxproj/WebInspectorUI.proj: Don't create directories
we don't need, make sure the target location exists before we build.
* WebInspectorUI.vcxproj/build-webinspectorui.pl: Make sure that
production builds get the intermediary command files from the
right place.


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