Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Links cannot be activated when running Mobile Safari with external SD…
…K build of WebKit for iOS Simulator

https://bugs.webkit.org/show_bug.cgi?id=141906

Reviewed by Tim Horton.

Source/WebKit2:

Even if Touch Events are disabled, we still need to register a
UIWebTouchEventsGestureRecognizer to record the layer tree transaction ID when a touch
begins. Click events are only generated for touches that occur after the current frame's
load has committed, and we use the transaction ID from when the touch began to implement
this check.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEventSynchronously):
(WebKit::WebPageProxy::resetState):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h: Declared _layerTreeTransactionIdAtLastTouchStart.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]): Register a UIWebTouchEventsGestureRecognizer even if
Touch Events are disabled.
(-[WKContentView cleanupInteraction]): Reset _layerTreeTransactionIdAtLastTouchStart to 0.
(-[WKContentView _webTouchEventsRecognized:]): Update _layerTreeTransactionIdAtLastTouchStart
when a touch begins, even if Touch Events are disabled.
(-[WKContentView _singleTapCommited:]): Passed _layerTreeTransactionIdAtLastTouchStart to
WebPageProxy::commitPotentialTap().
(-[WKContentView _attemptClickAtLocation:]): Ditto for WebPageProxy::handleTap().
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::commitPotentialTap):
(WebKit::WebPageProxy::handleTap):

LayoutTests:

Unskipped tests that now pass. Rewrote a test to use UIHelper so that it works on both
DumpRenderTree and WebKitTestRunner.

* fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html:
Rewrote to use UIHelper.activateAt().
* platform/ios-simulator-wk2/TestExpectations:
* platform/ios-simulator/TestExpectations:


Canonical link: https://commits.webkit.org/185891@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aestes committed Feb 27, 2017
1 parent dfdb943 commit e3cc067
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 30 deletions.
15 changes: 15 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
2017-02-27 Andy Estes <aestes@apple.com>

Links cannot be activated when running Mobile Safari with external SDK build of WebKit for iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=141906

Reviewed by Tim Horton.

Unskipped tests that now pass. Rewrote a test to use UIHelper so that it works on both
DumpRenderTree and WebKitTestRunner.

* fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html:
Rewrote to use UIHelper.activateAt().
* platform/ios-simulator-wk2/TestExpectations:
* platform/ios-simulator/TestExpectations:

2017-02-26 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r212942.
Expand Down
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/ui-helper.js"></script>
<style>
body:active {
/* Must be non-empty. */
Expand All @@ -28,13 +29,7 @@
var square = iframe.contentDocument.getElementById("square");
var x = iframe.offsetLeft + square.offsetLeft + Math.floor(square.offsetWidth / 2);
var y = iframe.offsetTop + square.offsetTop + Math.floor(square.offsetHeight / 2);
if (testRunner.runUIScript && window.TouchEvent)
testRunner.runUIScript("(function() { uiController.singleTapAtPoint(" + x + ", " + y + "); })()");
else if (window.eventSender) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
UIHelper.activateAt(x, y);
}
</script>
</head>
Expand Down
3 changes: 0 additions & 3 deletions LayoutTests/platform/ios-simulator-wk2/TestExpectations
Expand Up @@ -1759,13 +1759,10 @@ fast/dom/Window/post-message-crash.html [ Pass Failure ]
webkit.org/b/123431 http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html [ Pass Failure ]

# eventSender.mouseDown is not implemented
fast/events/focusing-element-with-tabindex-by-tap-or-click.html [ Skip ]
fast/loader/location-hash-user-gesture.html [ Skip ]
imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
fast/dom/Window/post-message-user-action.html [ Skip ]
fast/images/image-usemap-parsing.html [ Skip ]
fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html [ Skip ]
fast/shadow-dom/fullscreen-in-slot-fullscreenElement.html [ Skip ]
Expand Down
2 changes: 0 additions & 2 deletions LayoutTests/platform/ios-simulator/TestExpectations
Expand Up @@ -2430,8 +2430,6 @@ webkit.org/b/152137 fast/media/mq-pointer.html [ Failure ]

webkit.org/b/152442 fast/scrolling/rtl-point-in-iframe.html [ Skip ]

webkit.org/b/152449 fast/events/can-click-element-on-page-with-active-pseudo-class-and-search-field.html [ Skip ]

webkit.org/b/152701 fast/animation/request-animation-frame-disabled.html [ Skip ]

webkit.org/b/152282 css3/filters/composited-during-animation-layertree.html [ Failure ]
Expand Down
31 changes: 31 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,34 @@
2017-02-27 Andy Estes <aestes@apple.com>

Links cannot be activated when running Mobile Safari with external SDK build of WebKit for iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=141906

