| Index: Source/core/dom/CSSSelectorWatch.h
|
| diff --git a/Source/modules/donottrack/NavigatorDoNotTrack.h b/Source/core/dom/CSSSelectorWatch.h
|
| similarity index 51%
|
| copy from Source/modules/donottrack/NavigatorDoNotTrack.h
|
| copy to Source/core/dom/CSSSelectorWatch.h
|
| index 0c044e7cd8edef2f8860c374d59f077e1e963816..abaca558b4d40c5a4e5f96089dac5471a78ce5fb 100644
|
| --- a/Source/modules/donottrack/NavigatorDoNotTrack.h
|
| +++ b/Source/core/dom/CSSSelectorWatch.h
|
| @@ -28,32 +28,61 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef NavigatorDoNotTrack_h
|
| -#define NavigatorDoNotTrack_h
|
| +#ifndef CSSSelectorWatch_h
|
| +#define CSSSelectorWatch_h
|
|
|
| -#include "core/page/DOMWindowProperty.h"
|
| #include "core/platform/Supplementable.h"
|
| +#include "core/platform/Timer.h"
|
| +#include "wtf/HashSet.h"
|
| +#include "wtf/RefPtr.h"
|
| +#include "wtf/Vector.h"
|
| +#include "wtf/WeakPtr.h"
|
| #include "wtf/text/WTFString.h"
|
|
|
| namespace WebCore {
|
|
|
| -class Frame;
|
| -class Navigator;
|
| +class Document;
|
| +class ScriptExecutionContext;
|
| +class StyleRule;
|
| +class StyleRareNonInheritedData;
|
|
|
| -class NavigatorDoNotTrack : public Supplement<Navigator>, public DOMWindowProperty {
|
| +class CSSSelectorWatch : public Supplement<ScriptExecutionContext> {
|
| public:
|
| - virtual ~NavigatorDoNotTrack();
|
| - static NavigatorDoNotTrack* from(Navigator*);
|
| + virtual ~CSSSelectorWatch();
|
|
|
| - static String doNotTrack(Navigator*);
|
| + static CSSSelectorWatch* from(Document*);
|
|
|
| - String doNotTrack();
|
| + void watchCSSSelectors(const Vector<String>& selectors);
|
| + const Vector<RefPtr<StyleRule> >& watchedCallbackSelectors() const { return m_watchedCallbackSelectors; }
|
| +
|
| + void addSelectorMatch(const String& selector, StyleRareNonInheritedData*);
|
| + void removeSelectorMatch(const String& selector);
|
| +
|
| +private:
|
| + // Runs FrameLoaderClient::selectorMatchChanged with the updated value of
|
| + // m_callbackSelectorChange.
|
| + void callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*);
|
| +
|
| + Document* const m_document;
|
| +
|
| + Vector<RefPtr<StyleRule> > m_watchedCallbackSelectors;
|
| +
|
| + // Maps a CSS selector string with a -webkit-callback property to the number
|
| + // of matching RenderStyle objects in this document.
|
| + HashMap<String, int> m_matchingCallbackSelectors;
|
| + // Selectors are relative to m_matchingCallbackSelectors's contents at
|
| + // the previous call to selectorMatchChanged.
|
| + HashSet<String> m_addedSelectors;
|
| + HashSet<String> m_removedSelectors;
|
| +
|
| + Timer<CSSSelectorWatch> m_callbackSelectorChangeTimer;
|
| +
|
| + WeakPtrFactory<CSSSelectorWatch> m_weakThisFactory;
|
|
|
| private:
|
| - explicit NavigatorDoNotTrack(Frame*);
|
| - static const char* supplementName();
|
| + CSSSelectorWatch(Document*);
|
| };
|
|
|
| } // namespace WebCore
|
|
|
| -#endif // NavigatorDoNotTrack_h
|
| +#endif // CSSSelectorWatch_h
|
|
|