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

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

Issue 1824683002: Fixes 590477: Style pane numeric property change modifier shortcuts are undiscoverable. Shift mouse… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: show numeric precision modifier title hint on editing start Created 4 years, 9 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
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 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt} 2907 * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt}
2908 */ 2908 */
2909 function customNumberHandler(prefix, number, suffix) 2909 function customNumberHandler(prefix, number, suffix)
2910 { 2910 {
2911 if (number !== 0 && !suffix.length && WebInspector.CSSMetadata.isLen gthProperty(this._treeElement.property.name)) 2911 if (number !== 0 && !suffix.length && WebInspector.CSSMetadata.isLen gthProperty(this._treeElement.property.name))
2912 suffix = "px"; 2912 suffix = "px";
2913 return prefix + number + suffix; 2913 return prefix + number + suffix;
2914 } 2914 }
2915 2915
2916 // Handle numeric value increment/decrement only at this point. 2916 // Handle numeric value increment/decrement only at this point.
2917 if (!this._isEditingName && WebInspector.handleElementValueModifications (event, this._treeElement.valueElement, finishHandler.bind(this), this._isValueS uggestion.bind(this), customNumberHandler.bind(this))) 2917 if (!this._isEditingName && WebInspector.handleElementValueModifications (event, this._treeElement.valueElement, finishHandler.bind(this), this._isValueS uggestion.bind(this), customNumberHandler.bind(this))) {
lushnikov 2016/03/25 18:48:32 style: omit braces
2918 return true; 2918 return true;
2919 }
2919 2920
2920 return false; 2921 return false;
2921 }, 2922 },
2922 2923
2924 /**
2925 * @override
2926 */
2927 onEditStart: function()
lushnikov 2016/03/25 18:48:32 I think we can simplify this even further. Let's
2928 {
2929 // if a css value is being edited that has a numeric substring, hint tha t precision modifier shortcuts are available
lushnikov 2016/03/25 18:48:32 style: comments should start with capital letter a
2930 if (!this._isEditingName && !this.title() && this.text().match(/\d+/))
2931 this.setTitle(WebInspector.UIString("Increment/decrement with mousew heel or up/down keys. %s: ±100, Shift: ±10, Alt: ±0.1", WebInspector.isMac() ? " Cmd" : "Ctrl"));
2932 },
2933
2923 /** 2934 /**
2924 * @param {string} word 2935 * @param {string} word
2925 * @return {boolean} 2936 * @return {boolean}
2926 */ 2937 */
2927 _isValueSuggestion: function(word) 2938 _isValueSuggestion: function(word)
2928 { 2939 {
2929 if (!word) 2940 if (!word)
2930 return false; 2941 return false;
2931 word = word.toLowerCase(); 2942 word = word.toLowerCase();
2932 return this._cssCompletions.keySet().hasOwnProperty(word); 2943 return this._cssCompletions.keySet().hasOwnProperty(word);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); 3095 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged);
3085 onNodeChanged(); 3096 onNodeChanged();
3086 return button; 3097 return button;
3087 3098
3088 function onNodeChanged() 3099 function onNodeChanged()
3089 { 3100 {
3090 var node = WebInspector.context.flavor(WebInspector.DOMNode); 3101 var node = WebInspector.context.flavor(WebInspector.DOMNode);
3091 button.setEnabled(!!node); 3102 button.setEnabled(!!node);
3092 } 3103 }
3093 } 3104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698