Add a few pseudo type to the selector compiler through function calls
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Feb 2014 02:46:04 +0000 (02:46 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Feb 2014 02:46:04 +0000 (02:46 +0000)
commit4ea27c6585d5f1c557c157a69716cb348ff9d595
treeb4a65dee8f03002dad566d3beda3690eb1e5dd0e
parentf04e8c5cb35dcdf02b1442990b5f426c54272231
Add a few pseudo type to the selector compiler through function calls
https://bugs.webkit.org/show_bug.cgi?id=128514

Reviewed by Dean Jackson.

Certain pseudo type checkers rely on virtual function calls. Since those types
are uncommon, and this code generator cannot currently make virtual function calls,
the checker are added by generating a function call to a wrapper function.

To avoid code duplication between SelectorChecker and the compiler, all the relevant checking
code has been moved to a common header, SelectorCheckerTestFunctions.h.
SelectorChecker still inline the functions, while the SelectorCompiler generate local static functions
and generate calls to them as needed.

* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/SelectorCheckerTestFunctions.h: Added.
(WebCore::isAutofilled):
(WebCore::isDefaultButtonForForm):
(WebCore::isDisabled):
(WebCore::isEnabled):
(WebCore::isChecked):
(WebCore::isInvalid):
(WebCore::isOptionalFormControl):
(WebCore::isRequiredFormControl):
(WebCore::isValid):
(WebCore::matchesReadOnlyPseudoClass):
(WebCore::matchesReadWritePseudoClass):
(WebCore::shouldAppearIndeterminate):
(WebCore::matchesFullScreenPseudoClass):
(WebCore::matchesFutureCuePseudoClass):
(WebCore::matchesPastCuePseudoClass):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoType):
(WebCore::SelectorCompiler::nonConstTestFunctionWrapper):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
* dom/Element.h:
(WebCore::Element::isValidFormControlElement):
* dom/Node.h:
(WebCore::Node::toInputElement):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isValidFormControlElement):
* html/HTMLFormControlElement.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorCheckerTestFunctions.h [new file with mode: 0644]
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Node.h
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h