backout mjudge checkin against closed tree. it also breaks mac as well, so

mjudge will try again when tree reopens
This commit is contained in:
cyeh%netscape.com 1999-05-05 23:05:41 +00:00
Родитель 76efa1edc6
Коммит 8f54a21774
11 изменённых файлов: 147 добавлений и 158 удалений

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

@ -38,8 +38,6 @@
#include "nsIWebShell.h"
#include "nsIFocusableContent.h"
#include "nsIScrollableView.h"
#include "nsIDOMSelection.h"
#include "nsIFrameSelection.h"
static NS_DEFINE_IID(kIEventStateManagerIID, NS_IEVENTSTATEMANAGER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -161,22 +159,8 @@ nsEventStateManager::PostHandleEvent(nsIPresContext& aPresContext,
case NS_MOUSE_LEFT_BUTTON_UP:
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_RIGHT_BUTTON_UP:
{
ret = CheckForAndDispatchClick(aPresContext, (nsMouseEvent*)aEvent, aStatus);
SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell){
nsCOMPtr<nsIDOMSelection> selection;
rv = shell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(rv) && selection){
nsCOMPtr<nsIFrameSelection> frameSel;
frameSel = do_QueryInterface(selection);
if (frameSel)
frameSel->SetMouseDownState(PR_FALSE);
}
}
}
break;
case NS_KEY_DOWN:
ret = DispatchKeyPressEvent(aPresContext, (nsKeyEvent*)aEvent, aStatus);

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

@ -98,19 +98,6 @@ public:
*/
NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength,
PRInt32 *aStart, PRInt32 *aEnd, PRBool *aDrawSelected, PRUint32 aFlag/*not used*/) = 0;
/** SetMouseDownState(PRBool);
* sets the mouse state to aState for resons of drag state.
* @param aState is the new state of mousedown
*/
NS_IMETHOD SetMouseDownState(PRBool aState)=0;
/** GetMouseDownState(PRBool *);
* gets the mouse state to aState for resons of drag state.
* @param aState will hold the state of mousedown
*/
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
};

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

@ -98,19 +98,6 @@ public:
*/
NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength,
PRInt32 *aStart, PRInt32 *aEnd, PRBool *aDrawSelected, PRUint32 aFlag/*not used*/) = 0;
/** SetMouseDownState(PRBool);
* sets the mouse state to aState for resons of drag state.
* @param aState is the new state of mousedown
*/
NS_IMETHOD SetMouseDownState(PRBool aState)=0;
/** GetMouseDownState(PRBool *);
* gets the mouse state to aState for resons of drag state.
* @param aState will hold the state of mousedown
*/
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
};

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

@ -92,9 +92,6 @@ public:
NS_IMETHOD EnableFrameNotification(PRBool aEnable){mNotifyFrames = aEnable; return NS_OK;}
NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength,
PRInt32 *aStart, PRInt32 *aEnd, PRBool *aDrawSelected , PRUint32 aFlag/*not used*/);
NS_IMETHOD SetMouseDownState(PRBool aState);
NS_IMETHOD GetMouseDownState(PRBool *aState);
/*END nsIFrameSelection interfacse*/
/*BEGIN nsIDOMSelection interface implementations*/
@ -175,7 +172,6 @@ private:
// for nsIScriptContextOwner
void* mScriptObject;
nsIFocusTracker *mTracker;
PRBool mMouseDownState; //for drag purposes
};
class nsRangeListIterator : public nsIBidirectionalEnumerator
@ -241,7 +237,6 @@ nsRangeListIterator::nsRangeListIterator(nsRangeList *aList)
return;
}
mRangeList = aList;
mDirection = PR_TRUE;
NS_INIT_REFCNT();
}
@ -687,7 +682,6 @@ NS_IMETHODIMP
nsRangeList::Init(nsIFocusTracker *aTracker)
{
mTracker = aTracker;
mMouseDownState = PR_FALSE;
return NS_OK;
}
@ -1002,27 +996,6 @@ nsRangeList::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt
NS_METHOD
nsRangeList::SetMouseDownState(PRBool aState)
{
mMouseDownState = aState;
return NS_OK;
}
NS_METHOD
nsRangeList::GetMouseDownState(PRBool *aState)
{
if (!aState)
return NS_ERROR_NULL_POINTER;
*aState = mMouseDownState;
return NS_OK;
}
//////////END FRAMESELECTION
NS_METHOD
nsRangeList::AddSelectionListener(nsIDOMSelectionListener* inNewListener)
{
@ -1492,7 +1465,11 @@ nsRangeList::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
}
return NS_OK;
// If we get here, the focus wasn't contained in any of the ranges.
#ifdef DEBUG
printf("nsRangeList::Extend: focus not contained in any ranges\n");
#endif
return NS_ERROR_UNEXPECTED;
}

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

