Bug 133473 - CSS JIT: add support for the "any" pseudo class
Summary: CSS JIT: add support for the "any" pseudo class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-03 03:31 PDT by Yusuke Suzuki
Modified: 2014-06-03 19:28 PDT (History)
2 users (show)

See Also:


Attachments
Patch (16.43 KB, patch)
2014-06-03 05:21 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2014-06-03 03:31:18 PDT
Add support for the "any" pseudo class.
Comment 1 Yusuke Suzuki 2014-06-03 05:21:36 PDT
Created attachment 232422 [details]
Patch
Comment 2 Yusuke Suzuki 2014-06-03 05:27:45 PDT
Comment on attachment 232422 [details]
Patch

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

Added comments.

> Source/WebCore/cssjit/SelectorCompiler.cpp:160
> +    Vector<Vector<SelectorFragment>> anyFilters;

Used ">>" since C++11 is enabled.

> Source/WebCore/cssjit/SelectorCompiler.cpp:461
> +                // :any() may not contain complex selectors which have combinators.

simple_selectors don't contain combinators. So fragmentList.size() always becomes 1.

> Source/WebCore/cssjit/SelectorCompiler.cpp:467
> +                subFragment.inFunctionalPseudoClass = true;

Set `inFunctionalPseudoClass` true.

> Source/WebCore/cssjit/SelectorCompiler.cpp:476
> +            ASSERT(!anyFragments.isEmpty());

anyFragments always has fragments.

> Source/WebCore/cssjit/SelectorCompiler.cpp:2621
> +        RELEASE_ASSERT(!subFragments.isEmpty());

This is guaranteed in the construction phase.

> Source/WebCore/cssjit/SelectorCompiler.cpp:2632
> +        // At the last fragment, optimize the failure jump to jump to the non-local failure directly.

Optimized path. At the last fragment, the failure jump should jump to the non-local failure site directly.
This removes unnecessary trampolines.

> LayoutTests/ChangeLog:11
> +        * fast/selectors/pseudo-class-any.html: Added.

:hover / :active tests are needed? If so, I'll add them.
Comment 3 Benjamin Poulain 2014-06-03 13:56:08 PDT
Comment on attachment 232422 [details]
Patch

The patch is great. There is an issue I also forgot about :not(), fragmentOnlyMatchesLinksInQuirksMode() should return false in those cases.
Let's land this since it is complete and correct with the exception of fragmentOnlyMatchesLinksInQuirksMode(). I'll write a quick fix for fragmentOnlyMatchesLinksInQuirksMode.
Comment 4 WebKit Commit Bot 2014-06-03 14:27:21 PDT
Comment on attachment 232422 [details]
Patch

Clearing flags on attachment: 232422

Committed r169569: <http://trac.webkit.org/changeset/169569>
Comment 5 WebKit Commit Bot 2014-06-03 14:27:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Yusuke Suzuki 2014-06-03 19:28:39 PDT
(In reply to comment #3)
> (From update of attachment 232422 [details])
> The patch is great. There is an issue I also forgot about :not(), fragmentOnlyMatchesLinksInQuirksMode() should return false in those cases.
> Let's land this since it is complete and correct with the exception of fragmentOnlyMatchesLinksInQuirksMode(). I'll write a quick fix for fragmentOnlyMatchesLinksInQuirksMode.

Oh! Thank you. I've commented your patch :)
https://bugs.webkit.org/show_bug.cgi?id=133493