mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1023041 - Part 1: Rename SetMouseDownState to SetDragState. r=roc
This commit is contained in:
parent
a70b8ed90e
commit
a59488b63d
@ -710,7 +710,7 @@ nsFocusManager::WindowRaised(nsIDOMWindow* aWindow)
|
||||
// disable selection mousedown state on activation
|
||||
// XXXndeakin P3 not sure if this is necessary, but it doesn't hurt
|
||||
nsRefPtr<nsFrameSelection> frameSelection = presShell->FrameSelection();
|
||||
frameSelection->SetMouseDownState(false);
|
||||
frameSelection->SetDragState(false);
|
||||
}
|
||||
|
||||
Focus(currentWindow, currentFocus, 0, true, false, true, true);
|
||||
|
@ -8646,7 +8646,7 @@ nsGlobalWindow::EnterModalState()
|
||||
|
||||
if (activeShell) {
|
||||
nsRefPtr<nsFrameSelection> frameSelection = activeShell->FrameSelection();
|
||||
frameSelection->SetMouseDownState(false);
|
||||
frameSelection->SetDragState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1444,10 +1444,10 @@ EventStateManager::FireContextClick()
|
||||
nsRefPtr<nsFrameSelection> frameSel =
|
||||
mCurrentTarget->GetFrameSelection();
|
||||
|
||||
if (frameSel && frameSel->GetMouseDownState()) {
|
||||
if (frameSel && frameSel->GetDragState()) {
|
||||
// note that this can cause selection changed events to fire if we're in
|
||||
// a text field, which will null out mCurrentTarget
|
||||
frameSel->SetMouseDownState(false);
|
||||
frameSel->SetDragState(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1566,7 +1566,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
if (mCurrentTarget)
|
||||
{
|
||||
nsRefPtr<nsFrameSelection> frameSel = mCurrentTarget->GetFrameSelection();
|
||||
if (frameSel && frameSel->GetMouseDownState()) {
|
||||
if (frameSel && frameSel->GetDragState()) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
}
|
||||
@ -2908,7 +2908,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
nsIPresShell *shell = presContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsRefPtr<nsFrameSelection> frameSelection = shell->FrameSelection();
|
||||
frameSelection->SetMouseDownState(false);
|
||||
frameSelection->SetDragState(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1833,7 +1833,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
// Ignore mouse-moved events that happen as part of a dragging
|
||||
// operation that started over another frame. See bug 525078.
|
||||
nsRefPtr<nsFrameSelection> frameselection = mObjectFrame->GetFrameSelection();
|
||||
if (!frameselection->GetMouseDownState() ||
|
||||
if (!frameselection->GetDragState() ||
|
||||
(nsIPresShell::GetCapturingContent() == mObjectFrame->GetContent())) {
|
||||
synthCocoaEvent.type = NPCocoaEventMouseMoved;
|
||||
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
|
||||
|
@ -150,13 +150,13 @@ SelectionCarets::HandleEvent(WidgetEvent* aEvent)
|
||||
mDragMode = START_FRAME;
|
||||
mCaretCenterToDownPointOffsetY = GetCaretYCenterPosition() - ptInCanvas.y;
|
||||
SetSelectionDirection(false);
|
||||
SetMouseDownState(true);
|
||||
SetSelectionDragState(true);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
} else if (mVisible && IsOnRect(GetEndFrameRect(), ptInCanvas, inflateSize)) {
|
||||
mDragMode = END_FRAME;
|
||||
mCaretCenterToDownPointOffsetY = GetCaretYCenterPosition() - ptInCanvas.y;
|
||||
SetSelectionDirection(true);
|
||||
SetMouseDownState(true);
|
||||
SetSelectionDragState(true);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
} else {
|
||||
mDragMode = NONE;
|
||||
@ -171,7 +171,7 @@ SelectionCarets::HandleEvent(WidgetEvent* aEvent)
|
||||
if (mDragMode != NONE) {
|
||||
// Only care about same id
|
||||
if (mActiveTouchId == nowTouchId) {
|
||||
SetMouseDownState(false);
|
||||
SetSelectionDragState(false);
|
||||
mDragMode = NONE;
|
||||
mActiveTouchId = -1;
|
||||
}
|
||||
@ -521,11 +521,11 @@ SelectionCarets::SelectWord()
|
||||
|
||||
nsIFrame* caretFocusFrame = GetCaretFocusFrame();
|
||||
nsRefPtr<nsFrameSelection> fs = caretFocusFrame->GetFrameSelection();
|
||||
fs->SetMouseDownState(true);
|
||||
fs->SetDragState(true);
|
||||
nsFrame* frame = static_cast<nsFrame*>(ptFrame);
|
||||
nsresult rs = frame->SelectByTypeAtPoint(mPresShell->GetPresContext(), ptInFrame,
|
||||
eSelectWord, eSelectWord, 0);
|
||||
fs->SetMouseDownState(false);
|
||||
fs->SetDragState(false);
|
||||
|
||||
// Clear maintain selection otherwise we cannot select less than a word
|
||||
fs->MaintainSelection();
|
||||
@ -695,14 +695,14 @@ SelectionCarets::GetCaretYCenterPosition()
|
||||
}
|
||||
|
||||
void
|
||||
SelectionCarets::SetMouseDownState(bool aState)
|
||||
SelectionCarets::SetSelectionDragState(bool aState)
|
||||
{
|
||||
nsIFrame* caretFocusFrame = GetCaretFocusFrame();
|
||||
nsRefPtr<nsFrameSelection> fs = caretFocusFrame->GetFrameSelection();
|
||||
if (fs->GetMouseDownState() == aState) {
|
||||
if (fs->GetDragState() == aState) {
|
||||
return;
|
||||
}
|
||||
fs->SetMouseDownState(aState);
|
||||
fs->SetDragState(aState);
|
||||
|
||||
if (aState) {
|
||||
fs->StartBatchChanges();
|
||||
|
@ -118,10 +118,10 @@ private:
|
||||
nscoord GetCaretYCenterPosition();
|
||||
|
||||
/**
|
||||
* Simulate mouse down state when we change the selection range.
|
||||
* Simulate drag state when we change the selection range.
|
||||
* Hence, the selection change event will fire normally.
|
||||
*/
|
||||
void SetMouseDownState(bool aState);
|
||||
void SetSelectionDragState(bool aState);
|
||||
|
||||
void SetSelectionDirection(bool aForward);
|
||||
|
||||
|
@ -552,7 +552,7 @@ protected:
|
||||
{
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (frameSelection) {
|
||||
frameSelection->SetMouseDownState(false);
|
||||
frameSelection->SetDragState(false);
|
||||
}
|
||||
if (gCaptureInfo.mContent &&
|
||||
gCaptureInfo.mContent->OwnerDoc() == mDocument) {
|
||||
|
@ -2774,7 +2774,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
||||
if (mouseEvent->clickCount > 1) {
|
||||
// These methods aren't const but can't actually delete anything,
|
||||
// so no need for nsWeakFrame.
|
||||
fc->SetMouseDownState(true);
|
||||
fc->SetDragState(true);
|
||||
fc->SetMouseDoubleDown(true);
|
||||
return HandleMultiplePress(aPresContext, mouseEvent, aEventStatus, control);
|
||||
}
|
||||
@ -2812,7 +2812,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
||||
&target);
|
||||
if (NS_SUCCEEDED(rv) && parentContent)
|
||||
{
|
||||
fc->SetMouseDownState(true);
|
||||
fc->SetDragState(true);
|
||||
return fc->HandleTableSelection(parentContent, contentOffset, target,
|
||||
mouseEvent);
|
||||
}
|
||||
@ -2861,13 +2861,13 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (inSelection) {
|
||||
fc->SetMouseDownState(false);
|
||||
fc->SetDragState(false);
|
||||
fc->SetDelayedCaretData(mouseEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
fc->SetMouseDownState(true);
|
||||
fc->SetDragState(true);
|
||||
|
||||
// Do not touch any nsFrame members after this point without adding
|
||||
// weakFrame checks.
|
||||
@ -2889,7 +2889,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
|
||||
// -moz-user-select: all or a non-text node without children).
|
||||
// Therefore, disable selection extension during mouse moves.
|
||||
// XXX This is a bit hacky; shouldn't editor be able to deal with this?
|
||||
fc->SetMouseDownState(false);
|
||||
fc->SetDragState(false);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -3090,7 +3090,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
||||
nsIPresShell *presShell = aPresContext->PresShell();
|
||||
|
||||
nsRefPtr<nsFrameSelection> frameselection = GetFrameSelection();
|
||||
bool mouseDown = frameselection->GetMouseDownState();
|
||||
bool mouseDown = frameselection->GetDragState();
|
||||
if (!mouseDown)
|
||||
return NS_OK;
|
||||
|
||||
@ -3174,7 +3174,7 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
|
||||
// * that's the normal click position to use (although really, in
|
||||
// the normal case, small movements that don't count as a drag
|
||||
// can do selection)
|
||||
aFrameSelection->SetMouseDownState(true);
|
||||
aFrameSelection->SetDragState(true);
|
||||
|
||||
rv = aFrameSelection->HandleClick(aOffsets.content,
|
||||
aOffsets.StartOffset(),
|
||||
@ -3186,7 +3186,7 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
|
||||
return rv;
|
||||
}
|
||||
} else if (aParentContentForTableSel) {
|
||||
aFrameSelection->SetMouseDownState(false);
|
||||
aFrameSelection->SetDragState(false);
|
||||
rv = aFrameSelection->HandleTableSelection(
|
||||
aParentContentForTableSel,
|
||||
aContentOffsetForTableSel,
|
||||
@ -3199,7 +3199,7 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
|
||||
aFrameSelection->SetDelayedCaretData(0);
|
||||
}
|
||||
|
||||
aFrameSelection->SetMouseDownState(false);
|
||||
aFrameSelection->SetDragState(false);
|
||||
aFrameSelection->StopAutoScrollTimer();
|
||||
|
||||
return NS_OK;
|
||||
@ -3238,7 +3238,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
||||
// If not, the user must have clicked in a part of the selection.
|
||||
// Place the caret before continuing!
|
||||
|
||||
bool mouseDown = frameselection->GetMouseDownState();
|
||||
bool mouseDown = frameselection->GetDragState();
|
||||
|
||||
if (!mouseDown && frameselection->HasDelayedCaretData() &&
|
||||
frameselection->GetClickCountInDelayedCaretData() < 2) {
|
||||
@ -3278,7 +3278,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (frameSelection) {
|
||||
frameSelection->SetMouseDownState(false);
|
||||
frameSelection->SetDragState(false);
|
||||
frameSelection->StopAutoScrollTimer();
|
||||
}
|
||||
|
||||
|
@ -332,18 +332,18 @@ public:
|
||||
int32_t aContentLength,
|
||||
bool aSlowCheck) const;
|
||||
|
||||
/** SetMouseDownState(bool);
|
||||
* sets the mouse state to aState for resons of drag state.
|
||||
* @param aState is the new state of mousedown
|
||||
/** SetDragState(bool);
|
||||
* sets the drag state to aState for resons of drag state.
|
||||
* @param aState is the new state of drag
|
||||
*/
|
||||
/*unsafe*/
|
||||
void SetMouseDownState(bool aState);
|
||||
void SetDragState(bool aState);
|
||||
|
||||
/** GetMouseDownState(bool *);
|
||||
* gets the mouse state to aState for resons of drag state.
|
||||
* @param aState will hold the state of mousedown
|
||||
/** GetDragState(bool *);
|
||||
* gets the drag state to aState for resons of drag state.
|
||||
* @param aState will hold the state of drag
|
||||
*/
|
||||
bool GetMouseDownState() const { return mMouseDownState; }
|
||||
bool GetDragState() const { return mDragState; }
|
||||
|
||||
/**
|
||||
if we are in table cell selection mode. aka ctrl click in table cell
|
||||
@ -718,7 +718,7 @@ private:
|
||||
bool mChangesDuringBatching;
|
||||
bool mNotifyFrames;
|
||||
bool mDragSelectingCells;
|
||||
bool mMouseDownState; //for drag purposes
|
||||
bool mDragState; //for drag purposes
|
||||
bool mMouseDoubleDownState; //has the doubleclick down happened
|
||||
bool mDesiredXSet;
|
||||
|
||||
|
@ -707,7 +707,7 @@ void
|
||||
nsFrameSelection::Init(nsIPresShell *aShell, nsIContent *aLimiter)
|
||||
{
|
||||
mShell = aShell;
|
||||
mMouseDownState = false;
|
||||
mDragState = false;
|
||||
mDesiredXSet = false;
|
||||
mLimiter = aLimiter;
|
||||
mCaretMovementStyle =
|
||||
@ -1652,14 +1652,14 @@ nsFrameSelection::LookUpSelection(nsIContent *aContent,
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameSelection::SetMouseDownState(bool aState)
|
||||
nsFrameSelection::SetDragState(bool aState)
|
||||
{
|
||||
if (mMouseDownState == aState)
|
||||
if (mDragState == aState)
|
||||
return;
|
||||
|
||||
mMouseDownState = aState;
|
||||
mDragState = aState;
|
||||
|
||||
if (!mMouseDownState)
|
||||
if (!mDragState)
|
||||
{
|
||||
mDragSelectingCells = false;
|
||||
PostReason(nsISelectionListener::MOUSEUP_REASON);
|
||||
@ -2073,7 +2073,7 @@ nsFrameSelection::HandleTableSelection(nsINode* aParentContent,
|
||||
NS_ENSURE_TRUE(aParentContent, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aMouseEvent, NS_ERROR_NULL_POINTER);
|
||||
|
||||
if (mMouseDownState && mDragSelectingCells && (aTarget & nsISelectionPrivate::TABLESELECTION_TABLE))
|
||||
if (mDragState && mDragSelectingCells && (aTarget & nsISelectionPrivate::TABLESELECTION_TABLE))
|
||||
{
|
||||
// We were selecting cells and user drags mouse in table border or inbetween cells,
|
||||
// just do nothing
|
||||
@ -2098,7 +2098,7 @@ nsFrameSelection::HandleTableSelection(nsINode* aParentContent,
|
||||
nsSelectionBatcher selectionBatcher(mDomSelections[index]);
|
||||
|
||||
int32_t startRowIndex, startColIndex, curRowIndex, curColIndex;
|
||||
if (mMouseDownState && mDragSelectingCells)
|
||||
if (mDragState && mDragSelectingCells)
|
||||
{
|
||||
// We are drag-selecting
|
||||
if (aTarget != nsISelectionPrivate::TABLESELECTION_TABLE)
|
||||
@ -2182,7 +2182,7 @@ printf("HandleTableSelection: Dragged into a new cell\n");
|
||||
else
|
||||
{
|
||||
// Not dragging -- mouse event is down or up
|
||||
if (mMouseDownState)
|
||||
if (mDragState)
|
||||
{
|
||||
#ifdef DEBUG_TABLE_SELECTION
|
||||
printf("HandleTableSelection: Mouse down event\n");
|
||||
|
Loading…
Reference in New Issue
Block a user