Index: Source/core/inspector/InspectorCSSAgent.cpp |
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp |
index 206709bafc0d5e58f282302be7ca215fa21da5d1..b1ebd8d036fecfc652ef6f11e7e0e6f37ab772c8 100644 |
--- a/Source/core/inspector/InspectorCSSAgent.cpp |
+++ b/Source/core/inspector/InspectorCSSAgent.cpp |
@@ -436,6 +436,7 @@ void InspectorCSSAgent::reset() |
m_idToInspectorStyleSheet.clear(); |
m_cssStyleSheetToInspectorStyleSheet.clear(); |
m_documentToCSSStyleSheets.clear(); |
+ m_invalidatedDocuments.clear(); |
m_nodeToInspectorStyleSheet.clear(); |
m_documentToViaInspectorStyleSheet.clear(); |
resetNonPersistentData(); |
@@ -519,8 +520,8 @@ void InspectorCSSAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader) |
void InspectorCSSAgent::mediaQueryResultChanged() |
{ |
- if (m_frontend) |
- m_frontend->mediaQueryResultChanged(); |
+ validateFrontendStylesheets(); |
+ m_frontend->mediaQueryResultChanged(); |
} |
void InspectorCSSAgent::willMutateRules() |
@@ -557,11 +558,18 @@ void InspectorCSSAgent::didMutateStyle(CSSStyleDeclaration* style, bool isInline |
} |
} |
+void InspectorCSSAgent::didProcessTask() |
+{ |
+ validateFrontendStylesheets(); |
+} |
+ |
void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document) |
{ |
if (styleSheetEditInProgress()) |
return; |
- updateActiveStyleSheets(document, ExistingFrontendRefresh); |
+ m_invalidatedDocuments.add(document); |
+ if (m_creatingViaInspectorStyleSheet) |
+ validateFrontendStylesheets(); |
} |
void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsUpdateType styleSheetsUpdateType) |
@@ -626,8 +634,19 @@ void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS |
m_documentToCSSStyleSheets.remove(document); |
} |
+void InspectorCSSAgent::validateFrontendStylesheets() |
+{ |
+ if (!m_invalidatedDocuments.size()) |
+ return; |
+ HashSet<Document*> invalidatedDocuments; |
+ m_invalidatedDocuments.swap(&invalidatedDocuments); |
+ for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != invalidatedDocuments.end(); ++it) |
+ updateActiveStyleSheets(*it, ExistingFrontendRefresh); |
+} |
+ |
void InspectorCSSAgent::documentDisposed(Document* document) |
{ |
+ m_invalidatedDocuments.remove(document); |
setActiveStyleSheets(document, Vector<CSSStyleSheet*>(), ExistingFrontendRefresh); |
} |
@@ -896,6 +915,8 @@ void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String& |
return; |
} |
+ updateActiveStyleSheets(document, ExistingFrontendRefresh); |
vsevik
2014/03/17 12:49:28
remove
|
+ |
*outStyleSheetId = inspectorStyleSheet->id(); |
} |
@@ -1316,8 +1337,8 @@ void InspectorCSSAgent::didModifyDOMAttr(Element* element) |
void InspectorCSSAgent::styleSheetChanged(InspectorStyleSheet* styleSheet) |
{ |
- if (m_frontend) |
- m_frontend->styleSheetChanged(styleSheet->id()); |
+ validateFrontendStylesheets(); |
+ m_frontend->styleSheetChanged(styleSheet->id()); |
} |
void InspectorCSSAgent::willReparseStyleSheet() |