@ -38,8 +38,6 @@
#include "nsIWebShell.h"
#include "nsIFocusableContent.h"
#include "nsIScrollableView.h"
#include "nsIDOMSelection.h"
#include "nsIFrameSelection.h"
static NS_DEFINE_IID(kIEventStateManagerIID, NS_IEVENTSTATEMANAGER_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -161,22 +159,8 @@ nsEventStateManager::PostHandleEvent(nsIPresContext& aPresContext,
case NS_MOUSE_LEFT_BUTTON_UP:
case NS_MOUSE_MIDDLE_BUTTON_UP:
case NS_MOUSE_RIGHT_BUTTON_UP:
{
ret = CheckForAndDispatchClick(aPresContext, (nsMouseEvent*)aEvent, aStatus);
SetContentState(nsnull, NS_EVENT_STATE_ACTIVE);
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell){
nsCOMPtr<nsIDOMSelection> selection;
rv = shell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(rv) && selection){
nsCOMPtr<nsIFrameSelection> frameSel;
frameSel = do_QueryInterface(selection);
if (frameSel)
frameSel->SetMouseDownState(PR_FALSE);
}
}
}
break;
case NS_KEY_DOWN:
ret = DispatchKeyPressEvent(aPresContext, (nsKeyEvent*)aEvent, aStatus);

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

@ -692,6 +692,16 @@ NS_IMETHODIMP nsComboboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
if (nsEventStatus_eConsumeNoDefault == aEventStatus) {
return NS_OK;
}
if(nsEventStatus_eConsumeNoDefault != aEventStatus) {
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
} else if (aEvent->message == NS_MOUSE_MOVE && mDoingSelection ||
aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
// no-op
} else {
return NS_OK;
}
aEventStatus = nsEventStatus_eConsumeNoDefault;
@ -704,6 +714,8 @@ NS_IMETHODIMP nsComboboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
nsFormControlHelper::ForceDrawFrame(this);
MouseClicked(&aPresContext);
}
}
return NS_OK;
}

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

