| Index: WebCore/page/EventHandler.cpp
|
| ===================================================================
|
| --- WebCore/page/EventHandler.cpp (revision 48065)
|
| +++ WebCore/page/EventHandler.cpp (working copy)
|
| @@ -2162,7 +2162,9 @@
|
|
|
| if (initialKeyEvent.type() == PlatformKeyboardEvent::RawKeyDown) {
|
| node->dispatchEvent(keydown, ec);
|
| - return keydown->defaultHandled() || keydown->defaultPrevented();
|
| + // If frame changed as a result of keydown dispatch, then return true to avoid sending a subsequent keypress message to the new frame.
|
| + bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame();
|
| + return keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame;
|
| }
|
|
|
| // Run input method in advance of DOM event handling. This may result in the IM
|
| @@ -2182,7 +2184,9 @@
|
| }
|
|
|
| node->dispatchEvent(keydown, ec);
|
| - bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented();
|
| + // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame.
|
| + bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame();
|
| + bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame;
|
| if (handledByInputMethod || (keydownResult && !backwardCompatibilityMode))
|
| return keydownResult;
|
|
|
|
|