mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 813445 part.4 Remove NS_EVENT_FLAG_STOP_DISPATCH and NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY r=smaug
This commit is contained in:
parent
2c9891bdd2
commit
ce9ff392ec
@ -361,15 +361,15 @@ nsDOMEvent::GetTimeStamp(uint64_t* aTimeStamp)
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::StopPropagation()
|
||||
{
|
||||
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
mEvent->mFlags.mPropagationStopped = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::StopImmediatePropagation()
|
||||
{
|
||||
mEvent->flags |=
|
||||
(NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY | NS_EVENT_FLAG_STOP_DISPATCH);
|
||||
mEvent->mFlags.mPropagationStopped = true;
|
||||
mEvent->mFlags.mImmediatePropagationStopped = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -813,7 +813,7 @@ nsDOMEvent::SetTarget(nsIDOMEventTarget* aTarget)
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsDOMEvent::IsDispatchStopped()
|
||||
{
|
||||
return !!(mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH);
|
||||
return mEvent->mFlags.mPropagationStopped;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsEvent*)
|
||||
|
@ -292,19 +292,14 @@ NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCancelBubble);
|
||||
*aCancelBubble =
|
||||
(mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) ? true : false;
|
||||
*aCancelBubble = mEvent->mFlags.mPropagationStopped;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::SetCancelBubble(bool aCancelBubble)
|
||||
{
|
||||
if (aCancelBubble) {
|
||||
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
} else {
|
||||
mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
}
|
||||
mEvent->mFlags.mPropagationStopped = aCancelBubble;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
if (WantsWillHandleEvent()) {
|
||||
mTarget->WillHandleEvent(aVisitor);
|
||||
}
|
||||
if (aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) {
|
||||
if (aVisitor.mEvent->mFlags.mPropagationStopped) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!mManager) {
|
||||
@ -279,7 +279,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
while (item->mChild) {
|
||||
if ((!(aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH) ||
|
||||
item->ForceContentDispatch()) &&
|
||||
!(aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) {
|
||||
!aVisitor.mEvent->mFlags.mPropagationStopped) {
|
||||
item->HandleEvent(aVisitor, aFlags & NS_EVENT_CAPTURE_MASK,
|
||||
aMayHaveNewListenerManagers ||
|
||||
createdELMs != nsEventListenerManager::sCreatedCount,
|
||||
@ -304,7 +304,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
|
||||
// Target
|
||||
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
|
||||
if (!(aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) &&
|
||||
if (!aVisitor.mEvent->mFlags.mPropagationStopped &&
|
||||
(!(aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH) ||
|
||||
item->ForceContentDispatch())) {
|
||||
// FIXME Should use aFlags & NS_EVENT_BUBBLE_MASK because capture phase
|
||||
@ -333,7 +333,7 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
if (aVisitor.mEvent->mFlags.mBubbles || newTarget) {
|
||||
if ((!(aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH) ||
|
||||
item->ForceContentDispatch()) &&
|
||||
!(aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) {
|
||||
!aVisitor.mEvent->mFlags.mPropagationStopped) {
|
||||
item->HandleEvent(aVisitor, aFlags & NS_EVENT_BUBBLE_MASK,
|
||||
createdELMs != nsEventListenerManager::sCreatedCount,
|
||||
aPusher);
|
||||
@ -349,8 +349,8 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
if (!(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT)) {
|
||||
// Dispatch to the system event group. Make sure to clear the
|
||||
// STOP_DISPATCH flag since this resets for each event group.
|
||||
aVisitor.mEvent->flags &=
|
||||
~(NS_EVENT_FLAG_STOP_DISPATCH | NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY);
|
||||
aVisitor.mEvent->mFlags.mPropagationStopped = false;
|
||||
aVisitor.mEvent->mFlags.mImmediatePropagationStopped = false;
|
||||
|
||||
// Setting back the original target of the event.
|
||||
aVisitor.mEvent->target = aVisitor.mEvent->originalTarget;
|
||||
@ -372,8 +372,8 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
||||
|
||||
// After dispatch, clear all the propagation flags so that
|
||||
// system group listeners don't affect to the event.
|
||||
aVisitor.mEvent->flags &=
|
||||
~(NS_EVENT_FLAG_STOP_DISPATCH | NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY);
|
||||
aVisitor.mEvent->mFlags.mPropagationStopped = false;
|
||||
aVisitor.mEvent->mFlags.mImmediatePropagationStopped = false;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -945,7 +945,7 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
nsAutoPopupStatePusher popupStatePusher(nsDOMEvent::GetEventPopupControlState(aEvent));
|
||||
bool hasListener = false;
|
||||
while (iter.HasMore()) {
|
||||
if (aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY) {
|
||||
if (aEvent->mFlags.mImmediatePropagationStopped) {
|
||||
break;
|
||||
}
|
||||
nsListenerStruct* ls = &iter.GetNext();
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
nsEventStatus* aEventStatus,
|
||||
nsCxPusher* aPusher)
|
||||
{
|
||||
if (mListeners.IsEmpty() || aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) {
|
||||
if (mListeners.IsEmpty() || aEvent->mFlags.mPropagationStopped) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// Will not be handled locally, remote the event
|
||||
if (GetCrossProcessTarget()->SendTextEvent(*textEvent)) {
|
||||
// Cancel local dispatching
|
||||
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
aEvent->mFlags.mPropagationStopped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1264,7 +1264,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// Will not be handled locally, remote the event
|
||||
if (GetCrossProcessTarget()->SendCompositionEvent(*compositionEvent)) {
|
||||
// Cancel local dispatching
|
||||
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
aEvent->mFlags.mPropagationStopped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2155,7 +2155,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
targetContent, selection);
|
||||
if (dragStarted) {
|
||||
sActiveESM = nullptr;
|
||||
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
aEvent->mFlags.mPropagationStopped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4178,7 +4178,7 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
||||
} else if (aEvent->refPoint == sSynthCenteringPoint) {
|
||||
// This is the "synthetic native" event we dispatched to re-center the
|
||||
// pointer. Cancel it so we don't expose the centering move to content.
|
||||
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
aEvent->mFlags.mPropagationStopped = true;
|
||||
// Clear sSynthCenteringPoint so we don't cancel other events
|
||||
// targeted at the center.
|
||||
sSynthCenteringPoint = kInvalidRefPoint;
|
||||
|
@ -549,8 +549,7 @@ nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
{
|
||||
MOZ_ASSERT(aEvent->eventStructType == NS_COMPOSITION_EVENT ||
|
||||
aEvent->eventStructType == NS_TEXT_EVENT);
|
||||
if (!aEvent->mFlags.mIsTrusted ||
|
||||
(aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) != 0) {
|
||||
if (!aEvent->mFlags.mIsTrusted || aEvent->mFlags.mPropagationStopped) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,7 @@ nsHTMLFormElement::WillHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
aVisitor.mEvent->message == NS_FORM_RESET) &&
|
||||
aVisitor.mEvent->mFlags.mInBubblingPhase &&
|
||||
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
|
||||
aVisitor.mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
aVisitor.mEvent->mFlags.mPropagationStopped = true;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ enum nsEventStructType {
|
||||
#define NS_EVENT_FLAG_NONE 0x0000
|
||||
#define NS_EVENT_FLAG_BUBBLE 0x0002
|
||||
#define NS_EVENT_FLAG_CAPTURE 0x0004
|
||||
#define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
|
||||
#define NS_EVENT_FLAG_NO_DEFAULT 0x0010
|
||||
#define NS_PRIV_EVENT_FLAG_SCRIPT 0x0080
|
||||
#define NS_EVENT_FLAG_NO_CONTENT_DISPATCH 0x0100
|
||||
@ -139,8 +138,6 @@ enum nsEventStructType {
|
||||
|
||||
#define NS_EVENT_RETARGET_TO_NON_NATIVE_ANONYMOUS 0x40000
|
||||
|
||||
#define NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY 0x80000
|
||||
|
||||
#define NS_EVENT_FLAG_DONT_FORWARD_CROSS_PROCESS 0x100000
|
||||
|
||||
#define NS_EVENT_CAPTURE_MASK (~(NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
|
||||
@ -526,6 +523,13 @@ public:
|
||||
// If mBubbles is true, the event can bubble. Otherwise, cannot be handled
|
||||
// in bubbling phase.
|
||||
bool mBubbles : 1;
|
||||
// If mPropagationStopped is true, nsDOMEvent::StopPropagation() or
|
||||
// nsDOMEvent::StopImmediatePropagation() has been called.
|
||||
bool mPropagationStopped : 1;
|
||||
// If mImmediatePropagationStopped is true,
|
||||
// nsDOMEvent::StopImmediatePropagation() has been called.
|
||||
// Note that mPropagationStopped must be true when this is true.
|
||||
bool mImmediatePropagationStopped : 1;
|
||||
|
||||
// If the event is being handled in target phase, returns true.
|
||||
bool InTargetPhase() const
|
||||
|
Loading…
Reference in New Issue
Block a user