mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
updating capture code
This commit is contained in:
parent
9c0940bd11
commit
d12e670ad8
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -1247,6 +1247,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
||||
// It's generated content, so skip it!
|
||||
skipThisKid = PR_TRUE;
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
// The frame's content is not generated. Now check
|
||||
// if it is anonymous content!
|
||||
@ -1280,6 +1281,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //XXX we USED to skip anonymous content i dont think we should anymore leaving this here as a flah
|
||||
|
||||
if (skipThisKid) {
|
||||
kid->GetNextSibling(&kid);
|
||||
@ -1988,13 +1990,15 @@ nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionContro
|
||||
if (state & NS_FRAME_INDEPENDENT_SELECTION)
|
||||
{
|
||||
nsIFrame *tmp = this;
|
||||
while ( NS_SUCCEEDED(tmp->GetParent(&tmp)) && tmp)
|
||||
while (tmp)
|
||||
{
|
||||
nsIGfxTextControlFrame2 *tcf;
|
||||
if (NS_SUCCEEDED(tmp->QueryInterface(nsIGfxTextControlFrame2::GetIID(),(void**)&tcf)))
|
||||
{
|
||||
return tcf->GetSelectionController(aSelCon);
|
||||
}
|
||||
if (NS_FAILED(tmp->GetParent(&tmp)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
@ -2974,10 +2978,14 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
||||
// get its view
|
||||
nsIView* view = nsnull;
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
GetView(aPresContext, & view);
|
||||
if (!view)
|
||||
{
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
PRBool result;
|
||||
@ -3001,13 +3009,15 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = nsnull;
|
||||
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
|
||||
GetView(aPresContext, & view);
|
||||
if (!view)
|
||||
{
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
}
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
|
||||
if (view) {
|
||||
|
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -6334,19 +6334,13 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
nsCOMPtr<nsILineIterator> it;
|
||||
nsIFrame *mainframe = this;
|
||||
nsCOMPtr<nsIFocusTracker> tracker;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
result = shell->QueryInterface(NS_GET_IID(nsIFocusTracker),getter_AddRefs(tracker));
|
||||
@ -6424,9 +6418,19 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
|
||||
if (resultFrame)
|
||||
return resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
{
|
||||
result = resultFrame->HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && !IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);*/
|
||||
return NS_OK; //just stop it
|
||||
}
|
||||
}
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
@ -1247,6 +1247,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
||||
// It's generated content, so skip it!
|
||||
skipThisKid = PR_TRUE;
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
// The frame's content is not generated. Now check
|
||||
// if it is anonymous content!
|
||||
@ -1280,6 +1281,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //XXX we USED to skip anonymous content i dont think we should anymore leaving this here as a flah
|
||||
|
||||
if (skipThisKid) {
|
||||
kid->GetNextSibling(&kid);
|
||||
@ -1988,13 +1990,15 @@ nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionContro
|
||||
if (state & NS_FRAME_INDEPENDENT_SELECTION)
|
||||
{
|
||||
nsIFrame *tmp = this;
|
||||
while ( NS_SUCCEEDED(tmp->GetParent(&tmp)) && tmp)
|
||||
while (tmp)
|
||||
{
|
||||
nsIGfxTextControlFrame2 *tcf;
|
||||
if (NS_SUCCEEDED(tmp->QueryInterface(nsIGfxTextControlFrame2::GetIID(),(void**)&tcf)))
|
||||
{
|
||||
return tcf->GetSelectionController(aSelCon);
|
||||
}
|
||||
if (NS_FAILED(tmp->GetParent(&tmp)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
@ -2974,10 +2978,14 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
||||
// get its view
|
||||
nsIView* view = nsnull;
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
GetView(aPresContext, & view);
|
||||
if (!view)
|
||||
{
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
PRBool result;
|
||||
@ -3001,13 +3009,15 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = nsnull;
|
||||
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
|
||||
GetView(aPresContext, & view);
|
||||
if (!view)
|
||||
{
|
||||
nsIFrame *parent;//might be THIS frame thats ok
|
||||
nsresult rv = GetParentWithView(aPresContext, &parent);
|
||||
if (!parent || NS_FAILED(rv))
|
||||
return rv?rv:NS_ERROR_FAILURE;
|
||||
parent->GetView(aPresContext,&view);
|
||||
}
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
|
||||
if (view) {
|
||||
|
Loading…
Reference in New Issue
Block a user