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

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

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More assert fixes Created 4 years, 7 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/inspector/InspectorCSSAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
index b0862cb44698da1e639b9615b4c0a88571e98fd0..02f8d8d7f17e391ca83f143d7797fe52350f4435 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -58,6 +58,7 @@
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLStyleElement.h"
#include "core/html/VoidCallback.h"
#include "core/inspector/IdentifiersFactory.h"
#include "core/inspector/InspectedFrames.h"
@@ -1554,11 +1555,8 @@ Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId)
// static
void InspectorCSSAgent::collectAllDocumentStyleSheets(Document* document, HeapVector<Member<CSSStyleSheet>>& result)
{
- const HeapVector<Member<CSSStyleSheet>> activeStyleSheets = document->styleEngine().activeStyleSheetsForInspector();
- for (const auto& style : activeStyleSheets) {
- CSSStyleSheet* styleSheet = style.get();
- InspectorCSSAgent::collectStyleSheets(styleSheet, result);
- }
+ for (const auto& style : document->styleEngine().activeStyleSheetsForInspector())
+ InspectorCSSAgent::collectStyleSheets(style.first, result);
}
// static
@@ -1651,6 +1649,16 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen
targetNode->appendChild(styleElement, exceptionState);
// At this point the added stylesheet will get bound through the updateActiveStyleSheets() invocation.
// We just need to pick the respective InspectorStyleSheet from m_documentToViaInspectorStyleSheet.
+ HeapHashSet<Member<CSSStyleSheet>>* documentCSSStyleSheets = m_documentToCSSStyleSheets.get(document);
+ if (!documentCSSStyleSheets) {
+ documentCSSStyleSheets = new HeapHashSet<Member<CSSStyleSheet>>();
+ m_documentToCSSStyleSheets.set(document, documentCSSStyleSheets);
+ }
+ CSSStyleSheet* cssStyleSheet = toHTMLStyleElement(styleElement)->sheet();
+ InspectorStyleSheet* newStyleSheet = bindStyleSheet(cssStyleSheet);
+ documentCSSStyleSheets->add(cssStyleSheet);
+ if (frontend())
+ frontend()->styleSheetAdded(newStyleSheet->buildObjectForStyleSheetInfo());
m_creatingViaInspectorStyleSheet = false;
}
« no previous file with comments | « third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698