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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/inspector/css-agent.sky
diff --git a/sky/framework/inspector/css-agent.sky b/sky/framework/inspector/css-agent.sky
index c9d31a1cadf9f0af0cee063a23ca6ae76111a05b..1645b8fed5b7eed4c8ea3ed6a3b92ba5de30dc79 100644
--- a/sky/framework/inspector/css-agent.sky
+++ b/sky/framework/inspector/css-agent.sky
@@ -1,49 +1,52 @@
<script>
-function CSS(domAgent) {
- this.domAgent_ = domAgent;
-}
+class CSS {
+ constructor(domAgent) {
+ this.domAgent_ = domAgent;
+ Object.preventExtensions(this);
+ }
-CSS.prototype.enable = function() {
-};
+ enable() {
+ }
-CSS.prototype.getInlineStylesForNode = function(params) {
- return {
+ getInlineStylesForNode(params) {
+ return {
"inlineStyle": {
- "cssProperties": [],
- "shorthandEntries": [],
- "styleSheetId": "0",
- "range": {
- "startLine": 0,
- "startColumn": 0,
- "endLine": 0,
- "endColumn": 0
- },
- "cssText": "",
- }
+ "cssProperties": [],
+ "shorthandEntries": [],
+ "styleSheetId": "0",
+ "range": {
+ "startLine": 0,
+ "startColumn": 0,
+ "endLine": 0,
+ "endColumn": 0
+ },
+ "cssText": "",
+ }
+ };
}
-}
-CSS.prototype.getComputedStyleForNode = function(params) {
- var node = this.domAgent_.getNodeForId(params.nodeId);
- if (!node){
- console.log("Error, missing node" + params.nodeId);
- return { "computedStyle": [] };
- }
- var style = window.getComputedStyle(node, null);
- if (!style){
- console.log("Error, no computed style for " + params.nodeId + " " + node);
- return { "computedStyle": [] };
- }
- var computedStyles = [];
- for (var i = 0; i < style.length; i++) {
- var name = style.item(i);
- computedStyles.push({
- "name": name,
- "value": style.getPropertyValue(name),
- });
- }
- return {
- "computedStyle": computedStyles,
+ getComputedStyleForNode(params) {
+ var node = this.domAgent_.getNodeForId(params.nodeId);
+ if (!node){
+ console.log("Error, missing node" + params.nodeId);
+ return { "computedStyle": [] };
+ }
+ var style = window.getComputedStyle(node, null);
+ if (!style){
+ console.log("Error, no computed style for " + params.nodeId + " " + node);
+ return { "computedStyle": [] };
+ }
+ var computedStyles = [];
+ for (var i = 0; i < style.length; i++) {
+ var name = style.item(i);
+ computedStyles.push({
+ "name": name,
+ "value": style.getPropertyValue(name),
+ });
+ }
+ return {
+ "computedStyle": computedStyles,
+ };
}
}
« 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