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

Side by Side Diff: sky/framework/inspector/css-agent.sky

Issue 837933003: Convert the inspector framework to use ES6 classes. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: prevent extensions Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « sky/framework/inspector/console-agent.sky ('k') | sky/framework/inspector/dom-agent.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 function CSS(domAgent) { 2 class CSS {
3 this.domAgent_ = domAgent; 3 constructor(domAgent) {
4 } 4 this.domAgent_ = domAgent;
5 Object.preventExtensions(this);
6 }
5 7
6 CSS.prototype.enable = function() { 8 enable() {
7 }; 9 }
8 10
9 CSS.prototype.getInlineStylesForNode = function(params) { 11 getInlineStylesForNode(params) {
10 return { 12 return {
11 "inlineStyle": { 13 "inlineStyle": {
12 "cssProperties": [], 14 "cssProperties": [],
13 "shorthandEntries": [], 15 "shorthandEntries": [],
14 "styleSheetId": "0", 16 "styleSheetId": "0",
15 "range": { 17 "range": {
16 "startLine": 0, 18 "startLine": 0,
17 "startColumn": 0, 19 "startColumn": 0,
18 "endLine": 0, 20 "endLine": 0,
19 "endColumn": 0 21 "endColumn": 0
20 }, 22 },
21 "cssText": "", 23 "cssText": "",
24 }
25 };
26 }
27
28 getComputedStyleForNode(params) {
29 var node = this.domAgent_.getNodeForId(params.nodeId);
30 if (!node){
31 console.log("Error, missing node" + params.nodeId);
32 return { "computedStyle": [] };
22 } 33 }
34 var style = window.getComputedStyle(node, null);
35 if (!style){
36 console.log("Error, no computed style for " + params.nodeId + " " + node);
37 return { "computedStyle": [] };
38 }
39 var computedStyles = [];
40 for (var i = 0; i < style.length; i++) {
41 var name = style.item(i);
42 computedStyles.push({
43 "name": name,
44 "value": style.getPropertyValue(name),
45 });
46 }
47 return {
48 "computedStyle": computedStyles,
49 };
23 } 50 }
24 } 51 }
25 52
26 CSS.prototype.getComputedStyleForNode = function(params) {
27 var node = this.domAgent_.getNodeForId(params.nodeId);
28 if (!node){
29 console.log("Error, missing node" + params.nodeId);
30 return { "computedStyle": [] };
31 }
32 var style = window.getComputedStyle(node, null);
33 if (!style){
34 console.log("Error, no computed style for " + params.nodeId + " " + node);
35 return { "computedStyle": [] };
36 }
37 var computedStyles = [];
38 for (var i = 0; i < style.length; i++) {
39 var name = style.item(i);
40 computedStyles.push({
41 "name": name,
42 "value": style.getPropertyValue(name),
43 });
44 }
45 return {
46 "computedStyle": computedStyles,
47 }
48 }
49
50 module.exports = CSS; 53 module.exports = CSS;
51 </script> 54 </script>
OLDNEW
« no previous file with comments | « sky/framework/inspector/console-agent.sky ('k') | sky/framework/inspector/dom-agent.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698