#ifndef DocumentStyleSheetCollector_h
#define DocumentStyleSheetCollector_h
#include "heap/Handle.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
class CSSStyleSheet;
class Document;
class StyleSheet;
class StyleSheetCollection;
class DocumentStyleSheetCollector {
STACK_ALLOCATED();
public:
friend class ImportedDocumentStyleSheetCollector;
DocumentStyleSheetCollector(WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >& sheetsForList, WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& activeList, HashSet<Document*>&);
~DocumentStyleSheetCollector();
void appendActiveStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >&);
void appendActiveStyleSheet(CSSStyleSheet*);
void appendSheetForList(StyleSheet*);
bool hasVisited(Document* document) const { return m_visitedDocuments.contains(document); }
void willVisit(Document* document) { m_visitedDocuments.add(document); }
private:
WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >& m_styleSheetsForStyleSheetList;
WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& m_activeAuthorStyleSheets;
HashSet<Document*>& m_visitedDocuments;
};
class ActiveDocumentStyleSheetCollector FINAL : public DocumentStyleSheetCollector {
public:
ActiveDocumentStyleSheetCollector(StyleSheetCollection&);
private:
HashSet<Document*> m_visitedDocuments;
};
class ImportedDocumentStyleSheetCollector FINAL : public DocumentStyleSheetCollector {
public:
ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >&);
};
}
#endif