Changeset 106550 in webkit
- Timestamp:
- Feb 2, 2012 6:25:15 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106547 r106550 1 2012-02-02 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: add experiment for single click styles editing. 4 https://bugs.webkit.org/show_bug.cgi?id=77624 5 6 Reviewed by Vsevolod Vlasov. 7 8 * inspector/front-end/Settings.js: 9 (WebInspector.ExperimentsSettings): 10 * inspector/front-end/StylesSidebarPane.js: 11 (WebInspector.StylePropertiesSection): 12 (WebInspector.StylePropertyTreeElement.prototype.onattach): 13 (WebInspector.StylePropertyTreeElement.prototype._mouseDown): 14 (WebInspector.StylePropertyTreeElement.prototype._resetMouseDownElement): 15 (WebInspector.StylePropertyTreeElement.prototype): 16 (WebInspector.StylePropertyTreeElement.prototype.selectElement.context): 17 1 18 2012-02-02 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 19 -
trunk/Source/WebCore/inspector/front-end/Settings.js
r105877 r106550 173 173 this.freeFlowDOMEditing = this._createExperiment("freeFlowDOMEditing", "Enable free flow DOM editing"); 174 174 this.showMemoryCounters = this._createExperiment("showMemoryCounters", "Show memory counters in Timeline panel"); 175 this.singleClickEditing = this._createExperiment("singleClickEditing", "Single click CSS editing"); 175 176 176 177 this._cleanUpSetting(); -
trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js
r106237 r106550 900 900 this.element.appendChild(closeBrace); 901 901 902 this._selectorElement.addEventListener("dblclick", this._handleSelectorDoubleClick.bind(this), false); 903 this.element.addEventListener("dblclick", this._handleEmptySpaceDoubleClick.bind(this), false); 902 var eventName = WebInspector.experimentsSettings.singleClickEditing.isEnabled() ? "click" : "dblclick"; 903 this._selectorElement.addEventListener(eventName, this._handleSelectorDoubleClick.bind(this), false); 904 this.element.addEventListener(eventName, this._handleEmptySpaceDoubleClick.bind(this), false); 904 905 905 906 this._parentPane = parentPane; … … 1523 1524 { 1524 1525 this.updateTitle(); 1526 var eventName; 1527 if (WebInspector.experimentsSettings.singleClickEditing.isEnabled()) { 1528 this.listItemElement.addEventListener("mousedown", this._mouseDown.bind(this)); 1529 this.listItemElement.addEventListener("mouseup", this._resetMouseDownElement.bind(this)); 1530 eventName = "click"; 1531 } else 1532 eventName = "dblclick"; 1533 this.listItemElement.addEventListener(eventName, this._startEditing.bind(this)); 1534 }, 1535 1536 _mouseDown: function(event) 1537 { 1538 this._parentPane._mouseDownTreeElement = this; 1539 this._parentPane._mouseDownTreeElementIsName = this._isNameElement(event.target); 1540 this._parentPane._mouseDownTreeElementIsValue = this._isValueElement(event.target); 1541 }, 1542 1543 _resetMouseDownElement: function() 1544 { 1545 delete this._parentPane._mouseDownTreeElement; 1546 delete this._parentPane._mouseDownTreeElementIsName; 1547 delete this._parentPane._mouseDownTreeElementIsValue; 1525 1548 }, 1526 1549 … … 1810 1833 }, 1811 1834 1812 ondblclick: function(event)1813 {1814 this.startEditing(event.target);1815 event.stopPropagation();1816 },1817 1818 1835 restoreNameElement: function() 1819 1836 { … … 1826 1843 this.nameElement.textContent = ""; 1827 1844 this.listItemElement.insertBefore(this.nameElement, this.listItemElement.firstChild); 1845 }, 1846 1847 _startEditing: function(event) 1848 { 1849 this.startEditing(event.target); 1850 event.stopPropagation(); 1851 }, 1852 1853 _isNameElement: function(element) 1854 { 1855 return element.enclosingNodeOrSelfWithClass("webkit-css-property") === this.nameElement; 1856 }, 1857 1858 _isValueElement: function(element) 1859 { 1860 return !!element.enclosingNodeOrSelfWithClass("value"); 1828 1861 }, 1829 1862 … … 1893 1926 function blurListener(context, event) 1894 1927 { 1895 this.editingCommitted(null, event.target.textContent, context.previousContent, context, ""); 1928 var treeElement = this._parentPane._mouseDownTreeElement; 1929 var moveDirection = ""; 1930 if (treeElement === this) { 1931 if (isEditingName && this._parentPane._mouseDownTreeElementIsValue) 1932 moveDirection = "forward"; 1933 if (!isEditingName && this._parentPane._mouseDownTreeElementIsName) 1934 moveDirection = "backward"; 1935 } 1936 this.editingCommitted(null, event.target.textContent, context.previousContent, context, moveDirection); 1896 1937 } 1897 1938 … … 2005 2046 editingEnded: function(context) 2006 2047 { 2048 this._resetMouseDownElement(); 2007 2049 if (this._applyFreeFlowStyleTextEditTimer) 2008 2050 clearTimeout(this._applyFreeFlowStyleTextEditTimer);
Note: See TracChangeset
for help on using the changeset viewer.