WebKit Bugzilla
Attachment 347762 Details for
Bug 178001
: Focus navigation order in slot fallback contents is wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
wip178001.patch (text/plain), 5.43 KB, created by
Ryosuke Niwa
on 2018-08-21 20:47:05 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-21 20:47:05 PDT
Size:
5.43 KB
patch
obsolete
>Index: Source/WebCore/page/FocusController.cpp >=================================================================== >--- Source/WebCore/page/FocusController.cpp (revision 235153) >+++ Source/WebCore/page/FocusController.cpp (working copy) >@@ -75,7 +75,7 @@ > { > if (element.shadowRoot() && !hasCustomFocusLogic(element)) > return true; >- if (is<HTMLSlotElement>(element) && downcast<HTMLSlotElement>(element).assignedNodes()) { >+ if (is<HTMLSlotElement>(element)) { > ShadowRoot* root = element.containingShadowRoot(); > if (root && root->host() && !hasCustomFocusLogic(*root->host())) > return true; >@@ -135,7 +135,12 @@ > if (UNLIKELY(m_slotElement && m_slotElement == node.assignedSlot())) > return nullptr; > >- return node.parentNode(); >+ auto* parentNode = node.parentNode(); >+ if (!parentNode) >+ return nullptr; >+ if (UNLIKELY(is<HTMLSlotElement>(*parentNode)) && !downcast<HTMLSlotElement>(*parentNode).assignedNodes()) >+ return nullptr; >+ return parentNode; > } > > Node* FocusNavigationScope::nextSiblingInScope(const Node& node) const >@@ -166,7 +171,8 @@ > { > if (UNLIKELY(m_slotElement)) { > auto* assigneNodes = m_slotElement->assignedNodes(); >- ASSERT(assigneNodes); >+ if (!assigneNodes) >+ return m_slotElement->firstChild(); > return assigneNodes->first(); > } > ASSERT(m_rootTreeScope); >@@ -177,7 +183,8 @@ > { > if (UNLIKELY(m_slotElement)) { > auto* assigneNodes = m_slotElement->assignedNodes(); >- ASSERT(assigneNodes); >+ if (!assigneNodes) >+ return m_slotElement->lastChild(); > return assigneNodes->last(); > } > ASSERT(m_rootTreeScope); >@@ -235,8 +242,9 @@ > FocusNavigationScope FocusNavigationScope::scopeOf(Node& startingNode) > { > ASSERT(startingNode.isInTreeScope()); >- Node* root = nullptr; >- for (Node* currentNode = &startingNode; currentNode; currentNode = currentNode->parentNode()) { >+ RefPtr<Node> root = nullptr; >+ RefPtr<Node> parentNode = nullptr; >+ for (RefPtr<Node> currentNode = &startingNode; currentNode; currentNode = parentNode) { > root = currentNode; > if (HTMLSlotElement* slot = currentNode->assignedSlot()) { > if (isFocusScopeOwner(*slot)) >@@ -244,6 +252,11 @@ > } > if (is<ShadowRoot>(currentNode)) > return FocusNavigationScope(downcast<ShadowRoot>(*currentNode)); >+ parentNode = currentNode->parentNode(); >+ // The scope of a fallback content of a HTMLSlotElement is the slot element >+ // but the scope of a HTMLSlotElement is its parent scope. >+ if (parentNode && is<HTMLSlotElement>(parentNode) && !downcast<HTMLSlotElement>(*parentNode).assignedNodes()) >+ return FocusNavigationScope(downcast<HTMLSlotElement>(*parentNode)); > } > ASSERT(root); > return FocusNavigationScope(root->treeScope()); >Index: LayoutTests/fast/shadow-dom/focus-navigation-across-slots-expected.txt >=================================================================== >--- LayoutTests/fast/shadow-dom/focus-navigation-across-slots-expected.txt (revision 235153) >+++ LayoutTests/fast/shadow-dom/focus-navigation-across-slots-expected.txt (working copy) >@@ -14,15 +14,15 @@ > 10. Content in slot 2 with tabindex=1 > 11. Content in slot 2 with tabindex=1 > 12. Content in slot 2 with tabindex=0 >-13. Non-focusable slot fallback with tabindex=1 >-14. Focusable slot element. >+13. Focusable slot element. >+14. Focusable slot fallback content with tabindex=0 > 15. Shadow content with tabindex=2 >-16. Non-focusable slot fallback with tabindex=0 >-17. Focusable slot fallback content with tabindex=0 >-16. Non-focusable slot fallback with tabindex=0 >+16. Non-focusable slot fallback with tabindex=1 >+17. Non-focusable slot fallback with tabindex=0 >+16. Non-focusable slot fallback with tabindex=1 > 15. Shadow content with tabindex=2 >-14. Focusable slot element. >-13. Non-focusable slot fallback with tabindex=1 >+14. Focusable slot fallback content with tabindex=0 >+13. Focusable slot element. > 12. Content in slot 2 with tabindex=0 > 11. Content in slot 2 with tabindex=1 > 10. Content in slot 2 with tabindex=1 >Index: LayoutTests/fast/shadow-dom/focus-navigation-across-slots.html >=================================================================== >--- LayoutTests/fast/shadow-dom/focus-navigation-across-slots.html (revision 235153) >+++ LayoutTests/fast/shadow-dom/focus-navigation-across-slots.html (working copy) >@@ -102,13 +102,13 @@ > shadowWithSlotFallback.closedShadowRoot.innerHTML = ` > <slot name="slot1" onfocus="log(this)"> > Non-focusable slot should not be focused. >- <div tabindex="0">16. Non-focusable slot fallback with tabindex=0</div> >- <div tabindex="1">13. Non-focusable slot fallback with tabindex=1</div> >+ <div tabindex="0">17. Non-focusable slot fallback with tabindex=0</div> >+ <div tabindex="1">16. Non-focusable slot fallback with tabindex=1</div> > </slot> > <div tabindex="2" onfocus="log(this)">15. Shadow content with tabindex=2</div> > <slot name="slot2" tabindex="1" style="display:block;" onfocus="log(this)"> >- 14. Focusable slot element. >- <div tabindex="0">17. Focusable slot fallback content with tabindex=0</div> >+ 13. Focusable slot element. >+ <div tabindex="0">14. Focusable slot fallback content with tabindex=0</div> > </slot>`; > > document.getElementById('first').focus();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 178001
:
347762
|
347765