Bug 1472887, focusin/out should be composed, and mark chrome event target chain items as chrome, r=masayuki

This commit is contained in:
Olli Pettay 2018-07-09 17:40:01 +03:00
parent 9df2f94e3d
commit 7146d67afe
4 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -1,4 +1,3 @@
[test-003.html]
[A_05_05_03_T01]
expected: FAIL
prefs: [dom.webcomponents.shadowdom.enabled:true]

View File

@ -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');

View File

@ -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 ||