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); } }