2011-04-19 Stuart Morgan <stuartmorgan@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2011 18:17:30 +0000 (18:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2011 18:17:30 +0000 (18:17 +0000)
        Reviewed by Tony Chang.

        [chromium] Clicking on plugin for first time blocks focus shift
        https://bugs.webkit.org/show_bug.cgi?id=58419

        Added new test for cross-iframe focus changes on plugin clicks.

        * plugins/mouse-click-iframe-to-plugin-expected.txt: Added.
        * plugins/mouse-click-iframe-to-plugin.html: Added.
2011-04-19  Stuart Morgan  <stuartmorgan@chromium.org>

        Reviewed by Tony Chang.

        [chromium] Clicking on plugin for first time blocks focus shift
        https://bugs.webkit.org/show_bug.cgi?id=58419

        Switched to using FocusController when moving focus to a plugin
        so that cross-frame focus changes are handled correctly.

        * src/WebPluginContainerImpl.cpp:
        (WebKit::WebPluginContainerImpl::handleMouseEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84270 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/plugins/mouse-click-iframe-to-plugin-expected.txt [new file with mode: 0644]
LayoutTests/plugins/mouse-click-iframe-to-plugin.html [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

index 0f11aac..614a7ee 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-19  Stuart Morgan  <stuartmorgan@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [chromium] Clicking on plugin for first time blocks focus shift
+        https://bugs.webkit.org/show_bug.cgi?id=58419
+
+        Added new test for cross-iframe focus changes on plugin clicks.
+
+        * plugins/mouse-click-iframe-to-plugin-expected.txt: Added.
+        * plugins/mouse-click-iframe-to-plugin.html: Added.
+
 2011-04-19  Jungshik Shin  <jshin@chromium.org>
 
         Reviewed by David Levin
diff --git a/LayoutTests/plugins/mouse-click-iframe-to-plugin-expected.txt b/LayoutTests/plugins/mouse-click-iframe-to-plugin-expected.txt
new file mode 100644 (file)
index 0000000..d95403e
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+PASSED
diff --git a/LayoutTests/plugins/mouse-click-iframe-to-plugin.html b/LayoutTests/plugins/mouse-click-iframe-to-plugin.html
new file mode 100644 (file)
index 0000000..66381fb
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script>
+function runTest() {
+    frameDocument = document.getElementById('frame').contentWindow.document;
+    frameDocument.body.innerHTML = "<textarea id=textarea cols=50 rows=5 onblur='this.style.backgroundColor=\"green\"'></textarea>";
+    var textarea = frameDocument.getElementById('textarea');
+    textarea.focus();
+
+    if (!window.layoutTestController) {
+        output.textContent = "Click on the plugin (the blue rectangle); if the text field turns green the test has passed, otherwise it has failed.";
+    } else {
+        eventSender.mouseMoveTo(60, 60);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+
+        if (frameDocument.activeElement != textarea) {
+          document.getElementById('output').textContent = "PASSED";
+        }
+        layoutTestController.dumpAsText();
+    }
+}
+</script>
+</head>
+<body onload="runTest();">
+<embed type="application/x-shockwave-flash" src="resources/simple_blank.swf" width="100" height="100"></embed><br>
+<iframe id="frame" width="640"></iframe>
+<div id="output">FAILED</div>
+</body>
+</html>
index bfa7e41..bb0750a 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-19  Stuart Morgan  <stuartmorgan@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [chromium] Clicking on plugin for first time blocks focus shift
+        https://bugs.webkit.org/show_bug.cgi?id=58419
+
+        Switched to using FocusController when moving focus to a plugin
+        so that cross-frame focus changes are handled correctly.
+
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::handleMouseEvent):
+
 2011-04-19  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Reviewed by Pavel Feldman.
index 40f8625..150f173 100644 (file)
@@ -480,12 +480,11 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event)
         return;
 
     if (event->type() == eventNames().mousedownEvent) {
-        // Ensure that the frame containing the plugin has focus.
         Frame* containingFrame = parentView->frame();
         if (Page* currentPage = containingFrame->page())
-            currentPage->focusController()->setFocusedFrame(containingFrame);
-        // Give focus to our containing HTMLPluginElement.
-        containingFrame->document()->setFocusedNode(m_element);
+            currentPage->focusController()->setFocusedNode(m_element, containingFrame);
+        else
+            containingFrame->document()->setFocusedNode(m_element);
     }
 
     WebCursorInfo cursorInfo;