Index: Source/core/inspector/InspectorCSSAgent.cpp |
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp |
index dabd2fe598c5286e3936762f2803d10b6f892d55..3da6523355b5086bff1232a7e562f38e9a6c6f97 100644 |
--- a/Source/core/inspector/InspectorCSSAgent.cpp |
+++ b/Source/core/inspector/InspectorCSSAgent.cpp |
@@ -79,6 +79,8 @@ static const char cssAgentEnabled[] = "cssAgentEnabled"; |
typedef WebCore::InspectorBackendDispatcher::CSSCommandHandler::EnableCallback EnableCallback; |
+using WebCore::TypeBuilder::CSS::StyleSheetId; |
lushnikov
2014/02/28 11:55:59
there's a single use of this type in the file - ca
vsevik
2014/02/28 14:35:28
Done
|
+ |
namespace WebCore { |
enum ForcePseudoClassFlags { |
@@ -872,18 +874,35 @@ void InspectorCSSAgent::setRuleSelector(ErrorString* errorString, const RefPtr<J |
*errorString = InspectorDOMAgent::toErrorString(exceptionState); |
} |
-void InspectorCSSAgent::addRule(ErrorString* errorString, const int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) |
+void InspectorCSSAgent::createViaInspectorStyleSheet(ErrorString* errorString, const String& frameId, StyleSheetId* outStyleSheetId) |
{ |
- Node* node = m_domAgent->assertNode(errorString, contextNodeId); |
- if (!node) |
+ LocalFrame* frame = m_pageAgent->frameForId(frameId); |
+ if (!frame) { |
+ *errorString = "Frame not found"; |
return; |
+ } |
+ |
+ Document* document = frame->document(); |
+ if (!document) { |
+ *errorString = "Frame does not have a document"; |
+ return; |
+ } |
- InspectorStyleSheet* inspectorStyleSheet = viaInspectorStyleSheet(&node->document(), true); |
+ InspectorStyleSheet* inspectorStyleSheet = viaInspectorStyleSheet(document, true); |
if (!inspectorStyleSheet) { |
*errorString = "No target stylesheet found"; |
return; |
} |
+ *outStyleSheetId = inspectorStyleSheet->id(); |
+} |
+ |
+void InspectorCSSAgent::addRule(ErrorString* errorString, const String& styleSheetId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result) |
+{ |
+ InspectorStyleSheet* inspectorStyleSheet = assertStyleSheetForId(errorString, styleSheetId); |
+ if (!inspectorStyleSheet) |
+ return; |
+ |
TrackExceptionState exceptionState; |
OwnPtr<AddRuleAction> action = adoptPtr(new AddRuleAction(inspectorStyleSheet, selector)); |
AddRuleAction* rawAction = action.get(); |