Lines 35-40
Link Here
|
35 |
#include <nsIDOMXULDocument.h> |
35 |
#include <nsIDOMXULDocument.h> |
36 |
#include <nsIURI.h> |
36 |
#include <nsIURI.h> |
37 |
#include <nsIDOMNSEvent.h> |
37 |
#include <nsIDOMNSEvent.h> |
|
|
38 |
#include <nsIDOMNSElement.h> |
38 |
#include <nsIDOMNSHTMLElement.h> |
39 |
#include <nsIDOMNSHTMLElement.h> |
39 |
#include <nsIDOMCharacterData.h> |
40 |
#include <nsIDOMCharacterData.h> |
40 |
#include <nsIDOMHTMLButtonElement.h> |
41 |
#include <nsIDOMHTMLButtonElement.h> |
Lines 518-537
Link Here
|
518 |
nsresult EventContext::GetTargetCoords (nsIDOMEventTarget *aTarget, PRInt32 *aX, PRInt32 *aY) |
519 |
nsresult EventContext::GetTargetCoords (nsIDOMEventTarget *aTarget, PRInt32 *aX, PRInt32 *aY) |
519 |
{ |
520 |
{ |
520 |
/* Calculate the node coordinates relative to the widget origin */ |
521 |
/* Calculate the node coordinates relative to the widget origin */ |
521 |
nsCOMPtr<nsIDOMNSHTMLElement> elem = do_QueryInterface(aTarget); |
522 |
nsCOMPtr<nsIDOMNSHTMLElement> nsHTMLElem (do_QueryInterface(aTarget)); |
522 |
|
523 |
|
523 |
PRInt32 x = 0, y = 0; |
524 |
PRInt32 x = 0, y = 0; |
524 |
while (elem) |
525 |
while (nsHTMLElem) |
525 |
{ |
526 |
{ |
526 |
PRInt32 val; |
527 |
PRInt32 val; |
527 |
elem->GetOffsetTop(&val); y += val; |
528 |
nsCOMPtr<nsIDOMNSElement> nsElem (do_QueryInterface(nsHTMLElem)); |
528 |
elem->GetScrollTop(&val); y -= val; |
529 |
nsHTMLElem->GetOffsetTop(&val); y += val; |
529 |
elem->GetOffsetLeft(&val); x += val; |
530 |
nsElem->GetScrollTop(&val); y -= val; |
530 |
elem->GetScrollLeft(&val); x -= val; |
531 |
nsHTMLElem->GetOffsetLeft(&val); x += val; |
|
|
532 |
nsElem->GetScrollLeft(&val); x -= val; |
531 |
|
533 |
|
532 |
nsCOMPtr<nsIDOMElement> parent; |
534 |
nsCOMPtr<nsIDOMElement> parent; |
533 |
elem->GetOffsetParent(getter_AddRefs(parent)); |
535 |
nsHTMLElem->GetOffsetParent (getter_AddRefs (parent)); |
534 |
elem = do_QueryInterface(parent); |
536 |
nsHTMLElem = do_QueryInterface(parent); |
535 |
} |
537 |
} |
536 |
*aX = x; |
538 |
*aX = x; |
537 |
*aY = y; |
539 |
*aY = y; |