Title: [223626] trunk
- Revision
- 223626
- Author
- [email protected]
- Date
- 2017-10-18 13:26:38 -0700 (Wed, 18 Oct 2017)
Log Message
Key events should not update Document.lastHandledUserGestureTimestamp unless key event is handled
https://bugs.webkit.org/show_bug.cgi?id=178473
<rdar://problem/34869935>
Reviewed by Brent Fulgham.
Source/WebCore:
No new tests, updated media/restricted-audio-playback-with-document-gesture.html for this change.
* page/EventHandler.cpp:
(WebCore::EventHandler::keyEvent): Restore the current Document's "lastHandledUserGestureTimestamp"
if the key event was not handled.
LayoutTests:
* media/restricted-audio-playback-with-document-gesture.html: Pass true to runWithKeyDown so
it consumes the keydown event.
* media/video-test.js:
(runWithKeyDown): Take optional parameter which causes event handler to call preventDefault.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (223625 => 223626)
--- trunk/LayoutTests/ChangeLog 2017-10-18 20:20:37 UTC (rev 223625)
+++ trunk/LayoutTests/ChangeLog 2017-10-18 20:26:38 UTC (rev 223626)
@@ -1,3 +1,16 @@
+2017-10-18 Eric Carlson <[email protected]>
+
+ Key events should not update Document.lastHandledUserGestureTimestamp unless key event is handled
+ https://bugs.webkit.org/show_bug.cgi?id=178473
+ <rdar://problem/34869935>
+
+ Reviewed by Brent Fulgham.
+
+ * media/restricted-audio-playback-with-document-gesture.html: Pass true to runWithKeyDown so
+ it consumes the keydown event.
+ * media/video-test.js:
+ (runWithKeyDown): Take optional parameter which causes event handler to call preventDefault.
+
2017-10-18 Myles C. Maxfield <[email protected]>
editing/deleting/delete-emoji-9.html is failing consistently.
Modified: trunk/LayoutTests/media/restricted-audio-playback-with-document-gesture.html (223625 => 223626)
--- trunk/LayoutTests/media/restricted-audio-playback-with-document-gesture.html 2017-10-18 20:20:37 UTC (rev 223625)
+++ trunk/LayoutTests/media/restricted-audio-playback-with-document-gesture.html 2017-10-18 20:26:38 UTC (rev 223626)
@@ -20,7 +20,7 @@
run("mediaElement.src = "" 'content/test')");
waitForEvent('canplaythrough', canplaythrough);
waitForEventAndFail('error');
- });
+ }, true);
}
function canplaythrough()
Modified: trunk/LayoutTests/media/video-test.js (223625 => 223626)
--- trunk/LayoutTests/media/video-test.js 2017-10-18 20:20:37 UTC (rev 223625)
+++ trunk/LayoutTests/media/video-test.js 2017-10-18 20:26:38 UTC (rev 223626)
@@ -394,13 +394,16 @@
consoleWrite("<br><b>** This test only works in DRT! **<" + "/b><br>");
}
-function runWithKeyDown(fn)
+function runWithKeyDown(fn, preventDefault)
{
// FIXME: WKTR does not yet support the keyDown() message. Do a mouseDown here
// instead until keyDown support is added.
var eventName = !window.testRunner || eventSender.keyDown ? 'keypress' : 'mousedown'
- function thunk() {
+ function thunk(event) {
+ if (preventDefault)
+ event.preventDefault();
+
document.removeEventListener(eventName, thunk, false);
if (typeof fn === 'function')
fn();
Modified: trunk/Source/WebCore/ChangeLog (223625 => 223626)
--- trunk/Source/WebCore/ChangeLog 2017-10-18 20:20:37 UTC (rev 223625)
+++ trunk/Source/WebCore/ChangeLog 2017-10-18 20:26:38 UTC (rev 223626)
@@ -1,3 +1,17 @@
+2017-10-18 Eric Carlson <[email protected]>
+
+ Key events should not update Document.lastHandledUserGestureTimestamp unless key event is handled
+ https://bugs.webkit.org/show_bug.cgi?id=178473
+ <rdar://problem/34869935>
+
+ Reviewed by Brent Fulgham.
+
+ No new tests, updated media/restricted-audio-playback-with-document-gesture.html for this change.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::keyEvent): Restore the current Document's "lastHandledUserGestureTimestamp"
+ if the key event was not handled.
+
2017-10-18 Wenson Hsieh <[email protected]>
Unreviewed, rolling out r223291.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (223625 => 223626)
--- trunk/Source/WebCore/page/EventHandler.cpp 2017-10-18 20:20:37 UTC (rev 223625)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2017-10-18 20:26:38 UTC (rev 223626)
@@ -3122,7 +3122,12 @@
bool EventHandler::keyEvent(const PlatformKeyboardEvent& keyEvent)
{
Document* topDocument = m_frame.document() ? &m_frame.document()->topDocument() : nullptr;
+ MonotonicTime savedLastHandledUserGestureTimestamp;
bool savedUserDidInteractWithPage = topDocument ? topDocument->userDidInteractWithPage() : false;
+
+ if (m_frame.document())
+ savedLastHandledUserGestureTimestamp = m_frame.document()->lastHandledUserGestureTimestamp();
+
bool wasHandled = internalKeyEvent(keyEvent);
// If the key event was not handled, do not treat it as user interaction with the page.
@@ -3133,6 +3138,9 @@
ResourceLoadObserver::shared().logUserInteractionWithReducedTimeResolution(*topDocument);
}
+ if (!wasHandled && m_frame.document())
+ m_frame.document()->updateLastHandledUserGestureTimestamp(savedLastHandledUserGestureTimestamp);
+
return wasHandled;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes