| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 void CSSSelectorWatch::callbackSelectorChangeTimerFired(TimerBase*) { | 70 void CSSSelectorWatch::callbackSelectorChangeTimerFired(TimerBase*) { |
| 71 // Should be ensured by updateSelectorMatches(): | 71 // Should be ensured by updateSelectorMatches(): |
| 72 DCHECK(!m_addedSelectors.isEmpty() || !m_removedSelectors.isEmpty()); | 72 DCHECK(!m_addedSelectors.isEmpty() || !m_removedSelectors.isEmpty()); |
| 73 | 73 |
| 74 if (m_timerExpirations < 1) { | 74 if (m_timerExpirations < 1) { |
| 75 m_timerExpirations++; | 75 m_timerExpirations++; |
| 76 m_callbackSelectorChangeTimer.startOneShot(0, BLINK_FROM_HERE); | 76 m_callbackSelectorChangeTimer.startOneShot(0, BLINK_FROM_HERE); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 if (host()->frame()) { | 79 if (supplementable()->frame()) { |
| 80 Vector<String> addedSelectors; | 80 Vector<String> addedSelectors; |
| 81 Vector<String> removedSelectors; | 81 Vector<String> removedSelectors; |
| 82 copyToVector(m_addedSelectors, addedSelectors); | 82 copyToVector(m_addedSelectors, addedSelectors); |
| 83 copyToVector(m_removedSelectors, removedSelectors); | 83 copyToVector(m_removedSelectors, removedSelectors); |
| 84 host()->frame()->loader().client()->selectorMatchChanged(addedSelectors, | 84 supplementable()->frame()->loader().client()->selectorMatchChanged( |
| 85 removedSelectors); | 85 addedSelectors, removedSelectors); |
| 86 } | 86 } |
| 87 m_addedSelectors.clear(); | 87 m_addedSelectors.clear(); |
| 88 m_removedSelectors.clear(); | 88 m_removedSelectors.clear(); |
| 89 m_timerExpirations = 0; | 89 m_timerExpirations = 0; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void CSSSelectorWatch::updateSelectorMatches( | 92 void CSSSelectorWatch::updateSelectorMatches( |
| 93 const Vector<String>& removedSelectors, | 93 const Vector<String>& removedSelectors, |
| 94 const Vector<String>& addedSelectors) { | 94 const Vector<String>& addedSelectors) { |
| 95 bool shouldUpdateTimer = false; | 95 bool shouldUpdateTimer = false; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (!selectorList.isValid()) | 157 if (!selectorList.isValid()) |
| 158 continue; | 158 continue; |
| 159 | 159 |
| 160 // Only accept Compound Selectors, since they're cheaper to match. | 160 // Only accept Compound Selectors, since they're cheaper to match. |
| 161 if (!allCompound(selectorList)) | 161 if (!allCompound(selectorList)) |
| 162 continue; | 162 continue; |
| 163 | 163 |
| 164 m_watchedCallbackSelectors.push_back( | 164 m_watchedCallbackSelectors.push_back( |
| 165 StyleRule::create(std::move(selectorList), callbackPropertySet)); | 165 StyleRule::create(std::move(selectorList), callbackPropertySet)); |
| 166 } | 166 } |
| 167 host()->styleEngine().watchedSelectorsChanged(); | 167 supplementable()->styleEngine().watchedSelectorsChanged(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 DEFINE_TRACE(CSSSelectorWatch) { | 170 DEFINE_TRACE(CSSSelectorWatch) { |
| 171 visitor->trace(m_watchedCallbackSelectors); | 171 visitor->trace(m_watchedCallbackSelectors); |
| 172 Supplement<Document>::trace(visitor); | 172 Supplement<Document>::trace(visitor); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace blink | 175 } // namespace blink |
| OLD | NEW |