Bug 1446711 part 4. Get rid of nsIDOMMouseEvent::GetCtrl/Shift/Alt/MetaKey. r=qdot

MozReview-Commit-ID: 1H2FzUHf55n
This commit is contained in:
Boris Zbarsky 2018-03-20 00:16:06 -04:00
Родитель 3318363c75
Коммит 1be726ef98
3 изменённых файлов: 8 добавлений и 46 удалений

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

@ -414,56 +414,24 @@ MouseEvent::AltKey()
return mEvent->AsInputEvent()->IsAlt();
}
NS_IMETHODIMP
MouseEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = AltKey();
return NS_OK;
}
bool
MouseEvent::CtrlKey()
{
return mEvent->AsInputEvent()->IsControl();
}
NS_IMETHODIMP
MouseEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = CtrlKey();
return NS_OK;
}
bool
MouseEvent::ShiftKey()
{
return mEvent->AsInputEvent()->IsShift();
}
NS_IMETHODIMP
MouseEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ShiftKey();
return NS_OK;
}
bool
MouseEvent::MetaKey()
{
return mEvent->AsInputEvent()->IsMeta();
}
NS_IMETHODIMP
MouseEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = MetaKey();
return NS_OK;
}
NS_IMETHODIMP
MouseEvent::GetModifierState(const nsAString& aKey,
bool* aState)

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

@ -19,11 +19,6 @@ interface nsIDOMMouseEvent : nsIDOMUIEvent
readonly attribute long mozMovementX;
readonly attribute long mozMovementY;
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute nsIDOMEventTarget relatedTarget;

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

@ -846,15 +846,14 @@ bool
nsListControlFrame::HandleListSelection(nsIDOMEvent* aEvent,
int32_t aClickedIndex)
{
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
bool isShift;
MouseEvent* mouseEvent = aEvent->InternalDOMEvent()->AsMouseEvent();
bool isControl;
#ifdef XP_MACOSX
mouseEvent->GetMetaKey(&isControl);
isControl = mouseEvent->MetaKey();
#else
mouseEvent->GetCtrlKey(&isControl);
isControl = mouseEvent->CtrlKey();
#endif
mouseEvent->GetShiftKey(&isShift);
bool isShift = mouseEvent->ShiftKey();
return PerformSelection(aClickedIndex, isShift, isControl); // might destroy us
}
@ -1931,13 +1930,13 @@ nsListControlFrame::DragMove(nsIDOMEvent* aMouseEvent)
if (selectedIndex == mEndSelectionIndex) {
return NS_OK;
}
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
NS_ASSERTION(mouseEvent, "aMouseEvent is not an nsIDOMMouseEvent!");
MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
NS_ASSERTION(mouseEvent, "aMouseEvent is not a MouseEvent!");
bool isControl;
#ifdef XP_MACOSX
mouseEvent->GetMetaKey(&isControl);
isControl = mouseEvent->MetaKey();
#else
mouseEvent->GetCtrlKey(&isControl);
isControl = mouseEvent->CtrlKey();
#endif
AutoWeakFrame weakFrame(this);
// Turn SHIFT on when you are dragging, unless control is on.