UNPKG

2.65 kBJavaScriptView Raw
1const inspectorCommands = require('./InspectorBackendCommands');
2import * as debuggerDomains from '.';
3import { attachCSSInspectorCommandCallbacks } from './devtools-elements';
4let CSSDomainDebugger = class CSSDomainDebugger {
5 constructor() {
6 this.events = new inspectorCommands.CSSDomain.CSSFrontend();
7 this.commands = {};
8 attachCSSInspectorCommandCallbacks(this.commands);
9 // By default start enabled because we can miss the "enable" event when
10 // running with `--debug-brk` -- the frontend will send it before we've been created
11 this.enable();
12 }
13 get enabled() {
14 return this._enabled;
15 }
16 enable() {
17 if (debuggerDomains.getCSS()) {
18 throw new Error('One CSSDomainDebugger may be enabled at a time.');
19 }
20 else {
21 debuggerDomains.setCSS(this);
22 }
23 this._enabled = true;
24 }
25 /**
26 * Disables network tracking, prevents network events from being sent to the client.
27 */
28 disable() {
29 if (debuggerDomains.getCSS() === this) {
30 debuggerDomains.setCSS(null);
31 }
32 this._enabled = false;
33 }
34 getMatchedStylesForNode(params) {
35 return {};
36 }
37 // Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by <code>nodeId</code>.
38 getInlineStylesForNode(params) {
39 return {};
40 }
41 // Returns the computed style for a DOM node identified by <code>nodeId</code>.
42 getComputedStyleForNode(params) {
43 return {
44 computedStyle: this.commands.getComputedStylesForNode(params.nodeId),
45 };
46 }
47 // Requests information about platform fonts which we used to render child TextNodes in the given node.
48 getPlatformFontsForNode(params) {
49 return {
50 fonts: [
51 {
52 // Font's family name reported by platform.
53 familyName: 'Standard Font',
54 // Indicates if the font was downloaded or resolved locally.
55 isCustomFont: false,
56 // Amount of glyphs that were rendered with this font.
57 glyphCount: 0,
58 },
59 ],
60 };
61 }
62 // Returns the current textual content and the URL for a stylesheet.
63 getStyleSheetText(params) {
64 return null;
65 }
66};
67CSSDomainDebugger = __decorate([
68 inspectorCommands.DomainDispatcher('CSS'),
69 __metadata("design:paramtypes", [])
70], CSSDomainDebugger);
71export { CSSDomainDebugger };
72//# sourceMappingURL=webinspector-css.js.map
\No newline at end of file