Diff
Modified: trunk/LayoutTests/ChangeLog (214981 => 214982)
--- trunk/LayoutTests/ChangeLog 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/LayoutTests/ChangeLog 2017-04-06 00:55:14 UTC (rev 214982)
@@ -1,3 +1,14 @@
+2017-04-05 Simon Fraser <[email protected]>
+
+ Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
+ https://bugs.webkit.org/show_bug.cgi?id=170479
+
+ Reviewed by Sam Weinig.
+
+ * fast/frames/user-gesture-timestamp-propagation-expected.txt: Added.
+ * fast/frames/user-gesture-timestamp-propagation.html: Added.
+ * platform/ios/TestExpectations:
+
2017-04-05 Eric Carlson <[email protected]>
[MediaStream] Host application should be able to mute and unmute media streams
Added: trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation-expected.txt (0 => 214982)
--- trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation-expected.txt 2017-04-06 00:55:14 UTC (rev 214982)
@@ -0,0 +1,18 @@
+Tests that the EventTarget API is no longer working on detached frames.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS internals.lastHandledUserGestureTimestamp() is 0
+PASS frame.contentWindow.internals.lastHandledUserGestureTimestamp() is 0
+PASS innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp() is 0
+PASS innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp() is 0
+Dispatching click
+PASS internals.lastHandledUserGestureTimestamp() is not 0
+PASS frame.contentWindow.internals.lastHandledUserGestureTimestamp() is not 0
+PASS innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp() is not 0
+PASS innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp() is 0
+
Added: trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation.html (0 => 214982)
--- trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation.html (rev 0)
+++ trunk/LayoutTests/fast/frames/user-gesture-timestamp-propagation.html 2017-04-06 00:55:14 UTC (rev 214982)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <script>
+ description("Tests that the EventTarget API is no longer working on detached frames.");
+
+ var frame;
+ var innerFrame;
+ var innerFrame2;
+
+ function dispatchClick()
+ {
+ var x = frame.offsetLeft + frame.offsetWidth / 2;
+ var y = frame.offsetTop + frame.offsetHeight / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+
+ function doTest()
+ {
+ frame = document.getElementById('frame');
+ innerFrame = frame.contentWindow.document.getElementById('frame');
+ innerFrame2 = frame.contentWindow.document.getElementById('frame2');
+
+ shouldBe('internals.lastHandledUserGestureTimestamp()', '0');
+ shouldBe('frame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+ shouldBe('innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+ shouldBe('innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+
+ debug('Dispatching click');
+ dispatchClick();
+
+ shouldNotBe('internals.lastHandledUserGestureTimestamp()', '0');
+ shouldNotBe('frame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+ shouldNotBe('innerFrame.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+ // Should have not hit frame2
+ shouldBe('innerFrame2.contentWindow.internals.lastHandledUserGestureTimestamp()', '0');
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <iframe id="frame" srcdoc="
+ <body>
+ <iframe id='frame' srcdoc='
+ Inner frame
+ '>
+ </iframe>
+ <iframe id='frame2' srcdoc='
+ Inner frame
+ '>
+ </iframe>
+ </body>">
+ </iframe>
+ <script src=""
+
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (214981 => 214982)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-04-06 00:55:14 UTC (rev 214982)
@@ -379,10 +379,10 @@
http/tests/navigation/keyboard-events-during-provisional-navigation.html [ Skip ]
media/audio-dealloc-crash.html [ Skip ]
-# This test uses EventSender's mouseMoveTo, mouseUp and mouseDown
+# Tests that use EventSender's mouseMoveTo, mouseUp and mouseDown
fast/forms/range/disabled-while-dragging.html [ Skip ]
fast/forms/range/range-drag-when-toggled-disabled.html [ Skip ]
-fast/media/video-element-in-details-collapse.html [ Skip ]
+fast/frames/user-gesture-timestamp-propagation.html [ Failure ]
# The file-wrapper part of <attachment> is not yet working on iOS
fast/attachment/attachment-type-attribute.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (214981 => 214982)
--- trunk/Source/WebCore/ChangeLog 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/ChangeLog 2017-04-06 00:55:14 UTC (rev 214982)
@@ -1,3 +1,27 @@
+2017-04-05 Simon Fraser <[email protected]>
+
+ Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
+ https://bugs.webkit.org/show_bug.cgi?id=170479
+
+ Reviewed by Sam Weinig.
+
+ When interacting with a subframe document, set lastHandledUserGestureTimestamp on all ancestor
+ documents up to the root.
+
+ This will be used in future for requestAnimationFrame throttling.
+
+ Test: fast/frames/user-gesture-timestamp-propagation.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::updateLastHandledUserGestureTimestamp):
+ * dom/Document.h:
+ * dom/UserGestureIndicator.cpp:
+ (WebCore::UserGestureIndicator::UserGestureIndicator):
+ * testing/Internals.cpp:
+ (WebCore::Internals::lastHandledUserGestureTimestamp):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2017-04-05 Eric Carlson <[email protected]>
[MediaStream] Host application should be able to mute and unmute media streams
Modified: trunk/Source/WebCore/dom/Document.cpp (214981 => 214982)
--- trunk/Source/WebCore/dom/Document.cpp 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-04-06 00:55:14 UTC (rev 214982)
@@ -142,7 +142,6 @@
#include "RenderView.h"
#include "RenderWidget.h"
#include "RequestAnimationFrameCallback.h"
-#include "ResourceLoadObserver.h"
#include "RuntimeEnabledFeatures.h"
#include "SVGDocumentExtensions.h"
#include "SVGElement.h"
@@ -6313,10 +6312,12 @@
return RegionFixedPair(targetRegion, insideFixedPosition);
}
-void Document::updateLastHandledUserGestureTimestamp()
+void Document::updateLastHandledUserGestureTimestamp(MonotonicTime time)
{
- m_lastHandledUserGestureTimestamp = MonotonicTime::now();
- ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*this);
+ m_lastHandledUserGestureTimestamp = time;
+
+ if (HTMLFrameOwnerElement* element = ownerElement())
+ element->document().updateLastHandledUserGestureTimestamp(time);
}
void Document::startTrackingStyleRecalcs()
Modified: trunk/Source/WebCore/dom/Document.h (214981 => 214982)
--- trunk/Source/WebCore/dom/Document.h 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/dom/Document.h 2017-04-06 00:55:14 UTC (rev 214982)
@@ -1144,7 +1144,7 @@
void didRemoveWheelEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One);
MonotonicTime lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
- void updateLastHandledUserGestureTimestamp();
+ void updateLastHandledUserGestureTimestamp(MonotonicTime);
// Used for testing. Count handlers in the main document, and one per frame which contains handlers.
WEBCORE_EXPORT unsigned wheelEventHandlerCount() const;
Modified: trunk/Source/WebCore/dom/UserGestureIndicator.cpp (214981 => 214982)
--- trunk/Source/WebCore/dom/UserGestureIndicator.cpp 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/dom/UserGestureIndicator.cpp 2017-04-06 00:55:14 UTC (rev 214982)
@@ -27,6 +27,7 @@
#include "UserGestureIndicator.h"
#include "Document.h"
+#include "ResourceLoadObserver.h"
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
@@ -54,8 +55,10 @@
if (state)
currentToken() = UserGestureToken::create(state.value());
- if (document && currentToken()->processingUserGesture())
- document->topDocument().updateLastHandledUserGestureTimestamp();
+ if (document && currentToken()->processingUserGesture()) {
+ document->updateLastHandledUserGestureTimestamp(MonotonicTime::now());
+ ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*document);
+ }
}
UserGestureIndicator::UserGestureIndicator(RefPtr<UserGestureToken> token)
Modified: trunk/Source/WebCore/testing/Internals.cpp (214981 => 214982)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-04-06 00:55:14 UTC (rev 214982)
@@ -3773,6 +3773,15 @@
return UserGestureIndicator::processingUserGesture();
}
+double Internals::lastHandledUserGestureTimestamp()
+{
+ Document* document = contextDocument();
+ if (!document)
+ return 0;
+
+ return document->lastHandledUserGestureTimestamp().secondsSinceEpoch().value();
+}
+
RefPtr<GCObservation> Internals::observeGC(JSC::JSValue value)
{
if (!value.isObject())
Modified: trunk/Source/WebCore/testing/Internals.h (214981 => 214982)
--- trunk/Source/WebCore/testing/Internals.h 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/testing/Internals.h 2017-04-06 00:55:14 UTC (rev 214982)
@@ -532,6 +532,7 @@
String composedTreeAsText(Node&);
bool isProcessingUserGesture();
+ double lastHandledUserGestureTimestamp();
RefPtr<GCObservation> observeGC(JSC::JSValue);
Modified: trunk/Source/WebCore/testing/Internals.idl (214981 => 214982)
--- trunk/Source/WebCore/testing/Internals.idl 2017-04-06 00:13:52 UTC (rev 214981)
+++ trunk/Source/WebCore/testing/Internals.idl 2017-04-06 00:55:14 UTC (rev 214982)
@@ -501,6 +501,7 @@
DOMString composedTreeAsText(Node parent);
boolean isProcessingUserGesture();
+ double lastHandledUserGestureTimestamp();
GCObservation? observeGC(any observed);