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

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: 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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 var doesAffectSelectedNode = this._matchedStyles.matchingSelectors(rule).l ength > 0; 1504 var doesAffectSelectedNode = this._matchedStyles.matchingSelectors(rule).l ength > 0;
1505 this.propertiesTreeOutline.element.classList.toggle('no-affect', !doesAffe ctSelectedNode); 1505 this.propertiesTreeOutline.element.classList.toggle('no-affect', !doesAffe ctSelectedNode);
1506 this._matchedStyles.resetActiveProperties(); 1506 this._matchedStyles.resetActiveProperties();
1507 this._parentPane._refreshUpdate(this); 1507 this._parentPane._refreshUpdate(this);
1508 } 1508 }
1509 1509
1510 console.assert(rule instanceof SDK.CSSStyleRule); 1510 console.assert(rule instanceof SDK.CSSStyleRule);
1511 var oldSelectorRange = rule.selectorRange(); 1511 var oldSelectorRange = rule.selectorRange();
1512 if (!oldSelectorRange) 1512 if (!oldSelectorRange)
1513 return Promise.resolve(); 1513 return Promise.resolve();
1514 var selectedNode = this._parentPane.node();
1515 return rule.setSelectorText(newContent) 1514 return rule.setSelectorText(newContent)
1516 .then(onSelectorsUpdated.bind(this, /** @type {!SDK.CSSStyleRule} */ (ru le), oldSelectorRange)); 1515 .then(onSelectorsUpdated.bind(this, /** @type {!SDK.CSSStyleRule} */ (ru le), oldSelectorRange));
1517 } 1516 }
1518 1517
1519 _editingSelectorCommittedForTest() { 1518 _editingSelectorCommittedForTest() {
1520 } 1519 }
1521 1520
1522 _updateRuleOrigin() { 1521 _updateRuleOrigin() {
1523 this._selectorRefElement.removeChildren(); 1522 this._selectorRefElement.removeChildren();
1524 this._selectorRefElement.appendChild(Elements.StylePropertiesSection.createR uleOriginNode( 1523 this._selectorRefElement.appendChild(Elements.StylePropertiesSection.createR uleOriginNode(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 function updateSourceRanges(success) { 1709 function updateSourceRanges(success) {
1711 if (!success) 1710 if (!success)
1712 return; 1711 return;
1713 this._parentPane._refreshUpdate(this); 1712 this._parentPane._refreshUpdate(this);
1714 } 1713 }
1715 1714
1716 console.assert(rule instanceof SDK.CSSKeyframeRule); 1715 console.assert(rule instanceof SDK.CSSKeyframeRule);
1717 var oldRange = rule.key().range; 1716 var oldRange = rule.key().range;
1718 if (!oldRange) 1717 if (!oldRange)
1719 return Promise.resolve(); 1718 return Promise.resolve();
1720 var selectedNode = this._parentPane.node();
1721 return rule.setKeyText(newContent).then(updateSourceRanges.bind(this)); 1719 return rule.setKeyText(newContent).then(updateSourceRanges.bind(this));
1722 } 1720 }
1723 1721
1724 /** 1722 /**
1725 * @override 1723 * @override
1726 * @param {string} propertyName 1724 * @param {string} propertyName
1727 * @return {boolean} 1725 * @return {boolean}
1728 */ 1726 */
1729 isPropertyInherited(propertyName) { 1727 isPropertyInherited(propertyName) {
1730 return false; 1728 return false;
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 * @param {string} userInput 2497 * @param {string} userInput
2500 * @param {!Elements.StylePropertyTreeElement.Context} context 2498 * @param {!Elements.StylePropertyTreeElement.Context} context
2501 * @param {string} moveDirection 2499 * @param {string} moveDirection
2502 */ 2500 */
2503 _editingCommitted(userInput, context, moveDirection) { 2501 _editingCommitted(userInput, context, moveDirection) {
2504 this._removePrompt(); 2502 this._removePrompt();
2505 this.editingEnded(context); 2503 this.editingEnded(context);
2506 var isEditingName = context.isEditingName; 2504 var isEditingName = context.isEditingName;
2507 2505
2508 // Determine where to move to before making changes 2506 // Determine where to move to before making changes
2509 var createNewProperty, moveToPropertyName, moveToSelector; 2507 var createNewProperty, moveToSelector;
2510 var isDataPasted = 'originalName' in context; 2508 var isDataPasted = 'originalName' in context;
2511 var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== cont ext.originalName || 2509 var isDirtyViaPaste = isDataPasted && (this.nameElement.textContent !== cont ext.originalName ||
2512 this.valueElement.textContent !== con text.originalValue); 2510 this.valueElement.textContent !== con text.originalValue);
2513 var isPropertySplitPaste = isDataPasted && isEditingName && this.valueElemen t.textContent !== context.originalValue; 2511 var isPropertySplitPaste = isDataPasted && isEditingName && this.valueElemen t.textContent !== context.originalValue;
2514 var moveTo = this; 2512 var moveTo = this;
2515 var moveToOther = (isEditingName ^ (moveDirection === 'forward')); 2513 var moveToOther = (isEditingName ^ (moveDirection === 'forward'));
2516 var abandonNewProperty = this._newProperty && !userInput && (moveToOther || isEditingName); 2514 var abandonNewProperty = this._newProperty && !userInput && (moveToOther || isEditingName);
2517 if (moveDirection === 'forward' && (!isEditingName || isPropertySplitPaste) || 2515 if (moveDirection === 'forward' && (!isEditingName || isPropertySplitPaste) ||
2518 moveDirection === 'backward' && isEditingName) { 2516 moveDirection === 'backward' && isEditingName) {
2519 moveTo = moveTo._findSibling(moveDirection); 2517 moveTo = moveTo._findSibling(moveDirection);
2520 if (moveTo) 2518 if (!moveTo) {
2521 moveToPropertyName = moveTo.name; 2519 if (moveDirection === 'forward' && (!this._newProperty || userInput))
2522 else if (moveDirection === 'forward' && (!this._newProperty || userInput)) 2520 createNewProperty = true;
2523 createNewProperty = true; 2521 else if (moveDirection === 'backward')
2524 else if (moveDirection === 'backward') 2522 moveToSelector = true;
2525 moveToSelector = true; 2523 }
2526 } 2524 }
2527 2525
2528 // Make the Changes and trigger the moveToNextCallback after updating. 2526 // Make the Changes and trigger the moveToNextCallback after updating.
2529 var moveToIndex = moveTo && this.treeOutline ? this.treeOutline.rootElement( ).indexOfChild(moveTo) : -1; 2527 var moveToIndex = moveTo && this.treeOutline ? this.treeOutline.rootElement( ).indexOfChild(moveTo) : -1;
2530 var blankInput = userInput.isWhitespace(); 2528 var blankInput = userInput.isWhitespace();
2531 var shouldCommitNewProperty = this._newProperty && 2529 var shouldCommitNewProperty = this._newProperty &&
2532 (isPropertySplitPaste || moveToOther || (!moveDirection && !isEditingNam e) || (isEditingName && blankInput)); 2530 (isPropertySplitPaste || moveToOther || (!moveDirection && !isEditingNam e) || (isEditingName && blankInput));
2533 var section = /** @type {!Elements.StylePropertiesSection} */ (this.section( )); 2531 var section = /** @type {!Elements.StylePropertiesSection} */ (this.section( ));
2534 if (((userInput !== context.previousContent || isDirtyViaPaste) && !this._ne wProperty) || shouldCommitNewProperty) { 2532 if (((userInput !== context.previousContent || isDirtyViaPaste) && !this._ne wProperty) || shouldCommitNewProperty) {
2535 section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !b lankInput, section); 2533 section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !b lankInput, section);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 } 3044 }
3047 3045
3048 /** 3046 /**
3049 * @override 3047 * @override
3050 * @return {!UI.ToolbarItem} 3048 * @return {!UI.ToolbarItem}
3051 */ 3049 */
3052 item() { 3050 item() {
3053 return this._button; 3051 return this._button;
3054 } 3052 }
3055 }; 3053 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698