REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
https://bugs.webkit.org/show_bug.cgi?id=166472
rdar://problem/29675551

Reviewed by Tim Horton.

Source/WebCore:

r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible()
to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since
the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested.

This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles
in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need
the separate visibleRectRelativeToDocument parameter.

Tests: fast/events/autoscroll-main-document.html
       fast/events/autoscroll-when-zoomed.html
       fast/events/drag-select-when-zoomed-with-header.html
       fast/events/drag-select-when-zoomed.html
       fast/scrolling/scroll-to-anchor-zoomed-header.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::getRectToExpose):
* rendering/RenderLayer.h:

Tools:

These changes are necessary to allow the mouse to leave the WTR window while
drag-scrolling, to test autoscroll. Previously, we were never calling -mouseDragged
(which DRT does); we'd always go through mouseMoved, which hits an early return
in WebViewImpl::mouseMoved() when the point is outside the view.

* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::mouseMoveTo):

LayoutTests:

Add some test coverage for autoscroll of the main document. I could only get this
working in WebKitTestRunner, not DumpRenderTree.

* TestExpectations:
* fast/events/autoscroll-main-document-expected.txt: Added.
* fast/events/autoscroll-main-document.html: Added.
* fast/events/autoscroll-when-zoomed-expected.txt: Added.
* fast/events/autoscroll-when-zoomed.html: Added.
* fast/events/drag-select-when-zoomed-expected.txt: Added.
* fast/events/drag-select-when-zoomed-with-header-expected.txt: Added.
* fast/events/drag-select-when-zoomed-with-header.html: Added.
* fast/events/drag-select-when-zoomed.html: Added.
* fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt: Added.
* fast/scrolling/scroll-to-anchor-zoomed-header.html: Added.
* fast/transforms/selection-bounds-in-transformed-view.html: Revert the target scroll position to what it was
before r209299, and improve the failure output.
* platform/ios-simulator/TestExpectations:
* platform/mac-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations
index bf9b135..930fcd3 100644
--- a/LayoutTests/TestExpectations
+++ b/LayoutTests/TestExpectations
@@ -51,6 +51,10 @@
 fast/events/mouse-force-down.html [ Skip ]
 fast/events/mouse-force-up.html [ Skip ]
 
+# Document autoscroll tests only work on Mac WK2
+fast/events/autoscroll-when-zoomed.html [ Skip ]
+fast/events/autoscroll-main-document.html [ Skip ]
+
 # Only iOS supports QuickLook
 quicklook [ Skip ]
 http/tests/quicklook [ Skip ]