Prepare to use CSS selectors in content extensions.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2015 01:57:19 +0000 (01:57 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2015 01:57:19 +0000 (01:57 +0000)
commit5550ee769d13c4c2bc4c0c53d40cb3f500ed921e
tree7a03c16c7266e413d37b14e97ba93b8c42d68978
parent1570f982fb16b64e7bb42d8f3247b420bbc96650
Prepare to use CSS selectors in content extensions.
https://bugs.webkit.org/show_bug.cgi?id=142227

Reviewed by Benjamin Poulain.

Source/WebCore:

Test: http/tests/usercontentfilter/css-display-none.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* contentextensions/ContentExtensionActions.h: Added.
* contentextensions/ContentExtensionRule.cpp:
(WebCore::ContentExtensions::Action::deserialize):
* contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::Action::Action):
(WebCore::ContentExtensions::Action::type):
(WebCore::ContentExtensions::Action::cssSelector):
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::serializeActions):
Put action descriptions into a compact format in a Vector
to be able to be put into one block of shared read-only memory.
(WebCore::ContentExtensions::ContentExtensionsBackend::setRuleList):
Put an index of the beginning of the description into the NFA instead of the index of the rule
because we will be sharing the descriptions of the actions and not the rules.
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForURL):
(WebCore::ContentExtensions::ContentExtensionsBackend::actionForURL): Deleted.
Return a vector of actions to be able to do multiple actions for one URL.
* contentextensions/ContentExtensionsBackend.h:
* contentextensions/ContentExtensionsManager.cpp:
(WebCore::ContentExtensions::ExtensionsManager::loadTrigger):
(WebCore::ContentExtensions::ExtensionsManager::loadAction):
Added the css-display-none action type, which requires a selector.
(WebCore::ContentExtensions::ExtensionsManager::loadRule):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/UserContentController.cpp:
(WebCore::UserContentController::actionsForURL):
(WebCore::UserContentController::actionForURL): Deleted.
* page/UserContentController.h:

LayoutTests:

* http/tests/usercontentfilter/css-display-none-expected.txt: Added.
* http/tests/usercontentfilter/css-display-none.html: Added.
* http/tests/usercontentfilter/css-display-none.html.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/usercontentfilter/css-display-none-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/usercontentfilter/css-display-none.html [new file with mode: 0644]
LayoutTests/http/tests/usercontentfilter/css-display-none.html.json [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/contentextensions/ContentExtensionActions.h [new file with mode: 0644]
Source/WebCore/contentextensions/ContentExtensionRule.cpp
Source/WebCore/contentextensions/ContentExtensionRule.h
Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
Source/WebCore/contentextensions/ContentExtensionsBackend.h
Source/WebCore/contentextensions/ContentExtensionsManager.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/UserContentController.cpp
Source/WebCore/page/UserContentController.h