mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
fix for 46505, text inputs and text areas need to change their event targets when crossing the anonymous content boundry. r=hyatt
This commit is contained in:
parent
c18e089b7a
commit
cbf6ecc1f7
@ -826,7 +826,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
// to ourselves
|
||||
PRInt32 type;
|
||||
GetType(&type);
|
||||
if (type == NS_FORM_INPUT_FILE) {
|
||||
if (type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_INPUT_TEXT ) {
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
@ -896,7 +897,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Finish the special file control processing...
|
||||
if (type == NS_FORM_INPUT_FILE) {
|
||||
if (type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_INPUT_TEXT ) {
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLTextAreaElementIID, NS_IDOMHTMLTEXTAREAELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
|
||||
@ -533,8 +534,58 @@ nsHTMLTextAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
// We have anonymous content underneath
|
||||
// that we need to hide. We need to set the event target now
|
||||
// to ourselves
|
||||
{
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
if (!*aDOMEvent) {
|
||||
// We haven't made a DOMEvent yet. Force making one now.
|
||||
nsCOMPtr<nsIEventListenerManager> listenerManager;
|
||||
if (NS_FAILED(rv = mInner.GetListenerManager(getter_AddRefs(listenerManager)))) {
|
||||
return rv;
|
||||
}
|
||||
nsAutoString empty;
|
||||
if (NS_FAILED(rv = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
if (!*aDOMEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (!privateEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface((nsIDOMHTMLTextAreaElement*)this);
|
||||
privateEvent->SetTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
|
||||
// Finish the special anonymous content processing...
|
||||
{
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
if (!*aDOMEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (!privateEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// This will reset the target to its original value
|
||||
privateEvent->SetTarget(nsnull);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsIFormControl
|
||||
|
@ -826,7 +826,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
// to ourselves
|
||||
PRInt32 type;
|
||||
GetType(&type);
|
||||
if (type == NS_FORM_INPUT_FILE) {
|
||||
if (type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_INPUT_TEXT ) {
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
@ -896,7 +897,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Finish the special file control processing...
|
||||
if (type == NS_FORM_INPUT_FILE) {
|
||||
if (type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_INPUT_TEXT ) {
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLTextAreaElementIID, NS_IDOMHTMLTEXTAREAELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
|
||||
@ -533,8 +534,58 @@ nsHTMLTextAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
// We have anonymous content underneath
|
||||
// that we need to hide. We need to set the event target now
|
||||
// to ourselves
|
||||
{
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
if (!*aDOMEvent) {
|
||||
// We haven't made a DOMEvent yet. Force making one now.
|
||||
nsCOMPtr<nsIEventListenerManager> listenerManager;
|
||||
if (NS_FAILED(rv = mInner.GetListenerManager(getter_AddRefs(listenerManager)))) {
|
||||
return rv;
|
||||
}
|
||||
nsAutoString empty;
|
||||
if (NS_FAILED(rv = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
if (!*aDOMEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (!privateEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface((nsIDOMHTMLTextAreaElement*)this);
|
||||
privateEvent->SetTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
|
||||
// Finish the special anonymous content processing...
|
||||
{
|
||||
// If the event is starting here that's fine. If it's not
|
||||
// init'ing here it started beneath us and needs modification.
|
||||
if (!(NS_EVENT_FLAG_INIT & aFlags)) {
|
||||
if (!*aDOMEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(*aDOMEvent);
|
||||
if (!privateEvent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// This will reset the target to its original value
|
||||
privateEvent->SetTarget(nsnull);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsIFormControl
|
||||
|
Loading…
x
Reference in New Issue
Block a user