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

Side by Side Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 944343002: DevTools: migrate treeoutline from hasChildren to is/setExpandable(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 __proto__: WebInspector.StylePropertiesSection.prototype 2574 __proto__: WebInspector.StylePropertiesSection.prototype
2575 } 2575 }
2576 2576
2577 /** 2577 /**
2578 * @constructor 2578 * @constructor
2579 * @extends {TreeElement} 2579 * @extends {TreeElement}
2580 * @param {!WebInspector.StylesSectionModel} styleRule 2580 * @param {!WebInspector.StylesSectionModel} styleRule
2581 * @param {!WebInspector.CSSProperty} property 2581 * @param {!WebInspector.CSSProperty} property
2582 * @param {boolean} inherited 2582 * @param {boolean} inherited
2583 * @param {boolean} overloaded 2583 * @param {boolean} overloaded
2584 * @param {boolean} hasChildren 2584 * @param {boolean} expandable
2585 */ 2585 */
2586 WebInspector.StylePropertyTreeElementBase = function(styleRule, property, inheri ted, overloaded, hasChildren) 2586 WebInspector.StylePropertyTreeElementBase = function(styleRule, property, inheri ted, overloaded, expandable)
2587 { 2587 {
2588 this._styleRule = styleRule; 2588 this._styleRule = styleRule;
2589 this.property = property; 2589 this.property = property;
2590 this._inherited = inherited; 2590 this._inherited = inherited;
2591 this._overloaded = overloaded; 2591 this._overloaded = overloaded;
2592 2592
2593 // Pass an empty title, the title gets made later in onattach. 2593 // Pass an empty title, the title gets made later in onattach.
2594 TreeElement.call(this, "", hasChildren); 2594 TreeElement.call(this, "", expandable);
2595 2595
2596 this.selectable = false; 2596 this.selectable = false;
2597 } 2597 }
2598 2598
2599 WebInspector.StylePropertyTreeElementBase.prototype = { 2599 WebInspector.StylePropertyTreeElementBase.prototype = {
2600 /** 2600 /**
2601 * @return {!WebInspector.CSSStyleDeclaration} 2601 * @return {!WebInspector.CSSStyleDeclaration}
2602 */ 2602 */
2603 style: function() 2603 style: function()
2604 { 2604 {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 this.listItemElement.appendChild(nameElement); 2801 this.listItemElement.appendChild(nameElement);
2802 this.listItemElement.createTextChild(": "); 2802 this.listItemElement.createTextChild(": ");
2803 this.listItemElement.appendChild(this._expandElement); 2803 this.listItemElement.appendChild(this._expandElement);
2804 this.listItemElement.appendChild(valueElement); 2804 this.listItemElement.appendChild(valueElement);
2805 this.listItemElement.createTextChild(";"); 2805 this.listItemElement.createTextChild(";");
2806 if (this.disabled) 2806 if (this.disabled)
2807 this.listItemElement.createChild("span", "styles-clipboard-only").cr eateTextChild(" */"); 2807 this.listItemElement.createChild("span", "styles-clipboard-only").cr eateTextChild(" */");
2808 2808
2809 if (!this.parsedOk) { 2809 if (!this.parsedOk) {
2810 // Avoid having longhands under an invalid shorthand. 2810 // Avoid having longhands under an invalid shorthand.
2811 this.hasChildren = false;
2812 this.listItemElement.classList.add("not-parsed-ok"); 2811 this.listItemElement.classList.add("not-parsed-ok");
2813 2812
2814 // Add a separate exclamation mark IMG element with a tooltip. 2813 // Add a separate exclamation mark IMG element with a tooltip.
2815 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild); 2814 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild);
2816 } 2815 }
2817 if (this.property.inactive) 2816 if (this.property.inactive)
2818 this.listItemElement.classList.add("inactive"); 2817 this.listItemElement.classList.add("inactive");
2819 this._updateFilter(); 2818 this._updateFilter();
2820 }, 2819 },
2821 2820
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 var match = modelUrlRegex.exec(modelValue); 3209 var match = modelUrlRegex.exec(modelValue);
3211 if (match) 3210 if (match)
3212 splitFieldValue[i] = match[0]; 3211 splitFieldValue[i] = match[0];
3213 } 3212 }
3214 return splitFieldValue.join(""); 3213 return splitFieldValue.join("");
3215 } 3214 }
3216 3215
3217 /** @type {!WebInspector.StylePropertyTreeElement.Context} */ 3216 /** @type {!WebInspector.StylePropertyTreeElement.Context} */
3218 var context = { 3217 var context = {
3219 expanded: this.expanded, 3218 expanded: this.expanded,
3220 hasChildren: this.hasChildren, 3219 hasChildren: this.isExpandable(),
3221 isEditingName: isEditingName, 3220 isEditingName: isEditingName,
3222 previousContent: selectElement.textContent 3221 previousContent: selectElement.textContent
3223 }; 3222 };
3224 3223
3225 // Lie about our children to prevent expanding on double click and to co llapse shorthands. 3224 // Lie about our children to prevent expanding on double click and to co llapse shorthands.
3226 this.hasChildren = false; 3225 this.setExpandable(false);
3227 3226
3228 if (selectElement.parentElement) 3227 if (selectElement.parentElement)
3229 selectElement.parentElement.classList.add("child-editing"); 3228 selectElement.parentElement.classList.add("child-editing");
3230 selectElement.textContent = selectElement.textContent; // remove color s watch and the like 3229 selectElement.textContent = selectElement.textContent; // remove color s watch and the like
3231 3230
3232 /** 3231 /**
3233 * @param {!WebInspector.StylePropertyTreeElement.Context} context 3232 * @param {!WebInspector.StylePropertyTreeElement.Context} context
3234 * @param {!Event} event 3233 * @param {!Event} event
3235 * @this {WebInspector.StylePropertyTreeElement} 3234 * @this {WebInspector.StylePropertyTreeElement}
3236 */ 3235 */
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 this._applyFreeFlowStyleTextEdit(); 3406 this._applyFreeFlowStyleTextEdit();
3408 }, 3407 },
3409 3408
3410 /** 3409 /**
3411 * @param {!WebInspector.StylePropertyTreeElement.Context} context 3410 * @param {!WebInspector.StylePropertyTreeElement.Context} context
3412 */ 3411 */
3413 editingEnded: function(context) 3412 editingEnded: function(context)
3414 { 3413 {
3415 this._resetMouseDownElement(); 3414 this._resetMouseDownElement();
3416 3415
3417 this.hasChildren = context.hasChildren; 3416 this.setExpandable(context.hasChildren);
3418 if (context.expanded) 3417 if (context.expanded)
3419 this.expand(); 3418 this.expand();
3420 var editedElement = context.isEditingName ? this.nameElement : this.valu eElement; 3419 var editedElement = context.isEditingName ? this.nameElement : this.valu eElement;
3421 // The proxyElement has been deleted, no need to remove listener. 3420 // The proxyElement has been deleted, no need to remove listener.
3422 if (editedElement.parentElement) 3421 if (editedElement.parentElement)
3423 editedElement.parentElement.classList.remove("child-editing"); 3422 editedElement.parentElement.classList.remove("child-editing");
3424 3423
3425 delete this._parentPane._isEditingStyle; 3424 delete this._parentPane._isEditingStyle;
3426 }, 3425 },
3427 3426
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3903 3902
3904 WebInspector.StylesSidebarPane.MatchedRulesPayload.prototype = { 3903 WebInspector.StylesSidebarPane.MatchedRulesPayload.prototype = {
3905 /** 3904 /**
3906 * @return {boolean} 3905 * @return {boolean}
3907 */ 3906 */
3908 fulfilled: function() 3907 fulfilled: function()
3909 { 3908 {
3910 return !!(this.matchedCSSRules && this.pseudoElements && this.inherited) ; 3909 return !!(this.matchedCSSRules && this.pseudoElements && this.inherited) ;
3911 } 3910 }
3912 } 3911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698