Issue #2515 - Remove mForceContentDispatch and mNoContentDispatch

This commit is contained in:
Moonchild 2024-07-25 15:33:07 +02:00 committed by roytam1
commit 7e3f0d53a2
10 changed files with 3 additions and 68 deletions

View file

@ -7270,11 +7270,6 @@ nsDocument::GetEventTargetParent(EventChainPreVisitor& aVisitor)
aVisitor.mCanHandle = true;
// Middle/right click shouldn't dispatch click event, use auxclick to instead.
Element* docElement = GetRootElement();
if (docElement && docElement->IsXULElement()) {
// FIXME! This is a hack to make middle mouse paste working also in Editor.
// Bug 329119
aVisitor.mForceContentDispatch = true;
}
// Load events must not propagate to |window| object, see bug 335251.
if (aVisitor.mEvent->mMessage != eLoad) {

View file

@ -3544,12 +3544,6 @@ nsGlobalWindow::GetEventTargetParent(EventChainPreVisitor& aVisitor)
EventMessage msg = aVisitor.mEvent->mMessage;
aVisitor.mCanHandle = true;
// Middle/right click shouldn't dispatch click event, use auxclick to instead.
// Note: mDoc should always exist here, but check just in case someone yanked
// it out from under us.
if (mDoc && mDoc->IsXULDocument()) {
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
}
if (msg == eResize && aVisitor.mEvent->IsTrusted()) {
// QIing to window so that we can keep the old behavior also in case
// a child window is handling resize.

View file

@ -252,7 +252,6 @@ nsInProcessTabChildGlobal::GetOwnerContent()
nsresult
nsInProcessTabChildGlobal::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
aVisitor.mForceContentDispatch = true;
aVisitor.mCanHandle = true;
#ifdef DEBUG

View file

@ -182,7 +182,6 @@ nsresult
nsWindowRoot::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
aVisitor.mCanHandle = true;
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
// To keep mWindow alive
aVisitor.mItemData = static_cast<nsISupports *>(mWindow);
aVisitor.SetParentTarget(mParent, false);

View file

@ -214,16 +214,6 @@ public:
mRetargetedRelatedTarget = aTarget;
}
void SetForceContentDispatch(bool aForce)
{
mFlags.mForceContentDispatch = aForce;
}
bool ForceContentDispatch()
{
return mFlags.mForceContentDispatch;
}
void SetWantsWillHandleEvent(bool aWants)
{
mFlags.mWantsWillHandleEvent = aWants;
@ -387,7 +377,6 @@ private:
// Cached flags for each EventTargetChainItem which are set when calling
// GetEventTargetParent to create event target chain. They are used to
// manage or speedup event dispatching.
bool mForceContentDispatch : 1;
bool mWantsWillHandleEvent : 1;
bool mMayHaveManager : 1;
bool mChechedIfChrome : 1;
@ -439,7 +428,6 @@ EventTargetChainItem::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
aVisitor.Reset();
Unused << mTarget->GetEventTargetParent(aVisitor);
SetForceContentDispatch(aVisitor.mForceContentDispatch);
SetWantsWillHandleEvent(aVisitor.mWantsWillHandleEvent);
SetMayHaveListenerManager(aVisitor.mMayHaveListenerManager);
SetWantsPreHandleEvent(aVisitor.mWantsPreHandleEvent);
@ -492,9 +480,7 @@ EventTargetChainItem::HandleEventTargetChain(
if (item.PreHandleEventOnly()) {
continue;
}
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
!aVisitor.mEvent->PropagationStopped()) {
if (!aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
@ -538,9 +524,7 @@ EventTargetChainItem::HandleEventTargetChain(
// Target
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
EventTargetChainItem& targetItem = aChain[firstCanHandleEventTargetIdx];
if (!aVisitor.mEvent->PropagationStopped() &&
(!aVisitor.mEvent->mFlags.mNoContentDispatch ||
targetItem.ForceContentDispatch())) {
if (!aVisitor.mEvent->PropagationStopped()) {
targetItem.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
@ -570,9 +554,7 @@ EventTargetChainItem::HandleEventTargetChain(
}
if (aVisitor.mEvent->mFlags.mBubbles || newTarget) {
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
!aVisitor.mEvent->PropagationStopped()) {
if (!aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {

View file

@ -118,7 +118,6 @@ public:
: EventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus)
, mCanHandle(true)
, mAutomaticChromeDispatch(true)
, mForceContentDispatch(false)
, mRelatedTargetIsInAnon(false)
, mOriginalTargetIsInAnon(aIsInAnon)
, mWantsWillHandleEvent(false)
@ -143,7 +142,6 @@ public:
mItemData = nullptr;
mCanHandle = true;
mAutomaticChromeDispatch = true;
mForceContentDispatch = false;
mWantsWillHandleEvent = false;
mMayHaveListenerManager = true;
mWantsPreHandleEvent = false;
@ -195,13 +193,6 @@ public:
*/
bool mAutomaticChromeDispatch;
/**
* If mForceContentDispatch is set to true,
* content dispatching is not disabled for this event target.
* FIXME! This is here for backward compatibility. Bug 329119
*/
bool mForceContentDispatch;
/**
* true if it is known that related target is or is a descendant of an
* element which is anonymous for events.

View file

@ -4683,7 +4683,6 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aMouseUpEvent,
event.mTime = aMouseUpEvent->mTime;
event.mTimeStamp = aMouseUpEvent->mTimeStamp;
event.mFlags.mOnlyChromeDispatch = aNoContentDispatch;
event.mFlags.mNoContentDispatch = aNoContentDispatch;
event.button = aMouseUpEvent->button;
event.inputSource = aMouseUpEvent->inputSource;

View file

@ -136,7 +136,6 @@ public:
nsresult
GetEventTargetParent(EventChainPreVisitor& aVisitor) override
{
aVisitor.mForceContentDispatch = true;
return NS_OK;
}

View file

@ -2,18 +2,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 2000
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 03/27/2000 IBM Corp. Added PR_CALLBACK for Optlink
* use in OS2
*/
#include "nsCOMPtr.h"
@ -1299,7 +1287,6 @@ nsXULElement::DispatchXULCommand(const EventChainVisitor& aVisitor,
nsresult
nsXULElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
if (IsEventStoppedFromAnonymousScrollbar(aVisitor.mEvent->mMessage)) {
// Don't propagate these events from native anonymous scrollbar.
aVisitor.mCanHandle = true;

View file

@ -100,16 +100,6 @@ public:
// If mNoCrossProcessBoundaryForwarding is true, the event is not allowed to
// cross process boundary.
bool mNoCrossProcessBoundaryForwarding : 1;
// If mNoContentDispatch is true, the event is never dispatched to the
// event handlers which are added to the contents, onfoo attributes and
// properties. Note that this flag is ignored when
// EventChainPreVisitor::mForceContentDispatch is set true. For exapmle,
// window and document object sets it true. Therefore, web applications
// can handle the event if they add event listeners to the window or the
// document.
// XXX This is an ancient and broken feature, don't use this for new bug
// as far as possible.
bool mNoContentDispatch : 1;
// If mOnlyChromeDispatch is true, the event is dispatched to only chrome.
bool mOnlyChromeDispatch : 1;
// If mOnlySystemGroupDispatchInContent is true, event listeners added to