Reviewed by Tim Horton.

Even if Touch Events are disabled, we still need to register a
UIWebTouchEventsGestureRecognizer to record the layer tree transaction ID when a touch
begins. Click events are only generated for touches that occur after the current frame's
load has committed, and we use the transaction ID from when the touch began to implement
this check.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEventSynchronously):
(WebKit::WebPageProxy::resetState):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h: Declared _layerTreeTransactionIdAtLastTouchStart.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]): Register a UIWebTouchEventsGestureRecognizer even if
Touch Events are disabled.
(-[WKContentView cleanupInteraction]): Reset _layerTreeTransactionIdAtLastTouchStart to 0.
(-[WKContentView _webTouchEventsRecognized:]): Update _layerTreeTransactionIdAtLastTouchStart
when a touch begins, even if Touch Events are disabled.
(-[WKContentView _singleTapCommited:]): Passed _layerTreeTransactionIdAtLastTouchStart to
WebPageProxy::commitPotentialTap().
(-[WKContentView _attemptClickAtLocation:]): Ditto for WebPageProxy::handleTap().
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::commitPotentialTap):
(WebKit::WebPageProxy::handleTap):

2017-02-26 Zan Dobersek <zdobersek@igalia.com>

[CoordinatedGraphics] Remove CoordinatedGraphicsScene::paintToGraphicsContext()
Expand Down
5 changes: 1 addition & 4 deletions Source/WebKit2/UIProcess/WebPageProxy.cpp
Expand Up @@ -2154,10 +2154,8 @@ void WebPageProxy::handleTouchEventSynchronously(NativeWebTouchEvent& event)
if (!isValid())
return;

if (event.type() == WebEvent::TouchStart) {
if (event.type() == WebEvent::TouchStart)
updateTouchEventTracking(event);
m_layerTreeTransactionIdAtLastTouchStart = downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea()).lastCommittedLayerTreeTransactionID();
}

TrackingType touchEventsTrackingType = touchEventTrackingType(event);
if (touchEventsTrackingType == TrackingType::NotTracking)
Expand Down Expand Up @@ -5401,7 +5399,6 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason)
m_dynamicViewportSizeUpdateWaitingForTarget = false;
m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false;
m_dynamicViewportSizeUpdateLayerTreeTransactionID = 0;
m_layerTreeTransactionIdAtLastTouchStart = 0;
m_hasNetworkRequestsOnSuspended = false;
m_isKeyboardAnimatingIn = false;
m_isScrollingOrZooming = false;
Expand Down
5 changes: 2 additions & 3 deletions Source/WebKit2/UIProcess/WebPageProxy.h
Expand Up @@ -990,10 +990,10 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
void willStartUserTriggeredZooming();

void potentialTapAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
void commitPotentialTap();
void commitPotentialTap(uint64_t layerTreeTransactionIdAtLastTouchStart);
void cancelPotentialTap();
void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
void handleTap(const WebCore::FloatPoint&);
void handleTap(const WebCore::FloatPoint&, uint64_t layerTreeTransactionIdAtLastTouchStart);

void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
Expand Down Expand Up @@ -1664,7 +1664,6 @@ class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
bool m_dynamicViewportSizeUpdateWaitingForTarget { false };
bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit { false };
uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID { 0 };
uint64_t m_layerTreeTransactionIdAtLastTouchStart { 0 };
uint64_t m_currentDynamicViewportSizeUpdateID { 0 };
bool m_hasNetworkRequestsOnSuspended { false };
bool m_isKeyboardAnimatingIn { false };
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Expand Up @@ -160,6 +160,7 @@ struct WKAutoCorrectionData {
UIWKKeyWebEventCompletionHandler _keyWebEventHandler;

CGPoint _lastInteractionLocation;
uint64_t _layerTreeTransactionIdAtLastTouchStart;

WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo;

Expand Down
18 changes: 11 additions & 7 deletions Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Expand Up @@ -34,6 +34,7 @@
#import "ManagedConfigurationSPI.h"
#import "NativeWebKeyboardEvent.h"
#import "NativeWebTouchEvent.h"
#import "RemoteLayerTreeDrawingAreaProxy.h"
#import "SmartMagnificationController.h"
#import "TextInputSPI.h"
#import "UIKitSPI.h"
Expand Down Expand Up @@ -524,11 +525,9 @@ - (void)setupInteraction

[self.layer addObserver:self forKeyPath:@"transform" options:NSKeyValueObservingOptionInitial context:nil];

#if ENABLE(TOUCH_EVENTS)
_touchEventGestureRecognizer = adoptNS([[UIWebTouchEventsGestureRecognizer alloc] initWithTarget:self action:@selector(_webTouchEventsRecognized:) touchDelegate:self]);
[_touchEventGestureRecognizer setDelegate:self];
[self addGestureRecognizer:_touchEventGestureRecognizer.get()];
#endif

_singleTapGestureRecognizer = adoptNS([[WKSyntheticClickTapGestureRecognizer alloc] initWithTarget:self action:@selector(_singleTapCommited:)]);
[_singleTapGestureRecognizer setDelegate:self];
Expand Down Expand Up @@ -636,6 +635,8 @@ - (void)cleanupInteraction
[_twoFingerSingleTapGestureRecognizer setDelegate:nil];
[self removeGestureRecognizer:_twoFingerSingleTapGestureRecognizer.get()];

_layerTreeTransactionIdAtLastTouchStart = 0;

#if ENABLE(DATA_INTERACTION)
[self teardownDataInteractionDelegates];
_isPerformingDataInteractionOperation = NO;
Expand Down Expand Up @@ -858,13 +859,16 @@ - (BOOL)resignFirstResponderForWebView
return superDidResign;
}

