void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) { m_watchedCallbackSelectors.clear(); CSSParserContext context(UASheetMode); BisonCSSParser parser(context); const CSSProperty callbackProperty(CSSPropertyInternalCallback, CSSPrimitiveValue::createIdentifier(CSSValueInternalPresence)); const RefPtr<StylePropertySet> callbackPropertySet = ImmutableStylePropertySet::create(&callbackProperty, 1, UASheetMode); CSSSelectorList selectorList; for (unsigned i = 0; i < selectors.size(); ++i) { parser.parseSelector(selectors[i], selectorList); if (!selectorList.isValid()) continue; // Only accept Compound Selectors, since they're cheaper to match. if (!allCompound(selectorList)) continue; RefPtr<StyleRule> rule = StyleRule::create(); rule->wrapperAdoptSelectorList(selectorList); rule->setProperties(callbackPropertySet); m_watchedCallbackSelectors.append(rule.release()); } m_document.changedSelectorWatch(); }
void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) { m_watchedCallbackSelectors.clear(); const RefPtrWillBeRawPtr<StylePropertySet> callbackPropertySet = ImmutableStylePropertySet::create(nullptr, 0, UASheetMode); CSSSelectorList selectorList; for (unsigned i = 0; i < selectors.size(); ++i) { CSSParser::parseSelector(CSSParserContext(UASheetMode, 0), selectors[i], selectorList); if (!selectorList.isValid()) continue; // Only accept Compound Selectors, since they're cheaper to match. if (!allCompound(selectorList)) continue; RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create(); rule->wrapperAdoptSelectorList(selectorList); rule->setProperties(callbackPropertySet); m_watchedCallbackSelectors.append(rule.release()); } document().changedSelectorWatch(); }