|
|
|
|
| 65 |
#include "nsIDOMEventTarget.h" |
65 |
#include "nsIDOMEventTarget.h" |
| 66 |
#include "nsGUIEvent.h" |
66 |
#include "nsGUIEvent.h" |
| 67 |
#include "nsContentUtils.h" |
67 |
#include "nsContentUtils.h" |
| 68 |
#include "nsReadableUtils.h" |
68 |
#include "nsReadableUtils.h" |
| 69 |
#include "nsCRT.h" |
69 |
#include "nsCRT.h" |
| 70 |
#include "nsDOMError.h" |
70 |
#include "nsDOMError.h" |
| 71 |
#include "nsEventDispatcher.h" |
71 |
#include "nsEventDispatcher.h" |
| 72 |
#include "nsPresShellIterator.h" |
72 |
#include "nsPresShellIterator.h" |
|
|
73 |
#include "nsIWidget.h" |
| 74 |
#include "nsIFrame.h" |
| 73 |
|
75 |
|
| 74 |
#ifdef PR_LOGGING |
76 |
#ifdef PR_LOGGING |
| 75 |
static PRLogModuleInfo* gLog; |
77 |
static PRLogModuleInfo* gLog; |
| 76 |
#endif |
78 |
#endif |
| 77 |
|
79 |
|
| 78 |
//////////////////////////////////////////////////////////////////////// |
80 |
//////////////////////////////////////////////////////////////////////// |
| 79 |
|
81 |
|
| 80 |
nsXULCommandDispatcher::nsXULCommandDispatcher(nsIDocument* aDocument) |
82 |
nsXULCommandDispatcher::nsXULCommandDispatcher(nsIDocument* aDocument) |
|
Lines 469-476
nsXULCommandDispatcher::SetSuppressFocus
|
Link Here
|
|---|
|
| 469 |
nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll) |
471 |
nsXULCommandDispatcher::SetSuppressFocusScroll(PRBool aSuppressFocusScroll) |
| 470 |
{ |
472 |
{ |
| 471 |
nsIFocusController* fc = GetFocusController(); |
473 |
nsIFocusController* fc = GetFocusController(); |
| 472 |
NS_ENSURE_TRUE(fc, NS_ERROR_FAILURE); |
474 |
NS_ENSURE_TRUE(fc, NS_ERROR_FAILURE); |
| 473 |
|
475 |
|
| 474 |
return fc->SetSuppressFocusScroll(aSuppressFocusScroll); |
476 |
return fc->SetSuppressFocusScroll(aSuppressFocusScroll); |
| 475 |
} |
477 |
} |
| 476 |
|
478 |
|
|
|
479 |
NS_IMETHODIMP |
| 480 |
nsXULCommandDispatcher::SnapMouseCursorToButton(nsIDOMElement* aButton) |
| 481 |
{ |
| 482 |
if (!aButton) |
| 483 |
return NS_OK; |
| 484 |
|
| 485 |
nsCOMPtr<nsIContent> content = do_QueryInterface(aButton); |
| 486 |
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); |
| 487 |
|
| 488 |
nsIFrame *frame = nsnull; |
| 489 |
nsPresShellIterator iter(content->GetDocument()); |
| 490 |
nsCOMPtr<nsIPresShell> shell; |
| 491 |
while ((shell = iter.GetNextShell()) && !frame) { |
| 492 |
frame = shell->GetPrimaryFrameFor(content); |
| 493 |
} |
| 494 |
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); |
| 495 |
|
| 496 |
nsIWidget *widget = frame->GetWindow(); |
| 497 |
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); |
| 498 |
|
| 499 |
PRBool snap; |
| 500 |
nsresult rv = widget->DoesCursorSnapToDefauldButton(&snap); |
| 501 |
NS_ENSURE_SUCCESS(rv, rv); |
| 502 |
if (!snap) |
| 503 |
return NS_OK; |
| 504 |
|
| 505 |
nsIntRect r = frame->GetScreenRect(); |
| 506 |
return widget->MoveMouseCursorTo(nsPoint(r.x + r.width / 2, |
| 507 |
r.y + r.height / 2)); |
| 508 |
} |