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

Side by Side Diff: Source/devtools/front_end/CSSStyleModel.js

Issue 218703002: DevTools: [wip] move Elements panel off WebInspector.domModel and single tree outline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 this._pendingCommandsMajorState = []; 39 this._pendingCommandsMajorState = [];
40 this._styleLoader = new WebInspector.CSSStyleModel.ComputedStyleLoader(this) ; 40 this._styleLoader = new WebInspector.CSSStyleModel.ComputedStyleLoader(this) ;
41 this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoRequest ed, this._undoRedoRequested, this); 41 this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoRequest ed, this._undoRedoRequested, this);
42 this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoComplet ed, this._undoRedoCompleted, this); 42 this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoComplet ed, this._undoRedoCompleted, this);
43 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, th is); 43 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, th is);
44 InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this)) ; 44 InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this)) ;
45 CSSAgent.enable(this._wasEnabled.bind(this)); 45 CSSAgent.enable(this._wasEnabled.bind(this));
46 this._resetStyleSheets(); 46 this._resetStyleSheets();
47 } 47 }
48 48
49 WebInspector.CSSStyleModel.PseudoStatePropertyName = "pseudoState";
50
49 /** 51 /**
50 * @param {!WebInspector.CSSStyleModel} cssModel 52 * @param {!WebInspector.CSSStyleModel} cssModel
51 * @param {!Array.<!CSSAgent.RuleMatch>|undefined} matchArray 53 * @param {!Array.<!CSSAgent.RuleMatch>|undefined} matchArray
52 */ 54 */
53 WebInspector.CSSStyleModel.parseRuleMatchArrayPayload = function(cssModel, match Array) 55 WebInspector.CSSStyleModel.parseRuleMatchArrayPayload = function(cssModel, match Array)
54 { 56 {
55 if (!matchArray) 57 if (!matchArray)
56 return []; 58 return [];
57 59
58 var result = []; 60 var result = [];
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (error || !inlinePayload) 210 if (error || !inlinePayload)
209 userCallback(null, null); 211 userCallback(null, null);
210 else 212 else
211 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(this, inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parse Payload(this, attributesStylePayload) : null); 213 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(this, inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parse Payload(this, attributesStylePayload) : null);
212 } 214 }
213 215
214 CSSAgent.getInlineStylesForNode(nodeId, callback.bind(this, userCallback )); 216 CSSAgent.getInlineStylesForNode(nodeId, callback.bind(this, userCallback ));
215 }, 217 },
216 218
217 /** 219 /**
218 * @param {!DOMAgent.NodeId} nodeId
219 * @param {?Array.<string>|undefined} forcedPseudoClasses
220 * @param {function()=} userCallback
221 */
222 forcePseudoState: function(nodeId, forcedPseudoClasses, userCallback)
223 {
224 CSSAgent.forcePseudoState(nodeId, forcedPseudoClasses || [], userCallbac k);
225 },
226
227 /**
228 * @param {!CSSAgent.CSSRuleId} ruleId 220 * @param {!CSSAgent.CSSRuleId} ruleId
229 * @param {!DOMAgent.NodeId} nodeId 221 * @param {!DOMAgent.NodeId} nodeId
230 * @param {string} newSelector 222 * @param {string} newSelector
231 * @param {function(!WebInspector.CSSRule)} successCallback 223 * @param {function(!WebInspector.CSSRule)} successCallback
232 * @param {function()} failureCallback 224 * @param {function()} failureCallback
233 */ 225 */
234 setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, fail ureCallback) 226 setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, fail ureCallback)
235 { 227 {
236 /** 228 /**
237 * @param {!DOMAgent.NodeId} nodeId 229 * @param {!DOMAgent.NodeId} nodeId
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 styleSheetIds = styleSheetIds.concat(frameIdToSheetIds[frameId]); 558 styleSheetIds = styleSheetIds.concat(frameIdToSheetIds[frameId]);
567 var uiLocation; 559 var uiLocation;
568 for (var i = 0; !uiLocation && i < styleSheetIds.length; ++i) { 560 for (var i = 0; !uiLocation && i < styleSheetIds.length; ++i) {
569 var header = this.styleSheetHeaderForId(styleSheetIds[i]); 561 var header = this.styleSheetHeaderForId(styleSheetIds[i]);
570 console.assert(header); 562 console.assert(header);
571 uiLocation = header.rawLocationToUILocation(rawLocation.lineNumber, rawLocation.columnNumber); 563 uiLocation = header.rawLocationToUILocation(rawLocation.lineNumber, rawLocation.columnNumber);
572 } 564 }
573 return uiLocation || null; 565 return uiLocation || null;
574 }, 566 },
575 567
568 /**
569 * @param {!WebInspector.DOMNode} node
570 * @param {string} pseudoClass
571 * @param {boolean} enable
572 * @return {boolean}
573 */
574 forcePseudoState: function(node, pseudoClass, enable)
575 {
576 var pseudoClasses = node.getUserProperty(WebInspector.CSSStyleModel.Pseu doStatePropertyName);
577 if (enable) {
578 pseudoClasses = pseudoClasses || [];
579 if (pseudoClasses.indexOf(pseudoClass) >= 0)
580 return false;
581 pseudoClasses.push(pseudoClass);
582 node.setUserProperty(WebInspector.CSSStyleModel.PseudoStatePropertyN ame, pseudoClasses);
583 } else {
584 if (!pseudoClasses || pseudoClasses.indexOf(pseudoClass) < 0)
585 return false;
586 pseudoClasses.remove(pseudoClass);
587 if (!pseudoClasses.length)
588 node.removeUserProperty(WebInspector.CSSStyleModel.PseudoStatePr opertyName);
589 }
590
591 CSSAgent.forcePseudoState(node.id, node.getUserProperty(WebInspector.CSS StyleModel.PseudoStatePropertyName) || []);
sergeyv 2014/03/31 13:29:20 we already have node.getUserProperty(WebInspector.
pfeldman 2014/03/31 13:45:50 Done.
592 return true;
593 },
594
576 __proto__: WebInspector.Object.prototype 595 __proto__: WebInspector.Object.prototype
577 } 596 }
578 597
579 /** 598 /**
580 * @constructor 599 * @constructor
581 * @extends {WebInspector.LiveLocation} 600 * @extends {WebInspector.LiveLocation}
582 * @param {!WebInspector.CSSStyleModel} model 601 * @param {!WebInspector.CSSStyleModel} model
583 * @param {?WebInspector.CSSStyleSheetHeader} header 602 * @param {?WebInspector.CSSStyleSheetHeader} header
584 * @param {!WebInspector.CSSLocation} rawLocation 603 * @param {!WebInspector.CSSLocation} rawLocation
585 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegat e 604 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegat e
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 for (var i = 0; i < callbacks.length; ++i) 1603 for (var i = 0; i < callbacks.length; ++i)
1585 callbacks[i](computedStyle); 1604 callbacks[i](computedStyle);
1586 } 1605 }
1587 } 1606 }
1588 } 1607 }
1589 1608
1590 /** 1609 /**
1591 * @type {!WebInspector.CSSStyleModel} 1610 * @type {!WebInspector.CSSStyleModel}
1592 */ 1611 */
1593 WebInspector.cssModel; 1612 WebInspector.cssModel;
OLDNEW
« no previous file with comments | « LayoutTests/inspector/elements/reveal-shadow-dom-node.html ('k') | Source/devtools/front_end/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698