mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 2nd patch for bug 423355 due to unit test failures
This commit is contained in:
parent
aaac62d073
commit
2ff7b4b7c9
@ -3191,22 +3191,15 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
doc->MayDispatchMutationEvent(aTargetForSubtreeModified);
|
||||
|
||||
// global object will be null for documents that don't have windows.
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
window = do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
// This relies on nsEventListenerManager::AddEventListener, which sets
|
||||
// all mutation bits when there is a listener for DOMSubtreeModified event.
|
||||
if (window && !window->HasMutationListeners(aType)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT) &&
|
||||
static_cast<nsIContent*>(aNode)->IsInNativeAnonymousSubtree()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
doc->MayDispatchMutationEvent(aTargetForSubtreeModified);
|
||||
|
||||
// If we have a window, we can check it for mutation listeners now.
|
||||
nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(window));
|
||||
if (piTarget) {
|
||||
|
@ -5836,11 +5836,13 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
|
||||
nsCOMArray<nsINode> realTargets;
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsINode* possibleTarget = mSubtreeModifiedTargets[i];
|
||||
NS_ASSERTION(!possibleTarget ||
|
||||
!possibleTarget->IsNodeOfType(nsINode::eCONTENT) ||
|
||||
!static_cast<nsIContent*>(possibleTarget)->
|
||||
IsInNativeAnonymousSubtree(),
|
||||
"Mutation event targeted to native anonymous content!?!");
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(possibleTarget);
|
||||
if (content && content->IsInNativeAnonymousSubtree()) {
|
||||
if (realTargets.IndexOf(possibleTarget) == -1) {
|
||||
realTargets.AppendObject(possibleTarget);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
nsINode* commonAncestor = nsnull;
|
||||
PRInt32 realTargetCount = realTargets.Count();
|
||||
|
@ -2289,11 +2289,13 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
|
||||
|
||||
nsCOMPtr<nsIContent> parent = aContent->GetParent();
|
||||
if (isAnonForEvents) {
|
||||
// If a DOM event is explicitly dispatched using node.dispatchEvent(), then
|
||||
// all the events are allowed even in the native anonymous content..
|
||||
NS_ASSERTION(aVisitor.mEvent->eventStructType != NS_MUTATION_EVENT ||
|
||||
aVisitor.mDOMEvent,
|
||||
"Mutation event dispatched in native anonymous content!?!");
|
||||
// Don't propagate mutation events which are dispatched somewhere inside
|
||||
// native anonymous content.
|
||||
if (aVisitor.mEvent->eventStructType == NS_MUTATION_EVENT) {
|
||||
aVisitor.mParentTarget = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aVisitor.mEventTargetAtParent = parent;
|
||||
} else if (parent) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->target));
|
||||
|
@ -519,7 +519,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
NS_ASSERTION(window->IsInnerWindow(),
|
||||
"Setting mutation listener bits on outer window?");
|
||||
// If aType is NS_MUTATION_SUBTREEMODIFIED, we need to listen all
|
||||
// mutations. nsContentUtils::HasMutationListeners relies on this.
|
||||
// mutations.
|
||||
window->SetMutationListeners((aType == NS_MUTATION_SUBTREEMODIFIED) ?
|
||||
kAllMutationBits :
|
||||
MutationBitForEventType(aType));
|
||||
|
Loading…
Reference in New Issue
Block a user