author | Michael Layzell <michael@thelayzells.com> |
Mon, 18 Jul 2016 12:36:38 -0400 | |
changeset 313042 | b4d1a0890f4048ded5479b157b75f05138a34ade |
parent 313041 | 9a9dbfdcdb15c3b530f5b92ff43b1bd1b102d8e9 |
child 313043 | fe96a11b449b58bd550d8cbdcecf382528da2d67 |
push id | 30669 |
push user | kwierso@gmail.com |
push date | Thu, 08 Sep 2016 00:56:12 +0000 |
treeherder | mozilla-central@77940cbf0c2a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mstange |
bugs | 1018486 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -1529,17 +1529,17 @@ TextInputHandler::HandleKeyDownEvent(NSE // - Don't hide mouse cursor at pressing modifier key // - Hide mouse cursor even if the key event will be handled by IME (i.e., // even without dispatching eKeyPress events) // - Hide mouse cursor even when a plugin has focus if (!([aNativeEvent modifierFlags] & NSCommandKeyMask)) { [NSCursor setHiddenUntilMouseMoves:YES]; } - RefPtr<nsChildView> kungFuDeathGrip(mWidget); + RefPtr<nsChildView> widget(mWidget); KeyEventState* currentKeyEvent = PushKeyEvent(aNativeEvent); AutoKeyEventStateCleaner remover(this); ComplexTextInputPanel* ctiPanel = ComplexTextInputPanel::GetSharedComplexTextInputPanel(); if (ctiPanel && ctiPanel->IsInComposition()) { nsAutoString committed; ctiPanel->InterpretKeyEvent(aNativeEvent, committed); @@ -1548,17 +1548,17 @@ TextInputHandler::HandleKeyDownEvent(NSE if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyDownEvent, " "FAILED, due to BeginNativeInputTransaction() failure " "at dispatching keydown for ComplexTextInputPanel", this)); return false; } - WidgetKeyboardEvent imeEvent(true, eKeyDown, mWidget); + WidgetKeyboardEvent imeEvent(true, eKeyDown, widget); currentKeyEvent->InitKeyEvent(this, imeEvent); imeEvent.mPluginTextEventString.Assign(committed); nsEventStatus status = nsEventStatus_eIgnore; mDispatcher->DispatchKeyboardEvent(eKeyDown, imeEvent, status, currentKeyEvent); } return true; } @@ -1569,17 +1569,17 @@ TextInputHandler::HandleKeyDownEvent(NSE if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyDownEvent, " "FAILED, due to BeginNativeInputTransaction() failure " "at dispatching keydown for ordinal cases", this)); return false; } - WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget); + WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget); currentKeyEvent->InitKeyEvent(this, keydownEvent); nsEventStatus status = nsEventStatus_eIgnore; mDispatcher->DispatchKeyboardEvent(eKeyDown, keydownEvent, status, currentKeyEvent); currentKeyEvent->mKeyDownHandled = (status == nsEventStatus_eConsumeNoDefault); @@ -1608,17 +1608,17 @@ TextInputHandler::HandleKeyDownEvent(NSE } // Let Cocoa interpret the key events, caching IsIMEComposing first. bool wasComposing = IsIMEComposing(); bool interpretKeyEventsCalled = false; // Don't call interpretKeyEvents when a plugin has focus. If we call it, // for example, a character is inputted twice during a composition in e10s // mode. - if (!mWidget->IsPluginFocused() && (IsIMEEnabled() || IsASCIICapableOnly())) { + if (!widget->IsPluginFocused() && (IsIMEEnabled() || IsASCIICapableOnly())) { MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, calling interpretKeyEvents", this)); [mView interpretKeyEvents:[NSArray arrayWithObject:aNativeEvent]]; interpretKeyEventsCalled = true; MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, called interpretKeyEvents", this)); @@ -1642,17 +1642,17 @@ TextInputHandler::HandleKeyDownEvent(NSE if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyDownEvent, " "FAILED, due to BeginNativeInputTransaction() failure " "at dispatching keypress", this)); return false; } - WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget); + WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); currentKeyEvent->InitKeyEvent(this, keypressEvent); // If we called interpretKeyEvents and this isn't normal character input // then IME probably ate the event for some reason. We do not want to // send a key press event in that case. // TODO: // There are some other cases which IME eats the current event. // 1. If key events were nested during calling interpretKeyEvents, it means @@ -1738,16 +1738,17 @@ TextInputHandler::HandleFlagsChanged(NSE if (Destroyed()) { MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleFlagsChanged, " "widget has been already destroyed", this)); return; } RefPtr<nsChildView> kungFuDeathGrip(mWidget); + mozilla::Unused << kungFuDeathGrip; // Not referenced within this function MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleFlagsChanged, aNativeEvent=%p, " "type=%s, keyCode=%s (0x%X), modifierFlags=0x%08X, " "sLastModifierState=0x%08X, IsIMEComposing()=%s", this, aNativeEvent, GetNativeKeyEventType(aNativeEvent), GetKeyNameForNativeKeyCode([aNativeEvent keyCode]), [aNativeEvent keyCode], [aNativeEvent modifierFlags], sLastModifierState, @@ -2190,17 +2191,17 @@ TextInputHandler::InsertText(NSAttribute } // Don't let the same event be fired twice when hitting // enter/return! (Bug 420502) if (currentKeyEvent && !currentKeyEvent->CanDispatchKeyPressEvent()) { return; } - RefPtr<nsChildView> kungFuDeathGrip(mWidget); + RefPtr<nsChildView> widget(mWidget); // If the replacement range is specified, select the range. Then, the // selection will be replaced by the later keypress event. if (isEditable && aReplacementRange && aReplacementRange->location != NSNotFound && !NSEqualRanges(selectedRange, *aReplacementRange)) { NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange)); } @@ -2209,17 +2210,17 @@ TextInputHandler::InsertText(NSAttribute if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::HandleKeyUpEvent, " "FAILED, due to BeginNativeInputTransaction() failure", this)); return; } // Dispatch keypress event with char instead of compositionchange event - WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget); + WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); // XXX Why do we need to dispatch keypress event for not inputting any // string? If it wants to delete the specified range, should we // dispatch an eContentCommandDelete event instead? Because this // must not be caused by a key operation, a part of IME's processing. keypressEvent.mIsChar = IsPrintableChar(str.CharAt(0)); // Don't set other modifiers from the current event, because here in // -insertText: they've already been taken into account in creating @@ -2258,17 +2259,17 @@ TextInputHandler::InsertText(NSAttribute } NS_OBJC_END_TRY_ABORT_BLOCK; } bool TextInputHandler::DoCommandBySelector(const char* aSelector) { - RefPtr<nsChildView> kungFuDeathGrip(mWidget); + RefPtr<nsChildView> widget(mWidget); KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DoCommandBySelector, aSelector=\"%s\", " "Destroyed()=%s, keydownHandled=%s, keypressHandled=%s, " "causedOtherKeyEvents=%s", this, aSelector ? aSelector : "", TrueOrFalse(Destroyed()), @@ -2284,17 +2285,17 @@ TextInputHandler::DoCommandBySelector(co if (NS_WARN_IF(NS_FAILED(rv))) { MOZ_LOG(gLog, LogLevel::Error, ("%p IMEInputHandler::DoCommandBySelector, " "FAILED, due to BeginNativeInputTransaction() failure " "at dispatching keypress", this)); return false; } - WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget); + WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget); currentKeyEvent->InitKeyEvent(this, keypressEvent); nsEventStatus status = nsEventStatus_eIgnore; currentKeyEvent->mKeyPressDispatched = mDispatcher->MaybeDispatchKeypressEvents(keypressEvent, status, currentKeyEvent); currentKeyEvent->mKeyPressHandled = (status == nsEventStatus_eConsumeNoDefault);
--- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1401,16 +1401,18 @@ nsresult nsChildView::ConfigureChildren( { return NS_OK; } // Invokes callback and ProcessEvent methods on Event Listener object NS_IMETHODIMP nsChildView::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus) { + RefPtr<nsChildView> kungFuDeathGrip(this); + #ifdef DEBUG debug_DumpEvent(stdout, event->mWidget, event, "something", 0); #endif NS_ASSERTION(!(mTextInputHandler && mTextInputHandler->IsIMEComposing() && event->HasKeyEventMessage()), "Any key events should not be fired during IME composing"); @@ -1424,26 +1426,26 @@ NS_IMETHODIMP nsChildView::DispatchEvent aStatus = nsEventStatus_eIgnore; nsIWidgetListener* listener = mWidgetListener; // If the listener is NULL, check if the parent is a popup. If it is, then // this child is the popup content view attached to a popup. Get the // listener from the parent popup instead. - nsCOMPtr<nsIWidget> kungFuDeathGrip = do_QueryInterface(mParentWidget ? mParentWidget : this); - if (!listener && mParentWidget) { - if (mParentWidget->WindowType() == eWindowType_popup) { + nsCOMPtr<nsIWidget> parentWidget = mParentWidget; + if (!listener && parentWidget) { + if (parentWidget->WindowType() == eWindowType_popup) { // Check just in case event->mWidget isn't this widget if (event->mWidget) { listener = event->mWidget->GetWidgetListener(); } if (!listener) { - event->mWidget = mParentWidget; - listener = mParentWidget->GetWidgetListener(); + event->mWidget = parentWidget; + listener = parentWidget->GetWidgetListener(); } } } if (listener) aStatus = listener->HandleEvent(event, mUseAttachedEvents); return NS_OK; @@ -6061,18 +6063,18 @@ nsChildView::GetSelectionAsPlaintext(nsA - (id<mozAccessible>)accessible { if (!mGeckoChild) return nil; id<mozAccessible> nativeAccessible = nil; nsAutoRetainCocoaObject kungFuDeathGrip(self); - nsCOMPtr<nsIWidget> kungFuDeathGrip2(mGeckoChild); - RefPtr<a11y::Accessible> accessible = mGeckoChild->GetDocumentAccessible(); + RefPtr<nsChildView> geckoChild(mGeckoChild); + RefPtr<a11y::Accessible> accessible = geckoChild->GetDocumentAccessible(); if (!accessible) return nil; accessible->GetNativeInterface((void**)&nativeAccessible); #ifdef DEBUG_hakan NSAssert(![nativeAccessible isExpired], @"native acc is expired!!!"); #endif
--- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -1881,16 +1881,17 @@ NS_IMETHODIMP nsCocoaWindow::GetSheetWin // Invokes callback and ProcessEvent methods on Event Listener object NS_IMETHODIMP nsCocoaWindow::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus) { aStatus = nsEventStatus_eIgnore; nsCOMPtr<nsIWidget> kungFuDeathGrip(event->mWidget); + mozilla::Unused << kungFuDeathGrip; // Not used within this function if (mWidgetListener) aStatus = mWidgetListener->HandleEvent(event, mUseAttachedEvents); return NS_OK; } // aFullScreen should be the window's mInFullScreenMode. We don't have access to that
--- a/widget/cocoa/nsMenuX.mm +++ b/widget/cocoa/nsMenuX.mm @@ -416,17 +416,16 @@ void nsMenuX::MenuConstruct() nsCOMPtr<nsIXPConnect> xpconnect = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_SUCCEEDED(rv)) { nsIDocument* ownerDoc = menuPopup->OwnerDoc(); dom::AutoJSAPI jsapi; if (ownerDoc && jsapi.Init(ownerDoc->GetInnerWindow())) { JSContext* cx = jsapi.cx(); JS::RootedObject ignoredObj(cx); - nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper; xpconnect->WrapNative(cx, JS::CurrentGlobalOrNull(cx), menuPopup, NS_GET_IID(nsISupports), ignoredObj.address()); mXBLAttached = true; } } } // Iterate over the kids
--- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -214,18 +214,18 @@ WidgetShutdownObserver::~WidgetShutdownO } NS_IMETHODIMP WidgetShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (mWidget && !strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { - nsCOMPtr<nsIWidget> kungFuDeathGrip(mWidget); - mWidget->Shutdown(); + RefPtr<nsBaseWidget> widget(mWidget); + widget->Shutdown(); } return NS_OK; } void WidgetShutdownObserver::Register() { if (!mRegistered) {