Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: Source/core/dom/DocumentStyleSheetCollector.h

Issue 143463011: [import] support document.stylesheets in imported documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 10 matching lines...) Expand all
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef DocumentStyleSheetCollector_h 27 #ifndef DocumentStyleSheetCollector_h
28 #define DocumentStyleSheetCollector_h 28 #define DocumentStyleSheetCollector_h
29 29
30 #include "core/dom/StyleSheetCollection.h" 30 #include "core/dom/StyleSheetCollection.h"
31 #include "wtf/HashSet.h" 31 #include "wtf/HashMap.h"
32 32
33 namespace WebCore { 33 namespace WebCore {
34 34
35 class DocumentStyleSheetCollector FINAL { 35 class DocumentStyleSheetCollector FINAL {
36 public: 36 public:
37 DocumentStyleSheetCollector(TreeScope& root) 37 typedef Vector<RefPtr<StyleSheet> > SheetList;
38 : m_root(root) 38 typedef HashMap<Document*, SheetList> SheetListMap;
39 { } 39 typedef HashMap<Document*, SheetList>::const_iterator SheetListMapIteraor;
40 40
41 bool isCollectingForList(TreeScope&) const; 41 DocumentStyleSheetCollector(TreeScope& root);
42 ~DocumentStyleSheetCollector();
43
42 void setCollectionTo(StyleSheetCollectionBase&); 44 void setCollectionTo(StyleSheetCollectionBase&);
43 45
44 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& sheets) { m_collection.appendActiveStyleSheets(sheets); } 46 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& sheets) { m_collection.appendActiveStyleSheets(sheets); }
45 void appendActiveStyleSheet(CSSStyleSheet* sheet) { m_collection.appendActiv eStyleSheet(sheet); } 47 void appendActiveStyleSheet(CSSStyleSheet* sheet) { m_collection.appendActiv eStyleSheet(sheet); }
46 void appendSheetForList(StyleSheet* sheet) { m_collection.appendSheetForList (sheet); } 48 void appendSheetForList(StyleSheet*);
47 StyleSheetCollectionBase& collection() { return m_collection; } 49 StyleSheetCollectionBase& collection() { return m_collection; }
48 void markVisited(Document* document) { m_documentsVisited.add(document); } 50 void markVisited(Document*);
49 bool hasVisited(Document* document) const { return m_documentsVisited.contai ns(document); } 51 bool hasVisited(Document*) const;
52
53 const SheetListMap& sheetListMap() const { return m_sheetListMap; }
50 54
51 private: 55 private:
52 TreeScope& m_root; 56 TreeScope& m_root;
53 StyleSheetCollectionBase m_collection; 57 StyleSheetCollectionBase m_collection;
54 HashSet<Document*> m_documentsVisited; 58 SheetListMap m_sheetListMap;
55 }; 59 };
56 60
57 } // namespace WebCore 61 } // namespace WebCore
58 62
59 #endif // DocumentStyleSheetCollector_h 63 #endif // DocumentStyleSheetCollector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698