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

Side by Side Diff: Source/devtools/front_end/ui/SettingsUI.js

Issue 315003008: [DevTools] UI for network conditions emulation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 inputElement.className = "numeric"; 102 inputElement.className = "numeric";
103 if (maxLength) 103 if (maxLength)
104 inputElement.maxLength = maxLength; 104 inputElement.maxLength = maxLength;
105 if (width) 105 if (width)
106 inputElement.style.width = width; 106 inputElement.style.width = width;
107 107
108 if (validatorCallback || instant) { 108 if (validatorCallback || instant) {
109 inputElement.addEventListener("change", onInput, false); 109 inputElement.addEventListener("change", onInput, false);
110 inputElement.addEventListener("input", onInput, false); 110 inputElement.addEventListener("input", onInput, false);
111 } 111 }
112 inputElement.addEventListener("keydown", onKeyDown, false);
112 113
113 var errorMessageLabel; 114 var errorMessageLabel;
114 if (validatorCallback) { 115 if (validatorCallback) {
115 errorMessageLabel = p.createChild("div"); 116 errorMessageLabel = p.createChild("div");
116 errorMessageLabel.classList.add("field-error-message"); 117 errorMessageLabel.classList.add("field-error-message");
117 validate(); 118 validate();
118 } 119 }
119 120
120 function onInput() 121 function onInput()
121 { 122 {
122 if (validatorCallback) 123 if (validatorCallback)
123 validate(); 124 validate();
124 if (instant) 125 if (instant)
125 apply(); 126 apply();
126 } 127 }
127 128
129 function onKeyDown(event)
130 {
131 if (isEnterKey(event))
132 apply();
133 }
134
128 function validate() 135 function validate()
129 { 136 {
130 var error = validatorCallback(inputElement.value); 137 var error = validatorCallback(inputElement.value);
131 if (!error) 138 if (!error)
132 error = ""; 139 error = "";
133 inputElement.classList.toggle("error-input", !!error); 140 inputElement.classList.toggle("error-input", !!error);
134 errorMessageLabel.textContent = error; 141 errorMessageLabel.textContent = error;
135 } 142 }
136 143
137 if (!instant) 144 if (!instant)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 244
238 WebInspector.UISettingDelegate.prototype = { 245 WebInspector.UISettingDelegate.prototype = {
239 /** 246 /**
240 * @return {?Element} 247 * @return {?Element}
241 */ 248 */
242 settingElement: function() 249 settingElement: function()
243 { 250 {
244 return null; 251 return null;
245 } 252 }
246 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698