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

Unified Diff: third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp

Issue 2610513003: Avoid unnecessary updateActiveStyle comparing shadow styles. (Closed)
Patch Set: Fixed review issues. Created 3 years, 12 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: third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
diff --git a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
index 43b2518f34f4bb3ebcbb8840e27f3616d2765e96..e29035dc3be460bdb1f41826b77722664ae310a0 100644
--- a/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
+++ b/third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp
@@ -27,6 +27,7 @@
#include "core/dom/shadow/ElementShadow.h"
#include "core/css/StyleSheetList.h"
+#include "core/css/resolver/ScopedStyleResolver.h"
#include "core/dom/StyleChangeReason.h"
#include "core/dom/shadow/ElementShadowV0.h"
#include "core/frame/Deprecation.h"
@@ -139,17 +140,11 @@ bool ElementShadow::hasSameStyles(const ElementShadow& other) const {
if (!root || !otherRoot)
return false;
- StyleSheetList& list = root->styleSheets();
- StyleSheetList& otherList = otherRoot->styleSheets();
-
- if (list.length() != otherList.length())
+ if (!ScopedStyleResolver::haveSameStyles(
+ root->scopedStyleResolver(), otherRoot->scopedStyleResolver())) {
return false;
-
- for (size_t i = 0; i < list.length(); i++) {
- if (toCSSStyleSheet(list.item(i))->contents() !=
- toCSSStyleSheet(otherList.item(i))->contents())
- return false;
}
+
root = root->olderShadowRoot();
otherRoot = otherRoot->olderShadowRoot();
}

Powered by Google App Engine
This is Rietveld 408576698