| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) { | 148 void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors) { |
| 149 m_watchedCallbackSelectors.clear(); | 149 m_watchedCallbackSelectors.clear(); |
| 150 | 150 |
| 151 StylePropertySet* callbackPropertySet = | 151 StylePropertySet* callbackPropertySet = |
| 152 ImmutableStylePropertySet::create(nullptr, 0, UASheetMode); | 152 ImmutableStylePropertySet::create(nullptr, 0, UASheetMode); |
| 153 | 153 |
| 154 CSSParserContext* context = CSSParserContext::create(UASheetMode); |
| 154 for (const auto& selector : selectors) { | 155 for (const auto& selector : selectors) { |
| 155 CSSSelectorList selectorList = CSSParser::parseSelector( | 156 CSSSelectorList selectorList = |
| 156 CSSParserContext(UASheetMode, nullptr), nullptr, selector); | 157 CSSParser::parseSelector(context, nullptr, selector); |
| 157 if (!selectorList.isValid()) | 158 if (!selectorList.isValid()) |
| 158 continue; | 159 continue; |
| 159 | 160 |
| 160 // Only accept Compound Selectors, since they're cheaper to match. | 161 // Only accept Compound Selectors, since they're cheaper to match. |
| 161 if (!allCompound(selectorList)) | 162 if (!allCompound(selectorList)) |
| 162 continue; | 163 continue; |
| 163 | 164 |
| 164 m_watchedCallbackSelectors.push_back( | 165 m_watchedCallbackSelectors.push_back( |
| 165 StyleRule::create(std::move(selectorList), callbackPropertySet)); | 166 StyleRule::create(std::move(selectorList), callbackPropertySet)); |
| 166 } | 167 } |
| 167 supplementable()->styleEngine().watchedSelectorsChanged(); | 168 supplementable()->styleEngine().watchedSelectorsChanged(); |
| 168 } | 169 } |
| 169 | 170 |
| 170 DEFINE_TRACE(CSSSelectorWatch) { | 171 DEFINE_TRACE(CSSSelectorWatch) { |
| 171 visitor->trace(m_watchedCallbackSelectors); | 172 visitor->trace(m_watchedCallbackSelectors); |
| 172 Supplement<Document>::trace(visitor); | 173 Supplement<Document>::trace(visitor); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |