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

Unified Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 1 month 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/inspector/InspectorCSSAgent.cpp
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index ecd0faa6c6e14023ed3c080013825f837c4c00f9..40580c330d7e7f76ee925fffa17ea19d053566b4 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -956,6 +956,7 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int no
// Matched rules.
StyleResolver* styleResolver = ownerDocument->styleResolver();
+ appendPendingStyleSheetsIfNeeded(styleResolver);
// FIXME: This code should not pass DoNotIncludeStyleSheetInCSSOMWrapper. All CSSOMWrappers should always have a parent sheet or rule.
RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoCSSRulesForElement(element, elementPseudoId, StyleResolver::AllCSSRules, DoNotIncludeStyleSheetInCSSOMWrapper);
matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), styleResolver, originalElement);
@@ -982,6 +983,7 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int no
Element* parentElement = element->parentElement();
while (parentElement) {
StyleResolver* parentStyleResolver = parentElement->ownerDocument()->styleResolver();
+ appendPendingStyleSheetsIfNeeded(parentStyleResolver);
RefPtr<CSSRuleList> parentMatchedRules = parentStyleResolver->cssRulesForElement(parentElement, StyleResolver::AllCSSRules, DoNotIncludeStyleSheetInCSSOMWrapper);
RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::CSS::InheritedStyleEntry::create()
.setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRules.get(), styleResolver, parentElement));
@@ -1107,6 +1109,7 @@ void InspectorCSSAgent::getStyleSheet(ErrorString* errorString, const String& st
Document* doc = inspectorStyleSheet->pageStyleSheet() ? inspectorStyleSheet->pageStyleSheet()->ownerDocument() : 0;
if (!doc || !doc->styleResolver())
return;
+ appendPendingStyleSheetsIfNeeded(doc->styleResolver());
RefPtr<TypeBuilder::CSS::CSSStyleSheetBody> result = TypeBuilder::CSS::CSSStyleSheetBody::create()
.setStyleSheetId(styleSheetId)
« Source/core/css/resolver/StyleResolver.cpp ('K') | « Source/core/frame/DOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698