Bug 1256589 part.7 Add PropagationStopped() to WidgetEvent r=smaug
MozReview-Commit-ID: 3eLDURWr6d9
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -609,17 +609,17 @@ Event::SetTarget(nsIDOMEventTarget* aTar
{
mEvent->target = do_QueryInterface(aTarget);
return NS_OK;
}
NS_IMETHODIMP_(bool)
Event::IsDispatchStopped()
{
- return mEvent->mFlags.mPropagationStopped;
+ return mEvent->PropagationStopped();
}
NS_IMETHODIMP_(WidgetEvent*)
Event::WidgetEventPtr()
{
return mEvent;
}
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -239,17 +239,17 @@ public:
* manager, this method calls EventListenerManager::HandleEvent().
*/
void HandleEvent(EventChainPostVisitor& aVisitor,
ELMCreationDetector& aCd)
{
if (WantsWillHandleEvent()) {
mTarget->WillHandleEvent(aVisitor);
}
- if (aVisitor.mEvent->mFlags.mPropagationStopped) {
+ if (aVisitor.mEvent->PropagationStopped()) {
return;
}
if (aVisitor.mEvent->mFlags.mOnlySystemGroupDispatchInContent &&
!aVisitor.mEvent->mFlags.mInSystemGroup &&
!IsCurrentTargetChrome()) {
return;
}
if (!mManager) {
@@ -338,17 +338,17 @@ EventTargetChainItem::HandleEventTargetC
// Capture
aVisitor.mEvent->mFlags.mInCapturePhase = true;
aVisitor.mEvent->mFlags.mInBubblingPhase = false;
for (uint32_t i = chainLength - 1; i > 0; --i) {
EventTargetChainItem& item = aChain[i];
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
- !aVisitor.mEvent->mFlags.mPropagationStopped) {
+ !aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
if (item.GetNewTarget()) {
// item is at anonymous boundary. Need to retarget for the child items.
for (uint32_t j = i; j > 0; --j) {
uint32_t childIndex = j - 1;
EventTarget* newTarget = aChain[childIndex].GetNewTarget();
@@ -358,17 +358,17 @@ EventTargetChainItem::HandleEventTargetC
}
}
}
}
// Target
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
EventTargetChainItem& targetItem = aChain[0];
- if (!aVisitor.mEvent->mFlags.mPropagationStopped &&
+ if (!aVisitor.mEvent->PropagationStopped() &&
(!aVisitor.mEvent->mFlags.mNoContentDispatch ||
targetItem.ForceContentDispatch())) {
targetItem.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
targetItem.PostHandleEvent(aVisitor);
}
@@ -381,17 +381,17 @@ EventTargetChainItem::HandleEventTargetC
// Item is at anonymous boundary. Need to retarget for the current item
// and for parent items.
aVisitor.mEvent->target = newTarget;
}
if (aVisitor.mEvent->mFlags.mBubbles || newTarget) {
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
- !aVisitor.mEvent->mFlags.mPropagationStopped) {
+ !aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
item.PostHandleEvent(aVisitor);
}
}
}
aVisitor.mEvent->mFlags.mInBubblingPhase = false;
--- a/dom/events/EventListenerManager.h
+++ b/dom/events/EventListenerManager.h
@@ -323,17 +323,17 @@ public:
void RemoveEventHandler(nsIAtom *aName, const nsAString& aTypeString);
void HandleEvent(nsPresContext* aPresContext,
WidgetEvent* aEvent,
nsIDOMEvent** aDOMEvent,
dom::EventTarget* aCurrentTarget,
nsEventStatus* aEventStatus)
{
- if (mListeners.IsEmpty() || aEvent->mFlags.mPropagationStopped) {
+ if (mListeners.IsEmpty() || aEvent->PropagationStopped()) {
return;
}
if (!mMayHaveCapturingListeners && !aEvent->mFlags.mInBubblingPhase) {
return;
}
if (!mMayHaveSystemGroupListeners && aEvent->mFlags.mInSystemGroup) {
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1160,17 +1160,17 @@ IMEStateManager::DispatchCompositionEven
aCompositionEvent->widget->GetNativeIMEContext().mRawNativeIMEContext,
aCompositionEvent->widget->GetNativeIMEContext().mOriginProcessID,
GetBoolName(aCompositionEvent->widget->Destroyed()),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted),
GetBoolName(aCompositionEvent->mFlags.mPropagationStopped),
GetBoolName(aIsSynthesized), tabParent.get()));
if (!aCompositionEvent->IsTrusted() ||
- aCompositionEvent->mFlags.mPropagationStopped) {
+ aCompositionEvent->PropagationStopped()) {
return;
}
MOZ_ASSERT(aCompositionEvent->mMessage != eCompositionUpdate,
"compositionupdate event shouldn't be dispatched manually");
EnsureTextCompositionArray();
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -90,17 +90,17 @@ public:
}
already_AddRefed<nsINode> GetRangeParent();
int32_t RangeOffset() const;
bool CancelBubble() const
{
- return mEvent->mFlags.mPropagationStopped;
+ return mEvent->PropagationStopped();
}
bool IsChar() const;
protected:
~UIEvent() {}
// Internal helper functions
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -172,16 +172,20 @@ public:
{
MOZ_ASSERT(!mDefaultPreventedByContent || DefaultPrevented());
return mDefaultPreventedByContent;
}
inline bool IsTrusted() const
{
return mIsTrusted;
}
+ inline bool PropagationStopped() const
+ {
+ return mPropagationStopped;
+ }
inline void Clear()
{
SetRawFlags(0);
}
// Get if either the instance's bit or the aOther's bit is true, the
// instance's bit becomes true. In other words, this works like:
// eventFlags |= aOther;
@@ -368,16 +372,17 @@ public:
}
void PreventDefaultBeforeDispatch() { mFlags.PreventDefaultBeforeDispatch(); }
bool DefaultPrevented() const { return mFlags.DefaultPrevented(); }
bool DefaultPreventedByContent() const
{
return mFlags.DefaultPreventedByContent();
}
bool IsTrusted() const { return mFlags.IsTrusted(); }
+ bool PropagationStopped() const { return mFlags.PropagationStopped(); }
/**
* Utils for checking event types
*/
/**
* As*Event() returns the pointer of the instance only when the instance is
* the class or one of its derived class.