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

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

Issue 2312953002: Store a single inspector stylesheet hidden from CSSOM. (Closed)
Patch Set: Incorrect removal. Created 4 years, 3 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/InspectorStyleSheet.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
index 41c6734a7099b55b7b0fa70c881f565f1c1576a5..76bbe0d759b68a2fc92cd0c4b7ace7b3e7c4ce7d 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -981,7 +981,9 @@ InspectorStyleSheet::InspectorStyleSheet(InspectorNetworkAgent* networkAgent, CS
, m_documentURL(documentURL)
{
String text;
- bool success = inlineStyleSheetText(&text);
+ bool success = inspectorStyleSheetText(&text);
+ if (!success)
+ success = inlineStyleSheetText(&text);
if (!success)
success = resourceStyleSheetText(&text);
if (success)
@@ -1353,6 +1355,8 @@ void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod
Element* element = ownerStyleElement();
if (element)
m_resourceContainer->storeStyleElementContent(DOMNodeIds::idForNode(element), text);
+ else if (m_origin == protocol::CSS::StyleSheetOriginEnum::Inspector)
+ m_resourceContainer->storeStyleElementContent(DOMNodeIds::idForNode(m_pageStyleSheet->ownerDocument()), text);
else
m_resourceContainer->storeStyleSheetContent(finalURL(), text);
}
@@ -1748,6 +1752,18 @@ bool InspectorStyleSheet::inlineStyleSheetText(String* result)
return true;
}
+bool InspectorStyleSheet::inspectorStyleSheetText(String* result)
+{
+ if (m_origin != protocol::CSS::StyleSheetOriginEnum::Inspector)
+ return false;
+ if (!m_pageStyleSheet->ownerDocument())
+ return false;
+ if (m_resourceContainer->loadStyleElementContent(DOMNodeIds::idForNode(m_pageStyleSheet->ownerDocument()), result))
+ return true;
+ *result = "";
+ return true;
+}
+
InspectorStyleSheetForInlineStyle* InspectorStyleSheetForInlineStyle::create(Element* element, Listener* listener)
{
return new InspectorStyleSheetForInlineStyle(element, listener);

Powered by Google App Engine
This is Rietveld 408576698