Bug 140144 - AX: Add support for CSS4 :focus-within pseudo
Summary: AX: Add support for CSS4 :focus-within pseudo
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Benjamin Poulain
URL: https://drafts.csswg.org/selectors-4/...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-01-06 13:29 PST by James Craig
Modified: 2016-06-22 16:35 PDT (History)
7 users (show)

See Also:


Attachments
Patch (49.24 KB, patch)
2016-06-21 20:21 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (67.82 KB, patch)
2016-06-22 15:31 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2015-01-06 13:29:38 PST
AX: Add support for CSS4 :focus-within pseudo
http://dev.w3.org/csswg/selectors-4/#focus-within-pseudo
Comment 1 Radar WebKit Bug Importer 2015-01-06 13:29:54 PST
<rdar://problem/19389705>
Comment 2 James Craig 2015-01-06 13:32:41 PST
This would be a good addition for accessibility and full keyboard access.
Comment 3 James Craig 2015-01-06 13:35:26 PST
Seems like it's equivalent to the recently-removed CSS4 subject selector.
"!* *:focus" == "*:focus-within"
Comment 4 Benjamin Poulain 2016-06-21 20:21:15 PDT
Created attachment 281810 [details]
Patch
Comment 5 Antti Koivisto 2016-06-22 14:04:49 PDT
Comment on attachment 281810 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=281810&action=review

> Source/WebCore/dom/ContainerNode.cpp:108
> -    if (!child.renderer() && !child.isNamedFlowContentNode() && !childIsHTMLSlotElement)
> +    bool isElement = is<Element>(child);
> +    if (!child.renderer() && !childIsHTMLSlotElement
> +        && !(isElement && downcast<Element>(child).isNamedFlowContentElement()))

It would have been nicer to do the NamedFlow bit freeing dance separately.

> Source/WebCore/dom/Element.h:761
> +inline void Element::setHasFocusWithin(bool flag)
> +{
> +    setFlag(flag, HasFocusWithin);
> +    if (styleAffectedByFocusWithin())
> +        setNeedsStyleRecalc();
> +}

Would it be sufficient to invalidate only when the flag value changes?

> LayoutTests/fast/css/css-selector-text.html:313
> +testSelectorRoundTrip("a[b]:default");
> +testSelectorRoundTrip("a.b:default");
> +testSelectorRoundTrip("a#b:default");
> +testSelectorRoundTrip("a[b].c#d:default");

Is there anything sufficiently complicated here to test the SelectorChecker path?
Comment 6 Antti Koivisto 2016-06-22 14:07:13 PDT
> Is there anything sufficiently complicated here to test the SelectorChecker
> path?

Quoted wrong test but the question still applies.
Comment 7 Benjamin Poulain 2016-06-22 15:31:06 PDT
Created attachment 281878 [details]
Patch
Comment 8 WebKit Commit Bot 2016-06-22 16:35:39 PDT
Comment on attachment 281878 [details]
Patch

Clearing flags on attachment: 281878

Committed r202358: <http://trac.webkit.org/changeset/202358>
Comment 9 WebKit Commit Bot 2016-06-22 16:35:43 PDT
All reviewed patches have been landed.  Closing bug.