@ -72,6 +72,7 @@ PRInt32 fTrackerRemoveListMax = 0;
nsIContent * fTrackerContentArrayAddList[1024];
PRInt32 fTrackerAddListMax = 0;
nsIDocument *gDoc = nsnull;
// [HACK] Foward Declarations
void ForceDrawFrame(nsFrame * aFrame);
@ -79,6 +80,8 @@ void ForceDrawFrame(nsFrame * aFrame);
static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
#endif
PRBool nsFrame::mDoingSelection = PR_FALSE;
PRBool nsFrame::mDidDrag = PR_FALSE;
//----------------------------------------------------------------------
@ -725,33 +728,37 @@ nsFrame::HandleEvent(nsIPresContext& aPresContext,
return NS_OK;
}
/*i have no idea why this is here keeping incase..
if (DisplaySelection(aPresContext) == PR_FALSE) {
if (aEvent->message != NS_MOUSE_LEFT_BUTTON_DOWN) {
return NS_OK;
}
}
*/
if (aEvent->message == NS_MOUSE_MOVE) {
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv)){
nsCOMPtr<nsIDOMSelection> selection;
if (NS_SUCCEEDED(shell->GetSelection(getter_AddRefs(selection)))){
nsCOMPtr<nsIFrameSelection> frameselection;
frameselection = do_QueryInterface(selection);
if (frameselection) {
PRBool mouseDown = PR_FALSE;
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && mouseDown){
if(nsEventStatus_eConsumeNoDefault != aEventStatus) {
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
}
else if (aEvent->message == NS_MOUSE_MOVE && mDoingSelection ||
aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
// no-op
}
else {
return NS_OK;
}
if (SELECTION_DEBUG) printf("Message: %d-------------------------------------------------------------\n",aEvent->message);
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
if (mDoingSelection) {
HandleRelease(aPresContext, aEvent, aEventStatus);
}
} else if (aEvent->message == NS_MOUSE_MOVE) {
mDidDrag = PR_TRUE;
HandleDrag(aPresContext, aEvent, aEventStatus);
}
}
}
}
}
else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
//DEBUG MJUDGE DEBUG MESSAGE FOR DRAGGING FROM SELECTION
} else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
HandlePress(aPresContext, aEvent, aEventStatus);
}
}
return NS_OK;
}
@ -768,6 +775,8 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
return NS_OK;
}
mDoingSelection = PR_TRUE;
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
nsInputEvent *inputEvent = (nsInputEvent *)aEvent;
@ -778,18 +787,20 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsCOMPtr<nsIDOMSelection> selection;
if (NS_SUCCEEDED(shell->GetSelection(getter_AddRefs(selection)))){
nsCOMPtr<nsIFrameSelection> frameselection;
frameselection = do_QueryInterface(selection);
if (frameselection) {
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFrameSelection *frameselection = nsnull;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection, (void **)&frameselection))) {
nsCOMPtr<nsIContent> content;
rv = GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED( rv )){
frameselection->SetMouseDownState(PR_TRUE);//not important if it fails here
frameselection->EnableFrameNotification(PR_FALSE);
frameselection->TakeFocus(content, startPos + contentOffset, inputEvent->isShift);
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
}
NS_RELEASE(frameselection);
}
NS_RELEASE(selection);
}
//no release
}
@ -807,6 +818,8 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
return NS_OK;
}
mDoingSelection = PR_TRUE;
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
@ -823,7 +836,9 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
nsCOMPtr<nsIContent> content;
rv = GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED( rv )){
frameselection->EnableFrameNotification(PR_FALSE);
frameselection->TakeFocus(content, startPos + contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
}
NS_RELEASE(frameselection);
}
@ -840,6 +855,8 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext& aPresContext,
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus)
{
mDoingSelection = PR_FALSE;
NS_IF_RELEASE(gDoc);
return NS_OK;
}

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

@ -350,6 +350,12 @@ protected:
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
///////////////////////////////////
// Important Selection Variables
///////////////////////////////////
static PRBool mDoingSelection;
static PRBool mDidDrag;
static PRInt32 mStartPos;
// Selection data is valid only from the Mouse Press to the Mouse Release
///////////////////////////////////

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

