OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return false; | 136 return false; |
137 } | 137 } |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) | 141 void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) |
142 { | 142 { |
143 m_watchedCallbackSelectors.clear(); | 143 m_watchedCallbackSelectors.clear(); |
144 BisonCSSParser parser(CSSParserContext(UASheetMode, 0)); | 144 BisonCSSParser parser(CSSParserContext(UASheetMode, 0)); |
145 | 145 |
146 const CSSProperty callbackProperty(CSSPropertyInternalCallback, CSSPrimitive
Value::createIdentifier(CSSValueInternalPresence)); | 146 const RefPtrWillBeRawPtr<StylePropertySet> callbackPropertySet = ImmutableSt
ylePropertySet::create(nullptr, 0, UASheetMode); |
147 const RefPtrWillBeRawPtr<StylePropertySet> callbackPropertySet = ImmutableSt
ylePropertySet::create(&callbackProperty, 1, UASheetMode); | |
148 | 147 |
149 CSSSelectorList selectorList; | 148 CSSSelectorList selectorList; |
150 for (unsigned i = 0; i < selectors.size(); ++i) { | 149 for (unsigned i = 0; i < selectors.size(); ++i) { |
151 parser.parseSelector(selectors[i], selectorList); | 150 parser.parseSelector(selectors[i], selectorList); |
152 if (!selectorList.isValid()) | 151 if (!selectorList.isValid()) |
153 continue; | 152 continue; |
154 | 153 |
155 // Only accept Compound Selectors, since they're cheaper to match. | 154 // Only accept Compound Selectors, since they're cheaper to match. |
156 if (!allCompound(selectorList)) | 155 if (!allCompound(selectorList)) |
157 continue; | 156 continue; |
158 | 157 |
159 RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create(); | 158 RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create(); |
160 rule->wrapperAdoptSelectorList(selectorList); | 159 rule->wrapperAdoptSelectorList(selectorList); |
161 rule->setProperties(callbackPropertySet); | 160 rule->setProperties(callbackPropertySet); |
162 m_watchedCallbackSelectors.append(rule.release()); | 161 m_watchedCallbackSelectors.append(rule.release()); |
163 } | 162 } |
164 document().changedSelectorWatch(); | 163 document().changedSelectorWatch(); |
165 } | 164 } |
166 | 165 |
167 void CSSSelectorWatch::trace(Visitor* visitor) | 166 void CSSSelectorWatch::trace(Visitor* visitor) |
168 { | 167 { |
169 visitor->trace(m_watchedCallbackSelectors); | 168 visitor->trace(m_watchedCallbackSelectors); |
170 visitor->trace(m_document); | 169 visitor->trace(m_document); |
171 DocumentSupplement::trace(visitor); | 170 DocumentSupplement::trace(visitor); |
172 } | 171 } |
173 | 172 |
174 } // namespace blink | 173 } // namespace blink |
OLD | NEW |