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

Unified Diff: webkit/glue/devtools/js/dom_agent.js

Issue 100199: DevTools: Implement styles editing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 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
Index: webkit/glue/devtools/js/dom_agent.js
===================================================================
--- webkit/glue/devtools/js/dom_agent.js (revision 14844)
+++ webkit/glue/devtools/js/dom_agent.js (working copy)
@@ -829,9 +829,7 @@
*/
devtools.DomAgent.prototype.getNodePropertiesAsync = function(nodeId,
path, protoDepth, callback) {
- var mycallback =
- goog.bind(this.utilityFunctionCallbackWrapper_, this, callback);
- var callbackId = devtools.Callback.wrap(mycallback);
+ var callbackId = this.utilityFunctionCallbackWrapper_(callback);
RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
'getProperties', nodeId,
goog.json.serialize([path, protoDepth]));
@@ -845,9 +843,7 @@
*/
devtools.DomAgent.prototype.getNodePrototypesAsync = function(nodeId,
callback) {
- var mycallback =
- goog.bind(this.utilityFunctionCallbackWrapper_, this, callback);
- var callbackId = devtools.Callback.wrap(mycallback);
+ var callbackId = this.utilityFunctionCallbackWrapper_(callback);
RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
'getPrototypes', nodeId, '[]');
};
@@ -861,9 +857,7 @@
*/
devtools.DomAgent.prototype.getNodeStylesAsync = function(node,
authorOnly, callback) {
- var mycallback =
- goog.bind(this.utilityFunctionCallbackWrapper_, this, callback);
- var callbackId = devtools.Callback.wrap(mycallback);
+ var callbackId = this.utilityFunctionCallbackWrapper_(callback);
RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
'getStyles',
node.id_,
@@ -880,9 +874,7 @@
*/
devtools.DomAgent.prototype.toggleNodeStyleAsync = function(
style, enabled, name, callback) {
- var mycallback =
- goog.bind(this.utilityFunctionCallbackWrapper_, this, callback);
- var callbackId = devtools.Callback.wrap(mycallback);
+ var callbackId = this.utilityFunctionCallbackWrapper_(callback);
RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
'toggleNodeStyle',
style.nodeId_,
@@ -891,15 +883,37 @@
/**
+ * Applies new text to a style.
+ * @param {devtools.CSSStyleDeclaration} style Style to edit.
+ * @param {string} name Property name to edit.
+ * @param {string} styleText Text to set the style from.
+ * @param {Function} callback.
+ */
+devtools.DomAgent.prototype.applyStyleTextAsync = function(
+ style, name, styleText, callback) {
+ var callbackId = this.utilityFunctionCallbackWrapper_(callback);
+ RemoteToolsAgent.ExecuteUtilityFunction(callbackId,
yurys 2009/04/30 09:55:40 style: wrong arguments alignment
pfeldman 2009/04/30 10:00:16 Done.
+ 'applyStyleText',
+ style.nodeId_,
+ goog.json.serialize([style.id_, name, styleText]));
+};
+
+
+/**
* Dumps exception if something went wrong in ExecuteUtilityFunction.
+ * @param {Function} callback Callback to wrap.
+ * @return {number} Callback id.
*/
devtools.DomAgent.prototype.utilityFunctionCallbackWrapper_ =
- function(callback, result, exception) {
- if (exception && exception.length) {
- debugPrint('Exception in ExecuteUtilityFunction styles:' + exception);
- return;
- }
- callback(result);
+ function(callback) {
+ var mycallback = function(result, exception) {
+ if (exception && exception.length) {
+ debugPrint('Exception in ExecuteUtilityFunction styles:' + exception);
+ return;
+ }
+ callback(result);
+ };
+ return devtools.Callback.wrap(mycallback);
};

Powered by Google App Engine
This is Rietveld 408576698