haikuwebkit/LayoutTests/resources/basic-gestures.js

269 lines
9.6 KiB
JavaScript
Raw Permalink Normal View History

Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
function didShowKeyboard()
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
uiController.didShowKeyboardCallback = function() {
uiController.uiScriptComplete();
}
})();`, resolve);
});
Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
}
[Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=184631 <rdar://problem/39303706> Reviewed by Tim Horton. Source/WebKit: Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally represents a character. The first and second text legibility zoom scales are then computed based on the zoom scales needed to make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the first and second text legibility scales may end up being close to one another, or even the same (in the case where there is only a single font size in the entire document). In this case, we just snap the first scale to the second, so that double tapping will only toggle between two zoom scales. In another case where the document has no text (e.g. an image document), we just fall back to a zoom scale of 1. Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): LayoutTests: Add a layout test to check that double tap to zoom works in extra zoom mode, even when text spans the entire width of the document. * TestExpectations: * fast/events/extrazoom/double-tap-to-zoom-on-full-width-text-expected.txt: Added. * fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html: Added. * resources/basic-gestures.js: Add a helper method to double tap at a given location, and wait for zooming to finish. (return.new.Promise): Canonical link: https://commits.webkit.org/200232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-18 02:50:25 +00:00
function doubleTapToZoomAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
Changing view scale should zoom to initial scale if the page is already at initial scale https://bugs.webkit.org/show_bug.cgi?id=190570 <rdar://problem/45261877> Reviewed by Tim Horton. Source/WebCore: Add a getter for ViewportConfiguration's layout size scale factor. See Source/WebKit/ChangeLog for more details. * page/ViewportConfiguration.h: (WebCore::ViewportConfiguration::layoutSizeScaleFactor const): Source/WebKit: r237087 added support for changing the view scale on iOS, by making it possible to let the minimum layout size be a factor of the view size; this allows internal clients to change page zoom levels on iOS. Currently, changing the page zoom level automatically zooms to the new initial scale only if the user has not manually scaled the page before, even if the page is already at initial scale (e.g. after the user double taps to zoom on a small element, and double taps again to zoom back out to initial scale). This patch makes some minor adjustments to automatically zoom to the new initial scale after changing the view scale, as long as the page was at initial scale when changing zoom levels. Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::areEssentiallyEqualAsFloat): Move this function further up in the file, so that we can use it in `setViewportConfigurationViewLayoutSize`. (WebKit::WebPage::setViewportConfigurationViewLayoutSize): If the page is near initial scale and the zoom level changes, zoom to the new initial scale. (WebKit::WebPage::viewportConfigurationChanged): Make this take a new enum argument that determines whether we want to zoom to initial scale as a result of the viewport configuration change (`No` by default). LayoutTests: * fast/viewport/ios/initial-scale-after-changing-view-scale-expected.txt: Added. * fast/viewport/ios/initial-scale-after-changing-view-scale.html: Added. Add a new layout test to verify that: 1. Changing view scale before the page scale factor is changed by the user zooms to the new initial scale. 2. Changing view scale after the user changes the page scale to something different than initial scale does not cause the page to zoom to the new initial scale. 3. Changing view scale after the user changes the page scale factor back to initial scale causes the page to zoom to the new initial scale. * resources/basic-gestures.js: Make a small tweak in `doubleTapToZoomAtPoint` to ensure that both single taps as well as zooming are complete before invoking UIScriptController completion. (return.new.Promise): Canonical link: https://commits.webkit.org/205501@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-15 17:36:31 +00:00
let completionCount = 0;
const checkDone = () => {
if (++completionCount == 3)
uiController.uiScriptComplete();
};
uiController.didEndZoomingCallback = checkDone;
uiController.singleTapAtPoint(${x}, ${y}, checkDone);
uiController.singleTapAtPoint(${x}, ${y}, checkDone);
[Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode https://bugs.webkit.org/show_bug.cgi?id=184631 <rdar://problem/39303706> Reviewed by Tim Horton. Source/WebKit: Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally represents a character. The first and second text legibility zoom scales are then computed based on the zoom scales needed to make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the first and second text legibility scales may end up being close to one another, or even the same (in the case where there is only a single font size in the entire document). In this case, we just snap the first scale to the second, so that double tapping will only toggle between two zoom scales. In another case where the document has no text (e.g. an image document), we just fall back to a zoom scale of 1. Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): LayoutTests: Add a layout test to check that double tap to zoom works in extra zoom mode, even when text spans the entire width of the document. * TestExpectations: * fast/events/extrazoom/double-tap-to-zoom-on-full-width-text-expected.txt: Added. * fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html: Added. * resources/basic-gestures.js: Add a helper method to double tap at a given location, and wait for zooming to finish. (return.new.Promise): Canonical link: https://commits.webkit.org/200232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-18 02:50:25 +00:00
})();`, resolve);
});
}
function doubleTapAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
REGRESSION (iOS 13): Tests that simulate multiple back-to-back single taps fail or time out https://bugs.webkit.org/show_bug.cgi?id=201129 <rdar://problem/51857277> Reviewed by Tim Horton. Source/WebKit: Adds a new SPI hook in WebKit to let clients know when a synthetic tap gesture that has ended has been reset. See Tools/ChangeLog and LayoutTests/ChangeLog for more details. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _doAfterResettingSingleTapGesture:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapDidReset:]): (-[WKContentView _doAfterResettingSingleTapGesture:]): Tools: The tests in editing/pasteboard/ios were timing out on iOS 13 before this change. This is because they simulate back-to-back single taps; while this is recognized as two single taps on iOS 12 and prior, only the first single tap is recognized on iOS 13 (and the second is simply dropped on the floor). This occurs because the synthetic single tap gesture is reset slightly later on iOS 13 compared to iOS 12, so when the second tap is dispatched, the gesture recognizer is still in "ended" state after the first tap on iOS 13, which means the gesture isn't capable of recognizing further touches yet. In UIKit, a gesture recognizer is only reset once its UIGestureEnvironment's containing dependency subgraph no longer contains gestures that are active. In iOS 12, the synthetic click gesture is a part of a dependency subgraph that contains only itself and the normal (blocking) double tap gesture which requires the click to fail before it can be recognized; immediately after simulating the tap, both these gestures are inactive, which allows both of them to be reset. However, in iOS 13, the synthetic click gesture is part of a gesture dependency graph that contains the double tap for double click gesture, as well as the non-blocking double tap gesture, both of which are still active immediately after sending the first tap. This change in dependencies is caused by the introduction of UIUndoGestureInteraction's single and double three-finger tap gestures, which (in -[UIUndoGestureInteraction gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]) explicitly add all other taps as failure requirements. This effectively links the synthetic single tap gesture to most of the other gestures in WKContentView's dependency graph by way of these tap gestures for the undo interaction. All this means that there is now a short (~50 ms) delay after the synthetic single tap gestures is recognized, before it can be recognized again. To account for this new delay in our test infrastructure, simply wait for single tap gestures that have ended to reset before attempting to send subsequent single taps. We do this by introducing WebKit testing SPI to invoke a completion handler after resetting the synthetic click gesture (only if necessary - i.e., if the gesture is in ended state when we are about to begin simulating the tap). This allows calls to `UIScriptController::singleTapAtPoint` to be reliably recognized as single taps without requiring arbitrary 120 ms "human speed" delays. This fixes a number of flaky or failing layout tests, including the tests in editing/pasteboard/ios. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::doubleTapAtPoint): Add a `delay` parameter to `doubleTapAtPoint`. A number of layout tests were actually simulating double click gestures by simulating two back-to-back single taps; this is done for the purposes of being able to add a "human speed" delay prior to the second single tap gesture. After the change to wait for the single tap gesture to reset before attempting to simulate the next tap, this strategy no longer works, since the second gesture is recognized only as a single tap instead of a double tap. Instead, we add a delay parameter to `UIScriptController::doubleTapAtPoint`, which the "human speed" double tap gestures use instead to wait after simulating the first tap. * WebKitTestRunner/ios/HIDEventGenerator.h: * WebKitTestRunner/ios/HIDEventGenerator.mm: (-[HIDEventGenerator _waitFor:]): (-[HIDEventGenerator sendTaps:location:withNumberOfTouches:delay:completionBlock:]): Plumb the tap gesture delay through to this helper method. (-[HIDEventGenerator tap:completionBlock:]): (-[HIDEventGenerator doubleTap:delay:completionBlock:]): (-[HIDEventGenerator twoFingerTap:completionBlock:]): (-[HIDEventGenerator sendTaps:location:withNumberOfTouches:completionBlock:]): Deleted. (-[HIDEventGenerator doubleTap:completionBlock:]): Deleted. * WebKitTestRunner/ios/UIScriptControllerIOS.h: * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::waitForSingleTapToReset const): Add a new helper to wait for the content view's single tap gesture to reset if needed; call this before attempting to simulate single taps (either using a stylus, or with a regular touch). (WTR::UIScriptControllerIOS::singleTapAtPointWithModifiers): (WTR::UIScriptControllerIOS::doubleTapAtPoint): (WTR::UIScriptControllerIOS::stylusTapAtPointWithModifiers): LayoutTests: Adjusts a few layout tests after changes to UIScriptController::doubleTapAtPoint and UIScriptController::singleTapAtPoint. * editing/selection/ios/change-selection-by-tapping.html: Tweak this test to tap the page 12 times instead of 20 (which seems to cause occasional timeouts locally, when running all layout tests with a dozen active simulators). * fast/events/ios/double-tap-zoom.html: * fast/events/ios/viewport-device-width-allows-double-tap-zoom-out.html: * fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html: Augment a few call sites of `doubleTapAtPoint` with a 0 delay. Ideally, these should just use ui-helper.js, but we can refactor these tests as a part of folding basic-gestures.js into ui-helper.js. * http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt: * http/tests/security/anchor-download-block-crossorigin-expected.txt: Rebaseline these layout tests, due to change in line numbers. * platform/ipad/TestExpectations: Unskip these tests on iPad, now that they should pass. * pointerevents/utils.js: (const.ui.new.UIController.prototype.doubleTapToZoom): * resources/basic-gestures.js: (return.new.Promise.): (return.new.Promise): Adjust some more call sites of `doubleTapAtPoint`. Ideally, these should use just `ui-helper.js` too. * resources/ui-helper.js: (window.UIHelper.doubleTapAt.return.new.Promise): (window.UIHelper.doubleTapAt): (window.UIHelper.humanSpeedDoubleTapAt): (window.UIHelper.humanSpeedZoomByDoubleTappingAt): Add a delay parameter to `doubleTapAt` to specify a delay after each simulated tap. By default, this is 0, but the `humanSpeed*` helpers add a delay of 120 milliseconds. Additionally, these helpers were previously calling `singleTapAtPoint` twice, with a timeout in between to add a delay. Instead, call `doubleTapAtPoint` with a nonzero delay; otherwise, we'll end up waiting in `singleTapAtPoint` for the gesture subgraph containing both the double tap gestures and the synthetic single tap gesture to reset, which causes these two single taps to no longer be recognized as a double tap gesture. (window.UIHelper.zoomByDoubleTappingAt): Canonical link: https://commits.webkit.org/214834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-26 19:37:29 +00:00
uiController.doubleTapAtPoint(${x}, ${y}, 0, function() {
uiController.uiScriptComplete();
});
})();`, resolve);
});
}
function longPressAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
uiController.longPressAtPoint(${x}, ${y}, function() {
uiController.uiScriptComplete();
});
})();`, resolve);
});
}
Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
function liftUpAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
uiController.liftUpAtPoint(${x}, ${y}, 1, function() {
uiController.uiScriptComplete();
});
})();`, resolve);
});
Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
}
function longPressAndHoldAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
const eventStream = {
events : [
{
interpolate : "linear",
timestep: 0.1,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "began",
id : 1,
x : ${x},
y : ${y},
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 2.0,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${x},
y : ${y},
pressure : 0
}
]
}
}
]
};
uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
})();`, resolve);
});
}
function tapAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
uiController.singleTapAtPoint(${x}, ${y}, function() {
uiController.uiScriptComplete();
});
})();`, resolve);
});
}
function touchAndDragFromPointToPoint(startX, startY, endX, endY)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
const eventStream = {
events : [
{
interpolate : "linear",
timestep: 0.1,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "began",
id : 1,
x : ${startX},
y : ${startY},
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 0.5,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${endX},
y : ${endY},
pressure : 0
}
]
}
}
]
};
uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
})();`, resolve);
});
}
Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
function holdAtPoint(x, y)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
const eventStream = {
events : [
{
interpolate : "linear",
timestep: 0.1,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${x},
y : ${y},
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 5.0,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${x},
y : ${y},
pressure : 0
}
]
}
}
]
};
uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
})();`, resolve);
});
Support Autoscrolling in contenteditable for WK2 https://bugs.webkit.org/show_bug.cgi?id=180789 Source/WebCore: Reviewed by Simon Frasier and Wenson Hsieh.. Activate the autoscrollController to scroll to the position provided to us by the UIProcess. Allows for scrolling in contentEditable for WebKit2 Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html * page/AutoscrollController.cpp: (WebCore::AutoscrollController::autoscrollTimerFired): * page/EventHandler.cpp: (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. * page/EventHandler.h: * page/ios/EventHandlerIOS.mm: (WebCore::EventHandler::startTextAutoscroll): (WebCore::EventHandler::cancelTextAutoscroll): (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::shouldUpdateAutoscroll): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::targetPositionForSelectionAutoscroll const): (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted. Source/WebKit: Reviewed by Simon Frasier and Wenson Hsieh. Implements the UIKit protocol for autoscrolling and alerts the Web Process to start (or stop) an autoscroll to the specified position. Allows for scrolling in contenteditable in WebKit2. * Platform/spi/ios/UIKitSPI.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView startAutoscroll:]): (-[WKContentView cancelAutoscroll]): (-[WKContentView scrollSelectionToVisible:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::startAutoscrollAtPosition): (WebKit::WebPageProxy::cancelAutoscroll): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::startAutoscrollAtPosition): (WebKit::WebPage::cancelAutoscroll): Canonical link: https://commits.webkit.org/196828@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-18 20:13:56 +00:00
}
function continueTouchAndDragFromPointToPoint(startX, startY, endX, endY)
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
const eventStream = {
events : [
{
interpolate : "linear",
timestep: 0.1,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${startX},
y : ${startY},
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 0.5,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : ${endX},
y : ${endY},
pressure : 0
}
]
}
}
]
};
uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
})();`, resolve);
});
}