mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1148196 - Crashes at -[ChildView keyDown:] related to secure input. r=masayuki
This commit is contained in:
parent
6940ef010b
commit
4431c47e10
@ -847,12 +847,6 @@ public:
|
||||
*/
|
||||
bool IsFocused();
|
||||
|
||||
/**
|
||||
* True if our view has keyboard focus (and our window is key), or if
|
||||
* it would have keyboard focus if our window were key.
|
||||
*/
|
||||
bool IsOrWouldBeFocused();
|
||||
|
||||
static CFArrayRef CreateAllIMEModeList();
|
||||
static void DebugPrintAllIMEModes();
|
||||
|
||||
|
@ -3582,19 +3582,6 @@ IMEInputHandler::IsFocused()
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
bool
|
||||
IMEInputHandler::IsOrWouldBeFocused()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
NS_ENSURE_TRUE(!Destroyed(), false);
|
||||
NSWindow* window = [mView window];
|
||||
NS_ENSURE_TRUE(window, false);
|
||||
return [window firstResponder] == mView && ![window attachedSheet];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
bool
|
||||
IMEInputHandler::IsIMEOpened()
|
||||
{
|
||||
|
@ -1646,10 +1646,12 @@ nsChildView::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
mTextInputHandler->CancelIMEComposition();
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
if (mInputContext.IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
if (mTextInputHandler->IsFocused()) {
|
||||
if (mInputContext.IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
|
||||
@ -1715,7 +1717,7 @@ nsChildView::SetInputContext(const InputContext& aContext,
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(mTextInputHandler);
|
||||
|
||||
if (mTextInputHandler->IsOrWouldBeFocused()) {
|
||||
if (mTextInputHandler->IsFocused()) {
|
||||
if (aContext.IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
@ -5641,6 +5643,12 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
if (isMozWindow)
|
||||
[[self window] setSuppressMakeKeyFront:NO];
|
||||
|
||||
if (mGeckoChild->GetInputContext().IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
|
@ -2280,11 +2280,6 @@ nsCocoaWindow::NotifyIMEInternal(const IMENotification& aIMENotification)
|
||||
{
|
||||
switch (aIMENotification.mMessage) {
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
if (mInputContext.IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
}
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return NS_OK;
|
||||
@ -2299,16 +2294,6 @@ nsCocoaWindow::SetInputContext(const InputContext& aContext,
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mWindow &&
|
||||
[mWindow firstResponder] == mWindow &&
|
||||
[mWindow isKeyWindow] &&
|
||||
[[NSApplication sharedApplication] isActive]) {
|
||||
if (aContext.IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
}
|
||||
}
|
||||
mInputContext = aContext;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
@ -2545,6 +2530,16 @@ nsCocoaWindow::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
|
||||
if ([window isSheet])
|
||||
[WindowDelegate paintMenubarForWindow:window];
|
||||
|
||||
nsChildView* mainChildView =
|
||||
static_cast<nsChildView*>([[(BaseWindow*)window mainChildView] widget]);
|
||||
if (mainChildView) {
|
||||
if (mainChildView->GetInputContext().IsPasswordEditor()) {
|
||||
TextInputHandler::EnableSecureEventInput();
|
||||
} else {
|
||||
TextInputHandler::EnsureSecureEventInputDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user