This is almost certainly due to bug 774139. Testing on http://people.mozilla.com/~cjones/events-mouse.html, which doesn't preventDefault() the touchstart event so should only get mouse events IIUC, I see received event touchstart received event mousedown received event touchmove <== wrong, I think received event mousemove received event touchmove received event mousemove ... received event touchend <== also wrong, I think, maybe not received event mouseup This is probably confusing either our focus code or the JS form helper.
That sequence seems right to me. If you have listeners, you'll always get the touch events. And if the code called preventDefault() then it should stop getting mouse events, but will still get touch.
OK. Good to know, my understanding was incorrect.
Alright, doesn't seem to be touch-event related. Whew! If I load this page http://people.mozilla.com/~cjones/focus.html as the "Template" app, set to run out-of-process, it brings up the VKB just fine. If I remove the .focus() call and tap the app, it works just fine too. However, if I load the same page in the browser app, it *doesn't* work, whether with explicit .focus() or tapping the input box. This smells to me like a missing docShell.activate on the content side. Dale, Justin, can you guys investigate?
Another possibility is that this is a recent bug in the gaia browser app. If so please close out.
Here's what I think is happening: You remember when you were dealing with bug 761927 and debugging through nsFocusManager::SetFocusInner et. al? The focus manager is activated by mouse or keyboard input events. Now, in bug 774139, we stopped sending mouse events to the parent element, in favor of creating the phony mouse events in the content. But this means that SetFocusInner won't get called and remote->Activate() won't be called (http://mxr.mozilla.org/mozilla-central/source/dom/base/nsFocusManager.cpp#1781) The solution is that we can still block cross-process forwarding of mouse events in that case, but we make them reach the parent frame as well. This seems a more correct behavior. Another hack solution would be to call remote->Activate() in nsEventStateManager::HandleCrossProcessEvent, but that feels like a hack and I believe can fall into other focus issues.
Comment on attachment 643728 [details] [diff] [review] Experiment Fixes the bug for me.
Indeed a regression from forwarding touch events.
A potential problem with this patch is that IIUC, it will result in synthesized mouse events *always* being delivered to in-process content, even if the content preventDefault(). I don't think that's all that serious of a problem but we'd need to test.
Comment on attachment 643728 [details] [diff] [review] Experiment smaug is OK with delegating this review to me.