| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return static_cast<CSSSelectorWatch*>(WillBeHeapSupplement<Document>::from(d
ocument, kSupplementName)); | 66 return static_cast<CSSSelectorWatch*>(WillBeHeapSupplement<Document>::from(d
ocument, kSupplementName)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void CSSSelectorWatch::callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*
) | 69 void CSSSelectorWatch::callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*
) |
| 70 { | 70 { |
| 71 // Should be ensured by updateSelectorMatches(): | 71 // Should be ensured by updateSelectorMatches(): |
| 72 ASSERT(!m_addedSelectors.isEmpty() || !m_removedSelectors.isEmpty()); | 72 ASSERT(!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, FROM_HERE); | 76 m_callbackSelectorChangeTimer.startOneShot(0, BLINK_FROM_HERE); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 if (document().frame()) { | 79 if (document().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 document().frame()->loader().client()->selectorMatchChanged(addedSelecto
rs, removedSelectors); | 84 document().frame()->loader().client()->selectorMatchChanged(addedSelecto
rs, removedSelectors); |
| 85 } | 85 } |
| 86 m_addedSelectors.clear(); | 86 m_addedSelectors.clear(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 if (m_removedSelectors.isEmpty() && m_addedSelectors.isEmpty()) { | 124 if (m_removedSelectors.isEmpty() && m_addedSelectors.isEmpty()) { |
| 125 if (m_callbackSelectorChangeTimer.isActive()) { | 125 if (m_callbackSelectorChangeTimer.isActive()) { |
| 126 m_timerExpirations = 0; | 126 m_timerExpirations = 0; |
| 127 m_callbackSelectorChangeTimer.stop(); | 127 m_callbackSelectorChangeTimer.stop(); |
| 128 } | 128 } |
| 129 } else { | 129 } else { |
| 130 m_timerExpirations = 0; | 130 m_timerExpirations = 0; |
| 131 if (!m_callbackSelectorChangeTimer.isActive()) | 131 if (!m_callbackSelectorChangeTimer.isActive()) |
| 132 m_callbackSelectorChangeTimer.startOneShot(0, FROM_HERE); | 132 m_callbackSelectorChangeTimer.startOneShot(0, BLINK_FROM_HERE); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 static bool allCompound(const CSSSelectorList& selectorList) | 136 static bool allCompound(const CSSSelectorList& selectorList) |
| 137 { | 137 { |
| 138 for (const CSSSelector* selector = selectorList.first(); selector; selector
= selectorList.next(*selector)) { | 138 for (const CSSSelector* selector = selectorList.first(); selector; selector
= selectorList.next(*selector)) { |
| 139 if (!selector->isCompound()) | 139 if (!selector->isCompound()) |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 return true; | 142 return true; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 DEFINE_TRACE(CSSSelectorWatch) | 166 DEFINE_TRACE(CSSSelectorWatch) |
| 167 { | 167 { |
| 168 visitor->trace(m_watchedCallbackSelectors); | 168 visitor->trace(m_watchedCallbackSelectors); |
| 169 visitor->trace(m_document); | 169 visitor->trace(m_document); |
| 170 WillBeHeapSupplement<Document>::trace(visitor); | 170 WillBeHeapSupplement<Document>::trace(visitor); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace blink | 173 } // namespace blink |
| OLD | NEW |