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

Unified Diff: sky/engine/core/dom/TreeScope.cpp

Issue 796713002: Turn StyleSharing to 11. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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: sky/engine/core/dom/TreeScope.cpp
diff --git a/sky/engine/core/dom/TreeScope.cpp b/sky/engine/core/dom/TreeScope.cpp
index 446fc244d49a66d4aaed9e8f7a53ff8b0c68bd81..b4cd28df9e8f01fa2a1bb1c9b842f8a38dc6f5ef 100644
--- a/sky/engine/core/dom/TreeScope.cpp
+++ b/sky/engine/core/dom/TreeScope.cpp
@@ -28,6 +28,7 @@
#include "sky/engine/core/dom/TreeScope.h"
#include "gen/sky/core/HTMLNames.h"
+#include "sky/engine/core/css/StyleSheetList.h"
#include "sky/engine/core/css/resolver/ScopedStyleResolver.h"
#include "sky/engine/core/dom/ContainerNode.h"
#include "sky/engine/core/dom/Document.h"
@@ -420,4 +421,22 @@ void TreeScope::setNeedsStyleRecalcForViewportUnits()
}
}
+bool TreeScope::hasSameStyles(TreeScope& other)
+{
+ if (this == &other)
+ return true;
+ const Vector<RefPtr<blink::CSSStyleSheet> >& list = document().styleEngine()->styleSheetsForStyleSheetList(*this);
+ const Vector<RefPtr<blink::CSSStyleSheet> >& otherList = document().styleEngine()->styleSheetsForStyleSheetList(other);
+
+ if (list.size() != otherList.size())
+ return false;
+
+ for (size_t i = 0; i < list.size(); i++) {
+ if (list[i]->contents() != otherList[i]->contents())
+ return false;
+ }
+
+ return true;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698