@ -72,6 +72,7 @@ PRInt32 fTrackerRemoveListMax = 0;
nsIContent * fTrackerContentArrayAddList[1024];
PRInt32 fTrackerAddListMax = 0;
nsIDocument *gDoc = nsnull;
// [HACK] Foward Declarations
void ForceDrawFrame(nsFrame * aFrame);
@ -79,6 +80,8 @@ void ForceDrawFrame(nsFrame * aFrame);
static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
#endif
PRBool nsFrame::mDoingSelection = PR_FALSE;
PRBool nsFrame::mDidDrag = PR_FALSE;
//----------------------------------------------------------------------
@ -725,33 +728,37 @@ nsFrame::HandleEvent(nsIPresContext& aPresContext,
return NS_OK;
}
/*i have no idea why this is here keeping incase..
if (DisplaySelection(aPresContext) == PR_FALSE) {
if (aEvent->message != NS_MOUSE_LEFT_BUTTON_DOWN) {
return NS_OK;
}
}
*/
if (aEvent->message == NS_MOUSE_MOVE) {
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv)){
nsCOMPtr<nsIDOMSelection> selection;
if (NS_SUCCEEDED(shell->GetSelection(getter_AddRefs(selection)))){
nsCOMPtr<nsIFrameSelection> frameselection;
frameselection = do_QueryInterface(selection);
if (frameselection) {
PRBool mouseDown = PR_FALSE;
if (NS_SUCCEEDED(frameselection->GetMouseDownState(&mouseDown)) && mouseDown){
if(nsEventStatus_eConsumeNoDefault != aEventStatus) {
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
}
else if (aEvent->message == NS_MOUSE_MOVE && mDoingSelection ||
aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
// no-op
}
else {
return NS_OK;
}
if (SELECTION_DEBUG) printf("Message: %d-------------------------------------------------------------\n",aEvent->message);
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
if (mDoingSelection) {
HandleRelease(aPresContext, aEvent, aEventStatus);
}
} else if (aEvent->message == NS_MOUSE_MOVE) {
mDidDrag = PR_TRUE;
HandleDrag(aPresContext, aEvent, aEventStatus);
}
}
}
}
}
else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
//DEBUG MJUDGE DEBUG MESSAGE FOR DRAGGING FROM SELECTION
} else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
HandlePress(aPresContext, aEvent, aEventStatus);
}
}
return NS_OK;
}
@ -768,6 +775,8 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
return NS_OK;
}
mDoingSelection = PR_TRUE;
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
nsInputEvent *inputEvent = (nsInputEvent *)aEvent;
@ -778,18 +787,20 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
PRInt32 startPos = 0;
PRUint32 contentOffset = 0;
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
nsCOMPtr<nsIDOMSelection> selection;
if (NS_SUCCEEDED(shell->GetSelection(getter_AddRefs(selection)))){
nsCOMPtr<nsIFrameSelection> frameselection;
frameselection = do_QueryInterface(selection);
if (frameselection) {
nsIDOMSelection *selection = nsnull;
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
nsIFrameSelection *frameselection = nsnull;
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection, (void **)&frameselection))) {
nsCOMPtr<nsIContent> content;
rv = GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED( rv )){
frameselection->SetMouseDownState(PR_TRUE);//not important if it fails here
frameselection->EnableFrameNotification(PR_FALSE);
frameselection->TakeFocus(content, startPos + contentOffset, inputEvent->isShift);
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
}
NS_RELEASE(frameselection);
}
NS_RELEASE(selection);
}
//no release
}
@ -807,6 +818,8 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
return NS_OK;
}
mDoingSelection = PR_TRUE;
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
@ -823,7 +836,9 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
nsCOMPtr<nsIContent> content;
rv = GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED( rv )){
frameselection->EnableFrameNotification(PR_FALSE);
frameselection->TakeFocus(content, startPos + contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
}
NS_RELEASE(frameselection);
}
@ -840,6 +855,8 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext& aPresContext,
nsGUIEvent* aEvent,
nsEventStatus& aEventStatus)
{
mDoingSelection = PR_FALSE;
NS_IF_RELEASE(gDoc);
return NS_OK;
}

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

@ -350,6 +350,12 @@ protected:
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
///////////////////////////////////
// Important Selection Variables
///////////////////////////////////
static PRBool mDoingSelection;
static PRBool mDidDrag;
static PRInt32 mStartPos;
// Selection data is valid only from the Mouse Press to the Mouse Release
///////////////////////////////////

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

@ -692,6 +692,16 @@ NS_IMETHODIMP nsComboboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
if (nsEventStatus_eConsumeNoDefault == aEventStatus) {
return NS_OK;
}
if(nsEventStatus_eConsumeNoDefault != aEventStatus) {
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
} else if (aEvent->message == NS_MOUSE_MOVE && mDoingSelection ||
aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
// no-op
} else {
return NS_OK;
}
aEventStatus = nsEventStatus_eConsumeNoDefault;
@ -704,6 +714,8 @@ NS_IMETHODIMP nsComboboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
nsFormControlHelper::ForceDrawFrame(this);
MouseClicked(&aPresContext);
}
}
return NS_OK;
}