| 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..373a63e7b25d02f63714b062e058f8177ba9d78f 100644 | 
| --- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp | 
| +++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp | 
| @@ -298,6 +298,28 @@ void ScopedStyleResolver::addTreeBoundaryCrossingRules( | 
| RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope)); | 
| } | 
|  | 
| +bool ScopedStyleResolver::haveSameStyles(const ScopedStyleResolver* first, | 
| +                                         const ScopedStyleResolver* second) { | 
| +  // This method will return true if the two resolvers are either both empty, or | 
| +  // if they contain the same active stylesheets by sharing the same | 
| +  // StyleSheetContents. It is used to check if we can share ComputedStyle | 
| +  // between two shadow hosts. This typically works when we have multiple | 
| +  // instantiations of the same web component where the style elements are in | 
| +  // the same order and contain the exact same source string in which case we | 
| +  // will get a cache hit for sharing StyleSheetContents. | 
| + | 
| +  size_t firstCount = first ? first->m_authorStyleSheets.size() : 0; | 
| +  size_t secondCount = second ? second->m_authorStyleSheets.size() : 0; | 
| +  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); | 
|  |