From cccbddadeca2f8f8d2b950dfcfa383dc22aaa915 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Thu, 7 Sep 2000 02:47:52 +0000 Subject: [PATCH] Patch to enable event.originalTarget on input fields. r=joki --- content/html/content/src/nsHTMLInputElement.cpp | 12 +++++++++++- layout/html/content/src/nsHTMLInputElement.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index f132470ac5bc..63c02068e138 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -799,6 +799,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, return NS_OK; } + nsCOMPtr oldTarget; + // Do not process any DOM events if the element is disabled PRBool disabled; nsresult rv = GetDisabled(&disabled); @@ -850,6 +852,14 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; } + (*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget)); + + nsCOMPtr originalTarget; + (*aDOMEvent)->GetOriginalTarget(getter_AddRefs(originalTarget)); + if (!originalTarget) { + privateEvent->SetOriginalTarget(oldTarget); + } + nsCOMPtr target = do_QueryInterface((nsIDOMHTMLInputElement*)this); privateEvent->SetTarget(target); } @@ -911,7 +921,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, } // This will reset the target to its original value - privateEvent->SetTarget(nsnull); + privateEvent->SetTarget(oldTarget); } } diff --git a/layout/html/content/src/nsHTMLInputElement.cpp b/layout/html/content/src/nsHTMLInputElement.cpp index f132470ac5bc..63c02068e138 100644 --- a/layout/html/content/src/nsHTMLInputElement.cpp +++ b/layout/html/content/src/nsHTMLInputElement.cpp @@ -799,6 +799,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, return NS_OK; } + nsCOMPtr oldTarget; + // Do not process any DOM events if the element is disabled PRBool disabled; nsresult rv = GetDisabled(&disabled); @@ -850,6 +852,14 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; } + (*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget)); + + nsCOMPtr originalTarget; + (*aDOMEvent)->GetOriginalTarget(getter_AddRefs(originalTarget)); + if (!originalTarget) { + privateEvent->SetOriginalTarget(oldTarget); + } + nsCOMPtr target = do_QueryInterface((nsIDOMHTMLInputElement*)this); privateEvent->SetTarget(target); } @@ -911,7 +921,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, } // This will reset the target to its original value - privateEvent->SetTarget(nsnull); + privateEvent->SetTarget(oldTarget); } }