Bug 1018486 - Part 3: Changes in widget/cocoa/, r=mstange

MozReview-Commit-ID: DhvanRhe9XE
This commit is contained in:
Michael Layzell 2016-07-18 12:36:38 -04:00
Родитель 5d1745c161
Коммит e67b01fcd0
5 изменённых файлов: 22 добавлений и 19 удалений

Просмотреть файл

@ -1534,7 +1534,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
[NSCursor setHiddenUntilMouseMoves:YES];
}
RefPtr<nsChildView> kungFuDeathGrip(mWidget);
RefPtr<nsChildView> widget(mWidget);
KeyEventState* currentKeyEvent = PushKeyEvent(aNativeEvent);
AutoKeyEventStateCleaner remover(this);
@ -1553,7 +1553,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
return false;
}
WidgetKeyboardEvent imeEvent(true, eKeyDown, mWidget);
WidgetKeyboardEvent imeEvent(true, eKeyDown, widget);
currentKeyEvent->InitKeyEvent(this, imeEvent);
imeEvent.mPluginTextEventString.Assign(committed);
nsEventStatus status = nsEventStatus_eIgnore;
@ -1574,7 +1574,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
return false;
}
WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget);
WidgetKeyboardEvent keydownEvent(true, eKeyDown, widget);
currentKeyEvent->InitKeyEvent(this, keydownEvent);
nsEventStatus status = nsEventStatus_eIgnore;
@ -1613,7 +1613,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
// 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));
@ -1647,7 +1647,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
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
@ -1743,6 +1743,7 @@ TextInputHandler::HandleFlagsChanged(NSEvent* aNativeEvent)
}
RefPtr<nsChildView> kungFuDeathGrip(mWidget);
mozilla::Unused << kungFuDeathGrip; // Not referenced within this function
MOZ_LOG(gLog, LogLevel::Info,
("%p TextInputHandler::HandleFlagsChanged, aNativeEvent=%p, "
@ -2195,7 +2196,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString,
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.
@ -2214,7 +2215,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString,
}
// 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
@ -2263,7 +2264,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString,
bool
TextInputHandler::DoCommandBySelector(const char* aSelector)
{
RefPtr<nsChildView> kungFuDeathGrip(mWidget);
RefPtr<nsChildView> widget(mWidget);
KeyEventState* currentKeyEvent = GetCurrentKeyEvent();
@ -2289,7 +2290,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector)
return false;
}
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget);
currentKeyEvent->InitKeyEvent(this, keypressEvent);
nsEventStatus status = nsEventStatus_eIgnore;

Просмотреть файл

@ -1406,6 +1406,8 @@ nsresult nsChildView::ConfigureChildren(const nsTArray<Configuration>& aConfigur
NS_IMETHODIMP nsChildView::DispatchEvent(WidgetGUIEvent* event,
nsEventStatus& aStatus)
{
RefPtr<nsChildView> kungFuDeathGrip(this);
#ifdef DEBUG
debug_DumpEvent(stdout, event->mWidget, event, "something", 0);
#endif
@ -1429,16 +1431,16 @@ NS_IMETHODIMP nsChildView::DispatchEvent(WidgetGUIEvent* event,
// 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();
}
}
}
@ -6066,8 +6068,8 @@ nsChildView::GetSelectionAsPlaintext(nsAString& aResult)
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;

Просмотреть файл

@ -1886,6 +1886,7 @@ 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);

Просмотреть файл

@ -421,7 +421,6 @@ void nsMenuX::MenuConstruct()
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;

Просмотреть файл

@ -219,8 +219,8 @@ WidgetShutdownObserver::Observe(nsISupports *aSubject,
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;
}