#if ENABLE(TOUCH_EVENTS)
- (void)_webTouchEventsRecognized:(UIWebTouchEventsGestureRecognizer *)gestureRecognizer
{
const _UIWebTouchEvent* lastTouchEvent = gestureRecognizer.lastTouchEvent;
NativeWebTouchEvent nativeWebTouchEvent(lastTouchEvent);

_lastInteractionLocation = lastTouchEvent->locationInDocumentCoordinates;
if (lastTouchEvent->type == UIWebTouchEventTouchBegin)
_layerTreeTransactionIdAtLastTouchStart = downcast<RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();

#if ENABLE(TOUCH_EVENTS)
NativeWebTouchEvent nativeWebTouchEvent(lastTouchEvent);
nativeWebTouchEvent.setCanPreventNativeGestures(!_canSendTouchEventsAsynchronously || [gestureRecognizer isDefaultPrevented]);

if (_canSendTouchEventsAsynchronously)
Expand All @@ -874,8 +878,8 @@ - (void)_webTouchEventsRecognized:(UIWebTouchEventsGestureRecognizer *)gestureRe

if (nativeWebTouchEvent.allTouchPointsAreReleased())
_canSendTouchEventsAsynchronously = NO;
}
#endif
}

- (void)_inspectorNodeSearchRecognized:(UIGestureRecognizer *)gestureRecognizer
{
Expand Down Expand Up @@ -1637,7 +1641,7 @@ - (void)_singleTapCommited:(UITapGestureRecognizer *)gestureRecognizer
}

[_inputPeripheral endEditing];
_page->commitPotentialTap();
_page->commitPotentialTap(_layerTreeTransactionIdAtLastTouchStart);

if (!_isExpectingFastSingleTapCommit)
[self _finishInteraction];
Expand Down Expand Up @@ -1676,7 +1680,7 @@ - (void)_attemptClickAtLocation:(CGPoint)location
[self becomeFirstResponder];

[_inputPeripheral endEditing];
_page->handleTap(location);
_page->handleTap(location, _layerTreeTransactionIdAtLastTouchStart);
}

- (void)useSelectionAssistantWithMode:(UIWebSelectionMode)selectionMode
Expand Down
8 changes: 4 additions & 4 deletions Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
Expand Up @@ -839,9 +839,9 @@ static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t
process().send(Messages::WebPage::PotentialTapAtPosition(requestID, position), m_pageID);
}

void WebPageProxy::commitPotentialTap()
void WebPageProxy::commitPotentialTap(uint64_t layerTreeTransactionIdAtLastTouchStart)
{
process().send(Messages::WebPage::CommitPotentialTap(m_layerTreeTransactionIdAtLastTouchStart), m_pageID);
process().send(Messages::WebPage::CommitPotentialTap(layerTreeTransactionIdAtLastTouchStart), m_pageID);
}

void WebPageProxy::cancelPotentialTap()
Expand All @@ -854,9 +854,9 @@ static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t
process().send(Messages::WebPage::TapHighlightAtPosition(requestID, position), m_pageID);
}

void WebPageProxy::handleTap(const FloatPoint& location)
void WebPageProxy::handleTap(const FloatPoint& location, uint64_t layerTreeTransactionIdAtLastTouchStart)
{
process().send(Messages::WebPage::HandleTap(roundedIntPoint(location), m_layerTreeTransactionIdAtLastTouchStart), m_pageID);
process().send(Messages::WebPage::HandleTap(roundedIntPoint(location), layerTreeTransactionIdAtLastTouchStart), m_pageID);
}

void WebPageProxy::inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint& position)
Expand Down

0 comments on commit e3cc067

Please sign in to comment.