Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
[selectors4] :focus-within should use the flat tree
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=170899

Reviewed by Antti Koivisto.

Source/WebCore:

This has been discussed in the following CSS WG issue:
w3c/csswg-drafts#1135

And the spec has been updated (https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo):
"An element also matches :focus-within if one of its descendants in the flat tree
 (including non-element nodes, such as text nodes) matches the conditions for matching :focus."

Test: imported/w3c/web-platform-tests/css/selectors4/focus-within-shadow-006.html

* dom/Element.cpp:
(WebCore::Element::setFocus): Use "flat tree" ("composed tree" in WebKit)
to set focus-within flag.

LayoutTests:

* TestExpectations: Remove test that is passing now.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@215719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rego@igalia.com committed Apr 25, 2017
1 parent 936805a commit b78934d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
9 changes: 9 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2017-04-24 Manuel Rego Casasnovas <rego@igalia.com>

[selectors4] :focus-within should use the flat tree
https://bugs.webkit.org/show_bug.cgi?id=170899

Reviewed by Antti Koivisto.

* TestExpectations: Remove test that is passing now.

2017-04-24 Nan Wang <n_wang@apple.com>

AX: Crash at WebCore::AXObjectCache::characterOffsetForIndex(int, WebCore::AccessibilityObject const*) + 703
Expand Down
1 change: 0 additions & 1 deletion LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ webkit.org/b/169271 imported/w3c/web-platform-tests/css/css-grid-1/grid-items/gr

# selectors4
webkit.org/b/170900 imported/w3c/web-platform-tests/css/selectors4/focus-within-006.html [ ImageOnlyFailure ]
webkit.org/b/170899 imported/w3c/web-platform-tests/css/selectors4/focus-within-shadow-006.html [ ImageOnlyFailure ]
webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors4/selectors-dir-selector-ltr-001.html [ ImageOnlyFailure ]
webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors4/selectors-dir-selector-rtl-001.html [ ImageOnlyFailure ]

Expand Down
20 changes: 20 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
2017-04-24 Manuel Rego Casasnovas <rego@igalia.com>

[selectors4] :focus-within should use the flat tree
https://bugs.webkit.org/show_bug.cgi?id=170899

Reviewed by Antti Koivisto.

This has been discussed in the following CSS WG issue:
https://github.com/w3c/csswg-drafts/issues/1135

And the spec has been updated (https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo):
"An element also matches :focus-within if one of its descendants in the flat tree
(including non-element nodes, such as text nodes) matches the conditions for matching :focus."

Test: imported/w3c/web-platform-tests/css/selectors4/focus-within-shadow-006.html

* dom/Element.cpp:
(WebCore::Element::setFocus): Use "flat tree" ("composed tree" in WebKit)
to set focus-within flag.

2017-04-24 Wenson Hsieh <wenson_hsieh@apple.com>

Respect fidelity order when reading web content from item providers
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ void Element::setFocus(bool flag)
document().userActionElements().setFocused(this, flag);
invalidateStyleForSubtree();

for (Element* element = this; element; element = element->parentOrShadowHostElement())
for (Element* element = this; element; element = element->parentElementInComposedTree())
element->setHasFocusWithin(flag);
}

Expand Down

0 comments on commit b78934d

Please sign in to comment.