From 62ce0593d168f0ef6c1b9696fddbe27b2f72cfb2 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sat, 1 Oct 2011 10:10:43 +0900 Subject: [PATCH] backout bug 685073 part.2 due to random crash --- widget/src/cocoa/TextInputHandler.h | 10 ---------- widget/src/cocoa/TextInputHandler.mm | 13 ++++--------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/widget/src/cocoa/TextInputHandler.h b/widget/src/cocoa/TextInputHandler.h index 2206d4da5ec..c1cc789d7b9 100644 --- a/widget/src/cocoa/TextInputHandler.h +++ b/widget/src/cocoa/TextInputHandler.h @@ -481,8 +481,6 @@ protected: bool mKeyPressDispatched; // Whether keypress event was consumed by web contents or chrome contents. bool mKeyPressHandled; - // Whether the key event causes other key events via IME or something. - bool mCausedOtherKeyEvents; KeyEventState(NSEvent* aNativeKeyEvent) : mKeyEvent(nsnull) { @@ -497,7 +495,6 @@ protected: mKeyDownHandled = aOther.mKeyDownHandled; mKeyPressDispatched = aOther.mKeyPressDispatched; mKeyPressHandled = aOther.mKeyPressHandled; - mCausedOtherKeyEvents = aOther.mCausedOtherKeyEvents; } ~KeyEventState() @@ -521,7 +518,6 @@ protected: mKeyDownHandled = PR_FALSE; mKeyPressDispatched = PR_FALSE; mKeyPressHandled = PR_FALSE; - mCausedOtherKeyEvents = PR_FALSE; } bool KeyDownOrPressHandled() @@ -568,12 +564,6 @@ protected: */ KeyEventState* PushKeyEvent(NSEvent* aNativeKeyEvent) { - PRUint32 nestCount = mCurrentKeyEvents.Length(); - for (PRUint32 i = 0; i < nestCount; i++) { - // When the key event is caused by another key event, all key events - // which are being handled should be marked as "consumed". - mCurrentKeyEvents[i].mCausedOtherKeyEvents = PR_TRUE; - } KeyEventState keyEventState(aNativeKeyEvent); return mCurrentKeyEvents.InsertElementAt(0, keyEventState); } diff --git a/widget/src/cocoa/TextInputHandler.mm b/widget/src/cocoa/TextInputHandler.mm index 7eecaacf00d..22d3d7220e1 100644 --- a/widget/src/cocoa/TextInputHandler.mm +++ b/widget/src/cocoa/TextInputHandler.mm @@ -1124,8 +1124,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) // our default action for this key. if (!(interpretKeyEventsCalled && IsNormalCharInputtingEvent(keypressEvent))) { - if (currentKeyEvent->mKeyDownHandled || - currentKeyEvent->mCausedOtherKeyEvents) { + if (currentKeyEvent->mKeyDownHandled) { keypressEvent.flags |= NS_EVENT_FLAG_NO_DEFAULT; } currentKeyEvent->mKeyPressHandled = DispatchEvent(keypressEvent); @@ -1420,16 +1419,12 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) PR_LOG(gLog, PR_LOG_ALWAYS, ("%p TextInputHandler::DoCommandBySelector, aSelector=\"%s\", " - "Destroyed()=%s, keypressHandled=%s, causedOtherKeyEvents=%s", + "Destroyed()=%s, keypressHandled=%s", this, aSelector ? aSelector : "", TrueOrFalse(Destroyed()), currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mKeyPressHandled) : "N/A", - currentKeyEvent ? - TrueOrFalse(currentKeyEvent->mCausedOtherKeyEvents) : "N/A")); + TrueOrFalse(currentKeyEvent->mKeyPressHandled) : "N/A")); - return !Destroyed() && currentKeyEvent && - (currentKeyEvent->mKeyPressHandled || - currentKeyEvent->mCausedOtherKeyEvents); + return !Destroyed() && currentKeyEvent && currentKeyEvent->mKeyPressHandled; }