Title: [128273] trunk
Revision
128273
Author
joc...@chromium.org
Date
2012-09-12 00:53:59 -0700 (Wed, 12 Sep 2012)

Log Message

Source/WebKit/chromium: [chromium] consumable user gesture count off for input events
https://bugs.webkit.org/show_bug.cgi?id=96373

Reviewed by Adam Barth.

Don't create a UserGestureIndicator in the chromium layer, as it will
already be created by webcore's event handler. Creating multiple
UserGestureIndicator objects for the same object would allow to execute
multiple user-gesture-gated actions per user gesture such as opening a
new window.

* public/WebInputEvent.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleInputEvent):

Tools: [chromium] Consume a user gesture when creating a new view.
https://bugs.webkit.org/show_bug.cgi?id=96373

Reviewed by Adam Barth.

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::createView):

LayoutTests: [chromium] Only allow one user-gesture gated action per user action.
https://bugs.webkit.org/show_bug.cgi?id=96373

Reviewed by Adam Barth.

* platform/chromium/fast/events/popup-allowed-from-gesture-only-once-expected.txt: Added.
* platform/chromium/fast/events/popup-allowed-from-gesture-only-once.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128272 => 128273)


--- trunk/LayoutTests/ChangeLog	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/LayoutTests/ChangeLog	2012-09-12 07:53:59 UTC (rev 128273)
@@ -1,5 +1,15 @@
 2012-09-12  Jochen Eisinger  <joc...@chromium.org>
 
+        [chromium] Only allow one user-gesture gated action per user action.
+        https://bugs.webkit.org/show_bug.cgi?id=96373
+
+        Reviewed by Adam Barth.
+
+        * platform/chromium/fast/events/popup-allowed-from-gesture-only-once-expected.txt: Added.
+        * platform/chromium/fast/events/popup-allowed-from-gesture-only-once.html: Added.
+
+2012-09-12  Jochen Eisinger  <joc...@chromium.org>
+
         Change fast/events/popup-blocking-timers.html to generate a user action for each popup
         https://bugs.webkit.org/show_bug.cgi?id=96475
 

Added: trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once-expected.txt (0 => 128273)


--- trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once-expected.txt	2012-09-12 07:53:59 UTC (rev 128273)
@@ -0,0 +1,4 @@
+Test that only a single popup is allowed in response to a single user action. The test passes if only one popup is created.
+
+Click Here
+PASSED

Added: trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once.html (0 => 128273)


--- trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/popup-allowed-from-gesture-only-once.html	2012-09-12 07:53:59 UTC (rev 128273)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html> 
+    <body>
+        <p>
+            Test that only a single popup is allowed in response to a single
+            user action. The test passes if only one popup is created.
+        </p>
+        <button id="button" _onclick_="popup()">Click Here</button>
+        <div id="console"></div>
+        <script>
+            function popup() {
+                window.open("about:blank", "window1");
+                window.open("about:blank", "window2");
+                if (window.testRunner) {
+                    if (testRunner.windowCount() == windowCount + 1)
+                        document.getElementById("console").innerText = "PASSED";
+                    else
+                        document.getElementById("console").innerText = "FAILED";
+                    testRunner.notifyDone();
+                }
+            }
+
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.setCanOpenWindows();
+                testRunner.setPopupBlockingEnabled(true);
+                testRunner.setCloseRemainingWindowsWhenComplete(true);
+                testRunner.waitUntilDone();
+                windowCount = testRunner.windowCount();
+
+                var button = document.getElementById("button");
+
+                if (window.eventSender) {
+                    eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
+                    eventSender.mouseDown();
+                    eventSender.mouseUp();
+                }
+            }
+        </script>
+    </body>
+  </html>

Modified: trunk/Source/WebKit/chromium/ChangeLog (128272 => 128273)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-12 07:53:59 UTC (rev 128273)
@@ -1,3 +1,20 @@
+2012-09-12  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] consumable user gesture count off for input events
+        https://bugs.webkit.org/show_bug.cgi?id=96373
+
+        Reviewed by Adam Barth.
+
+        Don't create a UserGestureIndicator in the chromium layer, as it will
+        already be created by webcore's event handler. Creating multiple
+        UserGestureIndicator objects for the same object would allow to execute
+        multiple user-gesture-gated actions per user gesture such as opening a
+        new window.
+
+        * public/WebInputEvent.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::handleInputEvent):
+
 2012-09-12  Alexandre Elias  <ael...@chromium.org>
 
         [chromium] Flip Y and swizzle inside compositeAndReadback implementation

Modified: trunk/Source/WebKit/chromium/public/WebInputEvent.h (128272 => 128273)


--- trunk/Source/WebKit/chromium/public/WebInputEvent.h	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/Source/WebKit/chromium/public/WebInputEvent.h	2012-09-12 07:53:59 UTC (rev 128273)
@@ -194,16 +194,6 @@
             || 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;
-    }
-
     // Returns true if the WebInputEvent is a gesture event.
     static bool isGestureEventType(int type)
     {

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (128272 => 128273)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-09-12 07:53:59 UTC (rev 128273)
@@ -120,7 +120,6 @@
 #include "TextIterator.h"
 #include "Timer.h"
 #include "TraceEvent.h"
-#include "UserGestureIndicator.h"
 #include "WebAccessibilityObject.h"
 #include "WebActiveWheelFlingParameters.h"
 #include "WebAutofillClient.h"
@@ -1906,8 +1905,6 @@
 
 bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
 {
-    UserGestureIndicator gestureIndicator(WebInputEvent::isUserGestureEventType(inputEvent.type) ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
-
     // If we've started a drag and drop operation, ignore input events until
     // we're done.
     if (m_doingDragAndDrop)

Modified: trunk/Tools/ChangeLog (128272 => 128273)


--- trunk/Tools/ChangeLog	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/Tools/ChangeLog	2012-09-12 07:53:59 UTC (rev 128273)
@@ -1,3 +1,13 @@
+2012-09-12  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] Consume a user gesture when creating a new view.
+        https://bugs.webkit.org/show_bug.cgi?id=96373
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::createView):
+
 2012-09-12  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         [WK2][WTR] Some of TestRunner special options are not reset before testing

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (128272 => 128273)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-09-12 07:39:51 UTC (rev 128272)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-09-12 07:53:59 UTC (rev 128273)
@@ -251,12 +251,13 @@
 
 // WebViewClient -------------------------------------------------------------
 
-WebView* WebViewHost::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
+WebView* WebViewHost::createView(WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
 {
     if (!testRunner()->canOpenWindows())
         return 0;
     if (testRunner()->shouldDumpCreateView())
         fprintf(stdout, "createView(%s)\n", URLDescription(request.url()).c_str());
+    creator->consumeUserGesture();
     return m_shell->createNewWindow(WebURL())->webView();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to