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

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

Issue 2560043005: DevTools: Remove unused variables. Disallow unused variables with eslint (Closed)
Patch Set: A new unused variable was born Created 4 years 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
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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 var doesAffectSelectedNode = this._matchedStyles.matchingSelectors(rule).l ength > 0; 1506 var doesAffectSelectedNode = this._matchedStyles.matchingSelectors(rule).l ength > 0;
1507 this.propertiesTreeOutline.element.classList.toggle('no-affect', !doesAffe ctSelectedNode); 1507 this.propertiesTreeOutline.element.classList.toggle('no-affect', !doesAffe ctSelectedNode);
1508 this._matchedStyles.resetActiveProperties(); 1508 this._matchedStyles.resetActiveProperties();
1509 this._parentPane._refreshUpdate(this); 1509 this._parentPane._refreshUpdate(this);
1510 } 1510 }
1511 1511
1512 console.assert(rule instanceof SDK.CSSStyleRule); 1512 console.assert(rule instanceof SDK.CSSStyleRule);
1513 var oldSelectorRange = rule.selectorRange(); 1513 var oldSelectorRange = rule.selectorRange();
1514 if (!oldSelectorRange) 1514 if (!oldSelectorRange)
1515 return Promise.resolve(); 1515 return Promise.resolve();
1516 var selectedNode = this._parentPane.node();
1517 return rule.setSelectorText(newContent) 1516 return rule.setSelectorText(newContent)
1518 .then(onSelectorsUpdated.bind(this, /** @type {!SDK.CSSStyleRule} */ (ru le), oldSelectorRange)); 1517 .then(onSelectorsUpdated.bind(this, /** @type {!SDK.CSSStyleRule} */ (ru le), oldSelectorRange));
1519 } 1518 }
1520 1519
1521 _editingSelectorCommittedForTest() { 1520 _editingSelectorCommittedForTest() {
1522 } 1521 }
1523 1522
1524 _updateRuleOrigin() { 1523 _updateRuleOrigin() {
1525 this._selectorRefElement.removeChildren(); 1524 this._selectorRefElement.removeChildren();
1526 this._selectorRefElement.appendChild(Elements.StylePropertiesSection.createR uleOriginNode( 1525 this._selectorRefElement.appendChild(Elements.StylePropertiesSection.createR uleOriginNode(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 function updateSourceRanges(success) { 1711 function updateSourceRanges(success) {
1713 if (!success) 1712 if (!success)
1714 return; 1713 return;
1715 this._parentPane._refreshUpdate(this); 1714 this._parentPane._refreshUpdate(this);
1716 } 1715 }
1717 1716
1718 console.assert(rule instanceof SDK.CSSKeyframeRule); 1717 console.assert(rule instanceof SDK.CSSKeyframeRule);
1719 var oldRange = rule.key().range; 1718 var oldRange = rule.key().range;
1720 if (!oldRange) 1719 if (!oldRange)
1721 return Promise.resolve(); 1720 return Promise.resolve();
1722 var selectedNode = this._parentPane.node();
1723 return rule.setKeyText(newContent).then(updateSourceRanges.bind(this)); 1721 return rule.setKeyText(newContent).then(updateSourceRanges.bind(this));
1724 } 1722 }
1725 1723
1726 /** 1724 /**
1727 * @override 1725 * @override
1728 * @param {string} propertyName 1726 * @param {string} propertyName
1729 * @return {boolean} 1727 * @return {boolean}
1730 */ 1728 */
1731 isPropertyInherited(propertyName) { 1729 isPropertyInherited(propertyName) {
1732 return false; 1730 return false;
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 * @param {string} userInput 2526 * @param {string} userInput
2529 * @param {!Elements.StylePropertyTreeElement.Context} context 2527 * @param {!Elements.StylePropertyTreeElement.Context} context
2530 * @param {string} moveDirection 2528 * @param {string} moveDirection
2531 */ 2529 */
2532 _editingCommitted(userInput, context, moveDirection) { 2530 _editingCommitted(userInput, context, moveDirection) {
2533 this._removePrompt(); 2531 this._removePrompt();
2534 this.editingEnded(context); 2532 this.editingEnded(context);
2535 var isEditingName = context.isEditingName; 2533 var isEditingName = context.isEditingName;
2536 2534
2537 // Determine where to move to before making changes 2535 // Determine where to move to before making changes
2538 var createNewProperty, moveToPropertyName, moveToSelector; 2536 var createNewProperty, moveToSelector;
2539 var isDataPasted = 'originalName' in context; 2537 var isDataPasted = 'originalName' in context;
2540 var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== cont ext.originalName || 2538 var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== cont ext.originalName ||
2541 this.valueElement.textContent !== con text.originalValue); 2539 this.valueElement.textContent !== con text.originalValue);
2542 var isPropertySplitPaste = isDataPasted && isEditingName && this.valueElemen t.textContent !== context.originalValue; 2540 var isPropertySplitPaste = isDataPasted && isEditingName && this.valueElemen t.textContent !== context.originalValue;
2543 var moveTo = this; 2541 var moveTo = this;
2544 var moveToOther = (isEditingName ^ (moveDirection === 'forward')); 2542 var moveToOther = (isEditingName ^ (moveDirection === 'forward'));
2545 var abandonNewProperty = this._newProperty && !userInput && (moveToOther || isEditingName); 2543 var abandonNewProperty = this._newProperty && !userInput && (moveToOther || isEditingName);
2546 if (moveDirection === 'forward' && (!isEditingName || isPropertySplitPaste) || 2544 if (moveDirection === 'forward' && (!isEditingName || isPropertySplitPaste) ||
2547 moveDirection === 'backward' && isEditingName) { 2545 moveDirection === 'backward' && isEditingName) {
2548 moveTo = moveTo._findSibling(moveDirection); 2546 moveTo = moveTo._findSibling(moveDirection);
2549 if (moveTo) 2547 if (!moveTo) {
2550 moveToPropertyName = moveTo.name; 2548 if (moveDirection === 'forward' && (!this._newProperty || userInput))
2551 else if (moveDirection === 'forward' && (!this._newProperty || userInput)) 2549 createNewProperty = true;
2552 createNewProperty = true; 2550 else if (moveDirection === 'backward')
2553 else if (moveDirection === 'backward') 2551 moveToSelector = true;
2554 moveToSelector = true; 2552 }
2555 } 2553 }
2556 2554
2557 // Make the Changes and trigger the moveToNextCallback after updating. 2555 // Make the Changes and trigger the moveToNextCallback after updating.
2558 var moveToIndex = moveTo && this.treeOutline ? this.treeOutline.rootElement( ).indexOfChild(moveTo) : -1; 2556 var moveToIndex = moveTo && this.treeOutline ? this.treeOutline.rootElement( ).indexOfChild(moveTo) : -1;
2559 var blankInput = userInput.isWhitespace(); 2557 var blankInput = userInput.isWhitespace();
2560 var shouldCommitNewProperty = this._newProperty && 2558 var shouldCommitNewProperty = this._newProperty &&
2561 (isPropertySplitPaste || moveToOther || (!moveDirection && !isEditingNam e) || (isEditingName && blankInput)); 2559 (isPropertySplitPaste || moveToOther || (!moveDirection && !isEditingNam e) || (isEditingName && blankInput));
2562 var section = /** @type {!Elements.StylePropertiesSection} */ (this.section( )); 2560 var section = /** @type {!Elements.StylePropertiesSection} */ (this.section( ));
2563 if (((userInput !== context.previousContent || isDirtyViaPaste) && !this._ne wProperty) || shouldCommitNewProperty) { 2561 if (((userInput !== context.previousContent || isDirtyViaPaste) && !this._ne wProperty) || shouldCommitNewProperty) {
2564 section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !b lankInput, section); 2562 section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !b lankInput, section);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 } 3076 }
3079 3077
3080 /** 3078 /**
3081 * @override 3079 * @override
3082 * @return {!UI.ToolbarItem} 3080 * @return {!UI.ToolbarItem}
3083 */ 3081 */
3084 item() { 3082 item() {
3085 return this._button; 3083 return this._button;
3086 } 3084 }
3087 }; 3085 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698