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

Unified Diff: Source/core/dom/DocumentStyleSheetCollector.cpp

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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/DocumentStyleSheetCollector.cpp
diff --git a/Source/core/dom/DocumentStyleSheetCollector.cpp b/Source/core/dom/DocumentStyleSheetCollector.cpp
index a25d824dd4decd270d4931135a38af142cb93a4d..ef7063715da62b5560a27f8d77b624040226eba0 100644
--- a/Source/core/dom/DocumentStyleSheetCollector.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollector.cpp
@@ -27,13 +27,18 @@
#include "config.h"
#include "core/dom/DocumentStyleSheetCollector.h"
+#include "core/css/StyleSheet.h"
#include "core/dom/Document.h"
namespace WebCore {
-bool DocumentStyleSheetCollector::isCollectingForList(TreeScope& scope) const
+DocumentStyleSheetCollector::DocumentStyleSheetCollector(TreeScope& root)
+ : m_root(root)
+{
+}
+
+DocumentStyleSheetCollector::~DocumentStyleSheetCollector()
{
- return m_root == scope;
}
void DocumentStyleSheetCollector::setCollectionTo(StyleSheetCollectionBase& collection)
@@ -41,4 +46,25 @@ void DocumentStyleSheetCollector::setCollectionTo(StyleSheetCollectionBase& coll
m_collection.swap(collection);
}
+void DocumentStyleSheetCollector::appendSheetForList(StyleSheet* sheet)
esprehn 2014/01/23 07:51:03 reference?
Hajime Morrita 2014/01/24 01:25:51 This is aligned to DocumentStyleSheetCollection AP
+{
+ Document& ownerDocument = sheet->ownerNode()->document();
+ if (ownerDocument == m_root) {
+ m_collection.appendSheetForList(sheet);
+ } else {
+ ASSERT(m_sheetListMap.contains(&ownerDocument));
+ m_sheetListMap.find(&ownerDocument)->value.append(sheet);
+ }
+}
+
+void DocumentStyleSheetCollector::markVisited(Document* document)
+{
+ m_sheetListMap.add(document, SheetList());
+}
+
+bool DocumentStyleSheetCollector::hasVisited(Document* document) const
+{
+ return m_sheetListMap.contains(document);
esprehn 2014/01/23 07:51:03 This seems like the wrong abstraction, the StyleEn
Hajime Morrita 2014/01/24 01:25:51 Makes sense. Changed the approach.
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698