зеркало из https://github.com/mozilla/pjs.git
Bug 757807. Don't store an nsMouseEvent in nsFrameSelection, it's unnecessary and leaky. r=smaug
This commit is contained in:
Родитель
feb74777b8
Коммит
3623f99501
|
@ -2900,8 +2900,7 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
|
|||
|
||||
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
|
||||
if (!aHandleTableSel) {
|
||||
nsMouseEvent *me = aFrameSelection->GetDelayedCaretData();
|
||||
if (!aOffsets.content || !me) {
|
||||
if (!aOffsets.content || !aFrameSelection->HasDelayedCaretData()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -2919,7 +2918,8 @@ HandleFrameSelection(nsFrameSelection* aFrameSelection,
|
|||
rv = aFrameSelection->HandleClick(aOffsets.content,
|
||||
aOffsets.StartOffset(),
|
||||
aOffsets.EndOffset(),
|
||||
me->IsShift(), false,
|
||||
aFrameSelection->IsShiftDownInDelayedCaretData(),
|
||||
false,
|
||||
aOffsets.associateWithNext);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
@ -2973,9 +2973,9 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
// Place the caret before continuing!
|
||||
|
||||
bool mouseDown = frameselection->GetMouseDownState();
|
||||
nsMouseEvent *me = frameselection->GetDelayedCaretData();
|
||||
|
||||
if (!mouseDown && me && me->clickCount < 2) {
|
||||
if (!mouseDown && frameselection->HasDelayedCaretData() &&
|
||||
frameselection->GetClickCountInDelayedCaretData() < 2) {
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
|
||||
offsets = GetContentOffsetsFromPoint(pt);
|
||||
handleTableSelection = false;
|
||||
|
|
|
@ -500,7 +500,17 @@ public:
|
|||
* by the selection during MouseDown processing. It can be NULL
|
||||
* if the data is no longer valid.
|
||||
*/
|
||||
nsMouseEvent* GetDelayedCaretData();
|
||||
bool HasDelayedCaretData() { return mDelayedMouseEventValid; }
|
||||
bool IsShiftDownInDelayedCaretData()
|
||||
{
|
||||
NS_ASSERTION(mDelayedMouseEventValid, "No valid delayed caret data");
|
||||
return mDelayedMouseEventIsShift;
|
||||
}
|
||||
PRUint32 GetClickCountInDelayedCaretData()
|
||||
{
|
||||
NS_ASSERTION(mDelayedMouseEventValid, "No valid delayed caret data");
|
||||
return mDelayedMouseEventClickCount;
|
||||
}
|
||||
|
||||
/** Get the content node that limits the selection
|
||||
* When searching up a nodes for parents, as in a text edit field
|
||||
|
@ -696,9 +706,8 @@ private:
|
|||
#endif
|
||||
|
||||
PRInt32 mDesiredX;
|
||||
|
||||
nsMouseEvent mDelayedMouseEvent;
|
||||
|
||||
PRUint32 mDelayedMouseEventClickCount;
|
||||
bool mDelayedMouseEventIsShift;
|
||||
bool mDelayedMouseEventValid;
|
||||
|
||||
bool mChangesDuringBatching;
|
||||
|
|
|
@ -472,7 +472,6 @@ nsSelectionIterator::IsDone()
|
|||
////////////BEGIN nsFrameSelection methods
|
||||
|
||||
nsFrameSelection::nsFrameSelection()
|
||||
: mDelayedMouseEvent(false, 0, nsnull, nsMouseEvent::eReal)
|
||||
{
|
||||
PRInt32 i;
|
||||
for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){
|
||||
|
@ -510,9 +509,14 @@ nsFrameSelection::nsFrameSelection()
|
|||
}
|
||||
|
||||
mDisplaySelection = nsISelectionController::SELECTION_OFF;
|
||||
mSelectionChangeReason = nsISelectionListener::NO_REASON;
|
||||
|
||||
mDelayedMouseEventValid = false;
|
||||
mSelectionChangeReason = nsISelectionListener::NO_REASON;
|
||||
// These values are not used since they are only valid when
|
||||
// mDelayedMouseEventValid is true, and setting mDelayedMouseEventValid
|
||||
//alwaysoverrides these values.
|
||||
mDelayedMouseEventIsShift = false;
|
||||
mDelayedMouseEventClickCount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3118,25 +3122,13 @@ nsFrameSelection::DeleteFromDocument()
|
|||
void
|
||||
nsFrameSelection::SetDelayedCaretData(nsMouseEvent *aMouseEvent)
|
||||
{
|
||||
if (aMouseEvent)
|
||||
{
|
||||
if (aMouseEvent) {
|
||||
mDelayedMouseEventValid = true;
|
||||
mDelayedMouseEvent = *aMouseEvent;
|
||||
|
||||
// Don't cache the widget. We don't need it and it could go away.
|
||||
mDelayedMouseEvent.widget = nsnull;
|
||||
}
|
||||
else
|
||||
mDelayedMouseEventIsShift = aMouseEvent->IsShift();
|
||||
mDelayedMouseEventClickCount = aMouseEvent->clickCount;
|
||||
} else {
|
||||
mDelayedMouseEventValid = false;
|
||||
}
|
||||
|
||||
nsMouseEvent*
|
||||
nsFrameSelection::GetDelayedCaretData()
|
||||
{
|
||||
if (mDelayedMouseEventValid)
|
||||
return &mDelayedMouseEvent;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче