| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class CSSSelectorWatch final : public NoBaseWillBeGarbageCollectedFinalized<CSSS
electorWatch>, public DocumentSupplement { | 45 class CSSSelectorWatch final : public NoBaseWillBeGarbageCollectedFinalized<CSSS
electorWatch>, public DocumentSupplement { |
| 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CSSSelectorWatch); | 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CSSSelectorWatch); |
| 47 public: | 47 public: |
| 48 virtual ~CSSSelectorWatch() { } | 48 virtual ~CSSSelectorWatch() { } |
| 49 | 49 |
| 50 static CSSSelectorWatch& from(Document&); | 50 static CSSSelectorWatch& from(Document&); |
| 51 | 51 |
| 52 void watchCSSSelectors(const Vector<String>& selectors); | 52 void watchCSSSelectors(const Vector<String>& selectors); |
| 53 const WillBeHeapVector<RefPtrWillBeMember<StyleRule> >& watchedCallbackSelec
tors() const { return m_watchedCallbackSelectors; } | 53 const WillBeHeapVector<RefPtrWillBeMember<StyleRule>>& watchedCallbackSelect
ors() const { return m_watchedCallbackSelectors; } |
| 54 | 54 |
| 55 void updateSelectorMatches(const Vector<String>& removedSelectors, const Vec
tor<String>& addedSelectors); | 55 void updateSelectorMatches(const Vector<String>& removedSelectors, const Vec
tor<String>& addedSelectors); |
| 56 | 56 |
| 57 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 explicit CSSSelectorWatch(Document&); | 60 explicit CSSSelectorWatch(Document&); |
| 61 void callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*); | 61 void callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*); |
| 62 Document& document() const { return *m_document; } | 62 Document& document() const { return *m_document; } |
| 63 | 63 |
| 64 RawPtrWillBeMember<Document> m_document; | 64 RawPtrWillBeMember<Document> m_document; |
| 65 | 65 |
| 66 WillBeHeapVector<RefPtrWillBeMember<StyleRule> > m_watchedCallbackSelectors; | 66 WillBeHeapVector<RefPtrWillBeMember<StyleRule>> m_watchedCallbackSelectors; |
| 67 | 67 |
| 68 // Maps a CSS selector string with a -webkit-callback property to the number | 68 // Maps a CSS selector string with a -webkit-callback property to the number |
| 69 // of matching LayoutStyle objects in this document. | 69 // of matching LayoutStyle objects in this document. |
| 70 HashCountedSet<String> m_matchingCallbackSelectors; | 70 HashCountedSet<String> m_matchingCallbackSelectors; |
| 71 // Selectors are relative to m_matchingCallbackSelectors's contents at | 71 // Selectors are relative to m_matchingCallbackSelectors's contents at |
| 72 // the previous call to selectorMatchChanged. | 72 // the previous call to selectorMatchChanged. |
| 73 HashSet<String> m_addedSelectors; | 73 HashSet<String> m_addedSelectors; |
| 74 HashSet<String> m_removedSelectors; | 74 HashSet<String> m_removedSelectors; |
| 75 | 75 |
| 76 Timer<CSSSelectorWatch> m_callbackSelectorChangeTimer; | 76 Timer<CSSSelectorWatch> m_callbackSelectorChangeTimer; |
| 77 | 77 |
| 78 // When an element is reparented, the new location's style is evaluated afte
r the expriation of the relayout timer. | 78 // When an element is reparented, the new location's style is evaluated afte
r the expriation of the relayout timer. |
| 79 // We don't want to send redundant callbacks to the embedder, so this counte
r lets us wait another time around the event loop. | 79 // We don't want to send redundant callbacks to the embedder, so this counte
r lets us wait another time around the event loop. |
| 80 int m_timerExpirations; | 80 int m_timerExpirations; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| 84 | 84 |
| 85 #endif // CSSSelectorWatch_h | 85 #endif // CSSSelectorWatch_h |
| OLD | NEW |