summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/RuleFeature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/css/RuleFeature.cpp')
-rw-r--r--Source/WebCore/css/RuleFeature.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/WebCore/css/RuleFeature.cpp b/Source/WebCore/css/RuleFeature.cpp
index b1f929687..1b11c8fae 100644
--- a/Source/WebCore/css/RuleFeature.cpp
+++ b/Source/WebCore/css/RuleFeature.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "RuleFeature.h"
+#include "CSSSelector.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/MemoryInstrumentationHashSet.h>
@@ -36,6 +37,27 @@
namespace WebCore {
+void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector* selector)
+{
+ if (selector->m_match == CSSSelector::Id)
+ idsInRules.add(selector->value().impl());
+ else if (selector->m_match == CSSSelector::Class)
+ classesInRules.add(selector->value().impl());
+ else if (selector->isAttributeSelector())
+ attrsInRules.add(selector->attribute().localName().impl());
+ switch (selector->pseudoType()) {
+ case CSSSelector::PseudoFirstLine:
+ usesFirstLineRules = true;
+ break;
+ case CSSSelector::PseudoBefore:
+ case CSSSelector::PseudoAfter:
+ usesBeforeAfterRules = true;
+ break;
+ default:
+ break;
+ }
+}
+
void RuleFeatureSet::add(const RuleFeatureSet& other)
{
HashSet<AtomicStringImpl*>::const_iterator end = other.idsInRules.end();