4
4
5
5
#include < NativeScriptAssert.h>
6
6
#include < v8_inspector/third_party/inspector_protocol/crdtp/json.h>
7
- #include < v8_inspector/src/inspector/utils/v8-inspector-common.h>
8
7
#include < ArgConverter.h>
9
- #include " v8-css-agent-impl.h"
10
8
11
- namespace v8_inspector {
9
+ #include " CSSAgentImpl.h"
10
+ #include " utils/InspectorCommon.h"
12
11
13
- using tns::ArgConverter;
12
+ namespace tns {
14
13
15
14
namespace CSSAgentState {
16
15
static const char cssEnabled[] = " cssEnabled" ;
17
16
}
18
17
19
- V8CSSAgentImpl::V8CSSAgentImpl (V8InspectorSessionImpl* session,
20
- protocol::FrontendChannel* frontendChannel,
21
- protocol::DictionaryValue* state)
18
+ CSSAgentImpl::CSSAgentImpl (V8InspectorSessionImpl* session,
19
+ protocol::FrontendChannel* frontendChannel,
20
+ protocol::DictionaryValue* state)
22
21
: m_session(session),
23
22
m_frontend (frontendChannel),
24
23
m_state(state),
25
24
m_enabled(false ) {
26
25
Instance = this ;
27
26
}
28
27
29
- V8CSSAgentImpl ::~V8CSSAgentImpl () { }
28
+ CSSAgentImpl ::~CSSAgentImpl () { }
30
29
31
- void V8CSSAgentImpl ::enable (std::unique_ptr<EnableCallback> callback) {
30
+ void CSSAgentImpl ::enable (std::unique_ptr<EnableCallback> callback) {
32
31
if (m_enabled) {
33
32
callback->sendSuccess ();
34
33
return ;
@@ -40,7 +39,7 @@ void V8CSSAgentImpl::enable(std::unique_ptr<EnableCallback> callback) {
40
39
callback->sendSuccess ();
41
40
}
42
41
43
- DispatchResponse V8CSSAgentImpl ::disable () {
42
+ DispatchResponse CSSAgentImpl ::disable () {
44
43
if (!m_enabled) {
45
44
return DispatchResponse::Success ();
46
45
}
@@ -53,7 +52,7 @@ DispatchResponse V8CSSAgentImpl::disable() {
53
52
}
54
53
55
54
// Not supported
56
- DispatchResponse V8CSSAgentImpl ::getMatchedStylesForNode (int in_nodeId, Maybe<protocol::CSS::CSSStyle>* out_inlineStyle, Maybe<protocol::CSS::CSSStyle>* out_attributesStyle, Maybe<protocol::Array<protocol::CSS::RuleMatch>>* out_matchedCSSRules, Maybe<protocol::Array<protocol::CSS::PseudoElementMatches>>* out_pseudoElements, Maybe<protocol::Array<protocol::CSS::InheritedStyleEntry>>* out_inherited, Maybe<protocol::Array<protocol::CSS::CSSKeyframesRule>>* out_cssKeyframesRules) {
55
+ DispatchResponse CSSAgentImpl ::getMatchedStylesForNode (int in_nodeId, Maybe<protocol::CSS::CSSStyle>* out_inlineStyle, Maybe<protocol::CSS::CSSStyle>* out_attributesStyle, Maybe<protocol::Array<protocol::CSS::RuleMatch>>* out_matchedCSSRules, Maybe<protocol::Array<protocol::CSS::PseudoElementMatches>>* out_pseudoElements, Maybe<protocol::Array<protocol::CSS::InheritedStyleEntry>>* out_inherited, Maybe<protocol::Array<protocol::CSS::CSSKeyframesRule>>* out_cssKeyframesRules) {
57
56
// // out_inlineStyle
58
57
// auto cssPropsArr = protocol::Array<protocol::CSS::CSSProperty>::create();
59
58
// auto shorthandPropArr = protocol::Array<protocol::CSS::ShorthandEntry>::create();
@@ -114,7 +113,7 @@ DispatchResponse V8CSSAgentImpl::getMatchedStylesForNode(int in_nodeId, Maybe<pr
114
113
return DispatchResponse::Success ();
115
114
}
116
115
117
- DispatchResponse V8CSSAgentImpl ::getInlineStylesForNode (int in_nodeId, Maybe<protocol::CSS::CSSStyle>* out_inlineStyle, Maybe<protocol::CSS::CSSStyle>* out_attributesStyle) {
116
+ DispatchResponse CSSAgentImpl ::getInlineStylesForNode (int in_nodeId, Maybe<protocol::CSS::CSSStyle>* out_inlineStyle, Maybe<protocol::CSS::CSSStyle>* out_attributesStyle) {
118
117
// // out_inlineStyle
119
118
// auto cssPropsArr = protocol::Array<protocol::CSS::CSSProperty>::create();
120
119
// auto shorthandPropArr = protocol::Array<protocol::CSS::ShorthandEntry>::create();
@@ -137,7 +136,7 @@ DispatchResponse V8CSSAgentImpl::getInlineStylesForNode(int in_nodeId, Maybe<pro
137
136
return DispatchResponse::Success ();
138
137
}
139
138
140
- DispatchResponse V8CSSAgentImpl ::getComputedStyleForNode (int in_nodeId, std::unique_ptr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>>* out_computedStyle) {
139
+ DispatchResponse CSSAgentImpl ::getComputedStyleForNode (int in_nodeId, std::unique_ptr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>>* out_computedStyle) {
141
140
auto computedStylePropertyArr = std::make_unique<protocol::Array<protocol::CSS::CSSComputedStyleProperty>>();
142
141
143
142
std::string getComputedStylesForNodeString = " getComputedStylesForNode" ;
@@ -169,7 +168,7 @@ DispatchResponse V8CSSAgentImpl::getComputedStyleForNode(int in_nodeId, std::uni
169
168
170
169
if (maybeResult.ToLocal (&outResult)) {
171
170
auto resultString = outResult->ToString (context).ToLocalChecked ();
172
- String16 resultProtocolString = toProtocolString (isolate, resultString);
171
+ v8_inspector:: String16 resultProtocolString = v8_inspector:: toProtocolString (isolate, resultString);
173
172
std::vector<uint8_t > cbor;
174
173
v8_crdtp::json::ConvertJSONToCBOR (v8_crdtp::span<uint16_t >(resultProtocolString.characters16 (), resultProtocolString.length ()), &cbor);
175
174
std::unique_ptr<protocol::Value> resultJson = protocol::Value::parseBinary (cbor.data (), cbor.size ());
@@ -178,7 +177,7 @@ DispatchResponse V8CSSAgentImpl::getComputedStyleForNode(int in_nodeId, std::uni
178
177
179
178
std::vector<uint8_t > json;
180
179
v8_crdtp::json::ConvertCBORToJSON (errorSupport.Errors (), &json);
181
- auto errorSupportString = String16 (reinterpret_cast <const char *>(json.data ()), json.size ()).utf8 ();
180
+ auto errorSupportString = v8_inspector:: String16 (reinterpret_cast <const char *>(json.data ()), json.size ()).utf8 ();
182
181
if (!errorSupportString.empty ()) {
183
182
auto errorMessage = " Error while parsing CSSComputedStyleProperty object. " ;
184
183
DEBUG_WRITE_FORCE (" %s Error: %s" , errorMessage, errorSupportString.c_str ());
@@ -197,7 +196,7 @@ DispatchResponse V8CSSAgentImpl::getComputedStyleForNode(int in_nodeId, std::uni
197
196
return DispatchResponse::Success ();
198
197
}
199
198
200
- DispatchResponse V8CSSAgentImpl ::getPlatformFontsForNode (int in_nodeId, std::unique_ptr<protocol::Array<protocol::CSS::PlatformFontUsage>>* out_fonts) {
199
+ DispatchResponse CSSAgentImpl ::getPlatformFontsForNode (int in_nodeId, std::unique_ptr<protocol::Array<protocol::CSS::PlatformFontUsage>>* out_fonts) {
201
200
auto fontsArr = std::make_unique<protocol::Array<protocol::CSS::PlatformFontUsage>>();
202
201
auto defaultFont = " System Font" ;
203
202
fontsArr->emplace_back (std::move (protocol::CSS::PlatformFontUsage::create ()
@@ -210,71 +209,71 @@ DispatchResponse V8CSSAgentImpl::getPlatformFontsForNode(int in_nodeId, std::uni
210
209
return DispatchResponse::Success ();
211
210
}
212
211
213
- DispatchResponse V8CSSAgentImpl ::getStyleSheetText (const String& in_styleSheetId, String* out_text) {
212
+ DispatchResponse CSSAgentImpl ::getStyleSheetText (const String& in_styleSheetId, String* out_text) {
214
213
*out_text = " " ;
215
214
216
215
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
217
216
}
218
217
219
- DispatchResponse V8CSSAgentImpl ::addRule (const String& in_styleSheetId, const String& in_ruleText, std::unique_ptr<protocol::CSS::SourceRange> in_location, std::unique_ptr<protocol::CSS::CSSRule>* out_rule) {
218
+ DispatchResponse CSSAgentImpl ::addRule (const String& in_styleSheetId, const String& in_ruleText, std::unique_ptr<protocol::CSS::SourceRange> in_location, std::unique_ptr<protocol::CSS::CSSRule>* out_rule) {
220
219
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
221
220
}
222
221
223
- DispatchResponse V8CSSAgentImpl ::collectClassNames (const String& in_styleSheetId, std::unique_ptr<protocol::Array<String>>* out_classNames) {
222
+ DispatchResponse CSSAgentImpl ::collectClassNames (const String& in_styleSheetId, std::unique_ptr<protocol::Array<String>>* out_classNames) {
224
223
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
225
224
}
226
225
227
- DispatchResponse V8CSSAgentImpl ::createStyleSheet (const String& in_frameId, String* out_styleSheetId) {
226
+ DispatchResponse CSSAgentImpl ::createStyleSheet (const String& in_frameId, String* out_styleSheetId) {
228
227
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
229
228
}
230
229
231
- DispatchResponse V8CSSAgentImpl ::forcePseudoState (int in_nodeId, std::unique_ptr<protocol::Array<String>> in_forcedPseudoClasses) {
230
+ DispatchResponse CSSAgentImpl ::forcePseudoState (int in_nodeId, std::unique_ptr<protocol::Array<String>> in_forcedPseudoClasses) {
232
231
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
233
232
}
234
233
235
- DispatchResponse V8CSSAgentImpl ::getBackgroundColors (int in_nodeId, Maybe<protocol::Array<String>>* out_backgroundColors, Maybe<String>* out_computedFontSize, Maybe<String>* out_computedFontWeight) {
234
+ DispatchResponse CSSAgentImpl ::getBackgroundColors (int in_nodeId, Maybe<protocol::Array<String>>* out_backgroundColors, Maybe<String>* out_computedFontSize, Maybe<String>* out_computedFontWeight) {
236
235
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
237
236
}
238
237
239
- DispatchResponse V8CSSAgentImpl ::getMediaQueries (std::unique_ptr<protocol::Array<protocol::CSS::CSSMedia>>* out_medias) {
238
+ DispatchResponse CSSAgentImpl ::getMediaQueries (std::unique_ptr<protocol::Array<protocol::CSS::CSSMedia>>* out_medias) {
240
239
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
241
240
}
242
241
243
- DispatchResponse V8CSSAgentImpl ::setEffectivePropertyValueForNode (int in_nodeId, const String& in_propertyName, const String& in_value) {
242
+ DispatchResponse CSSAgentImpl ::setEffectivePropertyValueForNode (int in_nodeId, const String& in_propertyName, const String& in_value) {
244
243
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
245
244
}
246
245
247
- DispatchResponse V8CSSAgentImpl ::setKeyframeKey (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_keyText, std::unique_ptr<protocol::CSS::Value>* out_keyText) {
246
+ DispatchResponse CSSAgentImpl ::setKeyframeKey (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_keyText, std::unique_ptr<protocol::CSS::Value>* out_keyText) {
248
247
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
249
248
}
250
249
251
- DispatchResponse V8CSSAgentImpl ::setMediaText (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_text, std::unique_ptr<protocol::CSS::CSSMedia>* out_media) {
250
+ DispatchResponse CSSAgentImpl ::setMediaText (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_text, std::unique_ptr<protocol::CSS::CSSMedia>* out_media) {
252
251
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
253
252
}
254
253
255
- DispatchResponse V8CSSAgentImpl ::setRuleSelector (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_selector, std::unique_ptr<protocol::CSS::SelectorList>* out_selectorList) {
254
+ DispatchResponse CSSAgentImpl ::setRuleSelector (const String& in_styleSheetId, std::unique_ptr<protocol::CSS::SourceRange> in_range, const String& in_selector, std::unique_ptr<protocol::CSS::SelectorList>* out_selectorList) {
256
255
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
257
256
}
258
257
259
- DispatchResponse V8CSSAgentImpl ::setStyleSheetText (const String& in_styleSheetId, const String& in_text, Maybe<String>* out_sourceMapURL) {
258
+ DispatchResponse CSSAgentImpl ::setStyleSheetText (const String& in_styleSheetId, const String& in_text, Maybe<String>* out_sourceMapURL) {
260
259
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
261
260
}
262
261
263
- DispatchResponse V8CSSAgentImpl ::setStyleTexts (std::unique_ptr<protocol::Array<protocol::CSS::StyleDeclarationEdit>> in_edits, std::unique_ptr<protocol::Array<protocol::CSS::CSSStyle>>* out_styles) {
262
+ DispatchResponse CSSAgentImpl ::setStyleTexts (std::unique_ptr<protocol::Array<protocol::CSS::StyleDeclarationEdit>> in_edits, std::unique_ptr<protocol::Array<protocol::CSS::CSSStyle>>* out_styles) {
264
263
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
265
264
}
266
265
267
- DispatchResponse V8CSSAgentImpl ::startRuleUsageTracking () {
266
+ DispatchResponse CSSAgentImpl ::startRuleUsageTracking () {
268
267
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
269
268
}
270
269
271
- DispatchResponse V8CSSAgentImpl ::stopRuleUsageTracking (std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* out_ruleUsage) {
270
+ DispatchResponse CSSAgentImpl ::stopRuleUsageTracking (std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* out_ruleUsage) {
272
271
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
273
272
}
274
273
275
- DispatchResponse V8CSSAgentImpl ::takeCoverageDelta (std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* out_coverage) {
274
+ DispatchResponse CSSAgentImpl ::takeCoverageDelta (std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* out_coverage) {
276
275
return utils::Common::protocolCommandNotSupportedDispatchResponse ();
277
276
}
278
277
279
- V8CSSAgentImpl* V8CSSAgentImpl ::Instance = 0 ;
280
- }
278
+ CSSAgentImpl* CSSAgentImpl ::Instance = 0 ;
279
+ } // namespace tns
0 commit comments