Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1259661 part.9 Rename WidgetMouseEvent::clickCount to WidgetMouse…
Browse files Browse the repository at this point in the history
…Event::mClickCount r=smaug

MozReview-Commit-ID: 5tC8UqcfLek
  • Loading branch information
masayuki-nakano committed May 10, 2016
1 parent 0973184 commit 6fbde82
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 56 deletions.
2 changes: 1 addition & 1 deletion accessible/base/nsCoreUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,

event.mRefPoint = LayoutDeviceIntPoint(aX, aY);

event.clickCount = 1;
event.mClickCount = 1;
event.button = WidgetMouseEvent::eLeftButton;
event.mTime = PR_IntervalNow();
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
Expand Down
4 changes: 2 additions & 2 deletions dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,14 +2089,14 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
uint16_t inputSource = 0;
WidgetMouseEvent* sourceMouseEvent = aSourceEvent->AsMouseEvent();
if (sourceMouseEvent) {
clickCount = sourceMouseEvent->clickCount;
clickCount = sourceMouseEvent->mClickCount;
pressure = sourceMouseEvent->pressure;
inputSource = sourceMouseEvent->inputSource;
} else if (aSourceEvent->mClass == eKeyboardEventClass) {
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
}
event.pressure = pressure;
event.clickCount = clickCount;
event.mClickCount = clickCount;
event.inputSource = inputSource;
event.mModifiers = aSourceEvent->mModifiers;
if (aExtraEventFlags) {
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7787,7 +7787,7 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
event.buttons = GetButtonsFlagForButton(aButton);
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
event.clickCount = aClickCount;
event.mClickCount = aClickCount;
event.mTime = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;

Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
event.tiltX = aTiltX;
event.tiltY = aTiltY;
event.isPrimary = (nsIDOMMouseEvent::MOZ_SOURCE_MOUSE == aInputSourceArg) ? true : aIsPrimary;
event.clickCount = aClickCount;
event.mClickCount = aClickCount;
event.mTime = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aOptionalArgCount >= 10 ? aIsSynthesized : true;

Expand Down
28 changes: 14 additions & 14 deletions dom/events/EventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,16 +606,16 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
switch (mouseEvent->button) {
case WidgetMouseEvent::eLeftButton:
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
mLClickCount = mouseEvent->clickCount;
mLClickCount = mouseEvent->mClickCount;
SetClickCount(mouseEvent, aStatus);
sNormalLMouseEventInProcess = true;
break;
case WidgetMouseEvent::eMiddleButton:
mMClickCount = mouseEvent->clickCount;
mMClickCount = mouseEvent->mClickCount;
SetClickCount(mouseEvent, aStatus);
break;
case WidgetMouseEvent::eRightButton:
mRClickCount = mouseEvent->clickCount;
mRClickCount = mouseEvent->mClickCount;
SetClickCount(mouseEvent, aStatus);
break;
}
Expand Down Expand Up @@ -1545,7 +1545,7 @@ EventStateManager::FireContextClick()
// init the event while mCurrentTarget is still good
WidgetMouseEvent event(true, eContextMenu, targetWidget,
WidgetMouseEvent::eReal);
event.clickCount = 1;
event.mClickCount = 1;
FillInEventFromGestureDown(&event);

// stop selection tracking, we're in control now
Expand Down Expand Up @@ -4580,10 +4580,10 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
if (mLastLeftMouseDownContent == mouseContent ||
mLastLeftMouseDownContentParent == mouseContent ||
mLastLeftMouseDownContent == mouseContentParent) {
aEvent->clickCount = mLClickCount;
aEvent->mClickCount = mLClickCount;
mLClickCount = 0;
} else {
aEvent->clickCount = 0;
aEvent->mClickCount = 0;
}
mLastLeftMouseDownContent = nullptr;
mLastLeftMouseDownContentParent = nullptr;
Expand All @@ -4598,10 +4598,10 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
if (mLastMiddleMouseDownContent == mouseContent ||
mLastMiddleMouseDownContentParent == mouseContent ||
mLastMiddleMouseDownContent == mouseContentParent) {
aEvent->clickCount = mMClickCount;
aEvent->mClickCount = mMClickCount;
mMClickCount = 0;
} else {
aEvent->clickCount = 0;
aEvent->mClickCount = 0;
}
mLastMiddleMouseDownContent = nullptr;
mLastMiddleMouseDownContentParent = nullptr;
Expand All @@ -4616,10 +4616,10 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
if (mLastRightMouseDownContent == mouseContent ||
mLastRightMouseDownContentParent == mouseContent ||
mLastRightMouseDownContent == mouseContentParent) {
aEvent->clickCount = mRClickCount;
aEvent->mClickCount = mRClickCount;
mRClickCount = 0;
} else {
aEvent->clickCount = 0;
aEvent->mClickCount = 0;
}
mLastRightMouseDownContent = nullptr;
mLastRightMouseDownContentParent = nullptr;
Expand All @@ -4638,7 +4638,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,

//If mouse is still over same element, clickcount will be > 1.
//If it has moved it will be zero, so no click.
if (0 != aEvent->clickCount) {
if (aEvent->mClickCount) {
//Check that the window isn't disabled before firing a click
//(see bug 366544).
if (aEvent->mWidget && !aEvent->mWidget->IsEnabled()) {
Expand All @@ -4652,7 +4652,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
WidgetMouseEvent event(aEvent->IsTrusted(), eMouseClick,
aEvent->mWidget, WidgetMouseEvent::eReal);
event.mRefPoint = aEvent->mRefPoint;
event.clickCount = aEvent->clickCount;
event.mClickCount = aEvent->mClickCount;
event.mModifiers = aEvent->mModifiers;
event.buttons = aEvent->buttons;
event.mTime = aEvent->mTime;
Expand Down Expand Up @@ -4680,13 +4680,13 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
nsWeakFrame currentTarget = mCurrentTarget;
ret = presShell->HandleEventWithTarget(&event, currentTarget,
mouseContent, aStatus);
if (NS_SUCCEEDED(ret) && aEvent->clickCount == 2 &&
if (NS_SUCCEEDED(ret) && aEvent->mClickCount == 2 &&
mouseContent && mouseContent->IsInComposedDoc()) {
//fire double click
WidgetMouseEvent event2(aEvent->IsTrusted(), eMouseDoubleClick,
aEvent->mWidget, WidgetMouseEvent::eReal);
event2.mRefPoint = aEvent->mRefPoint;
event2.clickCount = aEvent->clickCount;
event2.mClickCount = aEvent->mClickCount;
event2.mModifiers = aEvent->mModifiers;
event2.buttons = aEvent->buttons;
event2.mFlags.mNoContentDispatch = notDispatchToContents;
Expand Down
4 changes: 2 additions & 2 deletions dom/events/MouseEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
if (mouseEvent) {
MOZ_ASSERT(mouseEvent->mReason != WidgetMouseEvent::eSynthesized,
"Don't dispatch DOM events from synthesized mouse events");
mDetail = mouseEvent->clickCount;
mDetail = mouseEvent->mClickCount;
}
}

Expand Down Expand Up @@ -87,7 +87,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,

WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
if (mouseEvent) {
mouseEvent->clickCount = aDetail;
mouseEvent->mClickCount = aDetail;
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/html/HTMLLabelElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
// Only set focus on the first click of multiple clicks to prevent
// to prevent immediate de-focus.
if (mouseEvent->clickCount <= 1) {
if (mouseEvent->mClickCount <= 1) {
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
// Use FLAG_BYMOVEFOCUS here so that the label is scrolled to.
Expand Down
4 changes: 2 additions & 2 deletions dom/plugins/base/nsPluginInstanceOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,7 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
default:
NS_WARNING("Mouse button we don't know about?");
}
cocoaEvent.data.mouse.clickCount = mouseEvent->clickCount;
cocoaEvent.data.mouse.clickCount = mouseEvent->mClickCount;
} else {
NS_WARNING("eMouseUp/DOWN is not a WidgetMouseEvent?");
}
Expand Down Expand Up @@ -2411,7 +2411,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
static const int dblClickMsgs[] =
{ WM_LBUTTONDBLCLK, WM_MBUTTONDBLCLK, WM_RBUTTONDBLCLK };
const WidgetMouseEvent* mouseEvent = anEvent.AsMouseEvent();
if (mouseEvent->clickCount == 2) {
if (mouseEvent->mClickCount == 2) {
pluginEvent.event = dblClickMsgs[mouseEvent->button];
} else {
pluginEvent.event = downMsgs[mouseEvent->button];
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/apz/util/APZCCallbackHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ APZCCallbackHelper::DispatchSynthesizedMouseEvent(EventMessage aMsg,
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
event.mIgnoreRootScrollFrame = true;
if (aMsg != eMouseMove) {
event.clickCount = 1;
event.mClickCount = 1;
}
event.mModifiers = aModifiers;

Expand Down
5 changes: 3 additions & 2 deletions layout/forms/nsListControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1666,10 +1666,11 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
FireOnChange();
}

mouseEvent->clickCount = 1;
mouseEvent->mClickCount = 1;
} else {
// the click was out side of the select or its dropdown
mouseEvent->clickCount = IgnoreMouseEventForSelection(aMouseEvent) ? 1 : 0;
mouseEvent->mClickCount =
IgnoreMouseEventForSelection(aMouseEvent) ? 1 : 0;
}
} else {
CaptureMouseEvents(false);
Expand Down
8 changes: 4 additions & 4 deletions layout/generic/nsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
#endif

RefPtr<nsFrameSelection> fc = const_cast<nsFrameSelection*>(frameselection);
if (mouseEvent->clickCount > 1) {
if (mouseEvent->mClickCount > 1) {
// These methods aren't const but can't actually delete anything,
// so no need for nsWeakFrame.
fc->SetDragState(true);
Expand Down Expand Up @@ -3467,16 +3467,16 @@ nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
return NS_OK;
}

if (mouseEvent->clickCount == 4) {
if (mouseEvent->mClickCount == 4) {
beginAmount = endAmount = eSelectParagraph;
} else if (mouseEvent->clickCount == 3) {
} else if (mouseEvent->mClickCount == 3) {
if (Preferences::GetBool("browser.triple_click_selects_paragraph")) {
beginAmount = endAmount = eSelectParagraph;
} else {
beginAmount = eSelectBeginLine;
endAmount = eSelectEndLine;
}
} else if (mouseEvent->clickCount == 2) {
} else if (mouseEvent->mClickCount == 2) {
// We only want inline frames; PeekBackwardAndForward dislikes blocks
beginAmount = endAmount = eSelectWord;
} else {
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3294,7 +3294,7 @@ nsFrameSelection::SetDelayedCaretData(WidgetMouseEvent* aMouseEvent)
if (aMouseEvent) {
mDelayedMouseEventValid = true;
mDelayedMouseEventIsShift = aMouseEvent->IsShift();
mDelayedMouseEventClickCount = aMouseEvent->clickCount;
mDelayedMouseEventClickCount = aMouseEvent->mClickCount;
} else {
mDelayedMouseEventValid = false;
}
Expand Down
4 changes: 2 additions & 2 deletions widget/InputData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ MouseInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
event.mRefPoint =
RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
event.clickCount = clickCount;
event.mClickCount = clickCount;
event.inputSource = mInputSource;
event.mIgnoreRootScrollFrame = true;

Expand Down Expand Up @@ -294,7 +294,7 @@ MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
event.mFlags.mHandledByAPZ = mHandledByAPZ;

if (mouseEventMessage != eMouseMove) {
event.clickCount = 1;
event.mClickCount = 1;
}

return event;
Expand Down
10 changes: 5 additions & 5 deletions widget/MouseEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase, public WidgetPointerHelper
, mContextMenuTrigger(eNormal)
, mExitFrom(eChild)
, mIgnoreRootScrollFrame(false)
, clickCount(0)
, mClickCount(0)
{
}

Expand All @@ -219,7 +219,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase, public WidgetPointerHelper
, mContextMenuTrigger(eNormal)
, mExitFrom(eChild)
, mIgnoreRootScrollFrame(false)
, clickCount(0)
, mClickCount(0)
{
}

Expand All @@ -236,7 +236,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase, public WidgetPointerHelper
, mContextMenuTrigger(aContextMenuTrigger)
, mExitFrom(eChild)
, mIgnoreRootScrollFrame(false)
, clickCount(0)
, mClickCount(0)
{
if (aMessage == eContextMenu) {
button = (mContextMenuTrigger == eNormal) ? eRightButton : eLeftButton;
Expand Down Expand Up @@ -277,15 +277,15 @@ class WidgetMouseEvent : public WidgetMouseEventBase, public WidgetPointerHelper
bool mIgnoreRootScrollFrame;

/// The number of mouse clicks.
uint32_t clickCount;
uint32_t mClickCount;

void AssignMouseEventData(const WidgetMouseEvent& aEvent, bool aCopyTargets)
{
AssignMouseEventBaseData(aEvent, aCopyTargets);
AssignPointerHelperData(aEvent);

mIgnoreRootScrollFrame = aEvent.mIgnoreRootScrollFrame;
clickCount = aEvent.clickCount;
mClickCount = aEvent.mClickCount;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion widget/android/AndroidJavaWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ AndroidGeckoEvent::MakeMouseEvent(nsIWidget* widget)
// XXX can we synthesize different buttons?
event.button = WidgetMouseEvent::eLeftButton;
if (msg != eMouseMove) {
event.clickCount = 1;
event.mClickCount = 1;
}
event.mModifiers = DOMModifiers();
event.mTime = Time();
Expand Down
2 changes: 1 addition & 1 deletion widget/android/nsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ nsWindow::OnLongTapEvent(AndroidGeckoEvent *ae)
event.button = WidgetMouseEvent::eLeftButton;
event.mRefPoint =
RoundedToInt(pt * GetDefaultScale()) - WidgetToScreenOffset();
event.clickCount = 1;
event.mClickCount = 1;
event.mTime = ae->Time();
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
event.mIgnoreRootScrollFrame = true;
Expand Down
8 changes: 4 additions & 4 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4530,7 +4530,7 @@ WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
// blocked.
clickCount--;
}
geckoEvent.clickCount = clickCount;
geckoEvent.mClickCount = clickCount;

if (modifierFlags & NSControlKeyMask)
geckoEvent.button = WidgetMouseEvent::eRightButton;
Expand Down Expand Up @@ -4741,7 +4741,7 @@ WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
geckoEvent.button = WidgetMouseEvent::eRightButton;
geckoEvent.clickCount = [theEvent clickCount];
geckoEvent.mClickCount = [theEvent clickCount];

mGeckoChild->DispatchInputEvent(&geckoEvent);
if (!mGeckoChild)
Expand All @@ -4767,7 +4767,7 @@ WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild,
WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
geckoEvent.button = WidgetMouseEvent::eRightButton;
geckoEvent.clickCount = [theEvent clickCount];
geckoEvent.mClickCount = [theEvent clickCount];

nsAutoRetainCocoaObject kungFuDeathGrip(self);
mGeckoChild->DispatchInputEvent(&geckoEvent);
Expand Down Expand Up @@ -4813,7 +4813,7 @@ WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
geckoEvent.button = WidgetMouseEvent::eMiddleButton;
geckoEvent.clickCount = [theEvent clickCount];
geckoEvent.mClickCount = [theEvent clickCount];

mGeckoChild->DispatchInputEvent(&geckoEvent);

Expand Down
8 changes: 4 additions & 4 deletions widget/gtk/nsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2754,14 +2754,14 @@ nsWindow::InitButtonEvent(WidgetMouseEvent& aEvent,

switch (aGdkEvent->type) {
case GDK_2BUTTON_PRESS:
aEvent.clickCount = 2;
aEvent.mClickCount = 2;
break;
case GDK_3BUTTON_PRESS:
aEvent.clickCount = 3;
aEvent.mClickCount = 3;
break;
// default is one click
default:
aEvent.clickCount = 1;
aEvent.mClickCount = 1;
}
}

Expand Down Expand Up @@ -3144,7 +3144,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent)

contextMenuEvent.mRefPoint = LayoutDeviceIntPoint(0, 0);
contextMenuEvent.AssignEventTime(GetWidgetEventTime(aEvent->time));
contextMenuEvent.clickCount = 1;
contextMenuEvent.mClickCount = 1;
KeymapWrapper::InitInputEvent(contextMenuEvent, aEvent->state);
DispatchInputEvent(&contextMenuEvent);
} else {
Expand Down
Loading

0 comments on commit 6fbde82

Please sign in to comment.