CSS4 Selectors: Add multiple pseudo elements support to :matches
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Nov 2014 11:14:06 +0000 (11:14 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Nov 2014 11:14:06 +0000 (11:14 +0000)
commitdbac3328a9d300beecd9de9973a2aed0a2879e96
treebfe697f5d5aa62999d0c3f4fb8c2243c5439f5f9
parent7a2ed0b1115b31286821f3bae0495c876f1659d9
CSS4 Selectors: Add multiple pseudo elements support to :matches
https://bugs.webkit.org/show_bug.cgi?id=138214

Reviewed by Benjamin Poulain.

Source/WebCore:

In this patch, we implement (multiple) pseudo elements support to :matches.
Currently, we implemented it in css/SelectorChecker and there's no CSS JIT implementation.

And we change the semantics of pseudo element selector behavior.
Previously when pseudo element selector appeared in the non-rightmost
fragment, it was ignored. This patch changes it to unmatched.

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::CheckingContextWithStatus::CheckingContextWithStatus):
(WebCore::SelectorChecker::match):
(WebCore::hasScrollbarPseudoElement):
(WebCore::SelectorChecker::matchRecursively):
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::matchSelectorList):
* css/SelectorChecker.h:
(WebCore::SelectorChecker::MatchResult::matches):
(WebCore::SelectorChecker::MatchResult::updateWithMatchType):
(WebCore::SelectorChecker::MatchResult::fails):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator):
(WebCore::SelectorCompiler::constructFragments):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPseudoElement):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setHasPseudoStyles):
* rendering/style/RenderStyleConstants.h:
(WebCore::PseudoIdSet::PseudoIdSet):
(WebCore::PseudoIdSet::fromMask):
(WebCore::PseudoIdSet::has):
(WebCore::PseudoIdSet::add):
(WebCore::PseudoIdSet::merge):
(WebCore::PseudoIdSet::operator &):
(WebCore::PseudoIdSet::operator |):
(WebCore::PseudoIdSet::operator bool):
(WebCore::PseudoIdSet::data):

LayoutTests:

* fast/selectors/pseudo-element-in-non-rightmost-fragments-expected.html: Added.
* fast/selectors/pseudo-element-in-non-rightmost-fragments.html: Added.
In this test, we ensure that pseudo elements selector in the
non-rightmost fragments becomes unmatched.
* fast/selectors/pseudo-element-inside-matches-expected.html: Added.
* fast/selectors/pseudo-element-inside-matches.html: Added.
* fast/selectors/ignore-pseudo-element-inside-non-rightmost-fragments-expected.txt: Added.
* fast/selectors/ignore-pseudo-element-inside-non-rightmost-fragments.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/selectors/ignore-pseudo-element-inside-non-rightmost-fragments-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/ignore-pseudo-element-inside-non-rightmost-fragments.html [new file with mode: 0644]
LayoutTests/fast/selectors/pseudo-element-in-non-rightmost-fragments-expected.html [new file with mode: 0644]
LayoutTests/fast/selectors/pseudo-element-in-non-rightmost-fragments.html [new file with mode: 0644]
LayoutTests/fast/selectors/pseudo-element-inside-matches-expected.html [new file with mode: 0644]
LayoutTests/fast/selectors/pseudo-element-inside-matches.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorChecker.h
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h