Title: [86856] branches/chromium/696
- Revision
- 86856
- Author
- [email protected]
- Date
- 2011-05-19 11:27:54 -0700 (Thu, 19 May 2011)
Log Message
Merge 85977 - 2011-05-06 Justin Schuh <[email protected]>
Reviewed by Adam Barth.
[Chromium] Whitelist input events interpreted as user gestures
https://bugs.webkit.org/show_bug.cgi?id=60213
* public/WebInputEvent.h:
(WebKit::WebInputEvent::isUserGestureEventType):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleInputEvent):
BUG=72189
Modified Paths
Added Paths
Diff
Copied: branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove-expected.txt (from rev 85977, trunk/LayoutTests/fast/events/popup-blocked-from-mousemove-expected.txt) (0 => 86856)
--- branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove-expected.txt (rev 0)
+++ branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove-expected.txt 2011-05-19 18:27:54 UTC (rev 86856)
@@ -0,0 +1,2 @@
+If you observe a popup this test has failed due to a MouseMovement being treated as a user gesture by the popup blocker.
+PASSED
Copied: branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove.html (from rev 85977, trunk/LayoutTests/fast/events/popup-blocked-from-mousemove.html) (0 => 86856)
--- branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove.html (rev 0)
+++ branches/chromium/696/LayoutTests/fast/events/popup-blocked-from-mousemove.html 2011-05-19 18:27:54 UTC (rev 86856)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.setPopupBlockingEnabled(true);
+ layoutTestController.setCloseRemainingWindowsWhenComplete(true);
+ layoutTestController.waitUntilDone();
+ // Record current window count.
+ window.windowCount = window.layoutTestController.windowCount();
+}
+
+function eventfire()
+{
+ oClickEvent = document.createEvent("MouseEvents");
+ oClickEvent.initEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ document.body.dispatchEvent(oClickEvent);
+}
+
+window._onload_ = function() {
+ if (!window.eventSender)
+ return;
+
+ eventSender.mouseMoveTo(50, 50);
+ eventSender.mouseMoveTo(0, 0);
+
+ function finishTest()
+ {
+ if (layoutTestController.windowCount() == window.windowCount)
+ document.getElementById("console").innerText = "PASSED";
+ else
+ document.getElementById("console").innerText = "FAILED";
+ layoutTestController.notifyDone();
+ }
+ setTimeout(finishTest, 0);
+}
+</script>
+</head>
+<body _onMouseOver_=eventfire() _onMouseOut_=eventfire() _onclick_="window.open('about:blank','','height=200,width=200')">
+If you observe a popup this test has failed due to a MouseMovement being treated as a user gesture by the popup blocker.
+<div id="console" style='height: 200; width: 200'></div>
+</body>
+</html>
+
Modified: branches/chromium/696/Source/WebKit/chromium/public/WebInputEvent.h (86855 => 86856)
--- branches/chromium/696/Source/WebKit/chromium/public/WebInputEvent.h 2011-05-19 18:14:58 UTC (rev 86855)
+++ branches/chromium/696/Source/WebKit/chromium/public/WebInputEvent.h 2011-05-19 18:27:54 UTC (rev 86856)
@@ -165,6 +165,16 @@
|| type == TouchEnd
|| type == TouchCancel;
}
+
+ // Returns true if the WebInputEvent |type| should be handled as user gesture.
+ static bool isUserGestureEventType(int type)
+ {
+ return isKeyboardEventType(type)
+ || type == MouseDown
+ || type == MouseUp
+ || type == TouchStart
+ || type == TouchEnd;
+ }
};
// WebKeyboardEvent -----------------------------------------------------------
Modified: branches/chromium/696/Source/WebKit/chromium/src/WebViewImpl.cpp (86855 => 86856)
--- branches/chromium/696/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-05-19 18:14:58 UTC (rev 86855)
+++ branches/chromium/696/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-05-19 18:27:54 UTC (rev 86856)
@@ -1107,7 +1107,7 @@
bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
{
- UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
+ UserGestureIndicator gestureIndicator(WebInputEvent::isUserGestureEventType(inputEvent.type) ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
// If we've started a drag and drop operation, ignore input events until
// we're done.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes