ContentExtension.h [plain text]
#pragma once
#if ENABLE(CONTENT_EXTENSIONS)
#include "DFABytecodeInterpreter.h"
#include "StyleSheetContents.h"
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
namespace ContentExtensions {
class CompiledContentExtension;
class ContentExtension : public RefCounted<ContentExtension> {
public:
enum class ShouldCompileCSS { No, Yes };
static Ref<ContentExtension> create(const String& identifier, Ref<CompiledContentExtension>&&, ShouldCompileCSS = ShouldCompileCSS::Yes);
const String& identifier() const { return m_identifier; }
const CompiledContentExtension& compiledExtension() const { return m_compiledExtension.get(); }
StyleSheetContents* globalDisplayNoneStyleSheet();
const DFABytecodeInterpreter::Actions& topURLActions(const URL& topURL);
const Vector<uint32_t>& universalActionsWithoutConditions() { return m_universalActionsWithoutConditions; }
const Vector<uint32_t>& universalActionsWithConditions(const URL& topURL);
private:
ContentExtension(const String& identifier, Ref<CompiledContentExtension>&&, ShouldCompileCSS);
uint32_t findFirstIgnorePreviousRules() const;
String m_identifier;
Ref<CompiledContentExtension> m_compiledExtension;
RefPtr<StyleSheetContents> m_globalDisplayNoneStyleSheet;
void compileGlobalDisplayNoneStyleSheet();
URL m_cachedTopURL;
void populateConditionCacheIfNeeded(const URL& topURL);
DFABytecodeInterpreter::Actions m_cachedTopURLActions;
Vector<uint32_t> m_cachedUniversalConditionedActions;
Vector<uint32_t> m_universalActionsWithoutConditions;
Vector<uint64_t> m_universalActionsWithConditions;
};
} }
#endif // ENABLE(CONTENT_EXTENSIONS)