diff --git a/dom/events/EventDispatcher.cpp b/dom/events/EventDispatcher.cpp index 3c609e3cfb0a..8f169f1f7b4f 100644 --- a/dom/events/EventDispatcher.cpp +++ b/dom/events/EventDispatcher.cpp @@ -773,6 +773,10 @@ MayRetargetToChromeIfCanNotHandleEvent( EventTargetChainItem* chromeTargetEtci = EventTargetChainItemForChromeTarget(aChain, aContent, aChildEtci); if (chromeTargetEtci) { + // If we propagate to chrome, need to ensure we mark + // EventTargetChainItem to be chrome handler so that event.composedPath() + // can return the right value. + chromeTargetEtci->SetIsChromeHandler(true); chromeTargetEtci->GetEventTargetParent(aPreVisitor); return chromeTargetEtci; } diff --git a/testing/web-platform/meta/shadow-dom/untriaged/events/event-dispatch/test-003.html.ini b/testing/web-platform/meta/shadow-dom/untriaged/events/event-dispatch/test-003.html.ini index 1a60615a61a9..b22c97630719 100644 --- a/testing/web-platform/meta/shadow-dom/untriaged/events/event-dispatch/test-003.html.ini +++ b/testing/web-platform/meta/shadow-dom/untriaged/events/event-dispatch/test-003.html.ini @@ -1,4 +1,3 @@ [test-003.html] - [A_05_05_03_T01] - expected: FAIL + prefs: [dom.webcomponents.shadowdom.enabled:true] diff --git a/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html index 78b76de7dd0f..20c00318c231 100644 --- a/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html +++ b/testing/web-platform/tests/shadow-dom/untriaged/events/event-dispatch/test-003.html @@ -45,6 +45,7 @@ A_05_05_03_T01.step(unit(function (ctx) { s.appendChild(input2); input1.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) { + assert_equals(event.composed, true); assert_equals(event.composedPath().length, 7); assert_equals(event.composedPath()[0].id, 'input1'); assert_equals(event.composedPath()[1].id, 'shadow'); @@ -55,6 +56,10 @@ A_05_05_03_T01.step(unit(function (ctx) { assert_equals(event.composedPath()[6], ctx.iframes[0].contentWindow); }), false); + input1.addEventListener('focusout', A_05_05_03_T01.step_func(function(event) { + assert_equals(event.composed, true); + }), false); + input2.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) { assert_equals(event.composedPath().length, 2); assert_equals(event.composedPath()[0].id, 'input2'); diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index dd8455d1e9ab..c27c84e03025 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -932,7 +932,8 @@ public: mFlags.mComposed = mMessage == eEditorInput; break; case eFocusEventClass: - mFlags.mComposed = mMessage == eBlur || mMessage == eFocus; + mFlags.mComposed = mMessage == eBlur || mMessage == eFocus || + mMessage == eFocusOut || mMessage == eFocusIn; break; case eKeyboardEventClass: mFlags.mComposed = mMessage == eKeyDown || mMessage == eKeyUp ||