[ContentExtensions] Prepare for compiling stylesheets of selectors to be used on...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Mar 2015 04:57:20 +0000 (04:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Mar 2015 04:57:20 +0000 (04:57 +0000)
commit0228ae0282082d107a144675f975436ab84edb10
treef5a78900fe39756f322607f928f0acac33d8c906
parentab4d97025ec0b50314315b93bec53ad9e9b9f3c7
[ContentExtensions] Prepare for compiling stylesheets of selectors to be used on every page.
https://bugs.webkit.org/show_bug.cgi?id=142799

Patch by Alex Christensen <achristensen@webkit.org> on 2015-03-18
Reviewed by Brady Eidson.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
Make private headers to use with API tests.
* contentextensions/CompiledContentExtension.cpp:
(WebCore::ContentExtensions::CompiledContentExtension::globalDisplayNoneSelectors):
* contentextensions/CompiledContentExtension.h:
Added method to get only the selectors from the root of the DFA, which apply to all URLs.
* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::compileRuleList):
Added checking if the trigger will match everything.
These actions can be put directly on the root of the DFA without adding extra epsilon transitions to the NFA.
* contentextensions/DFA.h:
(WebCore::ContentExtensions::DFA::nodeAt):
* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::actionsFromDFARoot):
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
* contentextensions/DFABytecodeInterpreter.h:
* contentextensions/NFA.h:
* contentextensions/URLFilterParser.cpp:
(WebCore::ContentExtensions::Term::quantifier):
Sink terms to a vector then add nodes to NFA when finalizing after checking for regexes that match everything.
(WebCore::ContentExtensions::GraphBuilder::GraphBuilder):
(WebCore::ContentExtensions::GraphBuilder::finalize):
(WebCore::ContentExtensions::GraphBuilder::parseStatus):
(WebCore::ContentExtensions::GraphBuilder::atomPatternCharacter):
(WebCore::ContentExtensions::GraphBuilder::atomBuiltInCharacterClass):
(WebCore::ContentExtensions::GraphBuilder::quantifyAtom):
(WebCore::ContentExtensions::GraphBuilder::atomBackReference):
(WebCore::ContentExtensions::GraphBuilder::assertionBOL):
(WebCore::ContentExtensions::GraphBuilder::assertionWordBoundary):
(WebCore::ContentExtensions::GraphBuilder::atomCharacterClassAtom):
(WebCore::ContentExtensions::GraphBuilder::atomCharacterClassRange):
(WebCore::ContentExtensions::GraphBuilder::atomCharacterClassBuiltIn):
(WebCore::ContentExtensions::GraphBuilder::atomParentheticalAssertionBegin):
(WebCore::ContentExtensions::GraphBuilder::disjunction):
(WebCore::ContentExtensions::GraphBuilder::hasError):
(WebCore::ContentExtensions::GraphBuilder::fail):
(WebCore::ContentExtensions::GraphBuilder::sinkFloatingTermIfNecessary):
(WebCore::ContentExtensions::URLFilterParser::addPattern):
(WebCore::ContentExtensions::URLFilterParser::statusString):
(WebCore::ContentExtensions::GraphBuilder::errorMessage): Deleted.
* contentextensions/URLFilterParser.h:
Use an enum instead of strings for the status to avoid checking strings when we have a regex that matches everything.

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::testPattern):
(TestWebKitAPI::TEST_F):
Start testing regex failures.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/contentextensions/CompiledContentExtension.cpp
Source/WebCore/contentextensions/CompiledContentExtension.h
Source/WebCore/contentextensions/ContentExtensionCompiler.cpp
Source/WebCore/contentextensions/DFA.h
Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp
Source/WebCore/contentextensions/DFABytecodeInterpreter.h
Source/WebCore/contentextensions/NFA.h
Source/WebCore/contentextensions/URLFilterParser.cpp
Source/WebCore/contentextensions/URLFilterParser.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp