Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
| diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
| index b4e489dc1471e02136c322e3a566e99535d8a68a..074ac0d18b9c79829035afcd08414b958d35a1d0 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
| @@ -298,6 +298,20 @@ void ScopedStyleResolver::addTreeBoundaryCrossingRules( |
| RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope)); |
| } |
| +bool ScopedStyleResolver::hasSameStyles(const ScopedStyleResolver* first, |
| + const ScopedStyleResolver* second) { |
| + unsigned firstCount = first ? first->m_authorStyleSheets.size() : 0; |
| + unsigned secondCount = second ? second->m_authorStyleSheets.size() : 0; |
|
sof
2017/01/03 18:48:34
Using size_t would avoid the (unlikely) problem of
rune
2017/01/03 21:33:01
Done.
|
| + if (firstCount != secondCount) |
| + return false; |
| + while (firstCount--) { |
| + if (first->m_authorStyleSheets[firstCount]->contents() != |
| + second->m_authorStyleSheets[firstCount]->contents()) |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { |
| visitor->trace(m_parentStyleSheet); |
| visitor->trace(m_ruleSet); |