Bug 320468: SetDelayCaretOverExistingSelection is unused, patch by Adam Guthrie <ispiked@gmail.com>, r+sr=dbaron

This commit is contained in:
gavin%gavinsharp.com 2006-12-16 14:40:44 +00:00
Родитель 08e38d253c
Коммит 9ecd20868a
3 изменённых файлов: 37 добавлений и 73 удалений

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

@ -1883,56 +1883,52 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
return frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
}
PRBool supportsDelay = frameselection->GetDelayCaretOverExistingSelection();
frameselection->SetDelayedCaretData(0);
if (supportsDelay)
// Check if any part of this frame is selected, and if the
// user clicked inside the selected region. If so, we delay
// starting a new selection since the user may be trying to
// drag the selected region to some other app.
SelectionDetails *details = 0;
PRBool isSelected = ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT);
if (isSelected)
{
// Check if any part of this frame is selected, and if the
// user clicked inside the selected region. If so, we delay
// starting a new selection since the user may be trying to
// drag the selected region to some other app.
details = frameselection->LookUpSelection(offsets.content, 0,
offsets.EndOffset(), PR_FALSE);
SelectionDetails *details = 0;
PRBool isSelected = ((GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT);
//
// If there are any details, check to see if the user clicked
// within any selected region of the frame.
//
if (isSelected)
if (details)
{
details = frameselection->LookUpSelection(offsets.content, 0,
offsets.EndOffset(), PR_FALSE);
SelectionDetails *curDetail = details;
//
// If there are any details, check to see if the user clicked
// within any selected region of the frame.
//
if (details)
while (curDetail)
{
SelectionDetails *curDetail = details;
while (curDetail)
//
// If the user clicked inside a selection, then just
// return without doing anything. We will handle placing
// the caret later on when the mouse is released. We ignore
// the spellcheck selection.
//
if (curDetail->mType != nsISelectionController::SELECTION_SPELLCHECK &&
curDetail->mStart <= offsets.StartOffset() &&
offsets.EndOffset() <= curDetail->mEnd)
{
//
// If the user clicked inside a selection, then just
// return without doing anything. We will handle placing
// the caret later on when the mouse is released. We ignore
// the spellcheck selection.
//
if (curDetail->mType != nsISelectionController::SELECTION_SPELLCHECK &&
curDetail->mStart <= offsets.StartOffset() &&
offsets.EndOffset() <= curDetail->mEnd)
{
delete details;
frameselection->SetMouseDownState(PR_FALSE);
frameselection->SetDelayedCaretData(me);
return NS_OK;
}
curDetail = curDetail->mNext;
delete details;
frameselection->SetMouseDownState(PR_FALSE);
frameselection->SetDelayedCaretData(me);
return NS_OK;
}
delete details;
curDetail = curDetail->mNext;
}
delete details;
}
}
@ -2275,9 +2271,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
if (!selectionOff) {
frameselection = GetFrameSelection();
if (nsEventStatus_eConsumeNoDefault != *aEventStatus &&
frameselection &&
frameselection->GetDelayCaretOverExistingSelection()) {
if (nsEventStatus_eConsumeNoDefault != *aEventStatus && frameselection) {
// Check if the frameselection recorded the mouse going down.
// If not, the user must have clicked in a part of the selection.
// Place the caret before continuing!

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

@ -424,27 +424,8 @@ public:
void SetDisplaySelection(PRInt16 aState) { mDisplaySelection = aState; }
PRInt16 GetDisplaySelection() { return mDisplaySelection; }
/** Allow applications to specify how we should place the caret
* when the user clicks over an existing selection. A aDelay
* value of PR_TRUE means delay clearing the selection and
* placing the caret until MouseUp, when the user clicks over
* an existing selection. This is especially useful when applications
* want to support Drag & Drop of the current selection. A value
* of PR_FALSE means place the caret immediately. If the application
* never calls this method, the nsIFrameSelection implementation
* assumes the default value is PR_TRUE.
* @param aDelay PR_TRUE if we should delay caret placement.
*/
void SetDelayCaretOverExistingSelection(PRBool aDelay);
/** Get the current delay caret setting.
*/
PRBool GetDelayCaretOverExistingSelection() { return mDelayCaretOverExistingSelection; }
/** If we are delaying caret placement til MouseUp (see
* Set/GetDelayCaretOverExistingSelection()), this method
* can be used to store the data received during the MouseDown
* so that we can place the caret during the MouseUp event.
/** This method can be used to store the data received during a MouseDown
* event so that we can place the caret during the MouseUp event.
* @aMouseEvent the event received by the selection MouseDown
* handling method. A NULL value can be use to tell this method
* that any data is storing is no longer valid.
@ -655,7 +636,6 @@ private:
nsMouseEvent mDelayedMouseEvent;
PRPackedBool mDelayCaretOverExistingSelection;
PRPackedBool mDelayedMouseEventValid;
PRPackedBool mChangesDuringBatching;

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

@ -852,7 +852,6 @@ nsFrameSelection::nsFrameSelection()
mDisplaySelection = nsISelectionController::SELECTION_OFF;
mDelayCaretOverExistingSelection = PR_TRUE;
mDelayedMouseEventValid = PR_FALSE;
mSelectionChangeReason = nsISelectionListener::NO_REASON;
}
@ -3893,15 +3892,6 @@ nsFrameSelection::DeleteFromDocument()
return NS_OK;
}
void
nsFrameSelection::SetDelayCaretOverExistingSelection(PRBool aDelay)
{
mDelayCaretOverExistingSelection = aDelay;
if (! aDelay)
mDelayedMouseEventValid = PR_FALSE;
}
void
nsFrameSelection::SetDelayedCaretData(nsMouseEvent *aMouseEvent)
{