Contents inside a shadow host with a negative tabindex should not be tab focusable
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Mar 2016 05:31:28 +0000 (05:31 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Mar 2016 05:31:28 +0000 (05:31 +0000)
commit682b98b372dd5855ddeb6de678abbe1891e1938c
tree8b15909b149d323a3079c56a6a5b4f640be4478a
parent4a9020200c0fd8ca58bcd3c765a248b2e3ce570d
Contents inside a shadow host with a negative tabindex should not be tab focusable
https://bugs.webkit.org/show_bug.cgi?id=154769

Reviewed by Antti Koivisto.

Source/WebCore:

Contents inside a shadow host with a negative tabindex content attribute should not be included in
the sequential focus navigation order as discussed on https://github.com/w3c/webcomponents/issues/399.

Test: fast/shadow-dom/negative-tabindex-on-shadow-host.html

* dom/Element.cpp:
(WebCore::Element::tabIndexSetExplicitly): Added.
* dom/Element.h:
* page/FocusController.cpp:
(WebCore::shadowAdjustedTabIndex): Renamed from adjustedTabIndex. Return 0 when tabindex content attribute
is not explicitly set since element.tabIndex() would return -1 for HTML elements in such case.
(WebCore::isFocusableOrHasShadowTreeWithoutCustomFocusLogic): Renamed from shouldVisit.
(WebCore::FocusController::findElementWithExactTabIndex):
(WebCore::nextElementWithGreaterTabIndex):
(WebCore::previousElementWithLowerTabIndex):
(WebCore::FocusController::nextFocusableElement):
(WebCore::FocusController::previousFocusableElement):

LayoutTests:

Added a test for navigating across shadow boundaries.

* fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt: Added.
* fast/shadow-dom/negative-tabindex-on-shadow-host.html: Added.
* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host-expected.txt [new file with mode: 0644]
LayoutTests/fast/shadow-dom/negative-tabindex-on-shadow-host.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/page/FocusController.cpp